13464ebd5Sriastradh/** 23464ebd5Sriastradh * This file has no copyright assigned and is placed in the Public Domain. 33464ebd5Sriastradh * This file is part of the w64 mingw-runtime package. 43464ebd5Sriastradh * No warranty is given; refer to the file DISCLAIMER.PD within this package. 53464ebd5Sriastradh */ 63464ebd5Sriastradh#ifndef _DBGHELP_ 73464ebd5Sriastradh#define _DBGHELP_ 83464ebd5Sriastradh 93464ebd5Sriastradh#ifdef _WIN64 103464ebd5Sriastradh#ifndef _IMAGEHLP64 113464ebd5Sriastradh#define _IMAGEHLP64 123464ebd5Sriastradh#endif 133464ebd5Sriastradh#endif 143464ebd5Sriastradh 153464ebd5Sriastradh#ifdef __cplusplus 163464ebd5Sriastradhextern "C" { 173464ebd5Sriastradh#endif 183464ebd5Sriastradh 193464ebd5Sriastradh#define IMAGEAPI DECLSPEC_IMPORT WINAPI 203464ebd5Sriastradh#define DBHLP_DEPRECIATED __declspec(deprecated) 213464ebd5Sriastradh 223464ebd5Sriastradh#define DBHLPAPI IMAGEAPI 233464ebd5Sriastradh 243464ebd5Sriastradh#define IMAGE_SEPARATION (64*1024) 253464ebd5Sriastradh 263464ebd5Sriastradh typedef struct _LOADED_IMAGE { 273464ebd5Sriastradh PSTR ModuleName; 283464ebd5Sriastradh HANDLE hFile; 293464ebd5Sriastradh PUCHAR MappedAddress; 303464ebd5Sriastradh#ifdef _IMAGEHLP64 313464ebd5Sriastradh PIMAGE_NT_HEADERS64 FileHeader; 323464ebd5Sriastradh#else 333464ebd5Sriastradh PIMAGE_NT_HEADERS32 FileHeader; 343464ebd5Sriastradh#endif 353464ebd5Sriastradh PIMAGE_SECTION_HEADER LastRvaSection; 363464ebd5Sriastradh ULONG NumberOfSections; 373464ebd5Sriastradh PIMAGE_SECTION_HEADER Sections; 383464ebd5Sriastradh ULONG Characteristics; 393464ebd5Sriastradh BOOLEAN fSystemImage; 403464ebd5Sriastradh BOOLEAN fDOSImage; 413464ebd5Sriastradh LIST_ENTRY Links; 423464ebd5Sriastradh ULONG SizeOfImage; 433464ebd5Sriastradh } LOADED_IMAGE,*PLOADED_IMAGE; 443464ebd5Sriastradh 453464ebd5Sriastradh#define MAX_SYM_NAME 2000 463464ebd5Sriastradh 473464ebd5Sriastradh typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); 483464ebd5Sriastradh typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename,PVOID context); 493464ebd5Sriastradh typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle,PSTR FileName,PVOID CallerData); 503464ebd5Sriastradh 513464ebd5Sriastradh typedef BOOL (WINAPI *PSYMBOLSERVERPROC)(LPCSTR,LPCSTR,PVOID,DWORD,DWORD,LPSTR); 523464ebd5Sriastradh typedef BOOL (WINAPI *PSYMBOLSERVEROPENPROC)(VOID); 533464ebd5Sriastradh typedef BOOL (WINAPI *PSYMBOLSERVERCLOSEPROC)(VOID); 543464ebd5Sriastradh typedef BOOL (WINAPI *PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR,ULONG64); 553464ebd5Sriastradh typedef BOOL (CALLBACK WINAPI *PSYMBOLSERVERCALLBACKPROC)(UINT_PTR action,ULONG64 data,ULONG64 context); 563464ebd5Sriastradh typedef UINT_PTR (WINAPI *PSYMBOLSERVERGETOPTIONSPROC)(); 573464ebd5Sriastradh typedef BOOL (WINAPI *PSYMBOLSERVERPINGPROC)(LPCSTR); 583464ebd5Sriastradh 593464ebd5Sriastradh HANDLE IMAGEAPI FindDebugInfoFile(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath); 603464ebd5Sriastradh HANDLE IMAGEAPI FindDebugInfoFileEx(PSTR FileName,PSTR SymbolPath,PSTR DebugFilePath,PFIND_DEBUG_FILE_CALLBACK Callback,PVOID CallerData); 613464ebd5Sriastradh BOOL IMAGEAPI SymFindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FoundFile,PFINDFILEINPATHCALLBACK callback,PVOID context); 623464ebd5Sriastradh HANDLE IMAGEAPI FindExecutableImage(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath); 633464ebd5Sriastradh HANDLE IMAGEAPI FindExecutableImageEx(PSTR FileName,PSTR SymbolPath,PSTR ImageFilePath,PFIND_EXE_FILE_CALLBACK Callback,PVOID CallerData); 643464ebd5Sriastradh PIMAGE_NT_HEADERS IMAGEAPI ImageNtHeader(PVOID Base); 653464ebd5Sriastradh PVOID IMAGEAPI ImageDirectoryEntryToDataEx(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size,PIMAGE_SECTION_HEADER *FoundHeader); 663464ebd5Sriastradh PVOID IMAGEAPI ImageDirectoryEntryToData(PVOID Base,BOOLEAN MappedAsImage,USHORT DirectoryEntry,PULONG Size); 673464ebd5Sriastradh PIMAGE_SECTION_HEADER IMAGEAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva); 683464ebd5Sriastradh PVOID IMAGEAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders,PVOID Base,ULONG Rva,PIMAGE_SECTION_HEADER *LastRvaSection); 693464ebd5Sriastradh 703464ebd5Sriastradh#define SSRVOPT_CALLBACK 0x0001 713464ebd5Sriastradh#define SSRVOPT_DWORD 0x0002 723464ebd5Sriastradh#define SSRVOPT_DWORDPTR 0x0004 733464ebd5Sriastradh#define SSRVOPT_GUIDPTR 0x0008 743464ebd5Sriastradh#define SSRVOPT_OLDGUIDPTR 0x0010 753464ebd5Sriastradh#define SSRVOPT_UNATTENDED 0x0020 763464ebd5Sriastradh#define SSRVOPT_NOCOPY 0x0040 773464ebd5Sriastradh#define SSRVOPT_PARENTWIN 0x0080 783464ebd5Sriastradh#define SSRVOPT_PARAMTYPE 0x0100 793464ebd5Sriastradh#define SSRVOPT_SECURE 0x0200 803464ebd5Sriastradh#define SSRVOPT_TRACE 0x0400 813464ebd5Sriastradh#define SSRVOPT_SETCONTEXT 0x0800 823464ebd5Sriastradh#define SSRVOPT_PROXY 0x1000 833464ebd5Sriastradh#define SSRVOPT_DOWNSTREAM_STORE 0x2000 843464ebd5Sriastradh#define SSRVOPT_RESET ((ULONG_PTR)-1) 853464ebd5Sriastradh 863464ebd5Sriastradh#define SSRVACTION_TRACE 1 873464ebd5Sriastradh#define SSRVACTION_QUERYCANCEL 2 883464ebd5Sriastradh#define SSRVACTION_EVENT 3 893464ebd5Sriastradh 903464ebd5Sriastradh#ifndef _WIN64 913464ebd5Sriastradh 923464ebd5Sriastradh typedef struct _IMAGE_DEBUG_INFORMATION { 933464ebd5Sriastradh LIST_ENTRY List; 943464ebd5Sriastradh DWORD ReservedSize; 953464ebd5Sriastradh PVOID ReservedMappedBase; 963464ebd5Sriastradh USHORT ReservedMachine; 973464ebd5Sriastradh USHORT ReservedCharacteristics; 983464ebd5Sriastradh DWORD ReservedCheckSum; 993464ebd5Sriastradh DWORD ImageBase; 1003464ebd5Sriastradh DWORD SizeOfImage; 1013464ebd5Sriastradh DWORD ReservedNumberOfSections; 1023464ebd5Sriastradh PIMAGE_SECTION_HEADER ReservedSections; 1033464ebd5Sriastradh DWORD ReservedExportedNamesSize; 1043464ebd5Sriastradh PSTR ReservedExportedNames; 1053464ebd5Sriastradh DWORD ReservedNumberOfFunctionTableEntries; 1063464ebd5Sriastradh PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries; 1073464ebd5Sriastradh DWORD ReservedLowestFunctionStartingAddress; 1083464ebd5Sriastradh DWORD ReservedHighestFunctionEndingAddress; 1093464ebd5Sriastradh DWORD ReservedNumberOfFpoTableEntries; 1103464ebd5Sriastradh PFPO_DATA ReservedFpoTableEntries; 1113464ebd5Sriastradh DWORD SizeOfCoffSymbols; 1123464ebd5Sriastradh PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols; 1133464ebd5Sriastradh DWORD ReservedSizeOfCodeViewSymbols; 1143464ebd5Sriastradh PVOID ReservedCodeViewSymbols; 1153464ebd5Sriastradh PSTR ImageFilePath; 1163464ebd5Sriastradh PSTR ImageFileName; 1173464ebd5Sriastradh PSTR ReservedDebugFilePath; 1183464ebd5Sriastradh DWORD ReservedTimeDateStamp; 1193464ebd5Sriastradh BOOL ReservedRomImage; 1203464ebd5Sriastradh PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory; 1213464ebd5Sriastradh DWORD ReservedNumberOfDebugDirectories; 1223464ebd5Sriastradh DWORD ReservedOriginalFunctionTableBaseAddress; 1233464ebd5Sriastradh DWORD Reserved[2 ]; 1243464ebd5Sriastradh } IMAGE_DEBUG_INFORMATION,*PIMAGE_DEBUG_INFORMATION; 1253464ebd5Sriastradh 1263464ebd5Sriastradh PIMAGE_DEBUG_INFORMATION IMAGEAPI MapDebugInformation(HANDLE FileHandle,PSTR FileName,PSTR SymbolPath,DWORD ImageBase); 1273464ebd5Sriastradh BOOL IMAGEAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo); 1283464ebd5Sriastradh#endif 1293464ebd5Sriastradh 1303464ebd5Sriastradh typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR FilePath,PVOID CallerData); 1313464ebd5Sriastradh 1323464ebd5Sriastradh BOOL IMAGEAPI SearchTreeForFile(PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer); 1333464ebd5Sriastradh BOOL IMAGEAPI EnumDirTree(HANDLE hProcess,PSTR RootPath,PSTR InputPathName,PSTR OutputPathBuffer,PENUMDIRTREE_CALLBACK Callback,PVOID CallbackData); 1343464ebd5Sriastradh BOOL IMAGEAPI MakeSureDirectoryPathExists(PCSTR DirPath); 1353464ebd5Sriastradh 1363464ebd5Sriastradh#define UNDNAME_COMPLETE (0x0000) 1373464ebd5Sriastradh#define UNDNAME_NO_LEADING_UNDERSCORES (0x0001) 1383464ebd5Sriastradh#define UNDNAME_NO_MS_KEYWORDS (0x0002) 1393464ebd5Sriastradh#define UNDNAME_NO_FUNCTION_RETURNS (0x0004) 1403464ebd5Sriastradh#define UNDNAME_NO_ALLOCATION_MODEL (0x0008) 1413464ebd5Sriastradh#define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010) 1423464ebd5Sriastradh#define UNDNAME_NO_MS_THISTYPE (0x0020) 1433464ebd5Sriastradh#define UNDNAME_NO_CV_THISTYPE (0x0040) 1443464ebd5Sriastradh#define UNDNAME_NO_THISTYPE (0x0060) 1453464ebd5Sriastradh#define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080) 1463464ebd5Sriastradh#define UNDNAME_NO_THROW_SIGNATURES (0x0100) 1473464ebd5Sriastradh#define UNDNAME_NO_MEMBER_TYPE (0x0200) 1483464ebd5Sriastradh#define UNDNAME_NO_RETURN_UDT_MODEL (0x0400) 1493464ebd5Sriastradh#define UNDNAME_32_BIT_DECODE (0x0800) 1503464ebd5Sriastradh#define UNDNAME_NAME_ONLY (0x1000) 1513464ebd5Sriastradh#define UNDNAME_NO_ARGUMENTS (0x2000) 1523464ebd5Sriastradh#define UNDNAME_NO_SPECIAL_SYMS (0x4000) 1533464ebd5Sriastradh 1543464ebd5Sriastradh DWORD IMAGEAPI WINAPI UnDecorateSymbolName(PCSTR DecoratedName,PSTR UnDecoratedName,DWORD UndecoratedLength,DWORD Flags); 1553464ebd5Sriastradh 1563464ebd5Sriastradh#define DBHHEADER_DEBUGDIRS 0x1 1573464ebd5Sriastradh 1583464ebd5Sriastradh typedef struct _MODLOAD_DATA { 1593464ebd5Sriastradh DWORD ssize; 1603464ebd5Sriastradh DWORD ssig; 1613464ebd5Sriastradh PVOID data; 1623464ebd5Sriastradh DWORD size; 1633464ebd5Sriastradh DWORD flags; 1643464ebd5Sriastradh } MODLOAD_DATA,*PMODLOAD_DATA; 1653464ebd5Sriastradh 1663464ebd5Sriastradh typedef enum { 1673464ebd5Sriastradh AddrMode1616,AddrMode1632,AddrModeReal,AddrModeFlat 1683464ebd5Sriastradh } ADDRESS_MODE; 1693464ebd5Sriastradh 1703464ebd5Sriastradh typedef struct _tagADDRESS64 { 1713464ebd5Sriastradh DWORD64 Offset; 1723464ebd5Sriastradh WORD Segment; 1733464ebd5Sriastradh ADDRESS_MODE Mode; 1743464ebd5Sriastradh } ADDRESS64,*LPADDRESS64; 1753464ebd5Sriastradh 1763464ebd5Sriastradh#ifdef _IMAGEHLP64 1773464ebd5Sriastradh#define ADDRESS ADDRESS64 1783464ebd5Sriastradh#define LPADDRESS LPADDRESS64 1793464ebd5Sriastradh#else 1803464ebd5Sriastradh typedef struct _tagADDRESS { 1813464ebd5Sriastradh DWORD Offset; 1823464ebd5Sriastradh WORD Segment; 1833464ebd5Sriastradh ADDRESS_MODE Mode; 1843464ebd5Sriastradh } ADDRESS,*LPADDRESS; 1853464ebd5Sriastradh 1863464ebd5Sriastradh static __inline void Address32To64(LPADDRESS a32,LPADDRESS64 a64) { 1873464ebd5Sriastradh a64->Offset = (ULONG64)(LONG64)(LONG)a32->Offset; 1883464ebd5Sriastradh a64->Segment = a32->Segment; 1893464ebd5Sriastradh a64->Mode = a32->Mode; 1903464ebd5Sriastradh } 1913464ebd5Sriastradh 1923464ebd5Sriastradh static __inline void Address64To32(LPADDRESS64 a64,LPADDRESS a32) { 1933464ebd5Sriastradh a32->Offset = (ULONG)a64->Offset; 1943464ebd5Sriastradh a32->Segment = a64->Segment; 1953464ebd5Sriastradh a32->Mode = a64->Mode; 1963464ebd5Sriastradh } 1973464ebd5Sriastradh#endif 1983464ebd5Sriastradh 1993464ebd5Sriastradh typedef struct _KDHELP64 { 2003464ebd5Sriastradh DWORD64 Thread; 2013464ebd5Sriastradh DWORD ThCallbackStack; 2023464ebd5Sriastradh DWORD ThCallbackBStore; 2033464ebd5Sriastradh DWORD NextCallback; 2043464ebd5Sriastradh DWORD FramePointer; 2053464ebd5Sriastradh DWORD64 KiCallUserMode; 2063464ebd5Sriastradh DWORD64 KeUserCallbackDispatcher; 2073464ebd5Sriastradh DWORD64 SystemRangeStart; 2083464ebd5Sriastradh DWORD64 Reserved[8]; 2093464ebd5Sriastradh } KDHELP64,*PKDHELP64; 2103464ebd5Sriastradh 2113464ebd5Sriastradh#ifdef _IMAGEHLP64 2123464ebd5Sriastradh#define KDHELP KDHELP64 2133464ebd5Sriastradh#define PKDHELP PKDHELP64 2143464ebd5Sriastradh#else 2153464ebd5Sriastradh typedef struct _KDHELP { 2163464ebd5Sriastradh DWORD Thread; 2173464ebd5Sriastradh DWORD ThCallbackStack; 2183464ebd5Sriastradh DWORD NextCallback; 2193464ebd5Sriastradh DWORD FramePointer; 2203464ebd5Sriastradh DWORD KiCallUserMode; 2213464ebd5Sriastradh DWORD KeUserCallbackDispatcher; 2223464ebd5Sriastradh DWORD SystemRangeStart; 2233464ebd5Sriastradh DWORD ThCallbackBStore; 2243464ebd5Sriastradh DWORD Reserved[8]; 2253464ebd5Sriastradh } KDHELP,*PKDHELP; 2263464ebd5Sriastradh 2273464ebd5Sriastradh static __inline void KdHelp32To64(PKDHELP p32,PKDHELP64 p64) { 2283464ebd5Sriastradh p64->Thread = p32->Thread; 2293464ebd5Sriastradh p64->ThCallbackStack = p32->ThCallbackStack; 2303464ebd5Sriastradh p64->NextCallback = p32->NextCallback; 2313464ebd5Sriastradh p64->FramePointer = p32->FramePointer; 2323464ebd5Sriastradh p64->KiCallUserMode = p32->KiCallUserMode; 2333464ebd5Sriastradh p64->KeUserCallbackDispatcher = p32->KeUserCallbackDispatcher; 2343464ebd5Sriastradh p64->SystemRangeStart = p32->SystemRangeStart; 2353464ebd5Sriastradh } 2363464ebd5Sriastradh#endif 2373464ebd5Sriastradh 2383464ebd5Sriastradh typedef struct _tagSTACKFRAME64 { 2393464ebd5Sriastradh ADDRESS64 AddrPC; 2403464ebd5Sriastradh ADDRESS64 AddrReturn; 2413464ebd5Sriastradh ADDRESS64 AddrFrame; 2423464ebd5Sriastradh ADDRESS64 AddrStack; 2433464ebd5Sriastradh ADDRESS64 AddrBStore; 2443464ebd5Sriastradh PVOID FuncTableEntry; 2453464ebd5Sriastradh DWORD64 Params[4]; 2463464ebd5Sriastradh BOOL Far; 2473464ebd5Sriastradh BOOL Virtual; 2483464ebd5Sriastradh DWORD64 Reserved[3]; 2493464ebd5Sriastradh KDHELP64 KdHelp; 2503464ebd5Sriastradh } STACKFRAME64,*LPSTACKFRAME64; 2513464ebd5Sriastradh 2523464ebd5Sriastradh#ifdef _IMAGEHLP64 2533464ebd5Sriastradh#define STACKFRAME STACKFRAME64 2543464ebd5Sriastradh#define LPSTACKFRAME LPSTACKFRAME64 2553464ebd5Sriastradh#else 2563464ebd5Sriastradh typedef struct _tagSTACKFRAME { 2573464ebd5Sriastradh ADDRESS AddrPC; 2583464ebd5Sriastradh ADDRESS AddrReturn; 2593464ebd5Sriastradh ADDRESS AddrFrame; 2603464ebd5Sriastradh ADDRESS AddrStack; 2613464ebd5Sriastradh PVOID FuncTableEntry; 2623464ebd5Sriastradh DWORD Params[4]; 2633464ebd5Sriastradh BOOL Far; 2643464ebd5Sriastradh BOOL Virtual; 2653464ebd5Sriastradh DWORD Reserved[3]; 2663464ebd5Sriastradh KDHELP KdHelp; 2673464ebd5Sriastradh ADDRESS AddrBStore; 2683464ebd5Sriastradh } STACKFRAME,*LPSTACKFRAME; 2693464ebd5Sriastradh#endif 2703464ebd5Sriastradh 2713464ebd5Sriastradh typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE64)(HANDLE hProcess,DWORD64 qwBaseAddress,PVOID lpBuffer,DWORD nSize,LPDWORD lpNumberOfBytesRead); 2723464ebd5Sriastradh typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE hProcess,DWORD64 AddrBase); 2733464ebd5Sriastradh typedef DWORD64 (WINAPI *PGET_MODULE_BASE_ROUTINE64)(HANDLE hProcess,DWORD64 Address); 2743464ebd5Sriastradh typedef DWORD64 (WINAPI *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE hProcess,HANDLE hThread,LPADDRESS64 lpaddr); 2753464ebd5Sriastradh 2763464ebd5Sriastradh 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); 2773464ebd5Sriastradh 2783464ebd5Sriastradh#ifdef _IMAGEHLP64 2793464ebd5Sriastradh#define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64 2803464ebd5Sriastradh#define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64 2813464ebd5Sriastradh#define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64 2823464ebd5Sriastradh#define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64 2833464ebd5Sriastradh#define StackWalk StackWalk64 2843464ebd5Sriastradh#else 2853464ebd5Sriastradh typedef BOOL (WINAPI *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE hProcess,DWORD lpBaseAddress,PVOID lpBuffer,DWORD nSize,PDWORD lpNumberOfBytesRead); 2863464ebd5Sriastradh typedef PVOID (WINAPI *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE hProcess,DWORD AddrBase); 2873464ebd5Sriastradh typedef DWORD (WINAPI *PGET_MODULE_BASE_ROUTINE)(HANDLE hProcess,DWORD Address); 2883464ebd5Sriastradh typedef DWORD (WINAPI *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE hProcess,HANDLE hThread,LPADDRESS lpaddr); 2893464ebd5Sriastradh 2903464ebd5Sriastradh 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); 2913464ebd5Sriastradh#endif 2923464ebd5Sriastradh 2933464ebd5Sriastradh#define API_VERSION_NUMBER 9 2943464ebd5Sriastradh 2953464ebd5Sriastradh typedef struct API_VERSION { 2963464ebd5Sriastradh USHORT MajorVersion; 2973464ebd5Sriastradh USHORT MinorVersion; 2983464ebd5Sriastradh USHORT Revision; 2993464ebd5Sriastradh USHORT Reserved; 3003464ebd5Sriastradh } API_VERSION,*LPAPI_VERSION; 3013464ebd5Sriastradh 3023464ebd5Sriastradh LPAPI_VERSION IMAGEAPI ImagehlpApiVersion(VOID); 3033464ebd5Sriastradh LPAPI_VERSION IMAGEAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion); 3043464ebd5Sriastradh DWORD IMAGEAPI GetTimestampForLoadedLibrary(HMODULE Module); 3053464ebd5Sriastradh 3063464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PSTR ModuleName,DWORD64 BaseOfDll,PVOID UserContext); 3073464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); 3083464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PWSTR SymbolName,DWORD64 SymbolAddress,ULONG SymbolSize,PVOID UserContext); 3093464ebd5Sriastradh typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PSTR ModuleName,DWORD64 ModuleBase,ULONG ModuleSize,PVOID UserContext); 3103464ebd5Sriastradh typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE hProcess,ULONG ActionCode,ULONG64 CallbackData,ULONG64 UserContext); 3113464ebd5Sriastradh typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE hProcess,DWORD AddrBase,PVOID UserContext); 3123464ebd5Sriastradh typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE hProcess,ULONG64 AddrBase,ULONG64 UserContext); 3133464ebd5Sriastradh 3143464ebd5Sriastradh#ifdef _IMAGEHLP64 3153464ebd5Sriastradh#define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64 3163464ebd5Sriastradh#define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64 3173464ebd5Sriastradh#define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACK64W 3183464ebd5Sriastradh#define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64 3193464ebd5Sriastradh#define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64 3203464ebd5Sriastradh#define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64 3213464ebd5Sriastradh#else 3223464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName,ULONG BaseOfDll,PVOID UserContext); 3233464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); 3243464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PWSTR SymbolName,ULONG SymbolAddress,ULONG SymbolSize,PVOID UserContext); 3253464ebd5Sriastradh typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName,ULONG ModuleBase,ULONG ModuleSize,PVOID UserContext); 3263464ebd5Sriastradh typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE hProcess,ULONG ActionCode,PVOID CallbackData,PVOID UserContext); 3273464ebd5Sriastradh#endif 3283464ebd5Sriastradh 3293464ebd5Sriastradh#define SYMFLAG_VALUEPRESENT 0x00000001 3303464ebd5Sriastradh#define SYMFLAG_REGISTER 0x00000008 3313464ebd5Sriastradh#define SYMFLAG_REGREL 0x00000010 3323464ebd5Sriastradh#define SYMFLAG_FRAMEREL 0x00000020 3333464ebd5Sriastradh#define SYMFLAG_PARAMETER 0x00000040 3343464ebd5Sriastradh#define SYMFLAG_LOCAL 0x00000080 3353464ebd5Sriastradh#define SYMFLAG_CONSTANT 0x00000100 3363464ebd5Sriastradh#define SYMFLAG_EXPORT 0x00000200 3373464ebd5Sriastradh#define SYMFLAG_FORWARDER 0x00000400 3383464ebd5Sriastradh#define SYMFLAG_FUNCTION 0x00000800 3393464ebd5Sriastradh#define SYMFLAG_VIRTUAL 0x00001000 3403464ebd5Sriastradh#define SYMFLAG_THUNK 0x00002000 3413464ebd5Sriastradh#define SYMFLAG_TLSREL 0x00004000 3423464ebd5Sriastradh 3433464ebd5Sriastradh typedef enum { 3443464ebd5Sriastradh SymNone = 0,SymCoff,SymCv,SymPdb,SymExport,SymDeferred,SymSym,SymDia,SymVirtual,NumSymTypes 3453464ebd5Sriastradh } SYM_TYPE; 3463464ebd5Sriastradh 3473464ebd5Sriastradh typedef struct _IMAGEHLP_SYMBOL64 { 3483464ebd5Sriastradh DWORD SizeOfStruct; 3493464ebd5Sriastradh DWORD64 Address; 3503464ebd5Sriastradh DWORD Size; 3513464ebd5Sriastradh DWORD Flags; 3523464ebd5Sriastradh DWORD MaxNameLength; 3533464ebd5Sriastradh CHAR Name[1]; 3543464ebd5Sriastradh } IMAGEHLP_SYMBOL64,*PIMAGEHLP_SYMBOL64; 3553464ebd5Sriastradh 3563464ebd5Sriastradh typedef struct _IMAGEHLP_SYMBOL64_PACKAGE { 3573464ebd5Sriastradh IMAGEHLP_SYMBOL64 sym; 3583464ebd5Sriastradh CHAR name[MAX_SYM_NAME + 1]; 3593464ebd5Sriastradh } IMAGEHLP_SYMBOL64_PACKAGE,*PIMAGEHLP_SYMBOL64_PACKAGE; 3603464ebd5Sriastradh 3613464ebd5Sriastradh#ifdef _IMAGEHLP64 3623464ebd5Sriastradh 3633464ebd5Sriastradh#define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64 3643464ebd5Sriastradh#define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64 3653464ebd5Sriastradh#define IMAGEHLP_SYMBOL_PACKAGE IMAGEHLP_SYMBOL64_PACKAGE 3663464ebd5Sriastradh#define PIMAGEHLP_SYMBOL_PACKAGE PIMAGEHLP_SYMBOL64_PACKAGE 3673464ebd5Sriastradh#else 3683464ebd5Sriastradh 3693464ebd5Sriastradh typedef struct _IMAGEHLP_SYMBOL { 3703464ebd5Sriastradh DWORD SizeOfStruct; 3713464ebd5Sriastradh DWORD Address; 3723464ebd5Sriastradh DWORD Size; 3733464ebd5Sriastradh DWORD Flags; 3743464ebd5Sriastradh DWORD MaxNameLength; 3753464ebd5Sriastradh CHAR Name[1]; 3763464ebd5Sriastradh } IMAGEHLP_SYMBOL,*PIMAGEHLP_SYMBOL; 3773464ebd5Sriastradh 3783464ebd5Sriastradh typedef struct _IMAGEHLP_SYMBOL_PACKAGE { 3793464ebd5Sriastradh IMAGEHLP_SYMBOL sym; 3803464ebd5Sriastradh CHAR name[MAX_SYM_NAME + 1]; 3813464ebd5Sriastradh } IMAGEHLP_SYMBOL_PACKAGE,*PIMAGEHLP_SYMBOL_PACKAGE; 3823464ebd5Sriastradh#endif 3833464ebd5Sriastradh 3843464ebd5Sriastradh typedef struct _IMAGEHLP_MODULE64 { 3853464ebd5Sriastradh DWORD SizeOfStruct; 3863464ebd5Sriastradh DWORD64 BaseOfImage; 3873464ebd5Sriastradh DWORD ImageSize; 3883464ebd5Sriastradh DWORD TimeDateStamp; 3893464ebd5Sriastradh DWORD CheckSum; 3903464ebd5Sriastradh DWORD NumSyms; 3913464ebd5Sriastradh SYM_TYPE SymType; 3923464ebd5Sriastradh CHAR ModuleName[32]; 3933464ebd5Sriastradh CHAR ImageName[256]; 3943464ebd5Sriastradh CHAR LoadedImageName[256]; 3953464ebd5Sriastradh CHAR LoadedPdbName[256]; 3963464ebd5Sriastradh DWORD CVSig; 3973464ebd5Sriastradh CHAR CVData[MAX_PATH*3]; 3983464ebd5Sriastradh DWORD PdbSig; 3993464ebd5Sriastradh GUID PdbSig70; 4003464ebd5Sriastradh DWORD PdbAge; 4013464ebd5Sriastradh BOOL PdbUnmatched; 4023464ebd5Sriastradh BOOL DbgUnmatched; 4033464ebd5Sriastradh BOOL LineNumbers; 4043464ebd5Sriastradh BOOL GlobalSymbols; 4053464ebd5Sriastradh BOOL TypeInfo; 4063464ebd5Sriastradh } IMAGEHLP_MODULE64,*PIMAGEHLP_MODULE64; 4073464ebd5Sriastradh 4083464ebd5Sriastradh typedef struct _IMAGEHLP_MODULE64W { 4093464ebd5Sriastradh DWORD SizeOfStruct; 4103464ebd5Sriastradh DWORD64 BaseOfImage; 4113464ebd5Sriastradh DWORD ImageSize; 4123464ebd5Sriastradh DWORD TimeDateStamp; 4133464ebd5Sriastradh DWORD CheckSum; 4143464ebd5Sriastradh DWORD NumSyms; 4153464ebd5Sriastradh SYM_TYPE SymType; 4163464ebd5Sriastradh WCHAR ModuleName[32]; 4173464ebd5Sriastradh WCHAR ImageName[256]; 4183464ebd5Sriastradh WCHAR LoadedImageName[256]; 4193464ebd5Sriastradh WCHAR LoadedPdbName[256]; 4203464ebd5Sriastradh DWORD CVSig; 4213464ebd5Sriastradh WCHAR CVData[MAX_PATH*3]; 4223464ebd5Sriastradh DWORD PdbSig; 4233464ebd5Sriastradh GUID PdbSig70; 4243464ebd5Sriastradh DWORD PdbAge; 4253464ebd5Sriastradh BOOL PdbUnmatched; 4263464ebd5Sriastradh BOOL DbgUnmatched; 4273464ebd5Sriastradh BOOL LineNumbers; 4283464ebd5Sriastradh BOOL GlobalSymbols; 4293464ebd5Sriastradh BOOL TypeInfo; 4303464ebd5Sriastradh } IMAGEHLP_MODULEW64,*PIMAGEHLP_MODULEW64; 4313464ebd5Sriastradh 4323464ebd5Sriastradh#ifdef _IMAGEHLP64 4333464ebd5Sriastradh#define IMAGEHLP_MODULE IMAGEHLP_MODULE64 4343464ebd5Sriastradh#define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64 4353464ebd5Sriastradh#define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64 4363464ebd5Sriastradh#define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64 4373464ebd5Sriastradh#else 4383464ebd5Sriastradh typedef struct _IMAGEHLP_MODULE { 4393464ebd5Sriastradh DWORD SizeOfStruct; 4403464ebd5Sriastradh DWORD BaseOfImage; 4413464ebd5Sriastradh DWORD ImageSize; 4423464ebd5Sriastradh DWORD TimeDateStamp; 4433464ebd5Sriastradh DWORD CheckSum; 4443464ebd5Sriastradh DWORD NumSyms; 4453464ebd5Sriastradh SYM_TYPE SymType; 4463464ebd5Sriastradh CHAR ModuleName[32]; 4473464ebd5Sriastradh CHAR ImageName[256]; 4483464ebd5Sriastradh CHAR LoadedImageName[256]; 4493464ebd5Sriastradh } IMAGEHLP_MODULE,*PIMAGEHLP_MODULE; 4503464ebd5Sriastradh 4513464ebd5Sriastradh typedef struct _IMAGEHLP_MODULEW { 4523464ebd5Sriastradh DWORD SizeOfStruct; 4533464ebd5Sriastradh DWORD BaseOfImage; 4543464ebd5Sriastradh DWORD ImageSize; 4553464ebd5Sriastradh DWORD TimeDateStamp; 4563464ebd5Sriastradh DWORD CheckSum; 4573464ebd5Sriastradh DWORD NumSyms; 4583464ebd5Sriastradh SYM_TYPE SymType; 4593464ebd5Sriastradh WCHAR ModuleName[32]; 4603464ebd5Sriastradh WCHAR ImageName[256]; 4613464ebd5Sriastradh WCHAR LoadedImageName[256]; 4623464ebd5Sriastradh } IMAGEHLP_MODULEW,*PIMAGEHLP_MODULEW; 4633464ebd5Sriastradh#endif 4643464ebd5Sriastradh 4653464ebd5Sriastradh typedef struct _IMAGEHLP_LINE64 { 4663464ebd5Sriastradh DWORD SizeOfStruct; 4673464ebd5Sriastradh PVOID Key; 4683464ebd5Sriastradh DWORD LineNumber; 4693464ebd5Sriastradh PCHAR FileName; 4703464ebd5Sriastradh DWORD64 Address; 4713464ebd5Sriastradh } IMAGEHLP_LINE64,*PIMAGEHLP_LINE64; 4723464ebd5Sriastradh 4733464ebd5Sriastradh#ifdef _IMAGEHLP64 4743464ebd5Sriastradh#define IMAGEHLP_LINE IMAGEHLP_LINE64 4753464ebd5Sriastradh#define PIMAGEHLP_LINE PIMAGEHLP_LINE64 4763464ebd5Sriastradh#else 4773464ebd5Sriastradh typedef struct _IMAGEHLP_LINE { 4783464ebd5Sriastradh DWORD SizeOfStruct; 4793464ebd5Sriastradh PVOID Key; 4803464ebd5Sriastradh DWORD LineNumber; 4813464ebd5Sriastradh PCHAR FileName; 4823464ebd5Sriastradh DWORD Address; 4833464ebd5Sriastradh } IMAGEHLP_LINE,*PIMAGEHLP_LINE; 4843464ebd5Sriastradh#endif 4853464ebd5Sriastradh 4863464ebd5Sriastradh typedef struct _SOURCEFILE { 4873464ebd5Sriastradh DWORD64 ModBase; 4883464ebd5Sriastradh PCHAR FileName; 4893464ebd5Sriastradh } SOURCEFILE,*PSOURCEFILE; 4903464ebd5Sriastradh 4913464ebd5Sriastradh#define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001 4923464ebd5Sriastradh#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002 4933464ebd5Sriastradh#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003 4943464ebd5Sriastradh#define CBA_SYMBOLS_UNLOADED 0x00000004 4953464ebd5Sriastradh#define CBA_DUPLICATE_SYMBOL 0x00000005 4963464ebd5Sriastradh#define CBA_READ_MEMORY 0x00000006 4973464ebd5Sriastradh#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007 4983464ebd5Sriastradh#define CBA_SET_OPTIONS 0x00000008 4993464ebd5Sriastradh#define CBA_EVENT 0x00000010 5003464ebd5Sriastradh#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020 5013464ebd5Sriastradh#define CBA_DEBUG_INFO 0x10000000 5023464ebd5Sriastradh 5033464ebd5Sriastradh typedef struct _IMAGEHLP_CBA_READ_MEMORY { 5043464ebd5Sriastradh DWORD64 addr; 5053464ebd5Sriastradh PVOID buf; 5063464ebd5Sriastradh DWORD bytes; 5073464ebd5Sriastradh DWORD *bytesread; 5083464ebd5Sriastradh } IMAGEHLP_CBA_READ_MEMORY,*PIMAGEHLP_CBA_READ_MEMORY; 5093464ebd5Sriastradh 5103464ebd5Sriastradh enum { 5113464ebd5Sriastradh sevInfo = 0,sevProblem,sevAttn,sevFatal,sevMax 5123464ebd5Sriastradh }; 5133464ebd5Sriastradh 5143464ebd5Sriastradh typedef struct _IMAGEHLP_CBA_EVENT { 5153464ebd5Sriastradh DWORD severity; 5163464ebd5Sriastradh DWORD code; 5173464ebd5Sriastradh PCHAR desc; 5183464ebd5Sriastradh PVOID object; 5193464ebd5Sriastradh } IMAGEHLP_CBA_EVENT,*PIMAGEHLP_CBA_EVENT; 5203464ebd5Sriastradh 5213464ebd5Sriastradh typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64 { 5223464ebd5Sriastradh DWORD SizeOfStruct; 5233464ebd5Sriastradh DWORD64 BaseOfImage; 5243464ebd5Sriastradh DWORD CheckSum; 5253464ebd5Sriastradh DWORD TimeDateStamp; 5263464ebd5Sriastradh CHAR FileName[MAX_PATH]; 5273464ebd5Sriastradh BOOLEAN Reparse; 5283464ebd5Sriastradh HANDLE hFile; 5293464ebd5Sriastradh DWORD Flags; 5303464ebd5Sriastradh } IMAGEHLP_DEFERRED_SYMBOL_LOAD64,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD64; 5313464ebd5Sriastradh 5323464ebd5Sriastradh#define DSLFLAG_MISMATCHED_PDB 0x1 5333464ebd5Sriastradh#define DSLFLAG_MISMATCHED_DBG 0x2 5343464ebd5Sriastradh 5353464ebd5Sriastradh#ifdef _IMAGEHLP64 5363464ebd5Sriastradh#define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64 5373464ebd5Sriastradh#define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64 5383464ebd5Sriastradh#else 5393464ebd5Sriastradh typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD { 5403464ebd5Sriastradh DWORD SizeOfStruct; 5413464ebd5Sriastradh DWORD BaseOfImage; 5423464ebd5Sriastradh DWORD CheckSum; 5433464ebd5Sriastradh DWORD TimeDateStamp; 5443464ebd5Sriastradh CHAR FileName[MAX_PATH]; 5453464ebd5Sriastradh BOOLEAN Reparse; 5463464ebd5Sriastradh HANDLE hFile; 5473464ebd5Sriastradh } IMAGEHLP_DEFERRED_SYMBOL_LOAD,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD; 5483464ebd5Sriastradh#endif 5493464ebd5Sriastradh 5503464ebd5Sriastradh typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64 { 5513464ebd5Sriastradh DWORD SizeOfStruct; 5523464ebd5Sriastradh DWORD NumberOfDups; 5533464ebd5Sriastradh PIMAGEHLP_SYMBOL64 Symbol; 5543464ebd5Sriastradh DWORD SelectedSymbol; 5553464ebd5Sriastradh } IMAGEHLP_DUPLICATE_SYMBOL64,*PIMAGEHLP_DUPLICATE_SYMBOL64; 5563464ebd5Sriastradh 5573464ebd5Sriastradh#ifdef _IMAGEHLP64 5583464ebd5Sriastradh#define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64 5593464ebd5Sriastradh#define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64 5603464ebd5Sriastradh#else 5613464ebd5Sriastradh typedef struct _IMAGEHLP_DUPLICATE_SYMBOL { 5623464ebd5Sriastradh DWORD SizeOfStruct; 5633464ebd5Sriastradh DWORD NumberOfDups; 5643464ebd5Sriastradh PIMAGEHLP_SYMBOL Symbol; 5653464ebd5Sriastradh DWORD SelectedSymbol; 5663464ebd5Sriastradh } IMAGEHLP_DUPLICATE_SYMBOL,*PIMAGEHLP_DUPLICATE_SYMBOL; 5673464ebd5Sriastradh#endif 5683464ebd5Sriastradh 5693464ebd5Sriastradh BOOL IMAGEAPI SymSetParentWindow(HWND hwnd); 5703464ebd5Sriastradh PCHAR IMAGEAPI SymSetHomeDirectory(PCSTR dir); 5713464ebd5Sriastradh PCHAR IMAGEAPI SymGetHomeDirectory(DWORD type,PSTR dir,size_t size); 5723464ebd5Sriastradh 5733464ebd5Sriastradh enum { 5743464ebd5Sriastradh hdBase = 0,hdSym,hdSrc,hdMax 5753464ebd5Sriastradh }; 5763464ebd5Sriastradh 5773464ebd5Sriastradh#define SYMOPT_CASE_INSENSITIVE 0x00000001 5783464ebd5Sriastradh#define SYMOPT_UNDNAME 0x00000002 5793464ebd5Sriastradh#define SYMOPT_DEFERRED_LOADS 0x00000004 5803464ebd5Sriastradh#define SYMOPT_NO_CPP 0x00000008 5813464ebd5Sriastradh#define SYMOPT_LOAD_LINES 0x00000010 5823464ebd5Sriastradh#define SYMOPT_OMAP_FIND_NEAREST 0x00000020 5833464ebd5Sriastradh#define SYMOPT_LOAD_ANYTHING 0x00000040 5843464ebd5Sriastradh#define SYMOPT_IGNORE_CVREC 0x00000080 5853464ebd5Sriastradh#define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100 5863464ebd5Sriastradh#define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200 5873464ebd5Sriastradh#define SYMOPT_EXACT_SYMBOLS 0x00000400 5883464ebd5Sriastradh#define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800 5893464ebd5Sriastradh#define SYMOPT_IGNORE_NT_SYMPATH 0x00001000 5903464ebd5Sriastradh#define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000 5913464ebd5Sriastradh#define SYMOPT_PUBLICS_ONLY 0x00004000 5923464ebd5Sriastradh#define SYMOPT_NO_PUBLICS 0x00008000 5933464ebd5Sriastradh#define SYMOPT_AUTO_PUBLICS 0x00010000 5943464ebd5Sriastradh#define SYMOPT_NO_IMAGE_SEARCH 0x00020000 5953464ebd5Sriastradh#define SYMOPT_SECURE 0x00040000 5963464ebd5Sriastradh#define SYMOPT_NO_PROMPTS 0x00080000 5973464ebd5Sriastradh 5983464ebd5Sriastradh#define SYMOPT_DEBUG 0x80000000 5993464ebd5Sriastradh 6003464ebd5Sriastradh DWORD IMAGEAPI SymSetOptions(DWORD SymOptions); 6013464ebd5Sriastradh DWORD IMAGEAPI SymGetOptions(VOID); 6023464ebd5Sriastradh BOOL IMAGEAPI SymCleanup(HANDLE hProcess); 6033464ebd5Sriastradh BOOL IMAGEAPI SymMatchString(LPSTR string,LPSTR expression,BOOL fCase); 6043464ebd5Sriastradh 6053464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,PVOID UserContext); 6063464ebd5Sriastradh 6073464ebd5Sriastradh BOOL IMAGEAPI SymEnumSourceFiles(HANDLE hProcess,ULONG64 ModBase,LPSTR Mask,PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,PVOID UserContext); 6083464ebd5Sriastradh BOOL IMAGEAPI SymEnumerateModules64(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK64 EnumModulesCallback,PVOID UserContext); 6093464ebd5Sriastradh 6103464ebd5Sriastradh#ifdef _IMAGEHLP64 6113464ebd5Sriastradh#define SymEnumerateModules SymEnumerateModules64 6123464ebd5Sriastradh#else 6133464ebd5Sriastradh BOOL IMAGEAPI SymEnumerateModules(HANDLE hProcess,PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,PVOID UserContext); 6143464ebd5Sriastradh#endif 6153464ebd5Sriastradh 6163464ebd5Sriastradh BOOL IMAGEAPI SymEnumerateSymbols64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64 EnumSymbolsCallback,PVOID UserContext); 6173464ebd5Sriastradh BOOL IMAGEAPI SymEnumerateSymbolsW64(HANDLE hProcess,DWORD64 BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK64W EnumSymbolsCallback,PVOID UserContext); 6183464ebd5Sriastradh 6193464ebd5Sriastradh#ifdef _IMAGEHLP64 6203464ebd5Sriastradh#define SymEnumerateSymbols SymEnumerateSymbols64 6213464ebd5Sriastradh#define SymEnumerateSymbolsW SymEnumerateSymbolsW64 6223464ebd5Sriastradh#else 6233464ebd5Sriastradh BOOL IMAGEAPI SymEnumerateSymbols(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 6243464ebd5Sriastradh BOOL IMAGEAPI SymEnumerateSymbolsW(HANDLE hProcess,DWORD BaseOfDll,PSYM_ENUMSYMBOLS_CALLBACKW EnumSymbolsCallback,PVOID UserContext); 6253464ebd5Sriastradh#endif 6263464ebd5Sriastradh 6273464ebd5Sriastradh BOOL IMAGEAPI EnumerateLoadedModules64(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK64 EnumLoadedModulesCallback,PVOID UserContext); 6283464ebd5Sriastradh#ifdef _IMAGEHLP64 6293464ebd5Sriastradh#define EnumerateLoadedModules EnumerateLoadedModules64 6303464ebd5Sriastradh#else 6313464ebd5Sriastradh BOOL IMAGEAPI EnumerateLoadedModules(HANDLE hProcess,PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,PVOID UserContext); 6323464ebd5Sriastradh#endif 6333464ebd5Sriastradh 6343464ebd5Sriastradh PVOID IMAGEAPI SymFunctionTableAccess64(HANDLE hProcess,DWORD64 AddrBase); 6353464ebd5Sriastradh 6363464ebd5Sriastradh#ifdef _IMAGEHLP64 6373464ebd5Sriastradh#define SymFunctionTableAccess SymFunctionTableAccess64 6383464ebd5Sriastradh#else 6393464ebd5Sriastradh PVOID IMAGEAPI SymFunctionTableAccess(HANDLE hProcess,DWORD AddrBase); 6403464ebd5Sriastradh#endif 6413464ebd5Sriastradh 6423464ebd5Sriastradh BOOL IMAGEAPI SymGetModuleInfo64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULE64 ModuleInfo); 6433464ebd5Sriastradh BOOL IMAGEAPI SymGetModuleInfoW64(HANDLE hProcess,DWORD64 qwAddr,PIMAGEHLP_MODULEW64 ModuleInfo); 6443464ebd5Sriastradh 6453464ebd5Sriastradh#ifdef _IMAGEHLP64 6463464ebd5Sriastradh#define SymGetModuleInfo SymGetModuleInfo64 6473464ebd5Sriastradh#define SymGetModuleInfoW SymGetModuleInfoW64 6483464ebd5Sriastradh#else 6493464ebd5Sriastradh BOOL IMAGEAPI SymGetModuleInfo(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULE ModuleInfo); 6503464ebd5Sriastradh BOOL IMAGEAPI SymGetModuleInfoW(HANDLE hProcess,DWORD dwAddr,PIMAGEHLP_MODULEW ModuleInfo); 6513464ebd5Sriastradh#endif 6523464ebd5Sriastradh 6533464ebd5Sriastradh DWORD64 IMAGEAPI SymGetModuleBase64(HANDLE hProcess,DWORD64 qwAddr); 6543464ebd5Sriastradh 6553464ebd5Sriastradh#ifdef _IMAGEHLP64 6563464ebd5Sriastradh#define SymGetModuleBase SymGetModuleBase64 6573464ebd5Sriastradh#else 6583464ebd5Sriastradh DWORD IMAGEAPI SymGetModuleBase(HANDLE hProcess,DWORD dwAddr); 6593464ebd5Sriastradh#endif 6603464ebd5Sriastradh 6613464ebd5Sriastradh BOOL IMAGEAPI SymGetSymNext64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); 6623464ebd5Sriastradh 6633464ebd5Sriastradh#ifdef _IMAGEHLP64 6643464ebd5Sriastradh#define SymGetSymNext SymGetSymNext64 6653464ebd5Sriastradh#else 6663464ebd5Sriastradh BOOL IMAGEAPI SymGetSymNext(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); 6673464ebd5Sriastradh#endif 6683464ebd5Sriastradh 6693464ebd5Sriastradh BOOL IMAGEAPI SymGetSymPrev64(HANDLE hProcess,PIMAGEHLP_SYMBOL64 Symbol); 6703464ebd5Sriastradh 6713464ebd5Sriastradh#ifdef _IMAGEHLP64 6723464ebd5Sriastradh#define SymGetSymPrev SymGetSymPrev64 6733464ebd5Sriastradh#else 6743464ebd5Sriastradh BOOL IMAGEAPI SymGetSymPrev(HANDLE hProcess,PIMAGEHLP_SYMBOL Symbol); 6753464ebd5Sriastradh#endif 6763464ebd5Sriastradh 6773464ebd5Sriastradh typedef struct _SRCCODEINFO { 6783464ebd5Sriastradh DWORD SizeOfStruct; 6793464ebd5Sriastradh PVOID Key; 6803464ebd5Sriastradh DWORD64 ModBase; 6813464ebd5Sriastradh CHAR Obj[MAX_PATH + 1]; 6823464ebd5Sriastradh CHAR FileName[MAX_PATH + 1]; 6833464ebd5Sriastradh DWORD LineNumber; 6843464ebd5Sriastradh DWORD64 Address; 6853464ebd5Sriastradh } SRCCODEINFO,*PSRCCODEINFO; 6863464ebd5Sriastradh 6873464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO LineInfo,PVOID UserContext); 6883464ebd5Sriastradh 6893464ebd5Sriastradh BOOL IMAGEAPI SymEnumLines(HANDLE hProcess,ULONG64 Base,PCSTR Obj,PCSTR File,PSYM_ENUMLINES_CALLBACK EnumLinesCallback,PVOID UserContext); 6903464ebd5Sriastradh BOOL IMAGEAPI SymGetLineFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE64 Line64); 6913464ebd5Sriastradh 6923464ebd5Sriastradh#ifdef _IMAGEHLP64 6933464ebd5Sriastradh#define SymGetLineFromAddr SymGetLineFromAddr64 6943464ebd5Sriastradh#else 6953464ebd5Sriastradh BOOL IMAGEAPI SymGetLineFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_LINE Line); 6963464ebd5Sriastradh#endif 6973464ebd5Sriastradh 6983464ebd5Sriastradh BOOL IMAGEAPI SymGetLineFromName64(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE64 Line); 6993464ebd5Sriastradh 7003464ebd5Sriastradh#ifdef _IMAGEHLP64 7013464ebd5Sriastradh#define SymGetLineFromName SymGetLineFromName64 7023464ebd5Sriastradh#else 7033464ebd5Sriastradh BOOL IMAGEAPI SymGetLineFromName(HANDLE hProcess,PSTR ModuleName,PSTR FileName,DWORD dwLineNumber,PLONG plDisplacement,PIMAGEHLP_LINE Line); 7043464ebd5Sriastradh#endif 7053464ebd5Sriastradh 7063464ebd5Sriastradh BOOL IMAGEAPI SymGetLineNext64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); 7073464ebd5Sriastradh 7083464ebd5Sriastradh#ifdef _IMAGEHLP64 7093464ebd5Sriastradh#define SymGetLineNext SymGetLineNext64 7103464ebd5Sriastradh#else 7113464ebd5Sriastradh BOOL IMAGEAPI SymGetLineNext(HANDLE hProcess,PIMAGEHLP_LINE Line); 7123464ebd5Sriastradh#endif 7133464ebd5Sriastradh 7143464ebd5Sriastradh BOOL IMAGEAPI SymGetLinePrev64(HANDLE hProcess,PIMAGEHLP_LINE64 Line); 7153464ebd5Sriastradh 7163464ebd5Sriastradh#ifdef _IMAGEHLP64 7173464ebd5Sriastradh#define SymGetLinePrev SymGetLinePrev64 7183464ebd5Sriastradh#else 7193464ebd5Sriastradh BOOL IMAGEAPI SymGetLinePrev(HANDLE hProcess,PIMAGEHLP_LINE Line); 7203464ebd5Sriastradh#endif 7213464ebd5Sriastradh 7223464ebd5Sriastradh BOOL IMAGEAPI SymMatchFileName(PSTR FileName,PSTR Match,PSTR *FileNameStop,PSTR *MatchStop); 7233464ebd5Sriastradh BOOL IMAGEAPI SymInitialize(HANDLE hProcess,PSTR UserSearchPath,BOOL fInvadeProcess); 7243464ebd5Sriastradh BOOL IMAGEAPI SymGetSearchPath(HANDLE hProcess,PSTR SearchPath,DWORD SearchPathLength); 7253464ebd5Sriastradh BOOL IMAGEAPI SymSetSearchPath(HANDLE hProcess,PSTR SearchPath); 7263464ebd5Sriastradh DWORD64 IMAGEAPI SymLoadModule64(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD SizeOfDll); 7273464ebd5Sriastradh 7283464ebd5Sriastradh#define SLMFLAG_VIRTUAL 0x1 7293464ebd5Sriastradh 7303464ebd5Sriastradh DWORD64 IMAGEAPI SymLoadModuleEx(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD64 BaseOfDll,DWORD DllSize,PMODLOAD_DATA Data,DWORD Flags); 7313464ebd5Sriastradh 7323464ebd5Sriastradh#ifdef _IMAGEHLP64 7333464ebd5Sriastradh#define SymLoadModule SymLoadModule64 7343464ebd5Sriastradh#else 7353464ebd5Sriastradh DWORD IMAGEAPI SymLoadModule(HANDLE hProcess,HANDLE hFile,PSTR ImageName,PSTR ModuleName,DWORD BaseOfDll,DWORD SizeOfDll); 7363464ebd5Sriastradh#endif 7373464ebd5Sriastradh 7383464ebd5Sriastradh BOOL IMAGEAPI SymUnloadModule64(HANDLE hProcess,DWORD64 BaseOfDll); 7393464ebd5Sriastradh 7403464ebd5Sriastradh#ifdef _IMAGEHLP64 7413464ebd5Sriastradh#define SymUnloadModule SymUnloadModule64 7423464ebd5Sriastradh#else 7433464ebd5Sriastradh BOOL IMAGEAPI SymUnloadModule(HANDLE hProcess,DWORD BaseOfDll); 7443464ebd5Sriastradh#endif 7453464ebd5Sriastradh 7463464ebd5Sriastradh BOOL IMAGEAPI SymUnDName64(PIMAGEHLP_SYMBOL64 sym,PSTR UnDecName,DWORD UnDecNameLength); 7473464ebd5Sriastradh 7483464ebd5Sriastradh#ifdef _IMAGEHLP64 7493464ebd5Sriastradh#define SymUnDName SymUnDName64 7503464ebd5Sriastradh#else 7513464ebd5Sriastradh BOOL IMAGEAPI SymUnDName(PIMAGEHLP_SYMBOL sym,PSTR UnDecName,DWORD UnDecNameLength); 7523464ebd5Sriastradh#endif 7533464ebd5Sriastradh 7543464ebd5Sriastradh BOOL IMAGEAPI SymRegisterCallback64(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction,ULONG64 UserContext); 7553464ebd5Sriastradh 7563464ebd5Sriastradh BOOL IMAGEAPI SymRegisterFunctionEntryCallback64(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK64 CallbackFunction,ULONG64 UserContext); 7573464ebd5Sriastradh 7583464ebd5Sriastradh#ifdef _IMAGEHLP64 7593464ebd5Sriastradh#define SymRegisterCallback SymRegisterCallback64 7603464ebd5Sriastradh#define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64 7613464ebd5Sriastradh#else 7623464ebd5Sriastradh BOOL IMAGEAPI SymRegisterCallback(HANDLE hProcess,PSYMBOL_REGISTERED_CALLBACK CallbackFunction,PVOID UserContext); 7633464ebd5Sriastradh BOOL IMAGEAPI SymRegisterFunctionEntryCallback(HANDLE hProcess,PSYMBOL_FUNCENTRY_CALLBACK CallbackFunction,PVOID UserContext); 7643464ebd5Sriastradh#endif 7653464ebd5Sriastradh 7663464ebd5Sriastradh typedef struct _IMAGEHLP_SYMBOL_SRC { 7673464ebd5Sriastradh DWORD sizeofstruct; 7683464ebd5Sriastradh DWORD type; 7693464ebd5Sriastradh char file[MAX_PATH]; 7703464ebd5Sriastradh } IMAGEHLP_SYMBOL_SRC,*PIMAGEHLP_SYMBOL_SRC; 7713464ebd5Sriastradh 7723464ebd5Sriastradh typedef struct _MODULE_TYPE_INFO { 7733464ebd5Sriastradh USHORT dataLength; 7743464ebd5Sriastradh USHORT leaf; 7753464ebd5Sriastradh BYTE data[1]; 7763464ebd5Sriastradh } MODULE_TYPE_INFO,*PMODULE_TYPE_INFO; 7773464ebd5Sriastradh 7783464ebd5Sriastradh typedef struct _SYMBOL_INFO { 7793464ebd5Sriastradh ULONG SizeOfStruct; 7803464ebd5Sriastradh ULONG TypeIndex; 7813464ebd5Sriastradh ULONG64 Reserved[2]; 7823464ebd5Sriastradh ULONG info; 7833464ebd5Sriastradh ULONG Size; 7843464ebd5Sriastradh ULONG64 ModBase; 7853464ebd5Sriastradh ULONG Flags; 7863464ebd5Sriastradh ULONG64 Value; 7873464ebd5Sriastradh ULONG64 Address; 7883464ebd5Sriastradh ULONG Register; 7893464ebd5Sriastradh ULONG Scope; 7903464ebd5Sriastradh ULONG Tag; 7913464ebd5Sriastradh ULONG NameLen; 7923464ebd5Sriastradh ULONG MaxNameLen; 7933464ebd5Sriastradh CHAR Name[1]; 7943464ebd5Sriastradh } SYMBOL_INFO,*PSYMBOL_INFO; 7953464ebd5Sriastradh 7963464ebd5Sriastradh typedef struct _SYMBOL_INFO_PACKAGE { 7973464ebd5Sriastradh SYMBOL_INFO si; 7983464ebd5Sriastradh CHAR name[MAX_SYM_NAME + 1]; 7993464ebd5Sriastradh } SYMBOL_INFO_PACKAGE,*PSYMBOL_INFO_PACKAGE; 8003464ebd5Sriastradh 8013464ebd5Sriastradh typedef struct _IMAGEHLP_STACK_FRAME 8023464ebd5Sriastradh { 8033464ebd5Sriastradh ULONG64 InstructionOffset; 8043464ebd5Sriastradh ULONG64 ReturnOffset; 8053464ebd5Sriastradh ULONG64 FrameOffset; 8063464ebd5Sriastradh ULONG64 StackOffset; 8073464ebd5Sriastradh ULONG64 BackingStoreOffset; 8083464ebd5Sriastradh ULONG64 FuncTableEntry; 8093464ebd5Sriastradh ULONG64 Params[4]; 8103464ebd5Sriastradh ULONG64 Reserved[5]; 8113464ebd5Sriastradh BOOL Virtual; 8123464ebd5Sriastradh ULONG Reserved2; 8133464ebd5Sriastradh } IMAGEHLP_STACK_FRAME,*PIMAGEHLP_STACK_FRAME; 8143464ebd5Sriastradh 8153464ebd5Sriastradh typedef VOID IMAGEHLP_CONTEXT,*PIMAGEHLP_CONTEXT; 8163464ebd5Sriastradh 8173464ebd5Sriastradh BOOL IMAGEAPI SymSetContext(HANDLE hProcess,PIMAGEHLP_STACK_FRAME StackFrame,PIMAGEHLP_CONTEXT Context); 8183464ebd5Sriastradh BOOL IMAGEAPI SymFromAddr(HANDLE hProcess,DWORD64 Address,PDWORD64 Displacement,PSYMBOL_INFO Symbol); 8193464ebd5Sriastradh BOOL IMAGEAPI SymFromToken(HANDLE hProcess,DWORD64 Base,DWORD Token,PSYMBOL_INFO Symbol); 8203464ebd5Sriastradh BOOL IMAGEAPI SymFromName(HANDLE hProcess,LPSTR Name,PSYMBOL_INFO Symbol); 8213464ebd5Sriastradh 8223464ebd5Sriastradh typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,ULONG SymbolSize,PVOID UserContext); 8233464ebd5Sriastradh 8243464ebd5Sriastradh BOOL IMAGEAPI SymEnumSymbols(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Mask,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 8253464ebd5Sriastradh BOOL IMAGEAPI SymEnumSymbolsForAddr(HANDLE hProcess,DWORD64 Address,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 8263464ebd5Sriastradh 8273464ebd5Sriastradh#define SYMENUMFLAG_FULLSRCH 1 8283464ebd5Sriastradh#define SYMENUMFLAG_SPEEDSRCH 2 8293464ebd5Sriastradh 8303464ebd5Sriastradh typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO { 8313464ebd5Sriastradh TI_GET_SYMTAG,TI_GET_SYMNAME,TI_GET_LENGTH,TI_GET_TYPE,TI_GET_TYPEID,TI_GET_BASETYPE,TI_GET_ARRAYINDEXTYPEID,TI_FINDCHILDREN, 8323464ebd5Sriastradh TI_GET_DATAKIND,TI_GET_ADDRESSOFFSET,TI_GET_OFFSET,TI_GET_VALUE,TI_GET_COUNT,TI_GET_CHILDRENCOUNT,TI_GET_BITPOSITION,TI_GET_VIRTUALBASECLASS, 8333464ebd5Sriastradh TI_GET_VIRTUALTABLESHAPEID,TI_GET_VIRTUALBASEPOINTEROFFSET,TI_GET_CLASSPARENTID,TI_GET_NESTED,TI_GET_SYMINDEX,TI_GET_LEXICALPARENT, 8343464ebd5Sriastradh TI_GET_ADDRESS,TI_GET_THISADJUST,TI_GET_UDTKIND,TI_IS_EQUIV_TO,TI_GET_CALLING_CONVENTION 8353464ebd5Sriastradh } IMAGEHLP_SYMBOL_TYPE_INFO; 8363464ebd5Sriastradh 8373464ebd5Sriastradh typedef struct _TI_FINDCHILDREN_PARAMS { 8383464ebd5Sriastradh ULONG Count; 8393464ebd5Sriastradh ULONG Start; 8403464ebd5Sriastradh ULONG ChildId[1]; 8413464ebd5Sriastradh } TI_FINDCHILDREN_PARAMS; 8423464ebd5Sriastradh 8433464ebd5Sriastradh BOOL IMAGEAPI SymGetTypeInfo(HANDLE hProcess,DWORD64 ModBase,ULONG TypeId,IMAGEHLP_SYMBOL_TYPE_INFO GetType,PVOID pInfo); 8443464ebd5Sriastradh BOOL IMAGEAPI SymEnumTypes(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 8453464ebd5Sriastradh BOOL IMAGEAPI SymGetTypeFromName(HANDLE hProcess,ULONG64 BaseOfDll,LPSTR Name,PSYMBOL_INFO Symbol); 8463464ebd5Sriastradh BOOL IMAGEAPI SymAddSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Size,DWORD Flags); 8473464ebd5Sriastradh BOOL IMAGEAPI SymDeleteSymbol(HANDLE hProcess,ULONG64 BaseOfDll,PCSTR Name,DWORD64 Address,DWORD Flags); 8483464ebd5Sriastradh 8493464ebd5Sriastradh typedef BOOL (WINAPI *PDBGHELP_CREATE_USER_DUMP_CALLBACK)(DWORD DataType,PVOID *Data,LPDWORD DataLength,PVOID UserData); 8503464ebd5Sriastradh 8513464ebd5Sriastradh BOOL WINAPI DbgHelpCreateUserDump(LPSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); 8523464ebd5Sriastradh BOOL WINAPI DbgHelpCreateUserDumpW(LPWSTR FileName,PDBGHELP_CREATE_USER_DUMP_CALLBACK Callback,PVOID UserData); 8533464ebd5Sriastradh BOOL IMAGEAPI SymGetSymFromAddr64(HANDLE hProcess,DWORD64 qwAddr,PDWORD64 pdwDisplacement,PIMAGEHLP_SYMBOL64 Symbol); 8543464ebd5Sriastradh 8553464ebd5Sriastradh#ifdef _IMAGEHLP64 8563464ebd5Sriastradh#define SymGetSymFromAddr SymGetSymFromAddr64 8573464ebd5Sriastradh#else 8583464ebd5Sriastradh BOOL IMAGEAPI SymGetSymFromAddr(HANDLE hProcess,DWORD dwAddr,PDWORD pdwDisplacement,PIMAGEHLP_SYMBOL Symbol); 8593464ebd5Sriastradh#endif 8603464ebd5Sriastradh 8613464ebd5Sriastradh BOOL IMAGEAPI SymGetSymFromName64(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL64 Symbol); 8623464ebd5Sriastradh 8633464ebd5Sriastradh#ifdef _IMAGEHLP64 8643464ebd5Sriastradh#define SymGetSymFromName SymGetSymFromName64 8653464ebd5Sriastradh#else 8663464ebd5Sriastradh BOOL IMAGEAPI SymGetSymFromName(HANDLE hProcess,PSTR Name,PIMAGEHLP_SYMBOL Symbol); 8673464ebd5Sriastradh#endif 8683464ebd5Sriastradh 8693464ebd5Sriastradh DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,PVOID id,DWORD two,DWORD three,DWORD flags,LPSTR FilePath); 8703464ebd5Sriastradh DBHLP_DEPRECIATED BOOL IMAGEAPI FindFileInSearchPath(HANDLE hprocess,LPSTR SearchPath,LPSTR FileName,DWORD one,DWORD two,DWORD three,LPSTR FilePath); 8713464ebd5Sriastradh DBHLP_DEPRECIATED BOOL IMAGEAPI SymEnumSym(HANDLE hProcess,ULONG64 BaseOfDll,PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,PVOID UserContext); 8723464ebd5Sriastradh 8733464ebd5Sriastradh#define SYMF_OMAP_GENERATED 0x00000001 8743464ebd5Sriastradh#define SYMF_OMAP_MODIFIED 0x00000002 8753464ebd5Sriastradh#define SYMF_REGISTER 0x00000008 8763464ebd5Sriastradh#define SYMF_REGREL 0x00000010 8773464ebd5Sriastradh#define SYMF_FRAMEREL 0x00000020 8783464ebd5Sriastradh#define SYMF_PARAMETER 0x00000040 8793464ebd5Sriastradh#define SYMF_LOCAL 0x00000080 8803464ebd5Sriastradh#define SYMF_CONSTANT 0x00000100 8813464ebd5Sriastradh#define SYMF_EXPORT 0x00000200 8823464ebd5Sriastradh#define SYMF_FORWARDER 0x00000400 8833464ebd5Sriastradh#define SYMF_FUNCTION 0x00000800 8843464ebd5Sriastradh#define SYMF_VIRTUAL 0x00001000 8853464ebd5Sriastradh#define SYMF_THUNK 0x00002000 8863464ebd5Sriastradh#define SYMF_TLSREL 0x00004000 8873464ebd5Sriastradh 8883464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1 8893464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER 8903464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL 8913464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL 8923464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER 8933464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL 8943464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT 8953464ebd5Sriastradh#define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION 8963464ebd5Sriastradh#define IMAGEHLP_SYMBOL_VIRTUAL SYMF_VIRTUAL 8973464ebd5Sriastradh#define IMAGEHLP_SYMBOL_THUNK SYMF_THUNK 8983464ebd5Sriastradh#define IMAGEHLP_SYMBOL_INFO_TLSRELATIVE SYMF_TLSREL 8993464ebd5Sriastradh 9003464ebd5Sriastradh#include <pshpack4.h> 9013464ebd5Sriastradh 9023464ebd5Sriastradh#define MINIDUMP_SIGNATURE ('PMDM') 9033464ebd5Sriastradh#define MINIDUMP_VERSION (42899) 9043464ebd5Sriastradh typedef DWORD RVA; 9053464ebd5Sriastradh typedef ULONG64 RVA64; 9063464ebd5Sriastradh 9073464ebd5Sriastradh typedef struct _MINIDUMP_LOCATION_DESCRIPTOR { 9083464ebd5Sriastradh ULONG32 DataSize; 9093464ebd5Sriastradh RVA Rva; 9103464ebd5Sriastradh } MINIDUMP_LOCATION_DESCRIPTOR; 9113464ebd5Sriastradh 9123464ebd5Sriastradh typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 { 9133464ebd5Sriastradh ULONG64 DataSize; 9143464ebd5Sriastradh RVA64 Rva; 9153464ebd5Sriastradh } MINIDUMP_LOCATION_DESCRIPTOR64; 9163464ebd5Sriastradh 9173464ebd5Sriastradh typedef struct _MINIDUMP_MEMORY_DESCRIPTOR { 9183464ebd5Sriastradh ULONG64 StartOfMemoryRange; 9193464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR Memory; 9203464ebd5Sriastradh } MINIDUMP_MEMORY_DESCRIPTOR,*PMINIDUMP_MEMORY_DESCRIPTOR; 9213464ebd5Sriastradh 9223464ebd5Sriastradh typedef struct _MINIDUMP_MEMORY_DESCRIPTOR64 { 9233464ebd5Sriastradh ULONG64 StartOfMemoryRange; 9243464ebd5Sriastradh ULONG64 DataSize; 9253464ebd5Sriastradh } MINIDUMP_MEMORY_DESCRIPTOR64,*PMINIDUMP_MEMORY_DESCRIPTOR64; 9263464ebd5Sriastradh 9273464ebd5Sriastradh typedef struct _MINIDUMP_HEADER { 9283464ebd5Sriastradh ULONG32 Signature; 9293464ebd5Sriastradh ULONG32 Version; 9303464ebd5Sriastradh ULONG32 NumberOfStreams; 9313464ebd5Sriastradh RVA StreamDirectoryRva; 9323464ebd5Sriastradh ULONG32 CheckSum; 9333464ebd5Sriastradh union { 9343464ebd5Sriastradh ULONG32 Reserved; 9353464ebd5Sriastradh ULONG32 TimeDateStamp; 9363464ebd5Sriastradh } DUMMYUNIONNAME; 9373464ebd5Sriastradh ULONG64 Flags; 9383464ebd5Sriastradh } MINIDUMP_HEADER,*PMINIDUMP_HEADER; 9393464ebd5Sriastradh 9403464ebd5Sriastradh typedef struct _MINIDUMP_DIRECTORY { 9413464ebd5Sriastradh ULONG32 StreamType; 9423464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR Location; 9433464ebd5Sriastradh } MINIDUMP_DIRECTORY,*PMINIDUMP_DIRECTORY; 9443464ebd5Sriastradh 9453464ebd5Sriastradh typedef struct _MINIDUMP_STRING { 9463464ebd5Sriastradh ULONG32 Length; 9473464ebd5Sriastradh WCHAR Buffer [0]; 9483464ebd5Sriastradh } MINIDUMP_STRING,*PMINIDUMP_STRING; 9493464ebd5Sriastradh 9503464ebd5Sriastradh typedef enum _MINIDUMP_STREAM_TYPE { 9513464ebd5Sriastradh UnusedStream = 0,ReservedStream0 = 1,ReservedStream1 = 2,ThreadListStream = 3,ModuleListStream = 4,MemoryListStream = 5, 9523464ebd5Sriastradh ExceptionStream = 6,SystemInfoStream = 7,ThreadExListStream = 8,Memory64ListStream = 9,CommentStreamA = 10,CommentStreamW = 11, 9533464ebd5Sriastradh HandleDataStream = 12,FunctionTableStream = 13,UnloadedModuleListStream = 14,MiscInfoStream = 15,LastReservedStream = 0xffff 9543464ebd5Sriastradh } MINIDUMP_STREAM_TYPE; 9553464ebd5Sriastradh 9563464ebd5Sriastradh typedef union _CPU_INFORMATION { 9573464ebd5Sriastradh struct { 9583464ebd5Sriastradh ULONG32 VendorId [3 ]; 9593464ebd5Sriastradh ULONG32 VersionInformation; 9603464ebd5Sriastradh ULONG32 FeatureInformation; 9613464ebd5Sriastradh ULONG32 AMDExtendedCpuFeatures; 9623464ebd5Sriastradh } X86CpuInfo; 9633464ebd5Sriastradh struct { 9643464ebd5Sriastradh ULONG64 ProcessorFeatures [2 ]; 9653464ebd5Sriastradh } OtherCpuInfo; 9663464ebd5Sriastradh } CPU_INFORMATION,*PCPU_INFORMATION; 9673464ebd5Sriastradh 9683464ebd5Sriastradh typedef struct _MINIDUMP_SYSTEM_INFO { 9693464ebd5Sriastradh USHORT ProcessorArchitecture; 9703464ebd5Sriastradh USHORT ProcessorLevel; 9713464ebd5Sriastradh USHORT ProcessorRevision; 9723464ebd5Sriastradh union { 9733464ebd5Sriastradh USHORT Reserved0; 9743464ebd5Sriastradh struct { 9753464ebd5Sriastradh UCHAR NumberOfProcessors; 9763464ebd5Sriastradh UCHAR ProductType; 9773464ebd5Sriastradh } DUMMYSTRUCTNAME; 9783464ebd5Sriastradh } DUMMYUNIONNAME; 9793464ebd5Sriastradh ULONG32 MajorVersion; 9803464ebd5Sriastradh ULONG32 MinorVersion; 9813464ebd5Sriastradh ULONG32 BuildNumber; 9823464ebd5Sriastradh ULONG32 PlatformId; 9833464ebd5Sriastradh RVA CSDVersionRva; 9843464ebd5Sriastradh union { 9853464ebd5Sriastradh ULONG32 Reserved1; 9863464ebd5Sriastradh struct { 9873464ebd5Sriastradh USHORT SuiteMask; 9883464ebd5Sriastradh USHORT Reserved2; 9893464ebd5Sriastradh } DUMMYSTRUCTNAME; 9903464ebd5Sriastradh } DUMMYUNIONNAME1; 9913464ebd5Sriastradh CPU_INFORMATION Cpu; 9923464ebd5Sriastradh } MINIDUMP_SYSTEM_INFO,*PMINIDUMP_SYSTEM_INFO; 9933464ebd5Sriastradh 9943464ebd5Sriastradh C_ASSERT (sizeof (((PPROCESS_INFORMATION)0)->dwThreadId)==4); 9953464ebd5Sriastradh 9963464ebd5Sriastradh typedef struct _MINIDUMP_THREAD { 9973464ebd5Sriastradh ULONG32 ThreadId; 9983464ebd5Sriastradh ULONG32 SuspendCount; 9993464ebd5Sriastradh ULONG32 PriorityClass; 10003464ebd5Sriastradh ULONG32 Priority; 10013464ebd5Sriastradh ULONG64 Teb; 10023464ebd5Sriastradh MINIDUMP_MEMORY_DESCRIPTOR Stack; 10033464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; 10043464ebd5Sriastradh } MINIDUMP_THREAD,*PMINIDUMP_THREAD; 10053464ebd5Sriastradh 10063464ebd5Sriastradh typedef struct _MINIDUMP_THREAD_LIST { 10073464ebd5Sriastradh ULONG32 NumberOfThreads; 10083464ebd5Sriastradh MINIDUMP_THREAD Threads [0]; 10093464ebd5Sriastradh } MINIDUMP_THREAD_LIST,*PMINIDUMP_THREAD_LIST; 10103464ebd5Sriastradh 10113464ebd5Sriastradh typedef struct _MINIDUMP_THREAD_EX { 10123464ebd5Sriastradh ULONG32 ThreadId; 10133464ebd5Sriastradh ULONG32 SuspendCount; 10143464ebd5Sriastradh ULONG32 PriorityClass; 10153464ebd5Sriastradh ULONG32 Priority; 10163464ebd5Sriastradh ULONG64 Teb; 10173464ebd5Sriastradh MINIDUMP_MEMORY_DESCRIPTOR Stack; 10183464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; 10193464ebd5Sriastradh MINIDUMP_MEMORY_DESCRIPTOR BackingStore; 10203464ebd5Sriastradh } MINIDUMP_THREAD_EX,*PMINIDUMP_THREAD_EX; 10213464ebd5Sriastradh 10223464ebd5Sriastradh typedef struct _MINIDUMP_THREAD_EX_LIST { 10233464ebd5Sriastradh ULONG32 NumberOfThreads; 10243464ebd5Sriastradh MINIDUMP_THREAD_EX Threads [0]; 10253464ebd5Sriastradh } MINIDUMP_THREAD_EX_LIST,*PMINIDUMP_THREAD_EX_LIST; 10263464ebd5Sriastradh 10273464ebd5Sriastradh typedef struct _MINIDUMP_EXCEPTION { 10283464ebd5Sriastradh ULONG32 ExceptionCode; 10293464ebd5Sriastradh ULONG32 ExceptionFlags; 10303464ebd5Sriastradh ULONG64 ExceptionRecord; 10313464ebd5Sriastradh ULONG64 ExceptionAddress; 10323464ebd5Sriastradh ULONG32 NumberParameters; 10333464ebd5Sriastradh ULONG32 __unusedAlignment; 10343464ebd5Sriastradh ULONG64 ExceptionInformation [EXCEPTION_MAXIMUM_PARAMETERS ]; 10353464ebd5Sriastradh } MINIDUMP_EXCEPTION,*PMINIDUMP_EXCEPTION; 10363464ebd5Sriastradh 10373464ebd5Sriastradh typedef struct MINIDUMP_EXCEPTION_STREAM { 10383464ebd5Sriastradh ULONG32 ThreadId; 10393464ebd5Sriastradh ULONG32 __alignment; 10403464ebd5Sriastradh MINIDUMP_EXCEPTION ExceptionRecord; 10413464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR ThreadContext; 10423464ebd5Sriastradh } MINIDUMP_EXCEPTION_STREAM,*PMINIDUMP_EXCEPTION_STREAM; 10433464ebd5Sriastradh 10443464ebd5Sriastradh typedef struct _MINIDUMP_MODULE { 10453464ebd5Sriastradh ULONG64 BaseOfImage; 10463464ebd5Sriastradh ULONG32 SizeOfImage; 10473464ebd5Sriastradh ULONG32 CheckSum; 10483464ebd5Sriastradh ULONG32 TimeDateStamp; 10493464ebd5Sriastradh RVA ModuleNameRva; 10503464ebd5Sriastradh VS_FIXEDFILEINFO VersionInfo; 10513464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR CvRecord; 10523464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR MiscRecord; 10533464ebd5Sriastradh ULONG64 Reserved0; 10543464ebd5Sriastradh ULONG64 Reserved1; 10553464ebd5Sriastradh } MINIDUMP_MODULE,*PMINIDUMP_MODULE; 10563464ebd5Sriastradh 10573464ebd5Sriastradh typedef struct _MINIDUMP_MODULE_LIST { 10583464ebd5Sriastradh ULONG32 NumberOfModules; 10593464ebd5Sriastradh MINIDUMP_MODULE Modules [0 ]; 10603464ebd5Sriastradh } MINIDUMP_MODULE_LIST,*PMINIDUMP_MODULE_LIST; 10613464ebd5Sriastradh 10623464ebd5Sriastradh typedef struct _MINIDUMP_MEMORY_LIST { 10633464ebd5Sriastradh ULONG32 NumberOfMemoryRanges; 10643464ebd5Sriastradh MINIDUMP_MEMORY_DESCRIPTOR MemoryRanges [0]; 10653464ebd5Sriastradh } MINIDUMP_MEMORY_LIST,*PMINIDUMP_MEMORY_LIST; 10663464ebd5Sriastradh 10673464ebd5Sriastradh typedef struct _MINIDUMP_MEMORY64_LIST { 10683464ebd5Sriastradh ULONG64 NumberOfMemoryRanges; 10693464ebd5Sriastradh RVA64 BaseRva; 10703464ebd5Sriastradh MINIDUMP_MEMORY_DESCRIPTOR64 MemoryRanges [0]; 10713464ebd5Sriastradh } MINIDUMP_MEMORY64_LIST,*PMINIDUMP_MEMORY64_LIST; 10723464ebd5Sriastradh 10733464ebd5Sriastradh typedef struct _MINIDUMP_EXCEPTION_INFORMATION { 10743464ebd5Sriastradh DWORD ThreadId; 10753464ebd5Sriastradh PEXCEPTION_POINTERS ExceptionPointers; 10763464ebd5Sriastradh BOOL ClientPointers; 10773464ebd5Sriastradh } MINIDUMP_EXCEPTION_INFORMATION,*PMINIDUMP_EXCEPTION_INFORMATION; 10783464ebd5Sriastradh 10793464ebd5Sriastradh typedef struct _MINIDUMP_EXCEPTION_INFORMATION64 { 10803464ebd5Sriastradh DWORD ThreadId; 10813464ebd5Sriastradh ULONG64 ExceptionRecord; 10823464ebd5Sriastradh ULONG64 ContextRecord; 10833464ebd5Sriastradh BOOL ClientPointers; 10843464ebd5Sriastradh } MINIDUMP_EXCEPTION_INFORMATION64,*PMINIDUMP_EXCEPTION_INFORMATION64; 10853464ebd5Sriastradh 10863464ebd5Sriastradh typedef struct _MINIDUMP_HANDLE_DESCRIPTOR { 10873464ebd5Sriastradh ULONG64 Handle; 10883464ebd5Sriastradh RVA TypeNameRva; 10893464ebd5Sriastradh RVA ObjectNameRva; 10903464ebd5Sriastradh ULONG32 Attributes; 10913464ebd5Sriastradh ULONG32 GrantedAccess; 10923464ebd5Sriastradh ULONG32 HandleCount; 10933464ebd5Sriastradh ULONG32 PointerCount; 10943464ebd5Sriastradh } MINIDUMP_HANDLE_DESCRIPTOR,*PMINIDUMP_HANDLE_DESCRIPTOR; 10953464ebd5Sriastradh 10963464ebd5Sriastradh typedef struct _MINIDUMP_HANDLE_DATA_STREAM { 10973464ebd5Sriastradh ULONG32 SizeOfHeader; 10983464ebd5Sriastradh ULONG32 SizeOfDescriptor; 10993464ebd5Sriastradh ULONG32 NumberOfDescriptors; 11003464ebd5Sriastradh ULONG32 Reserved; 11013464ebd5Sriastradh } MINIDUMP_HANDLE_DATA_STREAM,*PMINIDUMP_HANDLE_DATA_STREAM; 11023464ebd5Sriastradh 11033464ebd5Sriastradh typedef struct _MINIDUMP_FUNCTION_TABLE_DESCRIPTOR { 11043464ebd5Sriastradh ULONG64 MinimumAddress; 11053464ebd5Sriastradh ULONG64 MaximumAddress; 11063464ebd5Sriastradh ULONG64 BaseAddress; 11073464ebd5Sriastradh ULONG32 EntryCount; 11083464ebd5Sriastradh ULONG32 SizeOfAlignPad; 11093464ebd5Sriastradh } MINIDUMP_FUNCTION_TABLE_DESCRIPTOR,*PMINIDUMP_FUNCTION_TABLE_DESCRIPTOR; 11103464ebd5Sriastradh 11113464ebd5Sriastradh typedef struct _MINIDUMP_FUNCTION_TABLE_STREAM { 11123464ebd5Sriastradh ULONG32 SizeOfHeader; 11133464ebd5Sriastradh ULONG32 SizeOfDescriptor; 11143464ebd5Sriastradh ULONG32 SizeOfNativeDescriptor; 11153464ebd5Sriastradh ULONG32 SizeOfFunctionEntry; 11163464ebd5Sriastradh ULONG32 NumberOfDescriptors; 11173464ebd5Sriastradh ULONG32 SizeOfAlignPad; 11183464ebd5Sriastradh } MINIDUMP_FUNCTION_TABLE_STREAM,*PMINIDUMP_FUNCTION_TABLE_STREAM; 11193464ebd5Sriastradh 11203464ebd5Sriastradh typedef struct _MINIDUMP_UNLOADED_MODULE { 11213464ebd5Sriastradh ULONG64 BaseOfImage; 11223464ebd5Sriastradh ULONG32 SizeOfImage; 11233464ebd5Sriastradh ULONG32 CheckSum; 11243464ebd5Sriastradh ULONG32 TimeDateStamp; 11253464ebd5Sriastradh RVA ModuleNameRva; 11263464ebd5Sriastradh } MINIDUMP_UNLOADED_MODULE,*PMINIDUMP_UNLOADED_MODULE; 11273464ebd5Sriastradh 11283464ebd5Sriastradh typedef struct _MINIDUMP_UNLOADED_MODULE_LIST { 11293464ebd5Sriastradh ULONG32 SizeOfHeader; 11303464ebd5Sriastradh ULONG32 SizeOfEntry; 11313464ebd5Sriastradh ULONG32 NumberOfEntries; 11323464ebd5Sriastradh } MINIDUMP_UNLOADED_MODULE_LIST,*PMINIDUMP_UNLOADED_MODULE_LIST; 11333464ebd5Sriastradh 11343464ebd5Sriastradh#define MINIDUMP_MISC1_PROCESS_ID 0x00000001 11353464ebd5Sriastradh#define MINIDUMP_MISC1_PROCESS_TIMES 0x00000002 11363464ebd5Sriastradh 11373464ebd5Sriastradh typedef struct _MINIDUMP_MISC_INFO { 11383464ebd5Sriastradh ULONG32 SizeOfInfo; 11393464ebd5Sriastradh ULONG32 Flags1; 11403464ebd5Sriastradh ULONG32 ProcessId; 11413464ebd5Sriastradh ULONG32 ProcessCreateTime; 11423464ebd5Sriastradh ULONG32 ProcessUserTime; 11433464ebd5Sriastradh ULONG32 ProcessKernelTime; 11443464ebd5Sriastradh } MINIDUMP_MISC_INFO,*PMINIDUMP_MISC_INFO; 11453464ebd5Sriastradh 11463464ebd5Sriastradh typedef struct _MINIDUMP_USER_RECORD { 11473464ebd5Sriastradh ULONG32 Type; 11483464ebd5Sriastradh MINIDUMP_LOCATION_DESCRIPTOR Memory; 11493464ebd5Sriastradh } MINIDUMP_USER_RECORD,*PMINIDUMP_USER_RECORD; 11503464ebd5Sriastradh 11513464ebd5Sriastradh typedef struct _MINIDUMP_USER_STREAM { 11523464ebd5Sriastradh ULONG32 Type; 11533464ebd5Sriastradh ULONG BufferSize; 11543464ebd5Sriastradh PVOID Buffer; 11553464ebd5Sriastradh } MINIDUMP_USER_STREAM,*PMINIDUMP_USER_STREAM; 11563464ebd5Sriastradh 11573464ebd5Sriastradh typedef struct _MINIDUMP_USER_STREAM_INFORMATION { 11583464ebd5Sriastradh ULONG UserStreamCount; 11593464ebd5Sriastradh PMINIDUMP_USER_STREAM UserStreamArray; 11603464ebd5Sriastradh } MINIDUMP_USER_STREAM_INFORMATION,*PMINIDUMP_USER_STREAM_INFORMATION; 11613464ebd5Sriastradh 11623464ebd5Sriastradh typedef enum _MINIDUMP_CALLBACK_TYPE { 11633464ebd5Sriastradh ModuleCallback,ThreadCallback,ThreadExCallback,IncludeThreadCallback,IncludeModuleCallback,MemoryCallback 11643464ebd5Sriastradh } MINIDUMP_CALLBACK_TYPE; 11653464ebd5Sriastradh 11663464ebd5Sriastradh typedef struct _MINIDUMP_THREAD_CALLBACK { 11673464ebd5Sriastradh ULONG ThreadId; 11683464ebd5Sriastradh HANDLE ThreadHandle; 11693464ebd5Sriastradh CONTEXT Context; 11703464ebd5Sriastradh ULONG SizeOfContext; 11713464ebd5Sriastradh ULONG64 StackBase; 11723464ebd5Sriastradh ULONG64 StackEnd; 11733464ebd5Sriastradh } MINIDUMP_THREAD_CALLBACK,*PMINIDUMP_THREAD_CALLBACK; 11743464ebd5Sriastradh 11753464ebd5Sriastradh typedef struct _MINIDUMP_THREAD_EX_CALLBACK { 11763464ebd5Sriastradh ULONG ThreadId; 11773464ebd5Sriastradh HANDLE ThreadHandle; 11783464ebd5Sriastradh CONTEXT Context; 11793464ebd5Sriastradh ULONG SizeOfContext; 11803464ebd5Sriastradh ULONG64 StackBase; 11813464ebd5Sriastradh ULONG64 StackEnd; 11823464ebd5Sriastradh ULONG64 BackingStoreBase; 11833464ebd5Sriastradh ULONG64 BackingStoreEnd; 11843464ebd5Sriastradh } MINIDUMP_THREAD_EX_CALLBACK,*PMINIDUMP_THREAD_EX_CALLBACK; 11853464ebd5Sriastradh 11863464ebd5Sriastradh typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK { 11873464ebd5Sriastradh ULONG ThreadId; 11883464ebd5Sriastradh } MINIDUMP_INCLUDE_THREAD_CALLBACK,*PMINIDUMP_INCLUDE_THREAD_CALLBACK; 11893464ebd5Sriastradh 11903464ebd5Sriastradh typedef enum _THREAD_WRITE_FLAGS { 11913464ebd5Sriastradh ThreadWriteThread = 0x0001,ThreadWriteStack = 0x0002,ThreadWriteContext = 0x0004,ThreadWriteBackingStore = 0x0008, 11923464ebd5Sriastradh ThreadWriteInstructionWindow = 0x0010,ThreadWriteThreadData = 0x0020 11933464ebd5Sriastradh } THREAD_WRITE_FLAGS; 11943464ebd5Sriastradh 11953464ebd5Sriastradh typedef struct _MINIDUMP_MODULE_CALLBACK { 11963464ebd5Sriastradh PWCHAR FullPath; 11973464ebd5Sriastradh ULONG64 BaseOfImage; 11983464ebd5Sriastradh ULONG SizeOfImage; 11993464ebd5Sriastradh ULONG CheckSum; 12003464ebd5Sriastradh ULONG TimeDateStamp; 12013464ebd5Sriastradh VS_FIXEDFILEINFO VersionInfo; 12023464ebd5Sriastradh PVOID CvRecord; 12033464ebd5Sriastradh ULONG SizeOfCvRecord; 12043464ebd5Sriastradh PVOID MiscRecord; 12053464ebd5Sriastradh ULONG SizeOfMiscRecord; 12063464ebd5Sriastradh } MINIDUMP_MODULE_CALLBACK,*PMINIDUMP_MODULE_CALLBACK; 12073464ebd5Sriastradh 12083464ebd5Sriastradh typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK { 12093464ebd5Sriastradh ULONG64 BaseOfImage; 12103464ebd5Sriastradh } MINIDUMP_INCLUDE_MODULE_CALLBACK,*PMINIDUMP_INCLUDE_MODULE_CALLBACK; 12113464ebd5Sriastradh 12123464ebd5Sriastradh typedef enum _MODULE_WRITE_FLAGS { 12133464ebd5Sriastradh ModuleWriteModule = 0x0001,ModuleWriteDataSeg = 0x0002,ModuleWriteMiscRecord = 0x0004,ModuleWriteCvRecord = 0x0008, 12143464ebd5Sriastradh ModuleReferencedByMemory = 0x0010 12153464ebd5Sriastradh } MODULE_WRITE_FLAGS; 12163464ebd5Sriastradh 12173464ebd5Sriastradh typedef struct _MINIDUMP_CALLBACK_INPUT { 12183464ebd5Sriastradh ULONG ProcessId; 12193464ebd5Sriastradh HANDLE ProcessHandle; 12203464ebd5Sriastradh ULONG CallbackType; 12213464ebd5Sriastradh union { 12223464ebd5Sriastradh MINIDUMP_THREAD_CALLBACK Thread; 12233464ebd5Sriastradh MINIDUMP_THREAD_EX_CALLBACK ThreadEx; 12243464ebd5Sriastradh MINIDUMP_MODULE_CALLBACK Module; 12253464ebd5Sriastradh MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread; 12263464ebd5Sriastradh MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule; 12273464ebd5Sriastradh } DUMMYUNIONNAME; 12283464ebd5Sriastradh } MINIDUMP_CALLBACK_INPUT,*PMINIDUMP_CALLBACK_INPUT; 12293464ebd5Sriastradh 12303464ebd5Sriastradh typedef struct _MINIDUMP_CALLBACK_OUTPUT { 12313464ebd5Sriastradh union { 12323464ebd5Sriastradh ULONG ModuleWriteFlags; 12333464ebd5Sriastradh ULONG ThreadWriteFlags; 12343464ebd5Sriastradh struct { 12353464ebd5Sriastradh ULONG64 MemoryBase; 12363464ebd5Sriastradh ULONG MemorySize; 12373464ebd5Sriastradh } DUMMYSTRUCTNAME; 12383464ebd5Sriastradh } DUMMYUNIONNAME; 12393464ebd5Sriastradh } MINIDUMP_CALLBACK_OUTPUT,*PMINIDUMP_CALLBACK_OUTPUT; 12403464ebd5Sriastradh 12413464ebd5Sriastradh typedef enum _MINIDUMP_TYPE { 12423464ebd5Sriastradh MiniDumpNormal = 0x0000,MiniDumpWithDataSegs = 0x0001,MiniDumpWithFullMemory = 0x0002,MiniDumpWithHandleData = 0x0004, 12433464ebd5Sriastradh MiniDumpFilterMemory = 0x0008,MiniDumpScanMemory = 0x0010,MiniDumpWithUnloadedModules = 0x0020,MiniDumpWithIndirectlyReferencedMemory = 0x0040, 12443464ebd5Sriastradh MiniDumpFilterModulePaths = 0x0080,MiniDumpWithProcessThreadData = 0x0100,MiniDumpWithPrivateReadWriteMemory = 0x0200, 12453464ebd5Sriastradh MiniDumpWithoutOptionalData = 0x0400 12463464ebd5Sriastradh } MINIDUMP_TYPE; 12473464ebd5Sriastradh 12483464ebd5Sriastradh typedef BOOL (WINAPI *MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,PMINIDUMP_CALLBACK_OUTPUT CallbackOutput); 12493464ebd5Sriastradh 12503464ebd5Sriastradh typedef struct _MINIDUMP_CALLBACK_INFORMATION { 12513464ebd5Sriastradh MINIDUMP_CALLBACK_ROUTINE CallbackRoutine; 12523464ebd5Sriastradh PVOID CallbackParam; 12533464ebd5Sriastradh } MINIDUMP_CALLBACK_INFORMATION,*PMINIDUMP_CALLBACK_INFORMATION; 12543464ebd5Sriastradh 12553464ebd5Sriastradh#define RVA_TO_ADDR(Mapping,Rva) ((PVOID)(((ULONG_PTR) (Mapping)) + (Rva))) 12563464ebd5Sriastradh 12573464ebd5Sriastradh 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); 12583464ebd5Sriastradh BOOL WINAPI MiniDumpReadDumpStream(PVOID BaseOfDump,ULONG StreamNumber,PMINIDUMP_DIRECTORY *Dir,PVOID *StreamPointer,ULONG *StreamSize); 12593464ebd5Sriastradh 12603464ebd5Sriastradh#include <poppack.h> 12613464ebd5Sriastradh 12623464ebd5Sriastradh#ifdef __cplusplus 12633464ebd5Sriastradh} 12643464ebd5Sriastradh#endif 12653464ebd5Sriastradh#endif 1266