Commit 0d89f67e authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

winedump: Add support for dumping handle data stream from minidumps.

parent a9f9c1a6
...@@ -373,6 +373,38 @@ typedef struct _MINIDUMP_USER_STREAM_INFORMATION ...@@ -373,6 +373,38 @@ typedef struct _MINIDUMP_USER_STREAM_INFORMATION
PMINIDUMP_USER_STREAM UserStreamArray; PMINIDUMP_USER_STREAM UserStreamArray;
} MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION; } 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 typedef enum _MINIDUMP_STREAM_TYPE
{ {
UnusedStream = 0, UnusedStream = 0,
...@@ -393,6 +425,13 @@ typedef enum _MINIDUMP_STREAM_TYPE ...@@ -393,6 +425,13 @@ typedef enum _MINIDUMP_STREAM_TYPE
MiscInfoStream = 15, MiscInfoStream = 15,
MemoryInfoListStream = 16, MemoryInfoListStream = 16,
ThreadInfoListStream = 17, ThreadInfoListStream = 17,
HandleOperationListStream = 18,
TokenStream = 19,
JavaScriptDataStream = 20,
SystemMemoryInfoStream = 21,
ProcessVmCountersStream = 22,
IptTraceStream = 23,
ThreadNamesStream = 24,
LastReservedStream = 0xffff LastReservedStream = 0xffff
} MINIDUMP_STREAM_TYPE; } MINIDUMP_STREAM_TYPE;
......
...@@ -34,7 +34,9 @@ static void dump_mdmp_data(const MINIDUMP_LOCATION_DESCRIPTOR* md, const char* p ...@@ -34,7 +34,9 @@ static void dump_mdmp_data(const MINIDUMP_LOCATION_DESCRIPTOR* md, const char* p
static void dump_mdmp_string(DWORD rva) static void dump_mdmp_string(DWORD rva)
{ {
const MINIDUMP_STRING* ms = PRD(rva, sizeof(MINIDUMP_STRING)); 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) ); dump_unicode_str( ms->Buffer, ms->Length / sizeof(WCHAR) );
else else
printf("<<?>>"); printf("<<?>>");
...@@ -80,7 +82,7 @@ void mdmp_dump(void) ...@@ -80,7 +82,7 @@ void mdmp_dump(void)
const MINIDUMP_HEADER* hdr = PRD(0, sizeof(MINIDUMP_HEADER)); const MINIDUMP_HEADER* hdr = PRD(0, sizeof(MINIDUMP_HEADER));
const MINIDUMP_DIRECTORY* dir; const MINIDUMP_DIRECTORY* dir;
const void* stream; const void* stream;
unsigned int idx; unsigned int i, idx;
if (!hdr) if (!hdr)
{ {
...@@ -110,7 +112,6 @@ void mdmp_dump(void) ...@@ -110,7 +112,6 @@ void mdmp_dump(void)
{ {
const MINIDUMP_THREAD_LIST *mtl = stream; const MINIDUMP_THREAD_LIST *mtl = stream;
const MINIDUMP_THREAD *mt = mtl->Threads; const MINIDUMP_THREAD *mt = mtl->Threads;
unsigned int i;
printf("Threads: %u\n", (UINT)mtl->NumberOfThreads); printf("Threads: %u\n", (UINT)mtl->NumberOfThreads);
for (i = 0; i < mtl->NumberOfThreads; i++, mt++) for (i = 0; i < mtl->NumberOfThreads; i++, mt++)
...@@ -133,7 +134,6 @@ void mdmp_dump(void) ...@@ -133,7 +134,6 @@ void mdmp_dump(void)
{ {
const MINIDUMP_MODULE_LIST *mml = stream; const MINIDUMP_MODULE_LIST *mml = stream;
const MINIDUMP_MODULE* mm = mml->Modules; const MINIDUMP_MODULE* mm = mml->Modules;
unsigned int i;
const char* p1; const char* p1;
const char* p2; const char* p2;
...@@ -224,7 +224,6 @@ void mdmp_dump(void) ...@@ -224,7 +224,6 @@ void mdmp_dump(void)
{ {
const MINIDUMP_MEMORY_LIST *mml = stream; const MINIDUMP_MEMORY_LIST *mml = stream;
const MINIDUMP_MEMORY_DESCRIPTOR* mmd = mml->MemoryRanges; const MINIDUMP_MEMORY_DESCRIPTOR* mmd = mml->MemoryRanges;
unsigned int i;
printf("Memory Ranges: %u\n", mml->NumberOfMemoryRanges); printf("Memory Ranges: %u\n", mml->NumberOfMemoryRanges);
for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++) for (i = 0; i < mml->NumberOfMemoryRanges; i++, mmd++)
...@@ -419,7 +418,6 @@ void mdmp_dump(void) ...@@ -419,7 +418,6 @@ void mdmp_dump(void)
case ExceptionStream: case ExceptionStream:
{ {
const MINIDUMP_EXCEPTION_STREAM *mes = stream; const MINIDUMP_EXCEPTION_STREAM *mes = stream;
unsigned int i;
printf("Exception:\n"); printf("Exception:\n");
printf(" ThreadId: %#x\n", mes->ThreadId); printf(" ThreadId: %#x\n", mes->ThreadId);
...@@ -438,6 +436,46 @@ void mdmp_dump(void) ...@@ -438,6 +436,46 @@ void mdmp_dump(void)
dump_mdmp_data(&mes->ThreadContext, " "); dump_mdmp_data(&mes->ThreadContext, " ");
} }
break; 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: default:
printf("NIY %d\n", dir->StreamType); printf("NIY %d\n", dir->StreamType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment