Akihiro Sagawa : ntdll: Calculate SystemProcessInformation' s ReturnLength and return it.

Alexandre Julliard julliard at winehq.org
Wed Oct 24 13:39:41 CDT 2012


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Tue Oct 23 23:52:35 2012 +0900

ntdll: Calculate SystemProcessInformation's ReturnLength and return it.

---

 dlls/ntdll/nt.c         |    7 ++++---
 dlls/ntdll/tests/info.c |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 92db541..ab08190 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1739,9 +1739,8 @@ NTSTATUS WINAPI NtQuerySystemInformation(
 
                             /* spi->ti will be set later on */
 
-                            len += procstructlen;
                         }
-                        else ret = STATUS_INFO_LENGTH_MISMATCH;
+                        len += procstructlen;
                     }
                 }
                 SERVER_END_REQ;
@@ -1751,7 +1750,8 @@ NTSTATUS WINAPI NtQuerySystemInformation(
                     if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
                     break;
                 }
-                else /* Length is already checked for */
+
+                if (Length >= len)
                 {
                     int     i, j;
 
@@ -1799,6 +1799,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
                 }
             }
             if (ret == STATUS_SUCCESS && last) last->NextEntryOffset = 0;
+            if (len > Length) ret = STATUS_INFO_LENGTH_MISMATCH;
             if (hSnap) NtClose(hSnap);
         }
         break;
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index 5dba2da..c670731 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -289,7 +289,7 @@ static void test_query_process(void)
     ReturnLength = 0;
     status = pNtQuerySystemInformation(SystemProcessInformation, NULL, 0, &ReturnLength);
     ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_LENGTH_MISMATCH got %08x\n", status);
-    todo_wine ok( ReturnLength > 0 || broken(ReturnLength == 0) /* NT4, Win2K */,
+    ok( ReturnLength > 0 || broken(ReturnLength == 0) /* NT4, Win2K */,
         "Expected a ReturnLength to show the needed length\n");
 
     /* W2K3 and later returns the needed length, the rest returns 0, so we have to loop */




More information about the wine-cvs mailing list