ntdll: Return failure from RtlQueryProcessDebugInformation.

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>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Rémi Bernon 2020-11-26 11:26:53 +01:00 committed by Alexandre Julliard
parent e0a1bdf2bc
commit 97825b9c53
2 changed files with 30 additions and 2 deletions

View File

@ -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;
}

View File

@ -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();