[PATCH] Fix the SystemHandleInformation tests

Paul Vriens Paul.Vriens.Wine at gmail.com
Wed Aug 27 06:14:25 CDT 2008


---
 dlls/ntdll/tests/info.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 4a0b017..ed07912 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -406,27 +406,29 @@ static void test_query_handle(void)
     ULONG SystemInformationLength = sizeof(SYSTEM_HANDLE_INFORMATION);
     SYSTEM_HANDLE_INFORMATION* shi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
 
-    /* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
     status = pNtQuerySystemInformation(SystemHandleInformation, shi, 0, &ReturnLength);
+    ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
+    ok( ReturnLength == 0 || ReturnLength == sizeof(SYSTEM_HANDLE_INFORMATION) /* Vista */,
+        "Unexpected ReturnLength : %d\n", ReturnLength);
 
+    /* Request the needed length : a SystemInformationLength greater or equal to one struct sets ReturnLength */
+    status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
+    /* The following check assumes more than one handle on any given system */
+    todo_wine
     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
     ok( ReturnLength > 0, "Expected ReturnLength to be > 0, it was %d\n", ReturnLength);
 
-    SystemInformationLength = ReturnLength + sizeof(HANDLE);
+    SystemInformationLength = ReturnLength;
     shi = HeapReAlloc(GetProcessHeap(), 0, shi , SystemInformationLength);
     status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
-    if (status != STATUS_INFO_LENGTH_MISMATCH) /* vista */
-    {
-        ok( status == STATUS_SUCCESS,
-            "Expected STATUS_SUCCESS, got %08x\n", status);
+    ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
 
-        /* Check if we have some return values */
-        trace("Number of Handles : %d\n", shi->Count);
-        todo_wine
-        {
-            /* our implementation is a stub for now */
-            ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
-        }
+    /* Check if we have some return values */
+    trace("Number of Handles : %d\n", shi->Count);
+    todo_wine
+    {
+        /* our implementation is a stub for now */
+        ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
     }
     HeapFree( GetProcessHeap(), 0, shi);
 }
-- 
1.5.4.1


--------------080209090806060700060508--



More information about the wine-patches mailing list