1848b8605Smrg/** 2848b8605Smrg * This file has no copyright assigned and is placed in the Public Domain. 3848b8605Smrg * This file is part of the w64 mingw-runtime package. 4848b8605Smrg * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5848b8605Smrg */ 6848b8605Smrg#ifndef _DBGHELP_ 7848b8605Smrg#define _DBGHELP_ 8848b8605Smrg 9848b8605Smrg#ifdef _WIN64 10848b8605Smrg#ifndef _IMAGEHLP64 11848b8605Smrg#define _IMAGEHLP64 12848b8605Smrg#endif 13848b8605Smrg#endif 14848b8605Smrg 15848b8605Smrg#ifdef __cplusplus 16848b8605Smrgextern "C" { 17848b8605Smrg#endif 18848b8605Smrg 19848b8605Smrg#define IMAGEAPI DECLSPEC_IMPORT WINAPI 20848b8605Smrg#define DBHLP_DEPRECIATED __declspec(deprecated) 21848b8605Smrg 22848b8605Smrg#define DBHLPAPI IMAGEAPI 23848b8605Smrg 24848b8605Smrg#define IMAGE_SEPARATION (64*1024) 25848b8605Smrg 26848b8605Smrg typedef struct _LOADED_IMAGE { 27848b8605Smrg PSTR ModuleName; 28848b8605Smrg HANDLE hFile; 29848b8605Smrg PUCHAR MappedAddress; 30848b8605Smrg#ifdef _IMAGEHLP64 31848b8605Smrg PIMAGE_NT_HEADERS64 FileHeader; 32848b8605Smrg#else 33848b8605Smrg PIMAGE_NT_HEADERS32 FileHeader; 34848b8605Smrg#endif 35848b8605Smrg PIMAGE_SECTION_HEADER LastRvaSection; 36848b8605Smrg ULONG NumberOfSections; 37848b8605Smrg PIMAGE_SECTION_HEADER Sections; 38848b8605Smrg ULONG Characteristics; 39848b8605Smrg BOOLEAN fSystemImage; 40848b8605Smrg BOOLEAN fDOSImage; 41848b8605Smrg LIST_ENTRY Links; 42848b8605Smrg ULONG SizeOfImage; 43848b8605Smrg } LOADED_IMAGE,*PLOADED_IMAGE; 44848b8605Smrg 45848b8605Smrg#define MAX_SYM_NAME 2000 46848b8605Smrg 47848b8605Smrg typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); 48848b8605Smrg typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename,PVOID context); 49848b8605Smrg typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); 50848b8605Smrg 51848b8605Smrg typedef BOOL (WINAPI *PSYMBOLSERVERPROC)(LPCSTR,LPCSTR,PVOID,DWORD,DWORD,LPSTR); 52848b8605Smrg typedef BOOL (WINAPI *PSYMBOLSERVEROPENPROC)(VOID); 53848b8605Smrg typedef BOOL (WINAPI *PSYMBOLSERVERCLOSEPROC)(VOID); 54848b8605Smrg typedef BOOL (WINAPI *PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR,ULONG64); 55848b8605Smrg typedef BOOL (CALLBACK WINAPI *PSYMBOLSERVERCALLBACKPROC)(UINT_PTR action,ULONG64 data,ULONG64 context); 56848b8605Smrg typedef UINT_PTR (WINAPI *PSYMBOLSERVERGETOPTIONSPROC)(); 57848b8605Smrg typedef BOOL (WINAPI *PSYMBOLSERVERPINGPROC)(LPCSTR); 58848b8605Smrg 59848b8605Smrg HANDLE IMAGEAPI FindDebugInfoFile(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath); 60848b8605Smrg HANDLE IMAGEAPI FindDebugInfoFileEx(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath,PFIND_DEBUG_FILE_CALLBACK Callback,PVOID CallerData); 61848b8605Smrg BOOL IMAGEAPI SymFindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FoundFile,PFINDFILEINPATHCALLBACK callback,PVOID context); 62848b8605Smrg HANDLE IMAGEAPI FindExecutableImage(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath); 63848b8605Smrg HANDLE IMAGEAPI FindExecutableImageEx(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath,PFIND_EXE_FILE_CALLBACK Callback,PVOID CallerData); 64848b8605Smrg PIMAGE_NT_HEADERS IMAGEAPI ImageNtHeader(PVOID Base); 65848b8605Smrg PVOID IMAGEAPI ImageDirectoryEntryToDataEx(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size,PIMAGE_SECTION_HEADER *FoundHeader); 66848b8605Smrg PVOID IMAGEAPI ImageDirectoryEntryToData(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size); 67848b8605Smrg PIMAGE_SECTION_HEADER IMAGEAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva); 68848b8605Smrg PVOID IMAGEAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva,PIMAGE_SECTION_HEADER *LastRvaSection); 69848b8605Smrg 70848b8605Smrg#define SSRVOPT_CALLBACK 0x0001 71848b8605Smrg#define SSRVOPT_DWORD 0x0002 72848b8605Smrg#define SSRVOPT_DWORDPTR 0x0004 73848b8605Smrg#define SSRVOPT_GUIDPTR 0x0008 74848b8605Smrg#define SSRVOPT_OLDGUIDPTR 0x0010 75848b8605Smrg#define SSRVOPT_UNATTENDED 0x0020 76848b8605Smrg#define SSRVOPT_NOCOPY 0x0040 77848b8605Smrg#define SSRVOPT_PARENTWIN 0x0080 78848b8605Smrg#define SSRVOPT_PARAMTYPE 0x0100 79848b8605Smrg#define SSRVOPT_SECURE 0x0200 80848b8605Smrg#define SSRVOPT_TRACE 0x0400 81848b8605Smrg#define SSRVOPT_SETCONTEXT 0x0800 82848b8605Smrg#define SSRVOPT_PROXY 0x1000 83848b8605Smrg#define SSRVOPT_DOWNSTREAM_STORE 0x2000 84848b8605Smrg#define SSRVOPT_RESET ((ULONG_PTR)-1) 85848b8605Smrg 86848b8605Smrg#define SSRVACTION_TRACE 1 87848b8605Smrg#define SSRVACTION_QUERYCANCEL 2 88848b8605Smrg#define SSRVACTION_EVENT 3 89848b8605Smrg 90848b8605Smrg#ifndef _WIN64 91848b8605Smrg 92848b8605Smrg typedef struct _IMAGE_DEBUG_INFORMATION { 93848b8605Smrg LIST_ENTRY List; 94848b8605Smrg DWORD ReservedSize; 95848b8605Smrg PVOID ReservedMappedBase; 96848b8605Smrg USHORT ReservedMachine; 97848b8605Smrg USHORT ReservedCharacteristics; 98848b8605Smrg DWORD ReservedCheckSum; 99848b8605Smrg DWORD ImageBase; 100848b8605Smrg DWORD SizeOfImage; 101848b8605Smrg DWORD ReservedNumberOfSections; 102848b8605Smrg PIMAGE_SECTION_HEADER ReservedSections; 103848b8605Smrg DWORD ReservedExportedNamesSize; 104848b8605Smrg PSTR ReservedExportedNames; 105848b8605Smrg DWORD ReservedNumberOfFunctionTableEntries; 106848b8605Smrg PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries; 107848b8605Smrg DWORD ReservedLowestFunctionStartingAddress; 108848b8605Smrg DWORD ReservedHighestFunctionEndingAddress; 109848b8605Smrg DWORD ReservedNumberOfFpoTableEntries; 110848b8605Smrg PFPO_DATA ReservedFpoTableEntries; 111848b8605Smrg DWORD SizeOfCoffSymbols; 112848b8605Smrg PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols; 113848b8605Smrg DWORD ReservedSizeOfCodeViewSymbols; 114848b8605Smrg PVOID ReservedCodeViewSymbols; 115848b8605Smrg PSTR ImageFilePath; 116848b8605Smrg PSTR ImageFileName; 117848b8605Smrg PSTR ReservedDebugFilePath; 118848b8605Smrg DWORD ReservedTimeDateStamp; 119848b8605Smrg BOOL ReservedRomImage; 120848b8605Smrg PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory; 121848b8605Smrg DWORD ReservedNumberOfDebugDirectories; 122848b8605Smrg DWORD ReservedOriginalFunctionTableBaseAddress; 123848b8605Smrg DWORD Reserved[2 ]; 124848b8605Smrg } IMAGE_DEBUG_INFORMATION,*PIMAGE_DEBUG_INFORMATION; 125848b8605Smrg 126848b8605Smrg PIMAGE_DEBUG_INFORMATION IMAGEAPI MapDebugInformation(HANDLE FileHandle,PSTR FileName,PSTR SymbolPath,DWORD ImageBase); 127848b8605Smrg BOOL IMAGEAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo); 128848b8605Smrg#endif 129848b8605Smrg 130848b8605Smrg typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR FilePath,PVOID CallerData); 131848b8605Smrg 132848b8605Smrg BOOL IMAGEAPI SearchTreeForFile(PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer); 133848b8605Smrg BOOL IMAGEAPI EnumDirTree(HANDLE hProcess,PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer,PENUMDIRTREE_CALLBACK Callback,PVOID CallbackData); 134848b8605Smrg BOOL IMAGEAPI MakeSureDirectoryPathExists(PCSTR DirPath); 135848b8605Smrg 136848b8605Smrg#define UNDNAME_COMPLETE (0x0000) 137848b8605Smrg#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) 138848b8605Smrg#define UNDNAME_NO_MS_KEYWORDS (0x0002) 139848b8605Smrg#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) 140848b8605Smrg#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) 141848b8605Smrg#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) 142848b8605Smrg#define UNDNAME_NO_MS_THISTYPE (0x0020) 143848b8605Smrg#define UNDNAME_NO_CV_THISTYPE (0x0040) 144848b8605Smrg#define UNDNAME_NO_THISTYPE (0x0060) 145848b8605Smrg#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) 146848b8605Smrg#define UNDNAME_NO_THROW_SIGNATURES (0x0100) 147848b8605Smrg#define UNDNAME_NO_MEMBER_TYPE (0x0200) 148848b8605Smrg#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) 149848b8605Smrg#define UNDNAME_32_BIT_DECODE (0x0800) 150848b8605Smrg#define UNDNAME_NAME_ONLY (0x1000) 151848b8605Smrg#define UNDNAME_NO_ARGUMENTS (0x2000) 152848b8605Smrg#define UNDNAME_NO_SPECIAL_SYMS (0x4000) 153848b8605Smrg 154848b8605Smrg DWORD IMAGEAPI WINAPI UnDecorateSymbolName(PCSTR DecoratedName,PSTR UnDecoratedName,DWORD UndecoratedLength,DWORD Flags); 155848b8605Smrg 156848b8605Smrg#define DBHHEADER_DEBUGDIRS 0x1 157848b8605Smrg 158848b8605Smrg typedef struct _MODLOAD_DATA { 159848b8605Smrg DWORD ssize; 160848b8605Smrg DWORD ssig; 161848b8605Smrg PVOID data; 162848b8605Smrg DWORD size; 163848b8605Smrg DWORD flags; 164848b8605Smrg } MODLOAD_DATA,*PMODLOAD_DATA; 165848b8605Smrg 166848b8605Smrg typedef enum { 167848b8605Smrg AddrMode1616,AddrMode1632,AddrModeReal,AddrModeFlat 168848b8605Smrg } ADDRESS_MODE; 169848b8605Smrg 170848b8605Smrg typedef struct _tagADDRESS64 { 171848b8605Smrg DWORD64 Offset; 172848b8605Smrg WORD Segment; 173848b8605Smrg ADDRESS_MODE Mode; 174848b8605Smrg } ADDRESS64,*LPADDRESS64; 175848b8605Smrg 176848b8605Smrg#ifdef _IMAGEHLP64 177848b8605Smrg#define ADDRESS ADDRESS64 178848b8605Smrg#define LPADDRESS LPADDRESS64 179848b8605Smrg#else 180848b8605Smrg typedef struct _tagADDRESS { 181848b8605Smrg DWORD Offset; 182848b8605Smrg WORD Segment; 183848b8605Smrg ADDRESS_MODE Mode; 184848b8605Smrg } ADDRESS,*LPADDRESS; 185848b8605Smrg 186848b8605Smrg static __inline void Address32To64(LPADDRESS a32,LPADDRESS64 a64) { 187848b8605Smrg a64->Offset = (ULONG64)(LONG64)(LONG)a32->Offset; 188848b8605Smrg a64->Segment = a32->Segment; 189848b8605Smrg a64->Mode = a32->Mode; 190848b8605Smrg } 191848b8605Smrg 192848b8605Smrg static __inline void Address64To32(LPADDRESS64 a64,LPADDRESS a32) { 193848b8605Smrg a32->Offset = (ULONG)a64->Offset; 194848b8605Smrg a32->Segment = a64->Segment; 195848b8605Smrg a32->Mode = a64->Mode; 196848b8605Smrg } 197848b8605Smrg#endif 198848b8605Smrg 199848b8605Smrg typedef struct _KDHELP64 { 200848b8605Smrg DWORD64 Thread; 201848b8605Smrg DWORD ThCallbackStack; 202848b8605Smrg DWORD ThCallbackBStore; 203848b8605Smrg DWORD NextCallback; 204848b8605Smrg DWORD FramePointer; 205848b8605Smrg DWORD64 KiCallUserMode; 206848b8605Smrg DWORD64 KeUserCallbackDispatcher; 207848b8605Smrg DWORD64 SystemRangeStart; 208848b8605Smrg DWORD64 Reserved[8]; 209848b8605Smrg } KDHELP64,*PKDHELP64; 210848b8605Smrg 211848b8605Smrg#ifdef _IMAGEHLP64 212848b8605Smrg#define KDHELP KDHELP64 213848b8605Smrg#define PKDHELP PKDHELP64 214848b8605Smrg#else 215848b8605Smrg typedef struct _KDHELP { 216848b8605Smrg DWORD Thread; 217848b8605Smrg DWORD ThCallbackStack; 218848b8605Smrg DWORD NextCallback; 219848b8605Smrg DWORD FramePointer; 220848b8605Smrg DWORD KiCallUserMode; 221848b8605Smrg DWORD KeUserCallbackDispatcher; 222848b8605Smrg DWORD SystemRangeStart; 223848b8605Smrg DWORD ThCallbackBStore; 224848b8605Smrg DWORD Reserved[8]; 225848b8605Smrg } KDHELP,*PKDHELP; 226848b8605Smrg 227848b8605Smrg static __inline void KdHelp32To64(PKDHELP p32,PKDHELP64 p64) { 228848b8605Smrg p64->Thread = p32->Thread; 229848b8605Smrg p64->ThCallbackStack = p32->ThCallbackStack; 230848b8605Smrg p64->NextCallback = p32->NextCallback; 231848b8605Smrg p64->FramePointer = p32->FramePointer; 232848b8605Smrg p64->KiCallUserMode = p32->KiCallUserMode; 233848b8605Smrg p64->KeUserCallbackDispatcher = p32->KeUserCallbackDispatcher; 234848b8605Smrg p64->SystemRangeStart = p32->SystemRangeStart; 235848b8605Smrg } 236848b8605Smrg#endif 237848b8605Smrg 238848b8605Smrg typedef struct _tagSTACKFRAME64 { 239848b8605Smrg ADDRESS64 AddrPC; 240848b8605Smrg ADDRESS64 AddrReturn; 241848b8605Smrg ADDRESS64 AddrFrame; 242848b8605Smrg ADDRESS64 AddrStack; 243848b8605Smrg ADDRESS64 AddrBStore; 244848b8605Smrg PVOID FuncTableEntry; 245848b8605Smrg DWORD64 Params[4]; 246848b8605Smrg BOOL Far; 247848b8605Smrg BOOL Virtual; 248848b8605Smrg DWORD64 Reserved[3]; 249848b8605Smrg KDHELP64 KdHelp; 250848b8605Smrg } STACKFRAME64,*LPSTACKFRAME64; 251848b8605Smrg 252848b8605Smrg#ifdef _IMAGEHLP64 253848b8605Smrg#define STACKFRAME STACKFRAME64 254848b8605Smrg#define LPSTACKFRAME LPSTACKFRAME64 255848b8605Smrg#else 256848b8605Smrg typedef struct _tagSTACKFRAME { 257848b8605Smrg ADDRESS AddrPC; 258848b8605Smrg ADDRESS AddrReturn; 259848b8605Smrg ADDRESS AddrFrame; 260848b8605Smrg ADDRESS AddrStack; 261848b8605Smrg PVOID FuncTableEntry; 262848b8605Smrg DWORD Params[4]; 263848b8605Smrg BOOL Far; 264848b8605Smrg BOOL Virtual; 265848b8605Smrg DWORD Reserved[3]; 266848b8605Smrg KDHELP KdHelp; 267848b8605Smrg ADDRESS AddrBStore; 268848b8605Smrg } STACKFRAME,*LPSTACKFRAME; 269848b8605Smrg#endif 270848b8605Smrg 271848b8605Smrg typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE64)(HANDLE hProcess,DWORD64 qwBaseAddress,PVOID lpBuffer,DWORD nSize,LPDWORD lpNumberOfBytesRead); 272848b8605Smrg typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE hProcess,DWORD64 AddrBase); 273848b8605Smrg typedef DWORD64 (WINAPI *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,DWORD64 Address); 274848b8605Smrg typedef DWORD64 (WINAPI *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,HANDLE hThread,LPADDRESS64 lpaddr); 275848b8605Smrg 276848b8605Smrg 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); 277848b8605Smrg 278848b8605Smrg#ifdef _IMAGEHLP64 279848b8605Smrg#define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64 280848b8605Smrg#define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64 281848b8605Smrg#define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64 282848b8605Smrg#define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64 283848b8605Smrg#define StackWalk StackWalk64 284848b8605Smrg#else 285848b8605Smrg typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE hProcess,DWORD lpBaseAddress,PVOID lpBuffer,DWORD nSize,PDWORD lpNumberOfBytesRead); 286848b8605Smrg typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE hProcess,DWORD AddrBase); 287848b8605Smrg typedef DWORD (WINAPI *PGET_MODULE_BASE_ROUTINE)(HANDLE hProcess,DWORD Address); 288848b8605Smrg typedef DWORD (WINAPI *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE hProcess,HANDLE hThread,LPADDRESS lpaddr); 289848b8605Smrg 290848b8605Smrg 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); 291848b8605Smrg#endif 292848b8605Smrg 293848b8605Smrg#define API_VERSION_NUMBER 9 294848b8605Smrg 295848b8605Smrg typedef struct API_VERSION { 296848b8605Smrg USHORT MajorVersion; 297848b8605Smrg USHORT MinorVersion; 298848b8605Smrg USHORT Revision; 299848b8605Smrg USHORT Reserved; 300848b8605Smrg } API_VERSION,*LPAPI_VERSION; 301848b8605Smrg 302848b8605Smrg LPAPI_VERSION IMAGEAPI ImagehlpApiVersion(VOID); 303848b8605Smrg LPAPI_VERSION IMAGEAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion); 304848b8605Smrg DWORD IMAGEAPI GetTimestampForLoadedLibrary(HMODULE Module); 305848b8605Smrg 306848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PSTR ModuleName,DWORD64 BaseOfDll,PVOID UserContext); 307848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); 308848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PWSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); 309848b8605Smrg typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PSTR ModuleName,DWORD64 ModuleBase,ULONG ModuleSize,PVOID UserContext); 310848b8605Smrg typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE hProcess,ULONG ActionCode,ULONG64 CallbackData,ULONG64 UserContext); 311848b8605Smrg typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE hProcess,DWORD AddrBase,PVOID UserContext); 312848b8605Smrg typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE hProcess,ULONG64 AddrBase,ULONG64 UserContext); 313848b8605Smrg 314848b8605Smrg#ifdef _IMAGEHLP64 315848b8605Smrg#define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64 316848b8605Smrg#define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64 317848b8605Smrg#define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACK64W 318848b8605Smrg#define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64 319848b8605Smrg#define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 320848b8605Smrg#define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 321848b8605Smrg#else 322848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName,ULONG BaseOfDll,PVOID UserContext); 323848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); 324848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PWSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); 325848b8605Smrg typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName,ULONG ModuleBase,ULONG ModuleSize,PVOID UserContext); 326848b8605Smrg typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE hProcess,ULONG ActionCode,PVOID CallbackData,PVOID UserContext); 327848b8605Smrg#endif 328848b8605Smrg 329848b8605Smrg#define SYMFLAG_VALUEPRESENT 0x00000001 330848b8605Smrg#define SYMFLAG_REGISTER 0x00000008 331848b8605Smrg#define SYMFLAG_REGREL 0x00000010 332848b8605Smrg#define SYMFLAG_FRAMEREL 0x00000020 333848b8605Smrg#define SYMFLAG_PARAMETER 0x00000040 334848b8605Smrg#define SYMFLAG_LOCAL 0x00000080 335848b8605Smrg#define SYMFLAG_CONSTANT 0x00000100 336848b8605Smrg#define SYMFLAG_EXPORT 0x00000200 337848b8605Smrg#define SYMFLAG_FORWARDER 0x00000400 338848b8605Smrg#define SYMFLAG_FUNCTION 0x00000800 339848b8605Smrg#define SYMFLAG_VIRTUAL 0x00001000 340848b8605Smrg#define SYMFLAG_THUNK 0x00002000 341848b8605Smrg#define SYMFLAG_TLSREL 0x00004000 342848b8605Smrg 343848b8605Smrg typedef enum { 344848b8605Smrg SymNone = 0,SymCoff,SymCv,SymPdb,SymExport,SymDeferred,SymSym,SymDia,SymVirtual,NumSymTypes 345848b8605Smrg } SYM_TYPE; 346848b8605Smrg 347848b8605Smrg typedef struct _IMAGEHLP_SYMBOL64 { 348848b8605Smrg DWORD SizeOfStruct; 349848b8605Smrg DWORD64 Address; 350848b8605Smrg DWORD Size; 351848b8605Smrg DWORD Flags; 352848b8605Smrg DWORD MaxNameLength; 353848b8605Smrg CHAR Name[1]; 354848b8605Smrg } IMAGEHLP_SYMBOL64,*PIMAGEHLP_SYMBOL64; 355848b8605Smrg 356848b8605Smrg typedef struct _IMAGEHLP_SYMBOL64_PACKAGE { 357848b8605Smrg IMAGEHLP_SYMBOL64 sym; 358848b8605Smrg CHAR name[MAX_SYM_NAME + 1]; 359848b8605Smrg } IMAGEHLP_SYMBOL64_PACKAGE,*PIMAGEHLP_SYMBOL64_PACKAGE; 360848b8605Smrg 361848b8605Smrg#ifdef _IMAGEHLP64 362848b8605Smrg 363848b8605Smrg#define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64 364848b8605Smrg#define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64 365848b8605Smrg#define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE 366848b8605Smrg#define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE 367848b8605Smrg#else 368848b8605Smrg 369848b8605Smrg typedef struct _IMAGEHLP_SYMBOL { 370848b8605Smrg DWORD SizeOfStruct; 371848b8605Smrg DWORD Address; 372848b8605Smrg DWORD Size; 373848b8605Smrg DWORD Flags; 374848b8605Smrg DWORD MaxNameLength; 375848b8605Smrg CHAR Name[1]; 376848b8605Smrg } IMAGEHLP_SYMBOL,*PIMAGEHLP_SYMBOL; 377848b8605Smrg 378848b8605Smrg typedef struct _IMAGEHLP_SYMBOL_PACKAGE { 379848b8605Smrg IMAGEHLP_SYMBOL sym; 380848b8605Smrg CHAR name[MAX_SYM_NAME + 1]; 381848b8605Smrg } IMAGEHLP_SYMBOL_PACKAGE,*PIMAGEHLP_SYMBOL_PACKAGE; 382848b8605Smrg#endif 383848b8605Smrg 384848b8605Smrg typedef struct _IMAGEHLP_MODULE64 { 385848b8605Smrg DWORD SizeOfStruct; 386848b8605Smrg DWORD64 BaseOfImage; 387848b8605Smrg DWORD ImageSize; 388848b8605Smrg DWORD TimeDateStamp; 389848b8605Smrg DWORD CheckSum; 390848b8605Smrg DWORD NumSyms; 391848b8605Smrg SYM_TYPE SymType; 392848b8605Smrg CHAR ModuleName[32]; 393848b8605Smrg CHAR ImageName[256]; 394848b8605Smrg CHAR LoadedImageName[256]; 395848b8605Smrg CHAR LoadedPdbName[256]; 396848b8605Smrg DWORD CVSig; 397848b8605Smrg CHAR CVData[MAX_PATH*3]; 398848b8605Smrg DWORD PdbSig; 399848b8605Smrg GUID PdbSig70; 400848b8605Smrg DWORD PdbAge; 401848b8605Smrg BOOL PdbUnmatched; 402848b8605Smrg BOOL DbgUnmatched; 403848b8605Smrg BOOL LineNumbers; 404848b8605Smrg BOOL GlobalSymbols; 405848b8605Smrg BOOL TypeInfo; 406848b8605Smrg } IMAGEHLP_MODULE64,*PIMAGEHLP_MODULE64; 407848b8605Smrg 408848b8605Smrg typedef struct _IMAGEHLP_MODULE64W { 409848b8605Smrg DWORD SizeOfStruct; 410848b8605Smrg DWORD64 BaseOfImage; 411848b8605Smrg DWORD ImageSize; 412848b8605Smrg DWORD TimeDateStamp; 413848b8605Smrg DWORD CheckSum; 414848b8605Smrg DWORD NumSyms; 415848b8605Smrg SYM_TYPE SymType; 416848b8605Smrg WCHAR ModuleName[32]; 417848b8605Smrg WCHAR ImageName[256]; 418848b8605Smrg WCHAR LoadedImageName[256]; 419848b8605Smrg WCHAR LoadedPdbName[256]; 420848b8605Smrg DWORD CVSig; 421848b8605Smrg WCHAR CVData[MAX_PATH*3]; 422848b8605Smrg DWORD PdbSig; 423848b8605Smrg GUID PdbSig70; 424848b8605Smrg DWORD PdbAge; 425848b8605Smrg BOOL PdbUnmatched; 426848b8605Smrg BOOL DbgUnmatched; 427848b8605Smrg BOOL LineNumbers; 428848b8605Smrg BOOL GlobalSymbols; 429848b8605Smrg BOOL TypeInfo; 430848b8605Smrg } IMAGEHLP_MODULEW64,*PIMAGEHLP_MODULEW64; 431848b8605Smrg 432848b8605Smrg#ifdef _IMAGEHLP64 433848b8605Smrg#define IMAGEHLP_MODULE IMAGEHLP_MODULE64 434848b8605Smrg#define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 435848b8605Smrg#define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 436848b8605Smrg#define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 437848b8605Smrg#else 438848b8605Smrg typedef struct _IMAGEHLP_MODULE { 439848b8605Smrg DWORD SizeOfStruct; 440848b8605Smrg DWORD BaseOfImage; 441848b8605Smrg DWORD ImageSize; 442848b8605Smrg DWORD TimeDateStamp; 443848b8605Smrg DWORD CheckSum; 444848b8605Smrg DWORD NumSyms; 445848b8605Smrg SYM_TYPE SymType; 446848b8605Smrg CHAR ModuleName[32]; 447848b8605Smrg CHAR ImageName[256]; 448848b8605Smrg CHAR LoadedImageName[256]; 449848b8605Smrg } IMAGEHLP_MODULE,*PIMAGEHLP_MODULE; 450848b8605Smrg 451848b8605Smrg typedef struct _IMAGEHLP_MODULEW { 452848b8605Smrg DWORD SizeOfStruct; 453848b8605Smrg DWORD BaseOfImage; 454848b8605Smrg DWORD ImageSize; 455848b8605Smrg DWORD TimeDateStamp; 456848b8605Smrg DWORD CheckSum; 457848b8605Smrg DWORD NumSyms; 458848b8605Smrg SYM_TYPE SymType; 459848b8605Smrg WCHAR ModuleName[32]; 460848b8605Smrg WCHAR ImageName[256]; 461848b8605Smrg WCHAR LoadedImageName[256]; 462848b8605Smrg } IMAGEHLP_MODULEW,*PIMAGEHLP_MODULEW; 463848b8605Smrg#endif 464848b8605Smrg 465848b8605Smrg typedef struct _IMAGEHLP_LINE64 { 466848b8605Smrg DWORD SizeOfStruct; 467848b8605Smrg PVOID Key; 468848b8605Smrg DWORD LineNumber; 469848b8605Smrg PCHAR FileName; 470848b8605Smrg DWORD64 Address; 471848b8605Smrg } IMAGEHLP_LINE64,*PIMAGEHLP_LINE64; 472848b8605Smrg 473848b8605Smrg#ifdef _IMAGEHLP64 474848b8605Smrg#define IMAGEHLP_LINE IMAGEHLP_LINE64 475848b8605Smrg#define PIMAGEHLP_LINE PIMAGEHLP_LINE64 476848b8605Smrg#else 477848b8605Smrg typedef struct _IMAGEHLP_LINE { 478848b8605Smrg DWORD SizeOfStruct; 479848b8605Smrg PVOID Key; 480848b8605Smrg DWORD LineNumber; 481848b8605Smrg PCHAR FileName; 482848b8605Smrg DWORD Address; 483848b8605Smrg } IMAGEHLP_LINE,*PIMAGEHLP_LINE; 484848b8605Smrg#endif 485848b8605Smrg 486848b8605Smrg typedef struct _SOURCEFILE { 487848b8605Smrg DWORD64 ModBase; 488848b8605Smrg PCHAR FileName; 489848b8605Smrg } SOURCEFILE,*PSOURCEFILE; 490848b8605Smrg 491848b8605Smrg#define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 492848b8605Smrg#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 493848b8605Smrg#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 494848b8605Smrg#define CBA_SYMBOLS_UNLOADED 0x00000004 495848b8605Smrg#define CBA_DUPLICATE_SYMBOL 0x00000005 496848b8605Smrg#define CBA_READ_MEMORY 0x00000006 497848b8605Smrg#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 498848b8605Smrg#define CBA_SET_OPTIONS 0x00000008 499848b8605Smrg#define CBA_EVENT 0x00000010 500848b8605Smrg#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 501848b8605Smrg#define CBA_DEBUG_INFO 0x10000000 502848b8605Smrg 503848b8605Smrg typedef struct _IMAGEHLP_CBA_READ_MEMORY { 504848b8605Smrg DWORD64 addr; 505848b8605Smrg PVOID buf; 506848b8605Smrg DWORD bytes; 507848b8605Smrg DWORD *bytesread; 508848b8605Smrg } IMAGEHLP_CBA_READ_MEMORY,*PIMAGEHLP_CBA_READ_MEMORY; 509848b8605Smrg 510848b8605Smrg enum { 511848b8605Smrg sevInfo = 0,sevProblem,sevAttn,sevFatal,sevMax 512848b8605Smrg }; 513848b8605Smrg 514848b8605Smrg typedef struct _IMAGEHLP_CBA_EVENT { 515848b8605Smrg DWORD severity; 516848b8605Smrg DWORD code; 517848b8605Smrg PCHAR desc; 518848b8605Smrg PVOID object; 519848b8605Smrg } IMAGEHLP_CBA_EVENT,*PIMAGEHLP_CBA_EVENT; 520848b8605Smrg 521848b8605Smrg typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 { 522848b8605Smrg DWORD SizeOfStruct; 523848b8605Smrg DWORD64 BaseOfImage; 524848b8605Smrg DWORD CheckSum; 525848b8605Smrg DWORD TimeDateStamp; 526848b8605Smrg CHAR FileName[MAX_PATH]; 527848b8605Smrg BOOLEAN Reparse; 528848b8605Smrg HANDLE hFile; 529848b8605Smrg DWORD Flags; 530848b8605Smrg } IMAGEHLP_DEFERRED_SYMBOL_LOAD64,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD64; 531848b8605Smrg 532848b8605Smrg#define DSLFLAG_MISMATCHED_PDB 0x1 533848b8605Smrg#define DSLFLAG_MISMATCHED_DBG 0x2 534848b8605Smrg 535848b8605Smrg#ifdef _IMAGEHLP64 536848b8605Smrg#define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64 537848b8605Smrg#define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 538848b8605Smrg#else 539848b8605Smrg typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD { 540848b8605Smrg DWORD SizeOfStruct; 541848b8605Smrg DWORD BaseOfImage; 542848b8605Smrg DWORD CheckSum; 543848b8605Smrg DWORD TimeDateStamp; 544848b8605Smrg CHAR FileName[MAX_PATH]; 545848b8605Smrg BOOLEAN Reparse; 546848b8605Smrg HANDLE hFile; 547848b8605Smrg } IMAGEHLP_DEFERRED_SYMBOL_LOAD,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD; 548848b8605Smrg#endif 549848b8605Smrg 550848b8605Smrg typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64 { 551848b8605Smrg DWORD SizeOfStruct; 552848b8605Smrg DWORD NumberOfDups; 553848b8605Smrg PIMAGEHLP_SYMBOL64 Symbol; 554848b8605Smrg DWORD SelectedSymbol; 555848b8605Smrg } IMAGEHLP_DUPLICATE_SYMBOL64,*PIMAGEHLP_DUPLICATE_SYMBOL64; 556848b8605Smrg 557848b8605Smrg#ifdef _IMAGEHLP64 558848b8605Smrg#define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64 559848b8605Smrg#define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64 560848b8605Smrg#else 561848b8605Smrg typedef struct _IMAGEHLP_DUPLICATE_SYMBOL { 562848b8605Smrg DWORD SizeOfStruct; 563848b8605Smrg DWORD NumberOfDups; 564848b8605Smrg PIMAGEHLP_SYMBOL Symbol; 565848b8605Smrg DWORD SelectedSymbol; 566848b8605Smrg } IMAGEHLP_DUPLICATE_SYMBOL,*PIMAGEHLP_DUPLICATE_SYMBOL; 567848b8605Smrg#endif 568848b8605Smrg 569848b8605Smrg BOOL IMAGEAPI SymSetParentWindow(HWND hwnd); 570848b8605Smrg PCHAR IMAGEAPI SymSetHomeDirectory(PCSTR dir); 571848b8605Smrg PCHAR IMAGEAPI SymGetHomeDirectory(DWORD type,PSTR dir,size_t size); 572848b8605Smrg 573848b8605Smrg enum { 574848b8605Smrg hdBase = 0,hdSym,hdSrc,hdMax 575848b8605Smrg }; 576848b8605Smrg 577848b8605Smrg#define SYMOPT_CASE_INSENSITIVE 0x00000001 578848b8605Smrg#define SYMOPT_UNDNAME 0x00000002 579848b8605Smrg#define SYMOPT_DEFERRED_LOADS 0x00000004 580848b8605Smrg#define SYMOPT_NO_CPP 0x00000008 581848b8605Smrg#define SYMOPT_LOAD_LINES 0x00000010 582848b8605Smrg#define SYMOPT_OMAP_FIND_NEAREST 0x00000020 583848b8605Smrg#define SYMOPT_LOAD_ANYTHING 0x00000040 584848b8605Smrg#define SYMOPT_IGNORE_CVREC 0x00000080 585848b8605Smrg#define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100 586848b8605Smrg#define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200 587848b8605Smrg#define SYMOPT_EXACT_SYMBOLS 0x00000400 588848b8605Smrg#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800 589848b8605Smrg#define SYMOPT_IGNORE_NT_SYMPATH 0x00001000 590848b8605Smrg#define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000 591848b8605Smrg#define SYMOPT_PUBLICS_ONLY 0x00004000 592848b8605Smrg#define SYMOPT_NO_PUBLICS 0x00008000 593848b8605Smrg#define SYMOPT_AUTO_PUBLICS 0x00010000 594848b8605Smrg#define SYMOPT_NO_IMAGE_SEARCH 0x00020000 595848b8605Smrg#define SYMOPT_SECURE 0x00040000 596848b8605Smrg#define SYMOPT_NO_PROMPTS 0x00080000 597848b8605Smrg 598848b8605Smrg#define SYMOPT_DEBUG 0x80000000 599848b8605Smrg 600848b8605Smrg DWORD IMAGEAPI SymSetOptions(DWORD SymOptions); 601848b8605Smrg DWORD IMAGEAPI SymGetOptions(VOID); 602848b8605Smrg BOOL IMAGEAPI SymCleanup(HANDLE hProcess); 603848b8605Smrg BOOL IMAGEAPI SymMatchString(LPSTR string,LPSTR expression,BOOL fCase); 604848b8605Smrg 605848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,PVOID UserContext); 606848b8605Smrg 607848b8605Smrg BOOL IMAGEAPI SymEnumSourceFiles(HANDLE hProcess,ULONG64 ModBase,LPSTR Mask,PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,PVOID UserContext); 608848b8605Smrg BOOL IMAGEAPI SymEnumerateModules64(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback,PVOID UserContext); 609848b8605Smrg 610848b8605Smrg#ifdef _IMAGEHLP64 611848b8605Smrg#define SymEnumerateModules SymEnumerateModules64 612848b8605Smrg#else 613848b8605Smrg BOOL IMAGEAPI SymEnumerateModules(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,PVOID UserContext); 614848b8605Smrg#endif 615848b8605Smrg 616848b8605Smrg BOOL IMAGEAPI SymEnumerateSymbols64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback,PVOID UserContext); 617848b8605Smrg BOOL IMAGEAPI SymEnumerateSymbolsW64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64W EnumSymbolsCallback,PVOID UserContext); 618848b8605Smrg 619848b8605Smrg#ifdef _IMAGEHLP64 620848b8605Smrg#define SymEnumerateSymbols SymEnumerateSymbols64 621848b8605Smrg#define SymEnumerateSymbolsW SymEnumerateSymbolsW64 622848b8605Smrg#else 623848b8605Smrg BOOL IMAGEAPI SymEnumerateSymbols(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 624848b8605Smrg BOOL IMAGEAPI SymEnumerateSymbolsW(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACKW EnumSymbolsCallback,PVOID UserContext); 625848b8605Smrg#endif 626848b8605Smrg 627848b8605Smrg BOOL IMAGEAPI EnumerateLoadedModules64(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback,PVOID UserContext); 628848b8605Smrg#ifdef _IMAGEHLP64 629848b8605Smrg#define EnumerateLoadedModules EnumerateLoadedModules64 630848b8605Smrg#else 631848b8605Smrg BOOL IMAGEAPI EnumerateLoadedModules(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,PVOID UserContext); 632848b8605Smrg#endif 633848b8605Smrg 634848b8605Smrg PVOID IMAGEAPI SymFunctionTableAccess64(HANDLE hProcess,DWORD64 AddrBase); 635848b8605Smrg 636848b8605Smrg#ifdef _IMAGEHLP64 637848b8605Smrg#define SymFunctionTableAccess SymFunctionTableAccess64 638848b8605Smrg#else 639848b8605Smrg PVOID IMAGEAPI SymFunctionTableAccess(HANDLE hProcess,DWORD AddrBase); 640848b8605Smrg#endif 641848b8605Smrg 642848b8605Smrg BOOL IMAGEAPI SymGetModuleInfo64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULE64 ModuleInfo); 643848b8605Smrg BOOL IMAGEAPI SymGetModuleInfoW64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULEW64 ModuleInfo); 644848b8605Smrg 645848b8605Smrg#ifdef _IMAGEHLP64 646848b8605Smrg#define SymGetModuleInfo SymGetModuleInfo64 647848b8605Smrg#define SymGetModuleInfoW SymGetModuleInfoW64 648848b8605Smrg#else 649848b8605Smrg BOOL IMAGEAPI SymGetModuleInfo(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULE ModuleInfo); 650848b8605Smrg BOOL IMAGEAPI SymGetModuleInfoW(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULEW ModuleInfo); 651848b8605Smrg#endif 652848b8605Smrg 653848b8605Smrg DWORD64 IMAGEAPI SymGetModuleBase64(HANDLE hProcess,DWORD64 qwAddr); 654848b8605Smrg 655848b8605Smrg#ifdef _IMAGEHLP64 656848b8605Smrg#define SymGetModuleBase SymGetModuleBase64 657848b8605Smrg#else 658848b8605Smrg DWORD IMAGEAPI SymGetModuleBase(HANDLE hProcess,DWORD dwAddr); 659848b8605Smrg#endif 660848b8605Smrg 661848b8605Smrg BOOL IMAGEAPI SymGetSymNext64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); 662848b8605Smrg 663848b8605Smrg#ifdef _IMAGEHLP64 664848b8605Smrg#define SymGetSymNext SymGetSymNext64 665848b8605Smrg#else 666848b8605Smrg BOOL IMAGEAPI SymGetSymNext(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); 667848b8605Smrg#endif 668848b8605Smrg 669848b8605Smrg BOOL IMAGEAPI SymGetSymPrev64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); 670848b8605Smrg 671848b8605Smrg#ifdef _IMAGEHLP64 672848b8605Smrg#define SymGetSymPrev SymGetSymPrev64 673848b8605Smrg#else 674848b8605Smrg BOOL IMAGEAPI SymGetSymPrev(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); 675848b8605Smrg#endif 676848b8605Smrg 677848b8605Smrg typedef struct _SRCCODEINFO { 678848b8605Smrg DWORD SizeOfStruct; 679848b8605Smrg PVOID Key; 680848b8605Smrg DWORD64 ModBase; 681848b8605Smrg CHAR Obj[MAX_PATH + 1]; 682848b8605Smrg CHAR FileName[MAX_PATH + 1]; 683848b8605Smrg DWORD LineNumber; 684848b8605Smrg DWORD64 Address; 685848b8605Smrg } SRCCODEINFO,*PSRCCODEINFO; 686848b8605Smrg 687848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO LineInfo,PVOID UserContext); 688848b8605Smrg 689848b8605Smrg BOOL IMAGEAPI SymEnumLines(HANDLE hProcess,ULONG64 Base,PCSTR Obj,PCSTR File,PSYM_ENUMLINES_CALLBACK EnumLinesCallback,PVOID UserContext); 690848b8605Smrg BOOL IMAGEAPI SymGetLineFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE64 Line64); 691848b8605Smrg 692848b8605Smrg#ifdef _IMAGEHLP64 693848b8605Smrg#define SymGetLineFromAddr SymGetLineFromAddr64 694848b8605Smrg#else 695848b8605Smrg BOOL IMAGEAPI SymGetLineFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE Line); 696848b8605Smrg#endif 697848b8605Smrg 698848b8605Smrg BOOL IMAGEAPI SymGetLineFromName64(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE64 Line); 699848b8605Smrg 700848b8605Smrg#ifdef _IMAGEHLP64 701848b8605Smrg#define SymGetLineFromName SymGetLineFromName64 702848b8605Smrg#else 703848b8605Smrg BOOL IMAGEAPI SymGetLineFromName(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE Line); 704848b8605Smrg#endif 705848b8605Smrg 706848b8605Smrg BOOL IMAGEAPI SymGetLineNext64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); 707848b8605Smrg 708848b8605Smrg#ifdef _IMAGEHLP64 709848b8605Smrg#define SymGetLineNext SymGetLineNext64 710848b8605Smrg#else 711848b8605Smrg BOOL IMAGEAPI SymGetLineNext(HANDLE hProcess,PIMAGEHLP_LINE Line); 712848b8605Smrg#endif 713848b8605Smrg 714848b8605Smrg BOOL IMAGEAPI SymGetLinePrev64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); 715848b8605Smrg 716848b8605Smrg#ifdef _IMAGEHLP64 717848b8605Smrg#define SymGetLinePrev SymGetLinePrev64 718848b8605Smrg#else 719848b8605Smrg BOOL IMAGEAPI SymGetLinePrev(HANDLE hProcess,PIMAGEHLP_LINE Line); 720848b8605Smrg#endif 721848b8605Smrg 722848b8605Smrg BOOL IMAGEAPI SymMatchFileName(PSTR FileName,PSTR Match,PSTR *FileNameStop,PSTR *MatchStop); 723848b8605Smrg BOOL IMAGEAPI SymInitialize(HANDLE hProcess,PSTR UserSearchPath,BOOL fInvadeProcess); 724848b8605Smrg BOOL IMAGEAPI SymGetSearchPath(HANDLE hProcess,PSTR SearchPath,DWORD SearchPathLength); 725848b8605Smrg BOOL IMAGEAPI SymSetSearchPath(HANDLE hProcess,PSTR SearchPath); 726848b8605Smrg DWORD64 IMAGEAPI SymLoadModule64(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD SizeOfDll); 727848b8605Smrg 728848b8605Smrg#define SLMFLAG_VIRTUAL 0x1 729848b8605Smrg 730848b8605Smrg DWORD64 IMAGEAPI SymLoadModuleEx(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD DllSize,PMODLOAD_DATA Data,DWORD Flags); 731848b8605Smrg 732848b8605Smrg#ifdef _IMAGEHLP64 733848b8605Smrg#define SymLoadModule SymLoadModule64 734848b8605Smrg#else 735848b8605Smrg DWORD IMAGEAPI SymLoadModule(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD BaseOfDll,DWORD SizeOfDll); 736848b8605Smrg#endif 737848b8605Smrg 738848b8605Smrg BOOL IMAGEAPI SymUnloadModule64(HANDLE hProcess,DWORD64 BaseOfDll); 739848b8605Smrg 740848b8605Smrg#ifdef _IMAGEHLP64 741848b8605Smrg#define SymUnloadModule SymUnloadModule64 742848b8605Smrg#else 743848b8605Smrg BOOL IMAGEAPI SymUnloadModule(HANDLE hProcess,DWORD BaseOfDll); 744848b8605Smrg#endif 745848b8605Smrg 746848b8605Smrg BOOL IMAGEAPI SymUnDName64(PIMAGEHLP_SYMBOL64 sym,PSTR UnDecName,DWORD UnDecNameLength); 747848b8605Smrg 748848b8605Smrg#ifdef _IMAGEHLP64 749848b8605Smrg#define SymUnDName SymUnDName64 750848b8605Smrg#else 751848b8605Smrg BOOL IMAGEAPI SymUnDName(PIMAGEHLP_SYMBOL sym,PSTR UnDecName,DWORD UnDecNameLength); 752848b8605Smrg#endif 753848b8605Smrg 754848b8605Smrg BOOL IMAGEAPI SymRegisterCallback64(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction,ULONG64 UserContext); 755848b8605Smrg 756848b8605Smrg BOOL IMAGEAPI SymRegisterFunctionEntryCallback64(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction,ULONG64 UserContext); 757848b8605Smrg 758848b8605Smrg#ifdef _IMAGEHLP64 759848b8605Smrg#define SymRegisterCallback SymRegisterCallback64 760848b8605Smrg#define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 761848b8605Smrg#else 762848b8605Smrg BOOL IMAGEAPI SymRegisterCallback(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK CallbackFunction,PVOID UserContext); 763848b8605Smrg BOOL IMAGEAPI SymRegisterFunctionEntryCallback(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction,PVOID UserContext); 764848b8605Smrg#endif 765848b8605Smrg 766848b8605Smrg typedef struct _IMAGEHLP_SYMBOL_SRC { 767848b8605Smrg DWORD sizeofstruct; 768848b8605Smrg DWORD type; 769848b8605Smrg char file[MAX_PATH]; 770848b8605Smrg } IMAGEHLP_SYMBOL_SRC,*PIMAGEHLP_SYMBOL_SRC; 771848b8605Smrg 772848b8605Smrg typedef struct _MODULE_TYPE_INFO { 773848b8605Smrg USHORT dataLength; 774848b8605Smrg USHORT leaf; 775848b8605Smrg BYTE data[1]; 776848b8605Smrg } MODULE_TYPE_INFO,*PMODULE_TYPE_INFO; 777848b8605Smrg 778848b8605Smrg typedef struct _SYMBOL_INFO { 779848b8605Smrg ULONG SizeOfStruct; 780848b8605Smrg ULONG TypeIndex; 781848b8605Smrg ULONG64 Reserved[2]; 782848b8605Smrg ULONG info; 783848b8605Smrg ULONG Size; 784848b8605Smrg ULONG64 ModBase; 785848b8605Smrg ULONG Flags; 786848b8605Smrg ULONG64 Value; 787848b8605Smrg ULONG64 Address; 788848b8605Smrg ULONG Register; 789848b8605Smrg ULONG Scope; 790848b8605Smrg ULONG Tag; 791848b8605Smrg ULONG NameLen; 792848b8605Smrg ULONG MaxNameLen; 793848b8605Smrg CHAR Name[1]; 794848b8605Smrg } SYMBOL_INFO,*PSYMBOL_INFO; 795848b8605Smrg 796848b8605Smrg typedef struct _SYMBOL_INFO_PACKAGE { 797848b8605Smrg SYMBOL_INFO si; 798848b8605Smrg CHAR name[MAX_SYM_NAME + 1]; 799848b8605Smrg } SYMBOL_INFO_PACKAGE,*PSYMBOL_INFO_PACKAGE; 800848b8605Smrg 801848b8605Smrg typedef struct _IMAGEHLP_STACK_FRAME 802848b8605Smrg { 803848b8605Smrg ULONG64 InstructionOffset; 804848b8605Smrg ULONG64 ReturnOffset; 805848b8605Smrg ULONG64 FrameOffset; 806848b8605Smrg ULONG64 StackOffset; 807848b8605Smrg ULONG64 BackingStoreOffset; 808848b8605Smrg ULONG64 FuncTableEntry; 809848b8605Smrg ULONG64 Params[4]; 810848b8605Smrg ULONG64 Reserved[5]; 811848b8605Smrg BOOL Virtual; 812848b8605Smrg ULONG Reserved2; 813848b8605Smrg } IMAGEHLP_STACK_FRAME,*PIMAGEHLP_STACK_FRAME; 814848b8605Smrg 815848b8605Smrg typedef VOID IMAGEHLP_CONTEXT,*PIMAGEHLP_CONTEXT; 816848b8605Smrg 817848b8605Smrg BOOL IMAGEAPI SymSetContext(HANDLE hProcess,PIMAGEHLP_STACK_FRAME StackFrame,PIMAGEHLP_CONTEXT Context); 818848b8605Smrg BOOL IMAGEAPI SymFromAddr(HANDLE hProcess,DWORD64 Address,PDWORD64 Displacement,PSYMBOL_INFO Symbol); 819848b8605Smrg BOOL IMAGEAPI SymFromToken(HANDLE hProcess,DWORD64 Base,DWORD Token,PSYMBOL_INFO Symbol); 820848b8605Smrg BOOL IMAGEAPI SymFromName(HANDLE hProcess,LPSTR Name,PSYMBOL_INFO Symbol); 821848b8605Smrg 822848b8605Smrg typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,ULONG SymbolSize,PVOID UserContext); 823848b8605Smrg 824848b8605Smrg BOOL IMAGEAPI SymEnumSymbols(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Mask,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 825848b8605Smrg BOOL IMAGEAPI SymEnumSymbolsForAddr(HANDLE hProcess,DWORD64 Address,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 826848b8605Smrg 827848b8605Smrg#define SYMENUMFLAG_FULLSRCH 1 828848b8605Smrg#define SYMENUMFLAG_SPEEDSRCH 2 829848b8605Smrg 830848b8605Smrg typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO { 831848b8605Smrg TI_GET_SYMTAG,TI_GET_SYMNAME,TI_GET_LENGTH,TI_GET_TYPE,TI_GET_TYPEID,TI_GET_BASETYPE,TI_GET_ARRAYINDEXTYPEID,TI_FINDCHILDREN, 832848b8605Smrg TI_GET_DATAKIND,TI_GET_ADDRESSOFFSET,TI_GET_OFFSET,TI_GET_VALUE,TI_GET_COUNT,TI_GET_CHILDRENCOUNT,TI_GET_BITPOSITION,TI_GET_VIRTUALBASECLASS, 833848b8605Smrg TI_GET_VIRTUALTABLESHAPEID,TI_GET_VIRTUALBASEPOINTEROFFSET,TI_GET_CLASSPARENTID,TI_GET_NESTED,TI_GET_SYMINDEX,TI_GET_LEXICALPARENT, 834848b8605Smrg TI_GET_ADDRESS,TI_GET_THISADJUST,TI_GET_UDTKIND,TI_IS_EQUIV_TO,TI_GET_CALLING_CONVENTION 835848b8605Smrg } IMAGEHLP_SYMBOL_TYPE_INFO; 836848b8605Smrg 837848b8605Smrg typedef struct _TI_FINDCHILDREN_PARAMS { 838848b8605Smrg ULONG Count; 839848b8605Smrg ULONG Start; 840848b8605Smrg ULONG ChildId[1]; 841848b8605Smrg } TI_FINDCHILDREN_PARAMS; 842848b8605Smrg 843848b8605Smrg BOOL IMAGEAPI SymGetTypeInfo(HANDLE hProcess,DWORD64 ModBase,ULONG TypeId,IMAGEHLP_SYMBOL_TYPE_INFO GetType,PVOID pInfo); 844848b8605Smrg BOOL IMAGEAPI SymEnumTypes(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 845848b8605Smrg BOOL IMAGEAPI SymGetTypeFromName(HANDLE hProcess,ULONG64 BaseOfDll,LPSTR Name,PSYMBOL_INFO Symbol); 846848b8605Smrg BOOL IMAGEAPI SymAddSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Size,DWORD Flags); 847848b8605Smrg BOOL IMAGEAPI SymDeleteSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Flags); 848848b8605Smrg 849848b8605Smrg typedef BOOL (WINAPI *PDBGHELP_CREATE_USER_DUMP_CALLBACK)(DWORD DataType,PVOID *Data,LPDWORD DataLength,PVOID UserData); 850848b8605Smrg 851848b8605Smrg BOOL WINAPI DbgHelpCreateUserDump(LPSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); 852848b8605Smrg BOOL WINAPI DbgHelpCreateUserDumpW(LPWSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); 853848b8605Smrg BOOL IMAGEAPI SymGetSymFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD64 pdwDisplacement,PIMAGEHLP_SYMBOL64 Symbol); 854848b8605Smrg 855848b8605Smrg#ifdef _IMAGEHLP64 856848b8605Smrg#define SymGetSymFromAddr SymGetSymFromAddr64 857848b8605Smrg#else 858848b8605Smrg BOOL IMAGEAPI SymGetSymFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_SYMBOL Symbol); 859848b8605Smrg#endif 860848b8605Smrg 861848b8605Smrg BOOL IMAGEAPI SymGetSymFromName64(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL64 Symbol); 862848b8605Smrg 863848b8605Smrg#ifdef _IMAGEHLP64 864848b8605Smrg#define SymGetSymFromName SymGetSymFromName64 865848b8605Smrg#else 866848b8605Smrg BOOL IMAGEAPI SymGetSymFromName(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL Symbol); 867848b8605Smrg#endif 868848b8605Smrg 869848b8605Smrg DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FilePath); 870848b8605Smrg DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInSearchPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,DWORD one,DWORD two,DWORD three,LPSTR FilePath); 871848b8605Smrg DBHLP_DEPRECIATED BOOL IMAGEAPI SymEnumSym(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 872848b8605Smrg 873848b8605Smrg#define SYMF_OMAP_GENERATED 0x00000001 874848b8605Smrg#define SYMF_OMAP_MODIFIED 0x00000002 875848b8605Smrg#define SYMF_REGISTER 0x00000008 876848b8605Smrg#define SYMF_REGREL 0x00000010 877848b8605Smrg#define SYMF_FRAMEREL 0x00000020 878848b8605Smrg#define SYMF_PARAMETER 0x00000040 879848b8605Smrg#define SYMF_LOCAL 0x00000080 880848b8605Smrg#define SYMF_CONSTANT 0x00000100 881848b8605Smrg#define SYMF_EXPORT 0x00000200 882848b8605Smrg#define SYMF_FORWARDER 0x00000400 883848b8605Smrg#define SYMF_FUNCTION 0x00000800 884848b8605Smrg#define SYMF_VIRTUAL 0x00001000 885848b8605Smrg#define SYMF_THUNK 0x00002000 886848b8605Smrg#define SYMF_TLSREL 0x00004000 887848b8605Smrg 888848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1 889848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER 890848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL 891848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL 892848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER 893848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL 894848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT 895848b8605Smrg#define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION 896848b8605Smrg#define IMAGEHLP_SYMBOL_VIRTUAL SYMF_VIRTUAL 897848b8605Smrg#define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK 898848b8605Smrg#define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL 899848b8605Smrg 900848b8605Smrg#include <pshpack4.h> 901848b8605Smrg 902848b8605Smrg#define MINIDUMP_SIGNATURE ('PMDM') 903848b8605Smrg#define MINIDUMP_VERSION (42899) 904848b8605Smrg typedef DWORD RVA; 905848b8605Smrg typedef ULONG64 RVA64; 906848b8605Smrg 907848b8605Smrg typedef struct _MINIDUMP_LOCATION_DESCRIPTOR { 908848b8605Smrg ULONG32 DataSize; 909848b8605Smrg RVA Rva; 910848b8605Smrg } MINIDUMP_LOCATION_DESCRIPTOR; 911848b8605Smrg 912848b8605Smrg typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 { 913848b8605Smrg ULONG64 DataSize; 914848b8605Smrg RVA64 Rva; 915848b8605Smrg } MINIDUMP_LOCATION_DESCRIPTOR64; 916848b8605Smrg 917848b8605Smrg typedef struct _MINIDUMP_MEMORY_DESCRIPTOR { 918848b8605Smrg ULONG64 StartOfMemoryRange; 919848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR Memory; 920848b8605Smrg } MINIDUMP_MEMORY_DESCRIPTOR,*PMINIDUMP_MEMORY_DESCRIPTOR; 921848b8605Smrg 922848b8605Smrg typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64 { 923848b8605Smrg ULONG64 StartOfMemoryRange; 924848b8605Smrg ULONG64 DataSize; 925848b8605Smrg } MINIDUMP_MEMORY_DESCRIPTOR64,*PMINIDUMP_MEMORY_DESCRIPTOR64; 926848b8605Smrg 927848b8605Smrg typedef struct _MINIDUMP_HEADER { 928848b8605Smrg ULONG32 Signature; 929848b8605Smrg ULONG32 Version; 930848b8605Smrg ULONG32 NumberOfStreams; 931848b8605Smrg RVA StreamDirectoryRva; 932848b8605Smrg ULONG32 CheckSum; 933848b8605Smrg union { 934848b8605Smrg ULONG32 Reserved; 935848b8605Smrg ULONG32 TimeDateStamp; 936848b8605Smrg } DUMMYUNIONNAME; 937848b8605Smrg ULONG64 Flags; 938848b8605Smrg } MINIDUMP_HEADER,*PMINIDUMP_HEADER; 939848b8605Smrg 940848b8605Smrg typedef struct _MINIDUMP_DIRECTORY { 941848b8605Smrg ULONG32 StreamType; 942848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR Location; 943848b8605Smrg } MINIDUMP_DIRECTORY,*PMINIDUMP_DIRECTORY; 944848b8605Smrg 945848b8605Smrg typedef struct _MINIDUMP_STRING { 946848b8605Smrg ULONG32 Length; 947848b8605Smrg WCHAR Buffer [0]; 948848b8605Smrg } MINIDUMP_STRING,*PMINIDUMP_STRING; 949848b8605Smrg 950848b8605Smrg typedef enum _MINIDUMP_STREAM_TYPE { 951848b8605Smrg UnusedStream = 0,ReservedStream0 = 1,ReservedStream1 = 2,ThreadListStream = 3,ModuleListStream = 4,MemoryListStream = 5, 952848b8605Smrg ExceptionStream = 6,SystemInfoStream = 7,ThreadExListStream = 8,Memory64ListStream = 9,CommentStreamA = 10,CommentStreamW = 11, 953848b8605Smrg HandleDataStream = 12,FunctionTableStream = 13,UnloadedModuleListStream = 14,MiscInfoStream = 15,LastReservedStream = 0xffff 954848b8605Smrg } MINIDUMP_STREAM_TYPE; 955848b8605Smrg 956848b8605Smrg typedef union _CPU_INFORMATION { 957848b8605Smrg struct { 958848b8605Smrg ULONG32 VendorId [3 ]; 959848b8605Smrg ULONG32 VersionInformation; 960848b8605Smrg ULONG32 FeatureInformation; 961848b8605Smrg ULONG32 AMDExtendedCpuFeatures; 962848b8605Smrg } X86CpuInfo; 963848b8605Smrg struct { 964848b8605Smrg ULONG64 ProcessorFeatures [2 ]; 965848b8605Smrg } OtherCpuInfo; 966848b8605Smrg } CPU_INFORMATION,*PCPU_INFORMATION; 967848b8605Smrg 968848b8605Smrg typedef struct _MINIDUMP_SYSTEM_INFO { 969848b8605Smrg USHORT ProcessorArchitecture; 970848b8605Smrg USHORT ProcessorLevel; 971848b8605Smrg USHORT ProcessorRevision; 972848b8605Smrg union { 973848b8605Smrg USHORT Reserved0; 974848b8605Smrg struct { 975848b8605Smrg UCHAR NumberOfProcessors; 976848b8605Smrg UCHAR ProductType; 977848b8605Smrg } DUMMYSTRUCTNAME; 978848b8605Smrg } DUMMYUNIONNAME; 979848b8605Smrg ULONG32 MajorVersion; 980848b8605Smrg ULONG32 MinorVersion; 981848b8605Smrg ULONG32 BuildNumber; 982848b8605Smrg ULONG32 PlatformId; 983848b8605Smrg RVA CSDVersionRva; 984848b8605Smrg union { 985848b8605Smrg ULONG32 Reserved1; 986848b8605Smrg struct { 987848b8605Smrg USHORT SuiteMask; 988848b8605Smrg USHORT Reserved2; 989848b8605Smrg } DUMMYSTRUCTNAME; 990848b8605Smrg } DUMMYUNIONNAME1; 991848b8605Smrg CPU_INFORMATION Cpu; 992848b8605Smrg } MINIDUMP_SYSTEM_INFO,*PMINIDUMP_SYSTEM_INFO; 993848b8605Smrg 994848b8605Smrg C_ASSERT (sizeof (((PPROCESS_INFORMATION)0)->dwThreadId)==4); 995848b8605Smrg 996848b8605Smrg typedef struct _MINIDUMP_THREAD { 997848b8605Smrg ULONG32 ThreadId; 998848b8605Smrg ULONG32 SuspendCount; 999848b8605Smrg ULONG32 PriorityClass; 1000848b8605Smrg ULONG32 Priority; 1001848b8605Smrg ULONG64 Teb; 1002848b8605Smrg MINIDUMP_MEMORY_DESCRIPTOR Stack; 1003848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; 1004848b8605Smrg } MINIDUMP_THREAD,*PMINIDUMP_THREAD; 1005848b8605Smrg 1006848b8605Smrg typedef struct _MINIDUMP_THREAD_LIST { 1007848b8605Smrg ULONG32 NumberOfThreads; 1008848b8605Smrg MINIDUMP_THREAD Threads [0]; 1009848b8605Smrg } MINIDUMP_THREAD_LIST,*PMINIDUMP_THREAD_LIST; 1010848b8605Smrg 1011848b8605Smrg typedef struct _MINIDUMP_THREAD_EX { 1012848b8605Smrg ULONG32 ThreadId; 1013848b8605Smrg ULONG32 SuspendCount; 1014848b8605Smrg ULONG32 PriorityClass; 1015848b8605Smrg ULONG32 Priority; 1016848b8605Smrg ULONG64 Teb; 1017848b8605Smrg MINIDUMP_MEMORY_DESCRIPTOR Stack; 1018848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; 1019848b8605Smrg MINIDUMP_MEMORY_DESCRIPTOR BackingStore; 1020848b8605Smrg } MINIDUMP_THREAD_EX,*PMINIDUMP_THREAD_EX; 1021848b8605Smrg 1022848b8605Smrg typedef struct _MINIDUMP_THREAD_EX_LIST { 1023848b8605Smrg ULONG32 NumberOfThreads; 1024848b8605Smrg MINIDUMP_THREAD_EX Threads [0]; 1025848b8605Smrg } MINIDUMP_THREAD_EX_LIST,*PMINIDUMP_THREAD_EX_LIST; 1026848b8605Smrg 1027848b8605Smrg typedef struct _MINIDUMP_EXCEPTION { 1028848b8605Smrg ULONG32 ExceptionCode; 1029848b8605Smrg ULONG32 ExceptionFlags; 1030848b8605Smrg ULONG64 ExceptionRecord; 1031848b8605Smrg ULONG64 ExceptionAddress; 1032848b8605Smrg ULONG32 NumberParameters; 1033848b8605Smrg ULONG32 __unusedAlignment; 1034848b8605Smrg ULONG64 ExceptionInformation [EXCEPTION_MAXIMUM_PARAMETERS ]; 1035848b8605Smrg } MINIDUMP_EXCEPTION,*PMINIDUMP_EXCEPTION; 1036848b8605Smrg 1037848b8605Smrg typedef struct MINIDUMP_EXCEPTION_STREAM { 1038848b8605Smrg ULONG32 ThreadId; 1039848b8605Smrg ULONG32 __alignment; 1040848b8605Smrg MINIDUMP_EXCEPTION ExceptionRecord; 1041848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; 1042848b8605Smrg } MINIDUMP_EXCEPTION_STREAM,*PMINIDUMP_EXCEPTION_STREAM; 1043848b8605Smrg 1044848b8605Smrg typedef struct _MINIDUMP_MODULE { 1045848b8605Smrg ULONG64 BaseOfImage; 1046848b8605Smrg ULONG32 SizeOfImage; 1047848b8605Smrg ULONG32 CheckSum; 1048848b8605Smrg ULONG32 TimeDateStamp; 1049848b8605Smrg RVA ModuleNameRva; 1050848b8605Smrg VS_FIXEDFILEINFO VersionInfo; 1051848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR CvRecord; 1052848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR MiscRecord; 1053848b8605Smrg ULONG64 Reserved0; 1054848b8605Smrg ULONG64 Reserved1; 1055848b8605Smrg } MINIDUMP_MODULE,*PMINIDUMP_MODULE; 1056848b8605Smrg 1057848b8605Smrg typedef struct _MINIDUMP_MODULE_LIST { 1058848b8605Smrg ULONG32 NumberOfModules; 1059848b8605Smrg MINIDUMP_MODULE Modules [0 ]; 1060848b8605Smrg } MINIDUMP_MODULE_LIST,*PMINIDUMP_MODULE_LIST; 1061848b8605Smrg 1062848b8605Smrg typedef struct _MINIDUMP_MEMORY_LIST { 1063848b8605Smrg ULONG32 NumberOfMemoryRanges; 1064848b8605Smrg MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges [0]; 1065848b8605Smrg } MINIDUMP_MEMORY_LIST,*PMINIDUMP_MEMORY_LIST; 1066848b8605Smrg 1067848b8605Smrg typedef struct _MINIDUMP_MEMORY64_LIST { 1068848b8605Smrg ULONG64 NumberOfMemoryRanges; 1069848b8605Smrg RVA64 BaseRva; 1070848b8605Smrg MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges [0]; 1071848b8605Smrg } MINIDUMP_MEMORY64_LIST,*PMINIDUMP_MEMORY64_LIST; 1072848b8605Smrg 1073848b8605Smrg typedef struct _MINIDUMP_EXCEPTION_INFORMATION { 1074848b8605Smrg DWORD ThreadId; 1075848b8605Smrg PEXCEPTION_POINTERS ExceptionPointers; 1076848b8605Smrg BOOL ClientPointers; 1077848b8605Smrg } MINIDUMP_EXCEPTION_INFORMATION,*PMINIDUMP_EXCEPTION_INFORMATION; 1078848b8605Smrg 1079848b8605Smrg typedef struct _MINIDUMP_EXCEPTION_INFORMATION64 { 1080848b8605Smrg DWORD ThreadId; 1081848b8605Smrg ULONG64 ExceptionRecord; 1082848b8605Smrg ULONG64 ContextRecord; 1083848b8605Smrg BOOL ClientPointers; 1084848b8605Smrg } MINIDUMP_EXCEPTION_INFORMATION64,*PMINIDUMP_EXCEPTION_INFORMATION64; 1085848b8605Smrg 1086848b8605Smrg typedef struct _MINIDUMP_HANDLE_DESCRIPTOR { 1087848b8605Smrg ULONG64 Handle; 1088848b8605Smrg RVA TypeNameRva; 1089848b8605Smrg RVA ObjectNameRva; 1090848b8605Smrg ULONG32 Attributes; 1091848b8605Smrg ULONG32 GrantedAccess; 1092848b8605Smrg ULONG32 HandleCount; 1093848b8605Smrg ULONG32 PointerCount; 1094848b8605Smrg } MINIDUMP_HANDLE_DESCRIPTOR,*PMINIDUMP_HANDLE_DESCRIPTOR; 1095848b8605Smrg 1096848b8605Smrg typedef struct _MINIDUMP_HANDLE_DATA_STREAM { 1097848b8605Smrg ULONG32 SizeOfHeader; 1098848b8605Smrg ULONG32 SizeOfDescriptor; 1099848b8605Smrg ULONG32 NumberOfDescriptors; 1100848b8605Smrg ULONG32 Reserved; 1101848b8605Smrg } MINIDUMP_HANDLE_DATA_STREAM,*PMINIDUMP_HANDLE_DATA_STREAM; 1102848b8605Smrg 1103848b8605Smrg typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR { 1104848b8605Smrg ULONG64 MinimumAddress; 1105848b8605Smrg ULONG64 MaximumAddress; 1106848b8605Smrg ULONG64 BaseAddress; 1107848b8605Smrg ULONG32 EntryCount; 1108848b8605Smrg ULONG32 SizeOfAlignPad; 1109848b8605Smrg } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR,*PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR; 1110848b8605Smrg 1111848b8605Smrg typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM { 1112848b8605Smrg ULONG32 SizeOfHeader; 1113848b8605Smrg ULONG32 SizeOfDescriptor; 1114848b8605Smrg ULONG32 SizeOfNativeDescriptor; 1115848b8605Smrg ULONG32 SizeOfFunctionEntry; 1116848b8605Smrg ULONG32 NumberOfDescriptors; 1117848b8605Smrg ULONG32 SizeOfAlignPad; 1118848b8605Smrg } MINIDUMP_FUNCTION_TABLE_STREAM,*PMINIDUMP_FUNCTION_TABLE_STREAM; 1119848b8605Smrg 1120848b8605Smrg typedef struct _MINIDUMP_UNLOADED_MODULE { 1121848b8605Smrg ULONG64 BaseOfImage; 1122848b8605Smrg ULONG32 SizeOfImage; 1123848b8605Smrg ULONG32 CheckSum; 1124848b8605Smrg ULONG32 TimeDateStamp; 1125848b8605Smrg RVA ModuleNameRva; 1126848b8605Smrg } MINIDUMP_UNLOADED_MODULE,*PMINIDUMP_UNLOADED_MODULE; 1127848b8605Smrg 1128848b8605Smrg typedef struct _MINIDUMP_UNLOADED_MODULE_LIST { 1129848b8605Smrg ULONG32 SizeOfHeader; 1130848b8605Smrg ULONG32 SizeOfEntry; 1131848b8605Smrg ULONG32 NumberOfEntries; 1132848b8605Smrg } MINIDUMP_UNLOADED_MODULE_LIST,*PMINIDUMP_UNLOADED_MODULE_LIST; 1133848b8605Smrg 1134848b8605Smrg#define MINIDUMP_MISC1_PROCESS_ID 0x00000001 1135848b8605Smrg#define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002 1136848b8605Smrg 1137848b8605Smrg typedef struct _MINIDUMP_MISC_INFO { 1138848b8605Smrg ULONG32 SizeOfInfo; 1139848b8605Smrg ULONG32 Flags1; 1140848b8605Smrg ULONG32 ProcessId; 1141848b8605Smrg ULONG32 ProcessCreateTime; 1142848b8605Smrg ULONG32 ProcessUserTime; 1143848b8605Smrg ULONG32 ProcessKernelTime; 1144848b8605Smrg } MINIDUMP_MISC_INFO,*PMINIDUMP_MISC_INFO; 1145848b8605Smrg 1146848b8605Smrg typedef struct _MINIDUMP_USER_RECORD { 1147848b8605Smrg ULONG32 Type; 1148848b8605Smrg MINIDUMP_LOCATION_DESCRIPTOR Memory; 1149848b8605Smrg } MINIDUMP_USER_RECORD,*PMINIDUMP_USER_RECORD; 1150848b8605Smrg 1151848b8605Smrg typedef struct _MINIDUMP_USER_STREAM { 1152848b8605Smrg ULONG32 Type; 1153848b8605Smrg ULONG BufferSize; 1154848b8605Smrg PVOID Buffer; 1155848b8605Smrg } MINIDUMP_USER_STREAM,*PMINIDUMP_USER_STREAM; 1156848b8605Smrg 1157848b8605Smrg typedef struct _MINIDUMP_USER_STREAM_INFORMATION { 1158848b8605Smrg ULONG UserStreamCount; 1159848b8605Smrg PMINIDUMP_USER_STREAM UserStreamArray; 1160848b8605Smrg } MINIDUMP_USER_STREAM_INFORMATION,*PMINIDUMP_USER_STREAM_INFORMATION; 1161848b8605Smrg 1162848b8605Smrg typedef enum _MINIDUMP_CALLBACK_TYPE { 1163848b8605Smrg ModuleCallback,ThreadCallback,ThreadExCallback,IncludeThreadCallback,IncludeModuleCallback,MemoryCallback 1164848b8605Smrg } MINIDUMP_CALLBACK_TYPE; 1165848b8605Smrg 1166848b8605Smrg typedef struct _MINIDUMP_THREAD_CALLBACK { 1167848b8605Smrg ULONG ThreadId; 1168848b8605Smrg HANDLE ThreadHandle; 1169848b8605Smrg CONTEXT Context; 1170848b8605Smrg ULONG SizeOfContext; 1171848b8605Smrg ULONG64 StackBase; 1172848b8605Smrg ULONG64 StackEnd; 1173848b8605Smrg } MINIDUMP_THREAD_CALLBACK,*PMINIDUMP_THREAD_CALLBACK; 1174848b8605Smrg 1175848b8605Smrg typedef struct _MINIDUMP_THREAD_EX_CALLBACK { 1176848b8605Smrg ULONG ThreadId; 1177848b8605Smrg HANDLE ThreadHandle; 1178848b8605Smrg CONTEXT Context; 1179848b8605Smrg ULONG SizeOfContext; 1180848b8605Smrg ULONG64 StackBase; 1181848b8605Smrg ULONG64 StackEnd; 1182848b8605Smrg ULONG64 BackingStoreBase; 1183848b8605Smrg ULONG64 BackingStoreEnd; 1184848b8605Smrg } MINIDUMP_THREAD_EX_CALLBACK,*PMINIDUMP_THREAD_EX_CALLBACK; 1185848b8605Smrg 1186848b8605Smrg typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK { 1187848b8605Smrg ULONG ThreadId; 1188848b8605Smrg } MINIDUMP_INCLUDE_THREAD_CALLBACK,*PMINIDUMP_INCLUDE_THREAD_CALLBACK; 1189848b8605Smrg 1190848b8605Smrg typedef enum _THREAD_WRITE_FLAGS { 1191848b8605Smrg ThreadWriteThread = 0x0001,ThreadWriteStack = 0x0002,ThreadWriteContext = 0x0004,ThreadWriteBackingStore = 0x0008, 1192848b8605Smrg ThreadWriteInstructionWindow = 0x0010,ThreadWriteThreadData = 0x0020 1193848b8605Smrg } THREAD_WRITE_FLAGS; 1194848b8605Smrg 1195848b8605Smrg typedef struct _MINIDUMP_MODULE_CALLBACK { 1196848b8605Smrg PWCHAR FullPath; 1197848b8605Smrg ULONG64 BaseOfImage; 1198848b8605Smrg ULONG SizeOfImage; 1199848b8605Smrg ULONG CheckSum; 1200848b8605Smrg ULONG TimeDateStamp; 1201848b8605Smrg VS_FIXEDFILEINFO VersionInfo; 1202848b8605Smrg PVOID CvRecord; 1203848b8605Smrg ULONG SizeOfCvRecord; 1204848b8605Smrg PVOID MiscRecord; 1205848b8605Smrg ULONG SizeOfMiscRecord; 1206848b8605Smrg } MINIDUMP_MODULE_CALLBACK,*PMINIDUMP_MODULE_CALLBACK; 1207848b8605Smrg 1208848b8605Smrg typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK { 1209848b8605Smrg ULONG64 BaseOfImage; 1210848b8605Smrg } MINIDUMP_INCLUDE_MODULE_CALLBACK,*PMINIDUMP_INCLUDE_MODULE_CALLBACK; 1211848b8605Smrg 1212848b8605Smrg typedef enum _MODULE_WRITE_FLAGS { 1213848b8605Smrg ModuleWriteModule = 0x0001,ModuleWriteDataSeg = 0x0002,ModuleWriteMiscRecord = 0x0004,ModuleWriteCvRecord = 0x0008, 1214848b8605Smrg ModuleReferencedByMemory = 0x0010 1215848b8605Smrg } MODULE_WRITE_FLAGS; 1216848b8605Smrg 1217848b8605Smrg typedef struct _MINIDUMP_CALLBACK_INPUT { 1218848b8605Smrg ULONG ProcessId; 1219848b8605Smrg HANDLE ProcessHandle; 1220848b8605Smrg ULONG CallbackType; 1221848b8605Smrg union { 1222848b8605Smrg MINIDUMP_THREAD_CALLBACK Thread; 1223848b8605Smrg MINIDUMP_THREAD_EX_CALLBACK ThreadEx; 1224848b8605Smrg MINIDUMP_MODULE_CALLBACK Module; 1225848b8605Smrg MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread; 1226848b8605Smrg MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule; 1227848b8605Smrg } DUMMYUNIONNAME; 1228848b8605Smrg } MINIDUMP_CALLBACK_INPUT,*PMINIDUMP_CALLBACK_INPUT; 1229848b8605Smrg 1230848b8605Smrg typedef struct _MINIDUMP_CALLBACK_OUTPUT { 1231848b8605Smrg union { 1232848b8605Smrg ULONG ModuleWriteFlags; 1233848b8605Smrg ULONG ThreadWriteFlags; 1234848b8605Smrg struct { 1235848b8605Smrg ULONG64 MemoryBase; 1236848b8605Smrg ULONG MemorySize; 1237848b8605Smrg } DUMMYSTRUCTNAME; 1238848b8605Smrg } DUMMYUNIONNAME; 1239848b8605Smrg } MINIDUMP_CALLBACK_OUTPUT,*PMINIDUMP_CALLBACK_OUTPUT; 1240848b8605Smrg 1241848b8605Smrg typedef enum _MINIDUMP_TYPE { 1242848b8605Smrg MiniDumpNormal = 0x0000,MiniDumpWithDataSegs = 0x0001,MiniDumpWithFullMemory = 0x0002,MiniDumpWithHandleData = 0x0004, 1243848b8605Smrg MiniDumpFilterMemory = 0x0008,MiniDumpScanMemory = 0x0010,MiniDumpWithUnloadedModules = 0x0020,MiniDumpWithIndirectlyReferencedMemory = 0x0040, 1244848b8605Smrg MiniDumpFilterModulePaths = 0x0080,MiniDumpWithProcessThreadData = 0x0100,MiniDumpWithPrivateReadWriteMemory = 0x0200, 1245848b8605Smrg MiniDumpWithoutOptionalData = 0x0400 1246848b8605Smrg } MINIDUMP_TYPE; 1247848b8605Smrg 1248848b8605Smrg typedef BOOL (WINAPI *MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,PMINIDUMP_CALLBACK_OUTPUT CallbackOutput); 1249848b8605Smrg 1250848b8605Smrg typedef struct _MINIDUMP_CALLBACK_INFORMATION { 1251848b8605Smrg MINIDUMP_CALLBACK_ROUTINE CallbackRoutine; 1252848b8605Smrg PVOID CallbackParam; 1253848b8605Smrg } MINIDUMP_CALLBACK_INFORMATION,*PMINIDUMP_CALLBACK_INFORMATION; 1254848b8605Smrg 1255848b8605Smrg#define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva))) 1256848b8605Smrg 1257848b8605Smrg 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); 1258848b8605Smrg BOOL WINAPI MiniDumpReadDumpStream(PVOID BaseOfDump,ULONG StreamNumber,PMINIDUMP_DIRECTORY *Dir,PVOID *StreamPointer,ULONG *StreamSize); 1259848b8605Smrg 1260848b8605Smrg#include <poppack.h> 1261848b8605Smrg 1262848b8605Smrg#ifdef __cplusplus 1263848b8605Smrg} 1264848b8605Smrg#endif 1265848b8605Smrg#endif 1266