Zebediah Figura : psapi/tests: Call GetPerformanceInfo() after NtQuerySystemInformation().

Alexandre Julliard julliard at winehq.org
Fri Jul 6 15:52:09 CDT 2018


Module: wine
Branch: master
Commit: f01b9ab4c15061ba64a4748374c4ccd5d22788eb
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f01b9ab4c15061ba64a4748374c4ccd5d22788eb

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Jul  6 00:05:39 2018 +0200

psapi/tests: Call GetPerformanceInfo() after NtQuerySystemInformation().

For some reason, this gives consistently much more accurate results.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/psapi/tests/psapi_main.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/dlls/psapi/tests/psapi_main.c b/dlls/psapi/tests/psapi_main.c
index 99d081f..e61cf02 100644
--- a/dlls/psapi/tests/psapi_main.c
+++ b/dlls/psapi/tests/psapi_main.c
@@ -238,11 +238,6 @@ static void test_GetPerformanceInfo(void)
     ok(!ret, "GetPerformanceInfo unexpectedly succeeded\n");
     ok(GetLastError() == ERROR_BAD_LENGTH, "expected error=ERROR_BAD_LENGTH but got %d\n", GetLastError());
 
-    SetLastError(0xdeadbeef);
-    ret = GetPerformanceInfo(&info, sizeof(info));
-    ok(ret, "GetPerformanceInfo failed with %d\n", GetLastError());
-    ok(info.cb == sizeof(PERFORMANCE_INFORMATION), "got %d\n", info.cb);
-
     if (!pNtQuerySystemInformation)
         win_skip("NtQuerySystemInformation not found, skipping tests\n");
     else
@@ -259,6 +254,10 @@ static void test_GetPerformanceInfo(void)
         ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
         ok(size >= sizeof(SYSTEM_PERFORMANCE_INFORMATION), "incorrect length %d\n", size);
 
+        SetLastError(0xdeadbeef);
+        ret = GetPerformanceInfo(&info, sizeof(info));
+        ok(ret, "GetPerformanceInfo failed with %d\n", GetLastError());
+        ok(info.cb == sizeof(PERFORMANCE_INFORMATION), "got %d\n", info.cb);
 
         ok(check_with_margin(info.CommitTotal,          sys_performance_info->TotalCommittedPages,  288),
            "expected approximately %ld but got %d\n", info.CommitTotal, sys_performance_info->TotalCommittedPages);




More information about the wine-cvs mailing list