Nikolay Sivov : winedump: Add support for dumping handle data stream from minidumps.
Alexandre Julliard
julliard at winehq.org
Wed May 18 15:38:30 CDT 2022
Module: wine
Branch: master
Commit: 0d89f67ea21536f416eb4a0e4771b033066ff4fd
URL: https://source.winehq.org/git/wine.git/?a=commit;h=0d89f67ea21536f416eb4a0e4771b033066ff4fd
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue May 17 22:20:37 2022 +0300
winedump: Add support for dumping handle data stream from minidumps.
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
include/minidumpapiset.h | 39 ++++++++++++++++++++++++++++++++++++
tools/winedump/minidump.c | 50 +++++++++++++++++++++++++++++++++++++++++------
2 files changed, 83 insertions(+), 6 deletions(-)
diff --git a/include/minidumpapiset.h b/include/minidumpapiset.h
index 5409d6cd758..73994c0d3eb 100644
--- a/include/minidumpapiset.h
+++ b/include/minidumpapiset.h
@@ -373,6 +373,38 @@ typedef struct _MINIDUMP_USER_STREAM_INFORMATION
PMINIDUMP_USER_STREAM UserStreamArray;
} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
+typedef struct _MINIDUMP_HANDLE_DATA_STREAM
+{
+ ULONG32 SizeOfHeader;
+ ULONG32 SizeOfDescriptor;
+ ULONG32 NumberOfDescriptors;
+ ULONG32 Reserved;
+} MINIDUMP_HANDLE_DATA_STREAM, *PMINIDUMP_HANDLE_DATA_STREAM;
+
+typedef struct _MINIDUMP_HANDLE_DESCRIPTOR
+{
+ ULONG64 Handle;
+ RVA TypeNameRva;
+ RVA ObjectNameRva;
+ ULONG32 Attributes;
+ ULONG32 GrantedAccess;
+ ULONG32 HandleCount;
+ ULONG32 PointerCount;
+} MINIDUMP_HANDLE_DESCRIPTOR, *PMINIDUMP_HANDLE_DESCRIPTOR;
+
+typedef struct _MINIDUMP_HANDLE_DESCRIPTOR_2
+{
+ ULONG64 Handle;
+ RVA TypeNameRva;
+ RVA ObjectNameRva;
+ ULONG32 Attributes;
+ ULONG32 GrantedAccess;
+ ULONG32 HandleCount;
+ ULONG32 PointerCount;
+ RVA ObjectInfoRva;
+ ULONG32 Reserved0;
+} MINIDUMP_HANDLE_DESCRIPTOR_2, *PMINIDUMP_HANDLE_DESCRIPTOR_2;
+
typedef enum _MINIDUMP_STREAM_TYPE
{
UnusedStream = 0,
@@ -393,6 +425,13 @@ typedef enum _MINIDUMP_STREAM_TYPE
MiscInfoStream = 15,
MemoryInfoListStream = 16,
ThreadInfoListStream = 17,
+ HandleOperationListStream = 18,
+ TokenStream = 19,
+ JavaScriptDataStream = 20,
+ SystemMemoryInfoStream = 21,
+ ProcessVmCountersStream = 22,
+ IptTraceStream = 23,
+ ThreadNamesStream = 24,
LastReservedStream = 0xffff
} MINIDUMP_STREAM_TYPE;
diff --git a/tools/winedump/minidump.c b/tools/winedump/minidump.c
index 9474381fd02..f8bd03ca0c5 100644
--- a/tools/winedump/minidump.c
+++ b/tools/winedump/minidump.c
@@ -34,7 +34,9 @@ static void dump_mdmp_data(const MINIDUMP_LOCATION_DESCRIPTOR* md, const char* p
static void dump_mdmp_string(DWORD rva)
{
const MINIDUMP_STRING* ms = PRD(rva, sizeof(MINIDUMP_STRING));
- if (ms)
+ if (!rva)
+ printf("<<rva=0>>");
+ else if (ms)
dump_unicode_str( ms->Buffer, ms->Length / sizeof(WCHAR) );
else
printf("<<?>>");
@@ -80,7 +82,7 @@ void mdmp_dump(void)
const MINIDUMP_HEADER* hdr = PRD(0, sizeof(MINIDUMP_HEADER));
const MINIDUMP_DIRECTORY* dir;
const void* stream;
- unsigned int idx;
+ unsigned int i, idx;
if (!hdr)
{
@@ -110,7 +112,6 @@ void mdmp_dump(void)
{
const MINIDUMP_THREAD_LIST *mtl = stream;
const MINIDUMP_THREAD *mt = mtl->Threads;
- unsigned int i;
printf("Threads: %u\n", (UINT)mtl->NumberOfThreads);
for (i = 0; i < mtl->NumberOfThreads; i++, mt++)
@@ -133,7 +134,6 @@ void mdmp_dump(void)
{
const MINIDUMP_MODULE_LIST *mml = stream;
const MINIDUMP_MODULE* mm = mml->Modules;
- unsigned int i;
const char* p1;
const char* p2;
@@ -224,7 +224,6 @@ void mdmp_dump(void)
{
const MINIDUMP_MEMORY_LIST *mml = stream;
const MINIDUMP_MEMORY_DESCRIPTOR* mmd = mml->MemoryRanges;
- unsigned int i;
printf("Memory Ranges: %u\n", mml->NumberOfMemoryRanges);
for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++)
@@ -419,7 +418,6 @@ void mdmp_dump(void)
case ExceptionStream:
{
const MINIDUMP_EXCEPTION_STREAM *mes = stream;
- unsigned int i;
printf("Exception:\n");
printf(" ThreadId: %#x\n", mes->ThreadId);
@@ -438,6 +436,46 @@ void mdmp_dump(void)
dump_mdmp_data(&mes->ThreadContext, " ");
}
break;
+ case HandleDataStream:
+ {
+ const MINIDUMP_HANDLE_DATA_STREAM *mhd = stream;
+ const BYTE *desc;
+
+ printf("Handle data:\n");
+ printf(" SizeOfHeader: %u\n", mhd->SizeOfHeader);
+ printf(" SizeOfDescriptor: %u\n", mhd->SizeOfDescriptor);
+ printf(" NumberOfDescriptors: %u\n", mhd->NumberOfDescriptors);
+
+ desc = (BYTE *)mhd + sizeof(*mhd);
+ for (i = 0; i < mhd->NumberOfDescriptors; ++i)
+ {
+ const MINIDUMP_HANDLE_DESCRIPTOR_2 *hd = (void *)desc;
+
+ printf(" Handle [%u]:\n", i);
+ print_longlong(" Handle", hd->Handle);
+ printf(" TypeName: ");
+ dump_mdmp_string(hd->TypeNameRva);
+ printf("\n");
+ printf(" ObjectName: ");
+ dump_mdmp_string(hd->ObjectNameRva);
+ printf("\n");
+ printf(" Attributes: %#x\n", hd->Attributes);
+ printf(" GrantedAccess: %#x\n", hd->GrantedAccess);
+ printf(" HandleCount: %u\n", hd->HandleCount);
+ printf(" PointerCount: %#x\n", hd->PointerCount);
+
+ if (mhd->SizeOfDescriptor >= sizeof(MINIDUMP_HANDLE_DESCRIPTOR_2))
+ {
+ printf(" ObjectInfo: ");
+ dump_mdmp_string(hd->ObjectInfoRva);
+ printf("\n");
+ printf(" Reserved0: %#x\n", hd->Reserved0);
+ }
+
+ desc += mhd->SizeOfDescriptor;
+ }
+ }
+ break;
default:
printf("NIY %d\n", dir->StreamType);
More information about the wine-cvs
mailing list