[PATCH 4/4] ntdll: Return handles for SystemHandleInformation in NtQuerySystemInformation
Austin Lund
austin.lund at gmail.com
Sun Jun 19 21:15:41 CDT 2011
---
dlls/ntdll/nt.c | 23 +++++++++++++++++++++++
dlls/ntdll/tests/info.c | 6 ++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index f068dc6..48b1228 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1674,6 +1674,8 @@ NTSTATUS WINAPI NtQuerySystemInformation(
while (ret == STATUS_SUCCESS)
{
+ NTSTATUS handle_ret = STATUS_SUCCESS;
+ int handles_to_add = 0;
SERVER_START_REQ( next_process )
{
int i;
@@ -1682,6 +1684,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
ret = wine_server_call( req );
shi->Count += reply->handles;
+ handles_to_add = reply->handles;
len = sizeof(SYSTEM_HANDLE_ENTRY)*shi->Count + sizeof(ULONG);
shi = RtlReAllocateHeap(GetProcessHeap(), HEAP_ZERO_MEMORY, shi, len);
for (i = shi->Count - reply->handles; i < shi->Count; i++) {
@@ -1689,6 +1692,26 @@ NTSTATUS WINAPI NtQuerySystemInformation(
}
}
SERVER_END_REQ;
+
+ while (handle_ret == STATUS_SUCCESS) {
+
+ SERVER_START_REQ( next_handle )
+ {
+ SYSTEM_HANDLE_ENTRY *current_entry;
+ req->handle = wine_server_obj_handle( hSnap );
+ req->reset = 0;
+ handle_ret = wine_server_call( req );
+ if (handle_ret != STATUS_SUCCESS)
+ continue;
+ current_entry = shi->Handle + shi->Count - handles_to_add;
+ current_entry->HandleValue = reply->reply_handle;
+ current_entry->AccessMask = reply->access;
+ }
+ SERVER_END_REQ;
+
+ handles_to_add--;
+ if (handles_to_add < 0) break;
+ }
}
if ( ResultLength )
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
index f82bdfd..ef091ad 100644
--- a/dlls/ntdll/tests/info.c
+++ b/dlls/ntdll/tests/info.c
@@ -475,12 +475,18 @@ static void test_query_handle(void)
status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
if (status != STATUS_INFO_LENGTH_MISMATCH) /* vista */
{
+ int i;
+ SYSTEM_HANDLE_ENTRY *she;
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);
ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
+ for (i = 0; i < shi->Count; i++) {
+ she = shi->Handle + i;
+ ok(she->HandleValue != 0, "Returned a null handle at index %d, pid %x\n", i, she->OwnerPid);
+ }
}
HeapFree( GetProcessHeap(), 0, shi);
}
--
1.7.4.1
More information about the wine-patches
mailing list