ntdll: Fill the PrivateUsage field of VM_COUNTERS_EX.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-06-30 23:19:22 -05:00 committed by Alexandre Julliard
parent acc52bc90e
commit 2d5bd21f31
2 changed files with 12 additions and 4 deletions

View File

@ -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 %lu/%lu\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 %lu/%lu\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 %lu/%lu\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 %lu/%lu\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 %lu/%lu\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 %lu/%lu\n", pvi.PrivateUsage, pvi.PagefileUsage );
if (winetest_debug > 1)
dump_vm_counters("VM counters after VirtualAlloc(MEM_COMMIT)", &pvi);
ok( pvi.VirtualSize == prev_size,

View File

@ -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)));