Some DRM call it with GetCurrentThreadId(), although they don't seem to mind about the result.
Signed-off-by: Rémi Bernon rbernon@codeweavers.com ---
v2: Don't use FAILED for NTSTATUS. Supersedes: 196573
dlls/ntdll/debugbuffer.c | 13 +++++++++++-- dlls/ntdll/tests/rtl.c | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/debugbuffer.c b/dlls/ntdll/debugbuffer.c index 3ac765d454e..9f5d214aacb 100644 --- a/dlls/ntdll/debugbuffer.c +++ b/dlls/ntdll/debugbuffer.c @@ -114,7 +114,16 @@ NTSTATUS WINAPI RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER iBuf)
NTSTATUS WINAPI RtlQueryProcessDebugInformation(IN ULONG iProcessId, IN ULONG iDebugInfoMask, IN OUT PDEBUG_BUFFER iBuf) { - NTSTATUS nts = STATUS_SUCCESS; + CLIENT_ID cid; + NTSTATUS status; + HANDLE process; + + cid.UniqueProcess = ULongToHandle( iProcessId ); + cid.UniqueThread = 0; + + if ((status = NtOpenProcess( &process, PROCESS_QUERY_LIMITED_INFORMATION, NULL, &cid ))) return status; + NtClose( process ); + FIXME("(%d, %x, %p): stub\n", iProcessId, iDebugInfoMask, iBuf); iBuf->InfoClassMask = iDebugInfoMask;
@@ -139,5 +148,5 @@ NTSTATUS WINAPI RtlQueryProcessDebugInformation(IN ULONG iProcessId, IN ULONG iD } TRACE("returns:%p\n", iBuf); dump_DEBUG_BUFFER(iBuf); - return nts; + return status; } diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 897be4fcd12..28dd02fd118 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -132,6 +132,24 @@ static void InitFunctionPtrs(void) ok(strlen(src) == 15, "Source must be 16 bytes long!\n"); }
+static void test_RtlQueryProcessDebugInformation(void) +{ + DEBUG_BUFFER *buffer; + NTSTATUS status; + + buffer = RtlCreateQueryDebugBuffer( 0, 0 ); + ok( buffer != NULL, "RtlCreateQueryDebugBuffer returned NULL" ); + + status = RtlQueryProcessDebugInformation( GetCurrentThreadId(), PDI_HEAPS | PDI_HEAP_BLOCKS, buffer ); + ok( status == STATUS_INVALID_CID, "RtlQueryProcessDebugInformation returned %x\n", status ); + + status = RtlQueryProcessDebugInformation( GetCurrentProcessId(), PDI_HEAPS | PDI_HEAP_BLOCKS, buffer ); + ok( !status, "RtlQueryProcessDebugInformation returned %x\n", status ); + + status = RtlDestroyQueryDebugBuffer( buffer ); + ok( !status, "RtlDestroyQueryDebugBuffer returned %x\n", status ); +} + #define COMP(str1,str2,cmplen,len) size = RtlCompareMemory(str1, str2, cmplen); \ ok(size == len, "Expected %ld, got %ld\n", size, (SIZE_T)len)
@@ -3668,6 +3686,7 @@ START_TEST(rtl) { InitFunctionPtrs();
+ test_RtlQueryProcessDebugInformation(); test_RtlCompareMemory(); test_RtlCompareMemoryUlong(); test_RtlMoveMemory();