Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=56235
-- v2: ntdll: Improve stub RtlQueryProcessDebugInformation for 64-bit.
From: Bernhard Übelacker bernhardu@mailbox.org
This is to avoid crash in Process Explorer 17.05.
Wine-bug: https://bugs.winehq.org/show_bug.cgi?id=56235 --- dlls/ntdll/debugbuffer.c | 4 ++-- dlls/ntdll/tests/rtl.c | 15 +++++++++++++++ include/winternl.h | 6 +++--- 3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/debugbuffer.c b/dlls/ntdll/debugbuffer.c index f073207ac06..aa35651bb40 100644 --- a/dlls/ntdll/debugbuffer.c +++ b/dlls/ntdll/debugbuffer.c @@ -77,8 +77,8 @@ static void dump_DEBUG_BUFFER(const DEBUG_BUFFER *iBuf) TRACE( "EventPairHandle:%p\n", iBuf->EventPairHandle); TRACE( "RemoteThreadHandle:%p\n", iBuf->RemoteThreadHandle); TRACE( "InfoClassMask:%lx\n", iBuf->InfoClassMask); - TRACE( "SizeOfInfo:%ld\n", iBuf->SizeOfInfo); - TRACE( "AllocatedSize:%ld\n", iBuf->AllocatedSize); + TRACE( "SizeOfInfo:%Iu\n", iBuf->SizeOfInfo); + TRACE( "AllocatedSize:%Iu\n", iBuf->AllocatedSize); TRACE( "SectionSize:%ld\n", iBuf->SectionSize); TRACE( "BackTraceInfo:%p\n", iBuf->BackTraceInformation); dump_DEBUG_MODULE_INFORMATION(iBuf->ModuleInformation); diff --git a/dlls/ntdll/tests/rtl.c b/dlls/ntdll/tests/rtl.c index 03c31d7bf6b..754f5b711dd 100644 --- a/dlls/ntdll/tests/rtl.c +++ b/dlls/ntdll/tests/rtl.c @@ -157,6 +157,7 @@ static void test_RtlQueryProcessDebugInformation(void) DEBUG_BUFFER *buffer; NTSTATUS status;
+ /* PDI_HEAPS | PDI_HEAP_BLOCKS */ buffer = RtlCreateQueryDebugBuffer( 0, 0 ); ok( buffer != NULL, "RtlCreateQueryDebugBuffer returned NULL" );
@@ -165,6 +166,20 @@ static void test_RtlQueryProcessDebugInformation(void)
status = RtlQueryProcessDebugInformation( GetCurrentProcessId(), PDI_HEAPS | PDI_HEAP_BLOCKS, buffer ); ok( !status, "RtlQueryProcessDebugInformation returned %lx\n", status ); + ok( buffer->InfoClassMask == (PDI_HEAPS | PDI_HEAP_BLOCKS), "unexpected InfoClassMask %ld\n", buffer->InfoClassMask); + ok( buffer->HeapInformation != NULL, "unexpected HeapInformation %p\n", buffer->HeapInformation); + + status = RtlDestroyQueryDebugBuffer( buffer ); + ok( !status, "RtlDestroyQueryDebugBuffer returned %lx\n", status ); + + /* PDI_MODULES */ + buffer = RtlCreateQueryDebugBuffer( 0, 0 ); + ok( buffer != NULL, "RtlCreateQueryDebugBuffer returned NULL" ); + + status = RtlQueryProcessDebugInformation( GetCurrentProcessId(), PDI_MODULES, buffer ); + ok( !status, "RtlQueryProcessDebugInformation returned %lx\n", status ); + ok( buffer->InfoClassMask == PDI_MODULES, "unexpected InfoClassMask %ld\n", buffer->InfoClassMask); + ok( buffer->ModuleInformation != NULL, "unexpected ModuleInformation %p\n", buffer->ModuleInformation);
status = RtlDestroyQueryDebugBuffer( buffer ); ok( !status, "RtlDestroyQueryDebugBuffer returned %lx\n", status ); diff --git a/include/winternl.h b/include/winternl.h index 48eac76c4d6..e42c5f36c29 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -3040,11 +3040,11 @@ typedef struct _DEBUG_BUFFER { PVOID RemoteSectionBase; ULONG SectionBaseDelta; HANDLE EventPairHandle; - ULONG Unknown[2]; + SIZE_T Unknown[2]; HANDLE RemoteThreadHandle; ULONG InfoClassMask; - ULONG SizeOfInfo; - ULONG AllocatedSize; + SIZE_T SizeOfInfo; + SIZE_T AllocatedSize; ULONG SectionSize; PVOID ModuleInformation; PVOID BackTraceInformation;
Thanks for the input, usually I don't doubt the correctness of the headers. I made a few tests with testbot and compared the content of the returned DEBUG_BUFFER. Based on this I modified the structure to get wine return the pointer at the same offset like windows.
v2: - Rebased to current git. - Modify structure DEBUG_BUFFER to match for 64-Bit. - No longer doing functional change to RtlQueryProcessDebugInformation.