Module: wine Branch: master Commit: ab28825aceec92775fd570fc3a42c154366eceea URL: https://gitlab.winehq.org/wine/wine/-/commit/ab28825aceec92775fd570fc3a42c15...
Author: Bernhard Übelacker bernhardu@mailbox.org Date: Mon Jan 22 13:39:22 2024 +0100
ntdll: Fix structure layout in RtlQueryProcessDebugInformation for 64-bit.
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..52af87320a5 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;