From: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/ntdll/tests/info.c | 6 ++++++ dlls/ntdll/unix/process.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index 35e4b834c42..14c8d9d6199 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -1462,6 +1462,7 @@ static void test_query_process_vm(void) process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, GetCurrentProcessId()); status = pNtQueryInformationProcess(process, ProcessVmCounters, &pvi, sizeof(pvi), NULL); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %u/%u\n", pvi.PrivateUsage, pvi.PagefileUsage );
/* Check if we have some return values */ dump_vm_counters("VM counters for GetCurrentProcessId", &pvi); @@ -1473,6 +1474,7 @@ static void test_query_process_vm(void) /* Check if we have real counters */ status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %u/%u\n", pvi.PrivateUsage, pvi.PagefileUsage ); prev_size = pvi.VirtualSize; if (winetest_debug > 1) dump_vm_counters("VM counters before VirtualAlloc", &pvi); @@ -1480,6 +1482,7 @@ static void test_query_process_vm(void) ok( ptr != NULL, "VirtualAlloc failed, err %u\n", GetLastError()); status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %u/%u\n", pvi.PrivateUsage, pvi.PagefileUsage ); if (winetest_debug > 1) dump_vm_counters("VM counters after VirtualAlloc", &pvi); todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size, @@ -1488,6 +1491,7 @@ static void test_query_process_vm(void)
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %u/%u\n", pvi.PrivateUsage, pvi.PagefileUsage ); prev_size = pvi.VirtualSize; if (winetest_debug > 1) dump_vm_counters("VM counters before VirtualAlloc", &pvi); @@ -1495,6 +1499,7 @@ static void test_query_process_vm(void) ok( ptr != NULL, "VirtualAlloc failed, err %u\n", GetLastError()); status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %u/%u\n", pvi.PrivateUsage, pvi.PagefileUsage ); if (winetest_debug > 1) dump_vm_counters("VM counters after VirtualAlloc(MEM_RESERVE)", &pvi); todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size, @@ -1505,6 +1510,7 @@ static void test_query_process_vm(void) ok( ptr != NULL, "VirtualAlloc failed, err %u\n", GetLastError()); status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessVmCounters, &pvi, sizeof(pvi), NULL); ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %u/%u\n", pvi.PrivateUsage, pvi.PagefileUsage ); if (winetest_debug > 1) dump_vm_counters("VM counters after VirtualAlloc(MEM_COMMIT)", &pvi); ok( pvi.VirtualSize == prev_size, diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index c39d8fb23a4..33bee03c19a 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -1008,7 +1008,7 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
#if defined(HAVE_MACH_MACH_H)
-static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) +static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) { #if defined(MACH_TASK_BASIC_INFO) struct mach_task_basic_info info; @@ -1025,7 +1025,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
#elif defined(linux)
-static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) +static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) { FILE *f; char line[256]; @@ -1056,7 +1056,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi)
#else
-static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) +static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) { /* FIXME : real data */ } @@ -1168,7 +1168,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
case ProcessVmCounters: { - VM_COUNTERS pvmi; + VM_COUNTERS_EX pvmi;
/* older Windows versions don't have the PrivateUsage field */ if (size >= sizeof(VM_COUNTERS)) @@ -1196,6 +1196,8 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class SERVER_END_REQ; if (ret) break; } + if (size >= sizeof(VM_COUNTERS_EX)) + pvmi.PrivateUsage = pvmi.PagefileUsage; len = size; if (len != sizeof(VM_COUNTERS)) len = sizeof(VM_COUNTERS_EX); memcpy(info, &pvmi, min(size, sizeof(pvmi)));