2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
19 #define IMAGEAPI DECLSPEC_IMPORT WINAPI
20 #define DBHLP_DEPRECIATED __declspec(deprecated)
22 #define DBHLPAPI IMAGEAPI
24 #define IMAGE_SEPARATION (64*1024)
26 typedef struct _LOADED_IMAGE
{
31 PIMAGE_NT_HEADERS64 FileHeader
;
33 PIMAGE_NT_HEADERS32 FileHeader
;
35 PIMAGE_SECTION_HEADER LastRvaSection
;
36 ULONG NumberOfSections
;
37 PIMAGE_SECTION_HEADER Sections
;
38 ULONG Characteristics
;
43 } LOADED_IMAGE
,*PLOADED_IMAGE
;
45 #define MAX_SYM_NAME 2000
47 typedef BOOL (CALLBACK
*PFIND_DEBUG_FILE_CALLBACK
)(HANDLE FileHandle
,PSTR FileName
,PVOID CallerData
);
48 typedef BOOL (CALLBACK
*PFINDFILEINPATHCALLBACK
)(PSTR filename
,PVOID context
);
49 typedef BOOL (CALLBACK
*PFIND_EXE_FILE_CALLBACK
)(HANDLE FileHandle
,PSTR FileName
,PVOID CallerData
);
51 typedef BOOL (WINAPI
*PSYMBOLSERVERPROC
)(LPCSTR
,LPCSTR
,PVOID
,DWORD
,DWORD
,LPSTR
);
52 typedef BOOL (WINAPI
*PSYMBOLSERVEROPENPROC
)(VOID
);
53 typedef BOOL (WINAPI
*PSYMBOLSERVERCLOSEPROC
)(VOID
);
54 typedef BOOL (WINAPI
*PSYMBOLSERVERSETOPTIONSPROC
)(UINT_PTR
,ULONG64
);
55 typedef BOOL (CALLBACK WINAPI
*PSYMBOLSERVERCALLBACKPROC
)(UINT_PTR action
,ULONG64 data
,ULONG64 context
);
56 typedef UINT_PTR (WINAPI
*PSYMBOLSERVERGETOPTIONSPROC
)();
57 typedef BOOL (WINAPI
*PSYMBOLSERVERPINGPROC
)(LPCSTR
);
59 HANDLE IMAGEAPI
FindDebugInfoFile(PSTR FileName
,PSTR SymbolPath
,PSTR DebugFilePath
);
60 HANDLE IMAGEAPI
FindDebugInfoFileEx(PSTR FileName
,PSTR SymbolPath
,PSTR DebugFilePath
,PFIND_DEBUG_FILE_CALLBACK Callback
,PVOID CallerData
);
61 BOOL IMAGEAPI
SymFindFileInPath(HANDLE hprocess
,LPSTR SearchPath
,LPSTR FileName
,PVOID id
,DWORD two
,DWORD three
,DWORD flags
,LPSTR FoundFile
,PFINDFILEINPATHCALLBACK callback
,PVOID context
);
62 HANDLE IMAGEAPI
FindExecutableImage(PSTR FileName
,PSTR SymbolPath
,PSTR ImageFilePath
);
63 HANDLE IMAGEAPI
FindExecutableImageEx(PSTR FileName
,PSTR SymbolPath
,PSTR ImageFilePath
,PFIND_EXE_FILE_CALLBACK Callback
,PVOID CallerData
);
64 PIMAGE_NT_HEADERS IMAGEAPI
ImageNtHeader(PVOID Base
);
65 PVOID IMAGEAPI
ImageDirectoryEntryToDataEx(PVOID Base
,BOOLEAN MappedAsImage
,USHORT DirectoryEntry
,PULONG Size
,PIMAGE_SECTION_HEADER
*FoundHeader
);
66 PVOID IMAGEAPI
ImageDirectoryEntryToData(PVOID Base
,BOOLEAN MappedAsImage
,USHORT DirectoryEntry
,PULONG Size
);
67 PIMAGE_SECTION_HEADER IMAGEAPI
ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders
,PVOID Base
,ULONG Rva
);
68 PVOID IMAGEAPI
ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders
,PVOID Base
,ULONG Rva
,PIMAGE_SECTION_HEADER
*LastRvaSection
);
70 #define SSRVOPT_CALLBACK 0x0001
71 #define SSRVOPT_DWORD 0x0002
72 #define SSRVOPT_DWORDPTR 0x0004
73 #define SSRVOPT_GUIDPTR 0x0008
74 #define SSRVOPT_OLDGUIDPTR 0x0010
75 #define SSRVOPT_UNATTENDED 0x0020
76 #define SSRVOPT_NOCOPY 0x0040
77 #define SSRVOPT_PARENTWIN 0x0080
78 #define SSRVOPT_PARAMTYPE 0x0100
79 #define SSRVOPT_SECURE 0x0200
80 #define SSRVOPT_TRACE 0x0400
81 #define SSRVOPT_SETCONTEXT 0x0800
82 #define SSRVOPT_PROXY 0x1000
83 #define SSRVOPT_DOWNSTREAM_STORE 0x2000
84 #define SSRVOPT_RESET ((ULONG_PTR)-1)
86 #define SSRVACTION_TRACE 1
87 #define SSRVACTION_QUERYCANCEL 2
88 #define SSRVACTION_EVENT 3
92 typedef struct _IMAGE_DEBUG_INFORMATION
{
95 PVOID ReservedMappedBase
;
96 USHORT ReservedMachine
;
97 USHORT ReservedCharacteristics
;
98 DWORD ReservedCheckSum
;
101 DWORD ReservedNumberOfSections
;
102 PIMAGE_SECTION_HEADER ReservedSections
;
103 DWORD ReservedExportedNamesSize
;
104 PSTR ReservedExportedNames
;
105 DWORD ReservedNumberOfFunctionTableEntries
;
106 PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries
;
107 DWORD ReservedLowestFunctionStartingAddress
;
108 DWORD ReservedHighestFunctionEndingAddress
;
109 DWORD ReservedNumberOfFpoTableEntries
;
110 PFPO_DATA ReservedFpoTableEntries
;
111 DWORD SizeOfCoffSymbols
;
112 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols
;
113 DWORD ReservedSizeOfCodeViewSymbols
;
114 PVOID ReservedCodeViewSymbols
;
117 PSTR ReservedDebugFilePath
;
118 DWORD ReservedTimeDateStamp
;
119 BOOL ReservedRomImage
;
120 PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory
;
121 DWORD ReservedNumberOfDebugDirectories
;
122 DWORD ReservedOriginalFunctionTableBaseAddress
;
124 } IMAGE_DEBUG_INFORMATION
,*PIMAGE_DEBUG_INFORMATION
;
126 PIMAGE_DEBUG_INFORMATION IMAGEAPI
MapDebugInformation(HANDLE FileHandle
,PSTR FileName
,PSTR SymbolPath
,DWORD ImageBase
);
127 BOOL IMAGEAPI
UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo
);
130 typedef BOOL (CALLBACK
*PENUMDIRTREE_CALLBACK
)(LPCSTR FilePath
,PVOID CallerData
);
132 BOOL IMAGEAPI
SearchTreeForFile(PSTR RootPath
,PSTR InputPathName
,PSTR OutputPathBuffer
);
133 BOOL IMAGEAPI
EnumDirTree(HANDLE hProcess
,PSTR RootPath
,PSTR InputPathName
,PSTR OutputPathBuffer
,PENUMDIRTREE_CALLBACK Callback
,PVOID CallbackData
);
134 BOOL IMAGEAPI
MakeSureDirectoryPathExists(PCSTR DirPath
);
136 #define UNDNAME_COMPLETE (0x0000)
137 #define UNDNAME_NO_LEADING_UNDERSCORES (0x0001)
138 #define UNDNAME_NO_MS_KEYWORDS (0x0002)
139 #define UNDNAME_NO_FUNCTION_RETURNS (0x0004)
140 #define UNDNAME_NO_ALLOCATION_MODEL (0x0008)
141 #define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010)
142 #define UNDNAME_NO_MS_THISTYPE (0x0020)
143 #define UNDNAME_NO_CV_THISTYPE (0x0040)
144 #define UNDNAME_NO_THISTYPE (0x0060)
145 #define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080)
146 #define UNDNAME_NO_THROW_SIGNATURES (0x0100)
147 #define UNDNAME_NO_MEMBER_TYPE (0x0200)
148 #define UNDNAME_NO_RETURN_UDT_MODEL (0x0400)
149 #define UNDNAME_32_BIT_DECODE (0x0800)
150 #define UNDNAME_NAME_ONLY (0x1000)
151 #define UNDNAME_NO_ARGUMENTS (0x2000)
152 #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
154 DWORD IMAGEAPI WINAPI
UnDecorateSymbolName(PCSTR DecoratedName
,PSTR UnDecoratedName
,DWORD UndecoratedLength
,DWORD Flags
);
156 #define DBHHEADER_DEBUGDIRS 0x1
158 typedef struct _MODLOAD_DATA
{
164 } MODLOAD_DATA
,*PMODLOAD_DATA
;
167 AddrMode1616
,AddrMode1632
,AddrModeReal
,AddrModeFlat
170 typedef struct _tagADDRESS64
{
174 } ADDRESS64
,*LPADDRESS64
;
177 #define ADDRESS ADDRESS64
178 #define LPADDRESS LPADDRESS64
180 typedef struct _tagADDRESS
{
184 } ADDRESS
,*LPADDRESS
;
186 static __inline
void Address32To64(LPADDRESS a32
,LPADDRESS64 a64
) {
187 a64
->Offset
= (ULONG64
)(LONG64
)(LONG
)a32
->Offset
;
188 a64
->Segment
= a32
->Segment
;
189 a64
->Mode
= a32
->Mode
;
192 static __inline
void Address64To32(LPADDRESS64 a64
,LPADDRESS a32
) {
193 a32
->Offset
= (ULONG
)a64
->Offset
;
194 a32
->Segment
= a64
->Segment
;
195 a32
->Mode
= a64
->Mode
;
199 typedef struct _KDHELP64
{
201 DWORD ThCallbackStack
;
202 DWORD ThCallbackBStore
;
205 DWORD64 KiCallUserMode
;
206 DWORD64 KeUserCallbackDispatcher
;
207 DWORD64 SystemRangeStart
;
209 } KDHELP64
,*PKDHELP64
;
212 #define KDHELP KDHELP64
213 #define PKDHELP PKDHELP64
215 typedef struct _KDHELP
{
217 DWORD ThCallbackStack
;
220 DWORD KiCallUserMode
;
221 DWORD KeUserCallbackDispatcher
;
222 DWORD SystemRangeStart
;
223 DWORD ThCallbackBStore
;
227 static __inline
void KdHelp32To64(PKDHELP p32
,PKDHELP64 p64
) {
228 p64
->Thread
= p32
->Thread
;
229 p64
->ThCallbackStack
= p32
->ThCallbackStack
;
230 p64
->NextCallback
= p32
->NextCallback
;
231 p64
->FramePointer
= p32
->FramePointer
;
232 p64
->KiCallUserMode
= p32
->KiCallUserMode
;
233 p64
->KeUserCallbackDispatcher
= p32
->KeUserCallbackDispatcher
;
234 p64
->SystemRangeStart
= p32
->SystemRangeStart
;
238 typedef struct _tagSTACKFRAME64
{
240 ADDRESS64 AddrReturn
;
243 ADDRESS64 AddrBStore
;
244 PVOID FuncTableEntry
;
250 } STACKFRAME64
,*LPSTACKFRAME64
;
253 #define STACKFRAME STACKFRAME64
254 #define LPSTACKFRAME LPSTACKFRAME64
256 typedef struct _tagSTACKFRAME
{
261 PVOID FuncTableEntry
;
268 } STACKFRAME
,*LPSTACKFRAME
;
271 typedef BOOL (WINAPI
*PREAD_PROCESS_MEMORY_ROUTINE64
)(HANDLE hProcess
,DWORD64 qwBaseAddress
,PVOID lpBuffer
,DWORD nSize
,LPDWORD lpNumberOfBytesRead
);
272 typedef PVOID (WINAPI
*PFUNCTION_TABLE_ACCESS_ROUTINE64
)(HANDLE hProcess
,DWORD64 AddrBase
);
273 typedef DWORD64 (WINAPI
*PGET_MODULE_BASE_ROUTINE64
)(HANDLE hProcess
,DWORD64 Address
);
274 typedef DWORD64 (WINAPI
*PTRANSLATE_ADDRESS_ROUTINE64
)(HANDLE hProcess
,HANDLE hThread
,LPADDRESS64 lpaddr
);
276 BOOL IMAGEAPI
StackWalk64(DWORD MachineType
,HANDLE hProcess
,HANDLE hThread
,LPSTACKFRAME64 StackFrame
,PVOID ContextRecord
,PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine
,PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine
,PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine
,PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress
);
279 #define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64
280 #define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64
281 #define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64
282 #define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64
283 #define StackWalk StackWalk64
285 typedef BOOL (WINAPI
*PREAD_PROCESS_MEMORY_ROUTINE
)(HANDLE hProcess
,DWORD lpBaseAddress
,PVOID lpBuffer
,DWORD nSize
,PDWORD lpNumberOfBytesRead
);
286 typedef PVOID (WINAPI
*PFUNCTION_TABLE_ACCESS_ROUTINE
)(HANDLE hProcess
,DWORD AddrBase
);
287 typedef DWORD (WINAPI
*PGET_MODULE_BASE_ROUTINE
)(HANDLE hProcess
,DWORD Address
);
288 typedef DWORD (WINAPI
*PTRANSLATE_ADDRESS_ROUTINE
)(HANDLE hProcess
,HANDLE hThread
,LPADDRESS lpaddr
);
290 BOOL IMAGEAPI
StackWalk(DWORD MachineType
,HANDLE hProcess
,HANDLE hThread
,LPSTACKFRAME StackFrame
,PVOID ContextRecord
,PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine
,PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine
,PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine
,PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
);
293 #define API_VERSION_NUMBER 9
295 typedef struct API_VERSION
{
300 } API_VERSION
,*LPAPI_VERSION
;
302 LPAPI_VERSION IMAGEAPI
ImagehlpApiVersion(VOID
);
303 LPAPI_VERSION IMAGEAPI
ImagehlpApiVersionEx(LPAPI_VERSION AppVersion
);
304 DWORD IMAGEAPI
GetTimestampForLoadedLibrary(HMODULE Module
);
306 typedef BOOL (CALLBACK
*PSYM_ENUMMODULES_CALLBACK64
)(PSTR ModuleName
,DWORD64 BaseOfDll
,PVOID UserContext
);
307 typedef BOOL (CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK64
)(PSTR SymbolName
,DWORD64 SymbolAddress
,ULONG SymbolSize
,PVOID UserContext
);
308 typedef BOOL (CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK64W
)(PWSTR SymbolName
,DWORD64 SymbolAddress
,ULONG SymbolSize
,PVOID UserContext
);
309 typedef BOOL (CALLBACK
*PENUMLOADED_MODULES_CALLBACK64
)(PSTR ModuleName
,DWORD64 ModuleBase
,ULONG ModuleSize
,PVOID UserContext
);
310 typedef BOOL (CALLBACK
*PSYMBOL_REGISTERED_CALLBACK64
)(HANDLE hProcess
,ULONG ActionCode
,ULONG64 CallbackData
,ULONG64 UserContext
);
311 typedef PVOID (CALLBACK
*PSYMBOL_FUNCENTRY_CALLBACK
)(HANDLE hProcess
,DWORD AddrBase
,PVOID UserContext
);
312 typedef PVOID (CALLBACK
*PSYMBOL_FUNCENTRY_CALLBACK64
)(HANDLE hProcess
,ULONG64 AddrBase
,ULONG64 UserContext
);
315 #define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64
316 #define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64
317 #define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACK64W
318 #define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64
319 #define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64
320 #define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64
322 typedef BOOL (CALLBACK
*PSYM_ENUMMODULES_CALLBACK
)(PSTR ModuleName
,ULONG BaseOfDll
,PVOID UserContext
);
323 typedef BOOL (CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK
)(PSTR SymbolName
,ULONG SymbolAddress
,ULONG SymbolSize
,PVOID UserContext
);
324 typedef BOOL (CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACKW
)(PWSTR SymbolName
,ULONG SymbolAddress
,ULONG SymbolSize
,PVOID UserContext
);
325 typedef BOOL (CALLBACK
*PENUMLOADED_MODULES_CALLBACK
)(PSTR ModuleName
,ULONG ModuleBase
,ULONG ModuleSize
,PVOID UserContext
);
326 typedef BOOL (CALLBACK
*PSYMBOL_REGISTERED_CALLBACK
)(HANDLE hProcess
,ULONG ActionCode
,PVOID CallbackData
,PVOID UserContext
);
329 #define SYMFLAG_VALUEPRESENT 0x00000001
330 #define SYMFLAG_REGISTER 0x00000008
331 #define SYMFLAG_REGREL 0x00000010
332 #define SYMFLAG_FRAMEREL 0x00000020
333 #define SYMFLAG_PARAMETER 0x00000040
334 #define SYMFLAG_LOCAL 0x00000080
335 #define SYMFLAG_CONSTANT 0x00000100
336 #define SYMFLAG_EXPORT 0x00000200
337 #define SYMFLAG_FORWARDER 0x00000400
338 #define SYMFLAG_FUNCTION 0x00000800
339 #define SYMFLAG_VIRTUAL 0x00001000
340 #define SYMFLAG_THUNK 0x00002000
341 #define SYMFLAG_TLSREL 0x00004000
344 SymNone
= 0,SymCoff
,SymCv
,SymPdb
,SymExport
,SymDeferred
,SymSym
,SymDia
,SymVirtual
,NumSymTypes
347 typedef struct _IMAGEHLP_SYMBOL64
{
354 } IMAGEHLP_SYMBOL64
,*PIMAGEHLP_SYMBOL64
;
356 typedef struct _IMAGEHLP_SYMBOL64_PACKAGE
{
357 IMAGEHLP_SYMBOL64 sym
;
358 CHAR name
[MAX_SYM_NAME
+ 1];
359 } IMAGEHLP_SYMBOL64_PACKAGE
,*PIMAGEHLP_SYMBOL64_PACKAGE
;
363 #define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64
364 #define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64
365 #define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE
366 #define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE
369 typedef struct _IMAGEHLP_SYMBOL
{
376 } IMAGEHLP_SYMBOL
,*PIMAGEHLP_SYMBOL
;
378 typedef struct _IMAGEHLP_SYMBOL_PACKAGE
{
380 CHAR name
[MAX_SYM_NAME
+ 1];
381 } IMAGEHLP_SYMBOL_PACKAGE
,*PIMAGEHLP_SYMBOL_PACKAGE
;
384 typedef struct _IMAGEHLP_MODULE64
{
394 CHAR LoadedImageName
[256];
395 CHAR LoadedPdbName
[256];
397 CHAR CVData
[MAX_PATH
*3];
406 } IMAGEHLP_MODULE64
,*PIMAGEHLP_MODULE64
;
408 typedef struct _IMAGEHLP_MODULE64W
{
416 WCHAR ModuleName
[32];
417 WCHAR ImageName
[256];
418 WCHAR LoadedImageName
[256];
419 WCHAR LoadedPdbName
[256];
421 WCHAR CVData
[MAX_PATH
*3];
430 } IMAGEHLP_MODULEW64
,*PIMAGEHLP_MODULEW64
;
433 #define IMAGEHLP_MODULE IMAGEHLP_MODULE64
434 #define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64
435 #define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64
436 #define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64
438 typedef struct _IMAGEHLP_MODULE
{
448 CHAR LoadedImageName
[256];
449 } IMAGEHLP_MODULE
,*PIMAGEHLP_MODULE
;
451 typedef struct _IMAGEHLP_MODULEW
{
459 WCHAR ModuleName
[32];
460 WCHAR ImageName
[256];
461 WCHAR LoadedImageName
[256];
462 } IMAGEHLP_MODULEW
,*PIMAGEHLP_MODULEW
;
465 typedef struct _IMAGEHLP_LINE64
{
471 } IMAGEHLP_LINE64
,*PIMAGEHLP_LINE64
;
474 #define IMAGEHLP_LINE IMAGEHLP_LINE64
475 #define PIMAGEHLP_LINE PIMAGEHLP_LINE64
477 typedef struct _IMAGEHLP_LINE
{
483 } IMAGEHLP_LINE
,*PIMAGEHLP_LINE
;
486 typedef struct _SOURCEFILE
{
489 } SOURCEFILE
,*PSOURCEFILE
;
491 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
492 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
493 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
494 #define CBA_SYMBOLS_UNLOADED 0x00000004
495 #define CBA_DUPLICATE_SYMBOL 0x00000005
496 #define CBA_READ_MEMORY 0x00000006
497 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007
498 #define CBA_SET_OPTIONS 0x00000008
499 #define CBA_EVENT 0x00000010
500 #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020
501 #define CBA_DEBUG_INFO 0x10000000
503 typedef struct _IMAGEHLP_CBA_READ_MEMORY
{
508 } IMAGEHLP_CBA_READ_MEMORY
,*PIMAGEHLP_CBA_READ_MEMORY
;
511 sevInfo
= 0,sevProblem
,sevAttn
,sevFatal
,sevMax
514 typedef struct _IMAGEHLP_CBA_EVENT
{
519 } IMAGEHLP_CBA_EVENT
,*PIMAGEHLP_CBA_EVENT
;
521 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
{
526 CHAR FileName
[MAX_PATH
];
530 } IMAGEHLP_DEFERRED_SYMBOL_LOAD64
,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD64
;
532 #define DSLFLAG_MISMATCHED_PDB 0x1
533 #define DSLFLAG_MISMATCHED_DBG 0x2
536 #define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64
537 #define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64
539 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
{
544 CHAR FileName
[MAX_PATH
];
547 } IMAGEHLP_DEFERRED_SYMBOL_LOAD
,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD
;
550 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
{
553 PIMAGEHLP_SYMBOL64 Symbol
;
554 DWORD SelectedSymbol
;
555 } IMAGEHLP_DUPLICATE_SYMBOL64
,*PIMAGEHLP_DUPLICATE_SYMBOL64
;
558 #define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64
559 #define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64
561 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
{
564 PIMAGEHLP_SYMBOL Symbol
;
565 DWORD SelectedSymbol
;
566 } IMAGEHLP_DUPLICATE_SYMBOL
,*PIMAGEHLP_DUPLICATE_SYMBOL
;
569 BOOL IMAGEAPI
SymSetParentWindow(HWND hwnd
);
570 PCHAR IMAGEAPI
SymSetHomeDirectory(PCSTR dir
);
571 PCHAR IMAGEAPI
SymGetHomeDirectory(DWORD type
,PSTR dir
,size_t size
);
574 hdBase
= 0,hdSym
,hdSrc
,hdMax
577 #define SYMOPT_CASE_INSENSITIVE 0x00000001
578 #define SYMOPT_UNDNAME 0x00000002
579 #define SYMOPT_DEFERRED_LOADS 0x00000004
580 #define SYMOPT_NO_CPP 0x00000008
581 #define SYMOPT_LOAD_LINES 0x00000010
582 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
583 #define SYMOPT_LOAD_ANYTHING 0x00000040
584 #define SYMOPT_IGNORE_CVREC 0x00000080
585 #define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100
586 #define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200
587 #define SYMOPT_EXACT_SYMBOLS 0x00000400
588 #define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800
589 #define SYMOPT_IGNORE_NT_SYMPATH 0x00001000
590 #define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000
591 #define SYMOPT_PUBLICS_ONLY 0x00004000
592 #define SYMOPT_NO_PUBLICS 0x00008000
593 #define SYMOPT_AUTO_PUBLICS 0x00010000
594 #define SYMOPT_NO_IMAGE_SEARCH 0x00020000
595 #define SYMOPT_SECURE 0x00040000
596 #define SYMOPT_NO_PROMPTS 0x00080000
598 #define SYMOPT_DEBUG 0x80000000
600 DWORD IMAGEAPI
SymSetOptions(DWORD SymOptions
);
601 DWORD IMAGEAPI
SymGetOptions(VOID
);
602 BOOL IMAGEAPI
SymCleanup(HANDLE hProcess
);
603 BOOL IMAGEAPI
SymMatchString(LPSTR string
,LPSTR expression
,BOOL fCase
);
605 typedef BOOL (CALLBACK
*PSYM_ENUMSOURCFILES_CALLBACK
)(PSOURCEFILE pSourceFile
,PVOID UserContext
);
607 BOOL IMAGEAPI
SymEnumSourceFiles(HANDLE hProcess
,ULONG64 ModBase
,LPSTR Mask
,PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles
,PVOID UserContext
);
608 BOOL IMAGEAPI
SymEnumerateModules64(HANDLE hProcess
,PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback
,PVOID UserContext
);
611 #define SymEnumerateModules SymEnumerateModules64
613 BOOL IMAGEAPI
SymEnumerateModules(HANDLE hProcess
,PSYM_ENUMMODULES_CALLBACK EnumModulesCallback
,PVOID UserContext
);
616 BOOL IMAGEAPI
SymEnumerateSymbols64(HANDLE hProcess
,DWORD64 BaseOfDll
,PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback
,PVOID UserContext
);
617 BOOL IMAGEAPI
SymEnumerateSymbolsW64(HANDLE hProcess
,DWORD64 BaseOfDll
,PSYM_ENUMSYMBOLS_CALLBACK64W EnumSymbolsCallback
,PVOID UserContext
);
620 #define SymEnumerateSymbols SymEnumerateSymbols64
621 #define SymEnumerateSymbolsW SymEnumerateSymbolsW64
623 BOOL IMAGEAPI
SymEnumerateSymbols(HANDLE hProcess
,DWORD BaseOfDll
,PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback
,PVOID UserContext
);
624 BOOL IMAGEAPI
SymEnumerateSymbolsW(HANDLE hProcess
,DWORD BaseOfDll
,PSYM_ENUMSYMBOLS_CALLBACKW EnumSymbolsCallback
,PVOID UserContext
);
627 BOOL IMAGEAPI
EnumerateLoadedModules64(HANDLE hProcess
,PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback
,PVOID UserContext
);
629 #define EnumerateLoadedModules EnumerateLoadedModules64
631 BOOL IMAGEAPI
EnumerateLoadedModules(HANDLE hProcess
,PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback
,PVOID UserContext
);
634 PVOID IMAGEAPI
SymFunctionTableAccess64(HANDLE hProcess
,DWORD64 AddrBase
);
637 #define SymFunctionTableAccess SymFunctionTableAccess64
639 PVOID IMAGEAPI
SymFunctionTableAccess(HANDLE hProcess
,DWORD AddrBase
);
642 BOOL IMAGEAPI
SymGetModuleInfo64(HANDLE hProcess
,DWORD64 qwAddr
,PIMAGEHLP_MODULE64 ModuleInfo
);
643 BOOL IMAGEAPI
SymGetModuleInfoW64(HANDLE hProcess
,DWORD64 qwAddr
,PIMAGEHLP_MODULEW64 ModuleInfo
);
646 #define SymGetModuleInfo SymGetModuleInfo64
647 #define SymGetModuleInfoW SymGetModuleInfoW64
649 BOOL IMAGEAPI
SymGetModuleInfo(HANDLE hProcess
,DWORD dwAddr
,PIMAGEHLP_MODULE ModuleInfo
);
650 BOOL IMAGEAPI
SymGetModuleInfoW(HANDLE hProcess
,DWORD dwAddr
,PIMAGEHLP_MODULEW ModuleInfo
);
653 DWORD64 IMAGEAPI
SymGetModuleBase64(HANDLE hProcess
,DWORD64 qwAddr
);
656 #define SymGetModuleBase SymGetModuleBase64
658 DWORD IMAGEAPI
SymGetModuleBase(HANDLE hProcess
,DWORD dwAddr
);
661 BOOL IMAGEAPI
SymGetSymNext64(HANDLE hProcess
,PIMAGEHLP_SYMBOL64 Symbol
);
664 #define SymGetSymNext SymGetSymNext64
666 BOOL IMAGEAPI
SymGetSymNext(HANDLE hProcess
,PIMAGEHLP_SYMBOL Symbol
);
669 BOOL IMAGEAPI
SymGetSymPrev64(HANDLE hProcess
,PIMAGEHLP_SYMBOL64 Symbol
);
672 #define SymGetSymPrev SymGetSymPrev64
674 BOOL IMAGEAPI
SymGetSymPrev(HANDLE hProcess
,PIMAGEHLP_SYMBOL Symbol
);
677 typedef struct _SRCCODEINFO
{
681 CHAR Obj
[MAX_PATH
+ 1];
682 CHAR FileName
[MAX_PATH
+ 1];
685 } SRCCODEINFO
,*PSRCCODEINFO
;
687 typedef BOOL (CALLBACK
*PSYM_ENUMLINES_CALLBACK
)(PSRCCODEINFO LineInfo
,PVOID UserContext
);
689 BOOL IMAGEAPI
SymEnumLines(HANDLE hProcess
,ULONG64 Base
,PCSTR Obj
,PCSTR File
,PSYM_ENUMLINES_CALLBACK EnumLinesCallback
,PVOID UserContext
);
690 BOOL IMAGEAPI
SymGetLineFromAddr64(HANDLE hProcess
,DWORD64 qwAddr
,PDWORD pdwDisplacement
,PIMAGEHLP_LINE64 Line64
);
693 #define SymGetLineFromAddr SymGetLineFromAddr64
695 BOOL IMAGEAPI
SymGetLineFromAddr(HANDLE hProcess
,DWORD dwAddr
,PDWORD pdwDisplacement
,PIMAGEHLP_LINE Line
);
698 BOOL IMAGEAPI
SymGetLineFromName64(HANDLE hProcess
,PSTR ModuleName
,PSTR FileName
,DWORD dwLineNumber
,PLONG plDisplacement
,PIMAGEHLP_LINE64 Line
);
701 #define SymGetLineFromName SymGetLineFromName64
703 BOOL IMAGEAPI
SymGetLineFromName(HANDLE hProcess
,PSTR ModuleName
,PSTR FileName
,DWORD dwLineNumber
,PLONG plDisplacement
,PIMAGEHLP_LINE Line
);
706 BOOL IMAGEAPI
SymGetLineNext64(HANDLE hProcess
,PIMAGEHLP_LINE64 Line
);
709 #define SymGetLineNext SymGetLineNext64
711 BOOL IMAGEAPI
SymGetLineNext(HANDLE hProcess
,PIMAGEHLP_LINE Line
);
714 BOOL IMAGEAPI
SymGetLinePrev64(HANDLE hProcess
,PIMAGEHLP_LINE64 Line
);
717 #define SymGetLinePrev SymGetLinePrev64
719 BOOL IMAGEAPI
SymGetLinePrev(HANDLE hProcess
,PIMAGEHLP_LINE Line
);
722 BOOL IMAGEAPI
SymMatchFileName(PSTR FileName
,PSTR Match
,PSTR
*FileNameStop
,PSTR
*MatchStop
);
723 BOOL IMAGEAPI
SymInitialize(HANDLE hProcess
,PSTR UserSearchPath
,BOOL fInvadeProcess
);
724 BOOL IMAGEAPI
SymGetSearchPath(HANDLE hProcess
,PSTR SearchPath
,DWORD SearchPathLength
);
725 BOOL IMAGEAPI
SymSetSearchPath(HANDLE hProcess
,PSTR SearchPath
);
726 DWORD64 IMAGEAPI
SymLoadModule64(HANDLE hProcess
,HANDLE hFile
,PSTR ImageName
,PSTR ModuleName
,DWORD64 BaseOfDll
,DWORD SizeOfDll
);
728 #define SLMFLAG_VIRTUAL 0x1
730 DWORD64 IMAGEAPI
SymLoadModuleEx(HANDLE hProcess
,HANDLE hFile
,PSTR ImageName
,PSTR ModuleName
,DWORD64 BaseOfDll
,DWORD DllSize
,PMODLOAD_DATA Data
,DWORD Flags
);
733 #define SymLoadModule SymLoadModule64
735 DWORD IMAGEAPI
SymLoadModule(HANDLE hProcess
,HANDLE hFile
,PSTR ImageName
,PSTR ModuleName
,DWORD BaseOfDll
,DWORD SizeOfDll
);
738 BOOL IMAGEAPI
SymUnloadModule64(HANDLE hProcess
,DWORD64 BaseOfDll
);
741 #define SymUnloadModule SymUnloadModule64
743 BOOL IMAGEAPI
SymUnloadModule(HANDLE hProcess
,DWORD BaseOfDll
);
746 BOOL IMAGEAPI
SymUnDName64(PIMAGEHLP_SYMBOL64 sym
,PSTR UnDecName
,DWORD UnDecNameLength
);
749 #define SymUnDName SymUnDName64
751 BOOL IMAGEAPI
SymUnDName(PIMAGEHLP_SYMBOL sym
,PSTR UnDecName
,DWORD UnDecNameLength
);
754 BOOL IMAGEAPI
SymRegisterCallback64(HANDLE hProcess
,PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction
,ULONG64 UserContext
);
756 BOOL IMAGEAPI
SymRegisterFunctionEntryCallback64(HANDLE hProcess
,PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction
,ULONG64 UserContext
);
759 #define SymRegisterCallback SymRegisterCallback64
760 #define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64
762 BOOL IMAGEAPI
SymRegisterCallback(HANDLE hProcess
,PSYMBOL_REGISTERED_CALLBACK CallbackFunction
,PVOID UserContext
);
763 BOOL IMAGEAPI
SymRegisterFunctionEntryCallback(HANDLE hProcess
,PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction
,PVOID UserContext
);
766 typedef struct _IMAGEHLP_SYMBOL_SRC
{
770 } IMAGEHLP_SYMBOL_SRC
,*PIMAGEHLP_SYMBOL_SRC
;
772 typedef struct _MODULE_TYPE_INFO
{
776 } MODULE_TYPE_INFO
,*PMODULE_TYPE_INFO
;
778 typedef struct _SYMBOL_INFO
{
794 } SYMBOL_INFO
,*PSYMBOL_INFO
;
796 typedef struct _SYMBOL_INFO_PACKAGE
{
798 CHAR name
[MAX_SYM_NAME
+ 1];
799 } SYMBOL_INFO_PACKAGE
,*PSYMBOL_INFO_PACKAGE
;
801 typedef struct _IMAGEHLP_STACK_FRAME
803 ULONG64 InstructionOffset
;
804 ULONG64 ReturnOffset
;
807 ULONG64 BackingStoreOffset
;
808 ULONG64 FuncTableEntry
;
813 } IMAGEHLP_STACK_FRAME
,*PIMAGEHLP_STACK_FRAME
;
815 typedef VOID IMAGEHLP_CONTEXT
,*PIMAGEHLP_CONTEXT
;
817 BOOL IMAGEAPI
SymSetContext(HANDLE hProcess
,PIMAGEHLP_STACK_FRAME StackFrame
,PIMAGEHLP_CONTEXT Context
);
818 BOOL IMAGEAPI
SymFromAddr(HANDLE hProcess
,DWORD64 Address
,PDWORD64 Displacement
,PSYMBOL_INFO Symbol
);
819 BOOL IMAGEAPI
SymFromToken(HANDLE hProcess
,DWORD64 Base
,DWORD Token
,PSYMBOL_INFO Symbol
);
820 BOOL IMAGEAPI
SymFromName(HANDLE hProcess
,LPSTR Name
,PSYMBOL_INFO Symbol
);
822 typedef BOOL (CALLBACK
*PSYM_ENUMERATESYMBOLS_CALLBACK
)(PSYMBOL_INFO pSymInfo
,ULONG SymbolSize
,PVOID UserContext
);
824 BOOL IMAGEAPI
SymEnumSymbols(HANDLE hProcess
,ULONG64 BaseOfDll
,PCSTR Mask
,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
,PVOID UserContext
);
825 BOOL IMAGEAPI
SymEnumSymbolsForAddr(HANDLE hProcess
,DWORD64 Address
,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
,PVOID UserContext
);
827 #define SYMENUMFLAG_FULLSRCH 1
828 #define SYMENUMFLAG_SPEEDSRCH 2
830 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
{
831 TI_GET_SYMTAG
,TI_GET_SYMNAME
,TI_GET_LENGTH
,TI_GET_TYPE
,TI_GET_TYPEID
,TI_GET_BASETYPE
,TI_GET_ARRAYINDEXTYPEID
,TI_FINDCHILDREN
,
832 TI_GET_DATAKIND
,TI_GET_ADDRESSOFFSET
,TI_GET_OFFSET
,TI_GET_VALUE
,TI_GET_COUNT
,TI_GET_CHILDRENCOUNT
,TI_GET_BITPOSITION
,TI_GET_VIRTUALBASECLASS
,
833 TI_GET_VIRTUALTABLESHAPEID
,TI_GET_VIRTUALBASEPOINTEROFFSET
,TI_GET_CLASSPARENTID
,TI_GET_NESTED
,TI_GET_SYMINDEX
,TI_GET_LEXICALPARENT
,
834 TI_GET_ADDRESS
,TI_GET_THISADJUST
,TI_GET_UDTKIND
,TI_IS_EQUIV_TO
,TI_GET_CALLING_CONVENTION
835 } IMAGEHLP_SYMBOL_TYPE_INFO
;
837 typedef struct _TI_FINDCHILDREN_PARAMS
{
841 } TI_FINDCHILDREN_PARAMS
;
843 BOOL IMAGEAPI
SymGetTypeInfo(HANDLE hProcess
,DWORD64 ModBase
,ULONG TypeId
,IMAGEHLP_SYMBOL_TYPE_INFO GetType
,PVOID pInfo
);
844 BOOL IMAGEAPI
SymEnumTypes(HANDLE hProcess
,ULONG64 BaseOfDll
,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
,PVOID UserContext
);
845 BOOL IMAGEAPI
SymGetTypeFromName(HANDLE hProcess
,ULONG64 BaseOfDll
,LPSTR Name
,PSYMBOL_INFO Symbol
);
846 BOOL IMAGEAPI
SymAddSymbol(HANDLE hProcess
,ULONG64 BaseOfDll
,PCSTR Name
,DWORD64 Address
,DWORD Size
,DWORD Flags
);
847 BOOL IMAGEAPI
SymDeleteSymbol(HANDLE hProcess
,ULONG64 BaseOfDll
,PCSTR Name
,DWORD64 Address
,DWORD Flags
);
849 typedef BOOL (WINAPI
*PDBGHELP_CREATE_USER_DUMP_CALLBACK
)(DWORD DataType
,PVOID
*Data
,LPDWORD DataLength
,PVOID UserData
);
851 BOOL WINAPI
DbgHelpCreateUserDump(LPSTR FileName
,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback
,PVOID UserData
);
852 BOOL WINAPI
DbgHelpCreateUserDumpW(LPWSTR FileName
,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback
,PVOID UserData
);
853 BOOL IMAGEAPI
SymGetSymFromAddr64(HANDLE hProcess
,DWORD64 qwAddr
,PDWORD64 pdwDisplacement
,PIMAGEHLP_SYMBOL64 Symbol
);
856 #define SymGetSymFromAddr SymGetSymFromAddr64
858 BOOL IMAGEAPI
SymGetSymFromAddr(HANDLE hProcess
,DWORD dwAddr
,PDWORD pdwDisplacement
,PIMAGEHLP_SYMBOL Symbol
);
861 BOOL IMAGEAPI
SymGetSymFromName64(HANDLE hProcess
,PSTR Name
,PIMAGEHLP_SYMBOL64 Symbol
);
864 #define SymGetSymFromName SymGetSymFromName64
866 BOOL IMAGEAPI
SymGetSymFromName(HANDLE hProcess
,PSTR Name
,PIMAGEHLP_SYMBOL Symbol
);
869 DBHLP_DEPRECIATED BOOL IMAGEAPI
FindFileInPath(HANDLE hprocess
,LPSTR SearchPath
,LPSTR FileName
,PVOID id
,DWORD two
,DWORD three
,DWORD flags
,LPSTR FilePath
);
870 DBHLP_DEPRECIATED BOOL IMAGEAPI
FindFileInSearchPath(HANDLE hprocess
,LPSTR SearchPath
,LPSTR FileName
,DWORD one
,DWORD two
,DWORD three
,LPSTR FilePath
);
871 DBHLP_DEPRECIATED BOOL IMAGEAPI
SymEnumSym(HANDLE hProcess
,ULONG64 BaseOfDll
,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
,PVOID UserContext
);
873 #define SYMF_OMAP_GENERATED 0x00000001
874 #define SYMF_OMAP_MODIFIED 0x00000002
875 #define SYMF_REGISTER 0x00000008
876 #define SYMF_REGREL 0x00000010
877 #define SYMF_FRAMEREL 0x00000020
878 #define SYMF_PARAMETER 0x00000040
879 #define SYMF_LOCAL 0x00000080
880 #define SYMF_CONSTANT 0x00000100
881 #define SYMF_EXPORT 0x00000200
882 #define SYMF_FORWARDER 0x00000400
883 #define SYMF_FUNCTION 0x00000800
884 #define SYMF_VIRTUAL 0x00001000
885 #define SYMF_THUNK 0x00002000
886 #define SYMF_TLSREL 0x00004000
888 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
889 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER
890 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL
891 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL
892 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER
893 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL
894 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT
895 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION
896 #define IMAGEHLP_SYMBOL_VIRTUAL SYMF_VIRTUAL
897 #define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK
898 #define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL
900 #include <pshpack4.h>
902 #define MINIDUMP_SIGNATURE ('PMDM')
903 #define MINIDUMP_VERSION (42899)
905 typedef ULONG64 RVA64
;
907 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR
{
910 } MINIDUMP_LOCATION_DESCRIPTOR
;
912 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64
{
915 } MINIDUMP_LOCATION_DESCRIPTOR64
;
917 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR
{
918 ULONG64 StartOfMemoryRange
;
919 MINIDUMP_LOCATION_DESCRIPTOR Memory
;
920 } MINIDUMP_MEMORY_DESCRIPTOR
,*PMINIDUMP_MEMORY_DESCRIPTOR
;
922 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64
{
923 ULONG64 StartOfMemoryRange
;
925 } MINIDUMP_MEMORY_DESCRIPTOR64
,*PMINIDUMP_MEMORY_DESCRIPTOR64
;
927 typedef struct _MINIDUMP_HEADER
{
930 ULONG32 NumberOfStreams
;
931 RVA StreamDirectoryRva
;
935 ULONG32 TimeDateStamp
;
938 } MINIDUMP_HEADER
,*PMINIDUMP_HEADER
;
940 typedef struct _MINIDUMP_DIRECTORY
{
942 MINIDUMP_LOCATION_DESCRIPTOR Location
;
943 } MINIDUMP_DIRECTORY
,*PMINIDUMP_DIRECTORY
;
945 typedef struct _MINIDUMP_STRING
{
948 } MINIDUMP_STRING
,*PMINIDUMP_STRING
;
950 typedef enum _MINIDUMP_STREAM_TYPE
{
951 UnusedStream
= 0,ReservedStream0
= 1,ReservedStream1
= 2,ThreadListStream
= 3,ModuleListStream
= 4,MemoryListStream
= 5,
952 ExceptionStream
= 6,SystemInfoStream
= 7,ThreadExListStream
= 8,Memory64ListStream
= 9,CommentStreamA
= 10,CommentStreamW
= 11,
953 HandleDataStream
= 12,FunctionTableStream
= 13,UnloadedModuleListStream
= 14,MiscInfoStream
= 15,LastReservedStream
= 0xffff
954 } MINIDUMP_STREAM_TYPE
;
956 typedef union _CPU_INFORMATION
{
958 ULONG32 VendorId
[3 ];
959 ULONG32 VersionInformation
;
960 ULONG32 FeatureInformation
;
961 ULONG32 AMDExtendedCpuFeatures
;
964 ULONG64 ProcessorFeatures
[2 ];
966 } CPU_INFORMATION
,*PCPU_INFORMATION
;
968 typedef struct _MINIDUMP_SYSTEM_INFO
{
969 USHORT ProcessorArchitecture
;
970 USHORT ProcessorLevel
;
971 USHORT ProcessorRevision
;
975 UCHAR NumberOfProcessors
;
979 ULONG32 MajorVersion
;
980 ULONG32 MinorVersion
;
992 } MINIDUMP_SYSTEM_INFO
,*PMINIDUMP_SYSTEM_INFO
;
994 C_ASSERT (sizeof (((PPROCESS_INFORMATION
)0)->dwThreadId
)==4);
996 typedef struct _MINIDUMP_THREAD
{
998 ULONG32 SuspendCount
;
999 ULONG32 PriorityClass
;
1002 MINIDUMP_MEMORY_DESCRIPTOR Stack
;
1003 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext
;
1004 } MINIDUMP_THREAD
,*PMINIDUMP_THREAD
;
1006 typedef struct _MINIDUMP_THREAD_LIST
{
1007 ULONG32 NumberOfThreads
;
1008 MINIDUMP_THREAD Threads
[0];
1009 } MINIDUMP_THREAD_LIST
,*PMINIDUMP_THREAD_LIST
;
1011 typedef struct _MINIDUMP_THREAD_EX
{
1013 ULONG32 SuspendCount
;
1014 ULONG32 PriorityClass
;
1017 MINIDUMP_MEMORY_DESCRIPTOR Stack
;
1018 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext
;
1019 MINIDUMP_MEMORY_DESCRIPTOR BackingStore
;
1020 } MINIDUMP_THREAD_EX
,*PMINIDUMP_THREAD_EX
;
1022 typedef struct _MINIDUMP_THREAD_EX_LIST
{
1023 ULONG32 NumberOfThreads
;
1024 MINIDUMP_THREAD_EX Threads
[0];
1025 } MINIDUMP_THREAD_EX_LIST
,*PMINIDUMP_THREAD_EX_LIST
;
1027 typedef struct _MINIDUMP_EXCEPTION
{
1028 ULONG32 ExceptionCode
;
1029 ULONG32 ExceptionFlags
;
1030 ULONG64 ExceptionRecord
;
1031 ULONG64 ExceptionAddress
;
1032 ULONG32 NumberParameters
;
1033 ULONG32 __unusedAlignment
;
1034 ULONG64 ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
1035 } MINIDUMP_EXCEPTION
,*PMINIDUMP_EXCEPTION
;
1037 typedef struct MINIDUMP_EXCEPTION_STREAM
{
1039 ULONG32 __alignment
;
1040 MINIDUMP_EXCEPTION ExceptionRecord
;
1041 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext
;
1042 } MINIDUMP_EXCEPTION_STREAM
,*PMINIDUMP_EXCEPTION_STREAM
;
1044 typedef struct _MINIDUMP_MODULE
{
1045 ULONG64 BaseOfImage
;
1046 ULONG32 SizeOfImage
;
1048 ULONG32 TimeDateStamp
;
1050 VS_FIXEDFILEINFO VersionInfo
;
1051 MINIDUMP_LOCATION_DESCRIPTOR CvRecord
;
1052 MINIDUMP_LOCATION_DESCRIPTOR MiscRecord
;
1055 } MINIDUMP_MODULE
,*PMINIDUMP_MODULE
;
1057 typedef struct _MINIDUMP_MODULE_LIST
{
1058 ULONG32 NumberOfModules
;
1059 MINIDUMP_MODULE Modules
[0 ];
1060 } MINIDUMP_MODULE_LIST
,*PMINIDUMP_MODULE_LIST
;
1062 typedef struct _MINIDUMP_MEMORY_LIST
{
1063 ULONG32 NumberOfMemoryRanges
;
1064 MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges
[0];
1065 } MINIDUMP_MEMORY_LIST
,*PMINIDUMP_MEMORY_LIST
;
1067 typedef struct _MINIDUMP_MEMORY64_LIST
{
1068 ULONG64 NumberOfMemoryRanges
;
1070 MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges
[0];
1071 } MINIDUMP_MEMORY64_LIST
,*PMINIDUMP_MEMORY64_LIST
;
1073 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
{
1075 PEXCEPTION_POINTERS ExceptionPointers
;
1076 BOOL ClientPointers
;
1077 } MINIDUMP_EXCEPTION_INFORMATION
,*PMINIDUMP_EXCEPTION_INFORMATION
;
1079 typedef struct _MINIDUMP_EXCEPTION_INFORMATION64
{
1081 ULONG64 ExceptionRecord
;
1082 ULONG64 ContextRecord
;
1083 BOOL ClientPointers
;
1084 } MINIDUMP_EXCEPTION_INFORMATION64
,*PMINIDUMP_EXCEPTION_INFORMATION64
;
1086 typedef struct _MINIDUMP_HANDLE_DESCRIPTOR
{
1091 ULONG32 GrantedAccess
;
1092 ULONG32 HandleCount
;
1093 ULONG32 PointerCount
;
1094 } MINIDUMP_HANDLE_DESCRIPTOR
,*PMINIDUMP_HANDLE_DESCRIPTOR
;
1096 typedef struct _MINIDUMP_HANDLE_DATA_STREAM
{
1097 ULONG32 SizeOfHeader
;
1098 ULONG32 SizeOfDescriptor
;
1099 ULONG32 NumberOfDescriptors
;
1101 } MINIDUMP_HANDLE_DATA_STREAM
,*PMINIDUMP_HANDLE_DATA_STREAM
;
1103 typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR
{
1104 ULONG64 MinimumAddress
;
1105 ULONG64 MaximumAddress
;
1106 ULONG64 BaseAddress
;
1108 ULONG32 SizeOfAlignPad
;
1109 } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR
,*PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR
;
1111 typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM
{
1112 ULONG32 SizeOfHeader
;
1113 ULONG32 SizeOfDescriptor
;
1114 ULONG32 SizeOfNativeDescriptor
;
1115 ULONG32 SizeOfFunctionEntry
;
1116 ULONG32 NumberOfDescriptors
;
1117 ULONG32 SizeOfAlignPad
;
1118 } MINIDUMP_FUNCTION_TABLE_STREAM
,*PMINIDUMP_FUNCTION_TABLE_STREAM
;
1120 typedef struct _MINIDUMP_UNLOADED_MODULE
{
1121 ULONG64 BaseOfImage
;
1122 ULONG32 SizeOfImage
;
1124 ULONG32 TimeDateStamp
;
1126 } MINIDUMP_UNLOADED_MODULE
,*PMINIDUMP_UNLOADED_MODULE
;
1128 typedef struct _MINIDUMP_UNLOADED_MODULE_LIST
{
1129 ULONG32 SizeOfHeader
;
1130 ULONG32 SizeOfEntry
;
1131 ULONG32 NumberOfEntries
;
1132 } MINIDUMP_UNLOADED_MODULE_LIST
,*PMINIDUMP_UNLOADED_MODULE_LIST
;
1134 #define MINIDUMP_MISC1_PROCESS_ID 0x00000001
1135 #define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002
1137 typedef struct _MINIDUMP_MISC_INFO
{
1141 ULONG32 ProcessCreateTime
;
1142 ULONG32 ProcessUserTime
;
1143 ULONG32 ProcessKernelTime
;
1144 } MINIDUMP_MISC_INFO
,*PMINIDUMP_MISC_INFO
;
1146 typedef struct _MINIDUMP_USER_RECORD
{
1148 MINIDUMP_LOCATION_DESCRIPTOR Memory
;
1149 } MINIDUMP_USER_RECORD
,*PMINIDUMP_USER_RECORD
;
1151 typedef struct _MINIDUMP_USER_STREAM
{
1155 } MINIDUMP_USER_STREAM
,*PMINIDUMP_USER_STREAM
;
1157 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
{
1158 ULONG UserStreamCount
;
1159 PMINIDUMP_USER_STREAM UserStreamArray
;
1160 } MINIDUMP_USER_STREAM_INFORMATION
,*PMINIDUMP_USER_STREAM_INFORMATION
;
1162 typedef enum _MINIDUMP_CALLBACK_TYPE
{
1163 ModuleCallback
,ThreadCallback
,ThreadExCallback
,IncludeThreadCallback
,IncludeModuleCallback
,MemoryCallback
1164 } MINIDUMP_CALLBACK_TYPE
;
1166 typedef struct _MINIDUMP_THREAD_CALLBACK
{
1168 HANDLE ThreadHandle
;
1170 ULONG SizeOfContext
;
1173 } MINIDUMP_THREAD_CALLBACK
,*PMINIDUMP_THREAD_CALLBACK
;
1175 typedef struct _MINIDUMP_THREAD_EX_CALLBACK
{
1177 HANDLE ThreadHandle
;
1179 ULONG SizeOfContext
;
1182 ULONG64 BackingStoreBase
;
1183 ULONG64 BackingStoreEnd
;
1184 } MINIDUMP_THREAD_EX_CALLBACK
,*PMINIDUMP_THREAD_EX_CALLBACK
;
1186 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
{
1188 } MINIDUMP_INCLUDE_THREAD_CALLBACK
,*PMINIDUMP_INCLUDE_THREAD_CALLBACK
;
1190 typedef enum _THREAD_WRITE_FLAGS
{
1191 ThreadWriteThread
= 0x0001,ThreadWriteStack
= 0x0002,ThreadWriteContext
= 0x0004,ThreadWriteBackingStore
= 0x0008,
1192 ThreadWriteInstructionWindow
= 0x0010,ThreadWriteThreadData
= 0x0020
1193 } THREAD_WRITE_FLAGS
;
1195 typedef struct _MINIDUMP_MODULE_CALLBACK
{
1197 ULONG64 BaseOfImage
;
1200 ULONG TimeDateStamp
;
1201 VS_FIXEDFILEINFO VersionInfo
;
1203 ULONG SizeOfCvRecord
;
1205 ULONG SizeOfMiscRecord
;
1206 } MINIDUMP_MODULE_CALLBACK
,*PMINIDUMP_MODULE_CALLBACK
;
1208 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK
{
1209 ULONG64 BaseOfImage
;
1210 } MINIDUMP_INCLUDE_MODULE_CALLBACK
,*PMINIDUMP_INCLUDE_MODULE_CALLBACK
;
1212 typedef enum _MODULE_WRITE_FLAGS
{
1213 ModuleWriteModule
= 0x0001,ModuleWriteDataSeg
= 0x0002,ModuleWriteMiscRecord
= 0x0004,ModuleWriteCvRecord
= 0x0008,
1214 ModuleReferencedByMemory
= 0x0010
1215 } MODULE_WRITE_FLAGS
;
1217 typedef struct _MINIDUMP_CALLBACK_INPUT
{
1219 HANDLE ProcessHandle
;
1222 MINIDUMP_THREAD_CALLBACK Thread
;
1223 MINIDUMP_THREAD_EX_CALLBACK ThreadEx
;
1224 MINIDUMP_MODULE_CALLBACK Module
;
1225 MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread
;
1226 MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule
;
1228 } MINIDUMP_CALLBACK_INPUT
,*PMINIDUMP_CALLBACK_INPUT
;
1230 typedef struct _MINIDUMP_CALLBACK_OUTPUT
{
1232 ULONG ModuleWriteFlags
;
1233 ULONG ThreadWriteFlags
;
1239 } MINIDUMP_CALLBACK_OUTPUT
,*PMINIDUMP_CALLBACK_OUTPUT
;
1241 typedef enum _MINIDUMP_TYPE
{
1242 MiniDumpNormal
= 0x0000,MiniDumpWithDataSegs
= 0x0001,MiniDumpWithFullMemory
= 0x0002,MiniDumpWithHandleData
= 0x0004,
1243 MiniDumpFilterMemory
= 0x0008,MiniDumpScanMemory
= 0x0010,MiniDumpWithUnloadedModules
= 0x0020,MiniDumpWithIndirectlyReferencedMemory
= 0x0040,
1244 MiniDumpFilterModulePaths
= 0x0080,MiniDumpWithProcessThreadData
= 0x0100,MiniDumpWithPrivateReadWriteMemory
= 0x0200,
1245 MiniDumpWithoutOptionalData
= 0x0400
1248 typedef BOOL (WINAPI
*MINIDUMP_CALLBACK_ROUTINE
)(PVOID CallbackParam
,CONST PMINIDUMP_CALLBACK_INPUT CallbackInput
,PMINIDUMP_CALLBACK_OUTPUT CallbackOutput
);
1250 typedef struct _MINIDUMP_CALLBACK_INFORMATION
{
1251 MINIDUMP_CALLBACK_ROUTINE CallbackRoutine
;
1252 PVOID CallbackParam
;
1253 } MINIDUMP_CALLBACK_INFORMATION
,*PMINIDUMP_CALLBACK_INFORMATION
;
1255 #define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva)))
1257 BOOL WINAPI
MiniDumpWriteDump(HANDLE hProcess
,DWORD ProcessId
,HANDLE hFile
,MINIDUMP_TYPE DumpType
,CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam
,CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam
,CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam
);
1258 BOOL WINAPI
MiniDumpReadDumpStream(PVOID BaseOfDump
,ULONG StreamNumber
,PMINIDUMP_DIRECTORY
*Dir
,PVOID
*StreamPointer
,ULONG
*StreamSize
);
1260 #include <poppack.h>