[PATCH 3/3] ntdll: Implement ProcessHandleCount info class.

Nikolay Sivov nsivov at codeweavers.com
Mon May 23 09:09:53 CDT 2022


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/ntdll/tests/info.c   |  8 +-------
 dlls/ntdll/unix/process.c | 11 ++++++++---
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index dc141c6bf9c..67040d2263d 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -2222,13 +2222,7 @@ static void test_query_process_handlecount(void)
     ok( status == STATUS_INFO_LENGTH_MISMATCH || status == STATUS_SUCCESS,
         "Expected STATUS_INFO_LENGTH_MISMATCH or STATUS_SUCCESS, got %08lx\n", status);
     ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
-
-    /* Check if we have some return values */
-    if (winetest_debug > 1) trace("HandleCount : %ld\n", handlecount);
-    todo_wine
-    {
-        ok( handlecount > 0, "Expected some handles, got 0\n");
-    }
+    ok( handlecount > 0, "Expected some handles, got 0\n");
 }
 
 static void test_query_process_image_file_name(void)
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c
index 649a26be8e4..886aa2cfead 100644
--- a/dlls/ntdll/unix/process.c
+++ b/dlls/ntdll/unix/process.c
@@ -1349,11 +1349,16 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class
         if (size >= 4)
         {
             if (!info) ret = STATUS_ACCESS_VIOLATION;
-            else if (!handle) ret = STATUS_INVALID_HANDLE;
             else
             {
-                memset(info, 0, 4);
-                len = 4;
+                SERVER_START_REQ(get_process_handle_info)
+                {
+                    req->handle = wine_server_obj_handle( handle );
+                    ret = wine_server_call( req );
+                    *(ULONG *)info = reply->handle_count;
+                }
+                SERVER_END_REQ;
+                if (ret == STATUS_SUCCESS) len = 4;
             }
             if (size > 4) ret = STATUS_INFO_LENGTH_MISMATCH;
         }
-- 
2.35.1




More information about the wine-devel mailing list