2 imagehlp.h - Include file for IMAGEHLP.DLL APIs
4 Written by Mumit Khan <khan@nanotech.wisc.edu>
6 This file is part of a free library for the Win32 API.
8 NOTE: This strictly does not belong in the Win32 API since it's
9 really part of Platform SDK. However,GDB needs it and we might
10 as well provide it here.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 #pragma GCC system_header
28 #define API_VERSION_NUMBER 7
29 #define BIND_NO_BOUND_IMPORTS 0x00000001
30 #define BIND_NO_UPDATE 0x00000002
31 #define BIND_ALL_IMAGES 0x00000004
32 #define BIND_CACHE_IMPORT_DLLS 0x00000008
33 #define CBA_DEFERRED_SYMBOL_LOAD_START 1
34 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 2
35 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 3
36 #define CBA_SYMBOLS_UNLOADED 4
37 #define CBA_DUPLICATE_SYMBOL 5
38 #define CERT_PE_IMAGE_DIGEST_DEBUG_INFO 1
39 #define CERT_PE_IMAGE_DIGEST_RESOURCES 2
40 #define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO 4
41 #define CERT_PE_IMAGE_DIGEST_NON_PE_INFO 8
42 #define CERT_SECTION_TYPE_ANY 255
43 #define CHECKSUM_SUCCESS 0
44 #define CHECKSUM_OPEN_FAILURE 1
45 #define CHECKSUM_MAP_FAILURE 2
46 #define CHECKSUM_MAPVIEW_FAILURE 3
47 #define CHECKSUM_UNICODE_FAILURE 4
48 #define IMAGE_SEPARATION 65536
49 #define SPLITSYM_REMOVE_PRIVATE 1
50 #define SPLITSYM_EXTRACT_ALL 2
51 #define SPLITSYM_SYMBOLPATH_IS_SRC 4
52 #define SYMF_OMAP_GENERATED 1
53 #define SYMF_OMAP_MODIFIED 2
54 #define SYMOPT_CASE_INSENSITIVE 1
55 #define SYMOPT_UNDNAME 2
56 #define SYMOPT_DEFERRED_LOADS 4
57 #define SYMOPT_NO_CPP 8
58 #define SYMOPT_LOAD_LINES 16
59 #define SYMOPT_OMAP_FIND_NEAREST 32
60 #define UNDNAME_COMPLETE 0
61 #define UNDNAME_NO_LEADING_UNDERSCORES 1
62 #define UNDNAME_NO_MS_KEYWORDS 2
63 #define UNDNAME_NO_FUNCTION_RETURNS 4
64 #define UNDNAME_NO_ALLOCATION_MODEL 8
65 #define UNDNAME_NO_ALLOCATION_LANGUAGE 16
66 #define UNDNAME_NO_MS_THISTYPE 32
67 #define UNDNAME_NO_CV_THISTYPE 64
68 #define UNDNAME_NO_THISTYPE 96
69 #define UNDNAME_NO_ACCESS_SPECIFIERS 128
70 #define UNDNAME_NO_THROW_SIGNATURES 256
71 #define UNDNAME_NO_MEMBER_TYPE 512
72 #define UNDNAME_NO_RETURN_UDT_MODEL 1024
73 #define UNDNAME_32_BIT_DECODE 2048
74 #define UNDNAME_NAME_ONLY 4096
75 #define UNDNAME_NO_ARGUMENTS 8192
76 #define UNDNAME_NO_SPECIAL_SYMS 16384
78 #define _IMAGEHLPAPI DECLSPEC_IMPORT WINAPI
82 typedef enum _IMAGEHLP_STATUS_REASON
{
86 BindImportModuleFailed
,
87 BindImportProcedureFailed
,
93 BindExpandFileHeaders
,
95 BindMismatchedSymbols
,
97 } IMAGEHLP_STATUS_REASON
;
98 typedef BOOL(STDCALL
*PIMAGEHLP_STATUS_ROUTINE
)(IMAGEHLP_STATUS_REASON
,LPSTR
,LPSTR
,ULONG
,ULONG
);
99 typedef struct _LOADED_IMAGE
{
102 PUCHAR MappedAddress
;
103 PIMAGE_NT_HEADERS FileHeader
;
104 PIMAGE_SECTION_HEADER LastRvaSection
;
105 ULONG NumberOfSections
;
106 PIMAGE_SECTION_HEADER Sections
;
107 ULONG Characteristics
;
108 BOOLEAN fSystemImage
;
112 } LOADED_IMAGE
,*PLOADED_IMAGE
;
113 typedef struct _IMAGE_DEBUG_INFORMATION
{
118 USHORT Characteristics
;
122 DWORD NumberOfSections
;
123 PIMAGE_SECTION_HEADER Sections
;
124 DWORD ExportedNamesSize
;
126 DWORD NumberOfFunctionTableEntries
;
127 PIMAGE_FUNCTION_ENTRY FunctionTableEntries
;
128 DWORD LowestFunctionStartingAddress
;
129 DWORD HighestFunctionEndingAddress
;
130 DWORD NumberOfFpoTableEntries
;
131 PFPO_DATA FpoTableEntries
;
132 DWORD SizeOfCoffSymbols
;
133 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols
;
134 DWORD SizeOfCodeViewSymbols
;
135 PVOID CodeViewSymbols
;
141 PIMAGE_DEBUG_DIRECTORY DebugDirectory
;
142 DWORD NumberOfDebugDirectories
;
144 } IMAGE_DEBUG_INFORMATION
,*PIMAGE_DEBUG_INFORMATION
;
151 typedef struct _tagADDRESS
{
155 } ADDRESS
,*LPADDRESS
;
156 typedef struct _KDHELP
{
158 DWORD ThCallbackStack
;
161 DWORD KiCallUserMode
;
162 DWORD KeUserCallbackDispatcher
;
163 DWORD SystemRangeStart
;
165 typedef struct _tagSTACKFRAME
{
170 LPVOID FuncTableEntry
;
176 } STACKFRAME
,*LPSTACKFRAME
;
177 typedef BOOL(STDCALL
*PREAD_PROCESS_MEMORY_ROUTINE
)(HANDLE
,LPCVOID
,LPVOID
,DWORD
,LPDWORD
);
178 typedef LPVOID(STDCALL
*PFUNCTION_TABLE_ACCESS_ROUTINE
)(HANDLE
,DWORD
);
179 typedef DWORD(STDCALL
*PGET_MODULE_BASE_ROUTINE
)(HANDLE
,DWORD
);
180 typedef DWORD(STDCALL
*PTRANSLATE_ADDRESS_ROUTINE
)(HANDLE
,HANDLE
,LPADDRESS
);
181 typedef struct API_VERSION
{
186 } API_VERSION
,*LPAPI_VERSION
;
187 typedef BOOL(CALLBACK
*PSYM_ENUMMODULES_CALLBACK
)(LPSTR
,ULONG
,PVOID
);
188 typedef BOOL(CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK
)(LPSTR
,ULONG
,ULONG
,PVOID
);
189 typedef BOOL(CALLBACK
*PENUMLOADED_MODULES_CALLBACK
)(LPSTR
,ULONG
,ULONG
,PVOID
);
190 typedef BOOL(CALLBACK
*PSYMBOL_REGISTERED_CALLBACK
)(HANDLE
,ULONG
,PVOID
,PVOID
);
200 typedef struct _IMAGEHLP_SYMBOL
{
207 } IMAGEHLP_SYMBOL
,*PIMAGEHLP_SYMBOL
;
208 typedef struct _IMAGEHLP_MODULE
{
218 CHAR LoadedImageName
[256];
219 } IMAGEHLP_MODULE
,*PIMAGEHLP_MODULE
;
220 typedef struct _IMAGEHLP_LINE
{
226 } IMAGEHLP_LINE
,*PIMAGEHLP_LINE
;
227 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
{
232 CHAR FileName
[MAX_PATH
];
234 } IMAGEHLP_DEFERRED_SYMBOL_LOAD
,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD
;
235 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
{
238 PIMAGEHLP_SYMBOL Symbol
;
239 ULONG SelectedSymbol
;
240 } IMAGEHLP_DUPLICATE_SYMBOL
,*PIMAGEHLP_DUPLICATE_SYMBOL
;
241 typedef PVOID DIGEST_HANDLE
;
242 typedef BOOL(WINAPI
*DIGEST_FUNCTION
)(DIGEST_HANDLE refdata
,PBYTE pData
,DWORD dwLength
);
244 PIMAGE_NT_HEADERS _IMAGEHLPAPI
CheckSumMappedFile(LPVOID
,DWORD
,LPDWORD
,LPDWORD
);
245 DWORD _IMAGEHLPAPI
MapFileAndCheckSumA(LPSTR
,LPDWORD
,LPDWORD
);
246 DWORD _IMAGEHLPAPI
MapFileAndCheckSumW(PWSTR
,LPDWORD
,LPDWORD
);
247 BOOL _IMAGEHLPAPI
TouchFileTimes(HANDLE
,LPSYSTEMTIME
);
248 BOOL _IMAGEHLPAPI
SplitSymbols(LPSTR
,LPSTR
,LPSTR
,DWORD
);
249 HANDLE _IMAGEHLPAPI
FindDebugInfoFile(LPSTR
,LPSTR
,LPSTR
);
250 HANDLE _IMAGEHLPAPI
FindExecutableImage(LPSTR
,LPSTR
,LPSTR
);
251 BOOL _IMAGEHLPAPI
UpdateDebugInfoFile(LPSTR
,LPSTR
,LPSTR
,PIMAGE_NT_HEADERS
);
252 BOOL _IMAGEHLPAPI
UpdateDebugInfoFileEx(LPSTR
,LPSTR
,LPSTR
,PIMAGE_NT_HEADERS
,DWORD
);
253 BOOL _IMAGEHLPAPI
BindImage(/*IN*/ LPSTR
,/*IN*/ LPSTR
,/*IN*/ LPSTR
);
254 BOOL _IMAGEHLPAPI
BindImageEx(/*IN*/ DWORD
,/*IN*/ LPSTR
,/*IN*/ LPSTR
,/*IN*/ LPSTR
,/*IN*/ PIMAGEHLP_STATUS_ROUTINE
);
255 BOOL _IMAGEHLPAPI
ReBaseImage(/*IN*/ LPSTR
,/*IN*/ LPSTR
,/*IN*/ BOOL
,/*IN*/ BOOL
,/*IN*/ BOOL
,/*IN*/ ULONG
,/*OUT*/ ULONG
*,/*OUT*/ ULONG
*,/*OUT*/ ULONG
*,/*IN OUT*/ ULONG
*,/*IN*/ ULONG
);
257 PLOADED_IMAGE _IMAGEHLPAPI
ImageLoad(LPSTR
,LPSTR
);
258 BOOL _IMAGEHLPAPI
ImageUnload(PLOADED_IMAGE
);
259 PIMAGE_NT_HEADERS _IMAGEHLPAPI
ImageNtHeader(/*IN*/ PVOID
);
260 PVOID _IMAGEHLPAPI
ImageDirectoryEntryToData(/*IN*/ PVOID
,/*IN*/ BOOLEAN
,/*IN*/ USHORT
,/*OUT*/ PULONG
);
261 PIMAGE_SECTION_HEADER _IMAGEHLPAPI
ImageRvaToSection(/*IN*/ PIMAGE_NT_HEADERS
,/*IN*/ PVOID
,/*IN*/ ULONG
);
262 PVOID _IMAGEHLPAPI
ImageRvaToVa(/*IN*/ PIMAGE_NT_HEADERS
,/*IN*/ PVOID
,/*IN*/ ULONG
,/*IN OUT*/ PIMAGE_SECTION_HEADER
*);
263 BOOL _IMAGEHLPAPI
MapAndLoad(LPSTR
,LPSTR
,PLOADED_IMAGE
,BOOL
,BOOL
);
264 BOOL _IMAGEHLPAPI
GetImageConfigInformation(PLOADED_IMAGE
,PIMAGE_LOAD_CONFIG_DIRECTORY
);
265 DWORD _IMAGEHLPAPI
GetImageUnusedHeaderBytes(PLOADED_IMAGE
,LPDWORD
);
266 BOOL _IMAGEHLPAPI
SetImageConfigInformation(PLOADED_IMAGE
,PIMAGE_LOAD_CONFIG_DIRECTORY
);
267 BOOL _IMAGEHLPAPI
UnMapAndLoad(PLOADED_IMAGE
);
268 PIMAGE_DEBUG_INFORMATION _IMAGEHLPAPI
MapDebugInformation(HANDLE
,LPSTR
,LPSTR
,DWORD
);
269 BOOL _IMAGEHLPAPI
UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION
);
270 HANDLE _IMAGEHLPAPI
FindExecutableImage(LPSTR
,LPSTR
,LPSTR
);
271 BOOL _IMAGEHLPAPI
SearchTreeForFile(LPSTR
,LPSTR
,LPSTR
);
272 BOOL _IMAGEHLPAPI
MakeSureDirectoryPathExists(LPCSTR
);
273 DWORD _IMAGEHLPAPI WINAPI
UnDecorateSymbolName(LPCSTR
,LPSTR
,DWORD
, DWORD
);
276 StackWalk(DWORD
,HANDLE
,HANDLE
,LPSTACKFRAME
,LPVOID
,PREAD_PROCESS_MEMORY_ROUTINE
,PFUNCTION_TABLE_ACCESS_ROUTINE
,PGET_MODULE_BASE_ROUTINE
,PTRANSLATE_ADDRESS_ROUTINE
);
277 LPAPI_VERSION _IMAGEHLPAPI
ImagehlpApiVersion(VOID
);
278 LPAPI_VERSION _IMAGEHLPAPI
ImagehlpApiVersionEx(LPAPI_VERSION
);
279 DWORD _IMAGEHLPAPI
GetTimestampForLoadedLibrary(HMODULE
);
280 BOOL _IMAGEHLPAPI
RemovePrivateCvSymbolic(PCHAR
,PCHAR
*,ULONG
*);
281 VOID _IMAGEHLPAPI
RemoveRelocations(PCHAR
);
282 DWORD _IMAGEHLPAPI
SymSetOptions(/*IN*/ DWORD
);
283 DWORD _IMAGEHLPAPI
SymGetOptions(VOID
);
284 BOOL _IMAGEHLPAPI
SymCleanup(/*IN*/ HANDLE
);
285 BOOL _IMAGEHLPAPI
SymEnumerateModules(/*IN*/ HANDLE
,/*IN*/ PSYM_ENUMMODULES_CALLBACK
,/*IN*/ PVOID
);
286 BOOL _IMAGEHLPAPI
SymEnumerateSymbols(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*IN*/ PSYM_ENUMSYMBOLS_CALLBACK
,/*IN*/ PVOID
);
287 BOOL _IMAGEHLPAPI
EnumerateLoadedModules(/*IN*/ HANDLE
,/*IN*/ PENUMLOADED_MODULES_CALLBACK
,/*IN*/ PVOID
);
288 LPVOID _IMAGEHLPAPI
SymFunctionTableAccess(HANDLE
,DWORD
);
289 BOOL _IMAGEHLPAPI
SymGetModuleInfo(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*OUT*/ PIMAGEHLP_MODULE
);
290 DWORD _IMAGEHLPAPI
SymGetModuleBase(/*IN*/ HANDLE
,/*IN*/ DWORD
);
291 BOOL _IMAGEHLPAPI
SymGetSymFromAddr(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*OUT*/ PDWORD
,/*OUT*/ PIMAGEHLP_SYMBOL
);
292 BOOL _IMAGEHLPAPI
SymGetSymFromName(/*IN*/ HANDLE
,/*IN*/ LPSTR
,/*OUT*/ PIMAGEHLP_SYMBOL
);
293 BOOL _IMAGEHLPAPI
SymGetSymNext(/*IN*/ HANDLE
,/*IN OUT*/ PIMAGEHLP_SYMBOL
);
294 BOOL _IMAGEHLPAPI
SymGetSymPrev(/*IN*/ HANDLE
,/*IN OUT*/ PIMAGEHLP_SYMBOL
);
295 BOOL _IMAGEHLPAPI
SymGetLineFromAddr(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*OUT*/ PDWORD
,/*OUT*/ PIMAGEHLP_LINE
);
296 BOOL _IMAGEHLPAPI
SymGetLineFromName(/*IN*/ HANDLE
,/*IN*/ LPSTR
,/*IN*/ LPSTR
,/*IN*/ DWORD
,/*OUT*/ PLONG
,/*IN OUT*/ PIMAGEHLP_LINE
);
297 BOOL _IMAGEHLPAPI
SymGetLineNext(/*IN*/ HANDLE
,/*IN OUT*/ PIMAGEHLP_LINE
);
298 BOOL _IMAGEHLPAPI
SymGetLinePrev(/*IN*/ HANDLE
,/*IN OUT*/ PIMAGEHLP_LINE
);
299 BOOL _IMAGEHLPAPI
SymMatchFileName(/*IN*/ LPSTR
,/*IN*/ LPSTR
,/*OUT*/ LPSTR
*,/*OUT*/ LPSTR
*);
300 BOOL _IMAGEHLPAPI
SymInitialize(/*IN*/ HANDLE
,/*IN*/ LPSTR
,/*IN*/ BOOL
);
301 BOOL _IMAGEHLPAPI
SymGetSearchPath(/*IN*/ HANDLE
,/*OUT*/ LPSTR
,/*IN*/ DWORD
);
302 BOOL _IMAGEHLPAPI
SymSetSearchPath(/*IN*/ HANDLE
,/*IN*/ LPSTR
);
303 BOOL _IMAGEHLPAPI
SymLoadModule(/*IN*/ HANDLE
,/*IN*/ HANDLE
,/*IN*/ PSTR
,/*IN*/ PSTR
,/*IN*/ DWORD
,/*IN*/ DWORD
);
304 BOOL _IMAGEHLPAPI
SymUnloadModule(/*IN*/ HANDLE
,/*IN*/ DWORD
);
305 BOOL _IMAGEHLPAPI
SymUnDName(/*IN*/ PIMAGEHLP_SYMBOL
,/*OUT*/ LPSTR
,/*IN*/ DWORD
);
306 BOOL _IMAGEHLPAPI
SymRegisterCallback(/*IN*/ HANDLE
,/*IN*/ PSYMBOL_REGISTERED_CALLBACK
,/*IN*/ PVOID
);
307 BOOL _IMAGEHLPAPI
ImageGetDigestStream(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*IN*/ DIGEST_FUNCTION
,/*IN*/ DIGEST_HANDLE
);
308 BOOL _IMAGEHLPAPI
ImageAddCertificate(/*IN*/ HANDLE
,/*IN*/ LPWIN_CERTIFICATE
,/*OUT*/ PDWORD
);
309 BOOL _IMAGEHLPAPI
ImageRemoveCertificate(/*IN*/ HANDLE
,/*IN*/ DWORD
);
310 BOOL _IMAGEHLPAPI
ImageEnumerateCertificates(/*IN*/ HANDLE
,/*IN*/ WORD
,/*OUT*/ PDWORD
,/*IN OUT*/ PDWORD
/*OPTIONAL*/,/*IN OUT*/ DWORD
/*OPTIONAL*/);
311 BOOL _IMAGEHLPAPI
ImageGetCertificateData(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*OUT*/ LPWIN_CERTIFICATE
,/*IN OUT*/ PDWORD
);
312 BOOL _IMAGEHLPAPI
ImageGetCertificateHeader(/*IN*/ HANDLE
,/*IN*/ DWORD
,/*IN OUT*/ LPWIN_CERTIFICATE
);
313 BOOL _IMAGEHLPAPI
CopyPdb(CHAR
const*,CHAR
const*,BOOL
);
314 BOOL _IMAGEHLPAPI
RemovePrivateCvSymbolicEx(PCHAR
,ULONG
,PCHAR
*,ULONG
*);
316 #endif /* RC_INVOKED */
319 #define MapFileAndCheckSum MapFileAndCheckSumW
321 #define MapFileAndCheckSum MapFileAndCheckSumA
328 #endif /* _IMAGEHLP_H */