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.
25 #define API_VERSION_NUMBER 7
26 #define BIND_NO_BOUND_IMPORTS 0x00000001
27 #define BIND_NO_UPDATE 0x00000002
28 #define BIND_ALL_IMAGES 0x00000004
29 #define BIND_CACHE_IMPORT_DLLS 0x00000008
30 #define CBA_DEFERRED_SYMBOL_LOAD_START 1
31 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 2
32 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 3
33 #define CBA_SYMBOLS_UNLOADED 4
34 #define CBA_DUPLICATE_SYMBOL 5
35 #define CERT_PE_IMAGE_DIGEST_DEBUG_INFO 1
36 #define CERT_PE_IMAGE_DIGEST_RESOURCES 2
37 #define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO 4
38 #define CERT_PE_IMAGE_DIGEST_NON_PE_INFO 8
39 #define CERT_SECTION_TYPE_ANY 255
40 #define CHECKSUM_SUCCESS 0
41 #define CHECKSUM_OPEN_FAILURE 1
42 #define CHECKSUM_MAP_FAILURE 2
43 #define CHECKSUM_MAPVIEW_FAILURE 3
44 #define CHECKSUM_UNICODE_FAILURE 4
45 #define IMAGE_SEPARATION 65536
46 #define SPLITSYM_REMOVE_PRIVATE 1
47 #define SPLITSYM_EXTRACT_ALL 2
48 #define SPLITSYM_SYMBOLPATH_IS_SRC 4
49 #define SYMF_OMAP_GENERATED 1
50 #define SYMF_OMAP_MODIFIED 2
51 #define SYMOPT_CASE_INSENSITIVE 1
52 #define SYMOPT_UNDNAME 2
53 #define SYMOPT_DEFERRED_LOADS 4
54 #define SYMOPT_NO_CPP 8
55 #define SYMOPT_LOAD_LINES 16
56 #define SYMOPT_OMAP_FIND_NEAREST 32
57 #define UNDNAME_COMPLETE 0
58 #define UNDNAME_NO_LEADING_UNDERSCORES 1
59 #define UNDNAME_NO_MS_KEYWORDS 2
60 #define UNDNAME_NO_FUNCTION_RETURNS 4
61 #define UNDNAME_NO_ALLOCATION_MODEL 8
62 #define UNDNAME_NO_ALLOCATION_LANGUAGE 16
63 #define UNDNAME_NO_MS_THISTYPE 32
64 #define UNDNAME_NO_CV_THISTYPE 64
65 #define UNDNAME_NO_THISTYPE 96
66 #define UNDNAME_NO_ACCESS_SPECIFIERS 128
67 #define UNDNAME_NO_THROW_SIGNATURES 256
68 #define UNDNAME_NO_MEMBER_TYPE 512
69 #define UNDNAME_NO_RETURN_UDT_MODEL 1024
70 #define UNDNAME_32_BIT_DECODE 2048
71 #define UNDNAME_NAME_ONLY 4096
72 #define UNDNAME_NO_ARGUMENTS 8192
73 #define UNDNAME_NO_SPECIAL_SYMS 16384
75 #define _IMAGEHLPAPI DECLSPEC_IMPORT WINAPI
79 typedef enum _IMAGEHLP_STATUS_REASON
{
83 BindImportModuleFailed
,
84 BindImportProcedureFailed
,
90 BindExpandFileHeaders
,
92 BindMismatchedSymbols
,
94 } IMAGEHLP_STATUS_REASON
;
95 typedef BOOL(STDCALL
*PIMAGEHLP_STATUS_ROUTINE
)(IMAGEHLP_STATUS_REASON
,LPSTR
,LPSTR
,ULONG
,ULONG
);
96 typedef struct _LOADED_IMAGE
{
100 PIMAGE_NT_HEADERS FileHeader
;
101 PIMAGE_SECTION_HEADER LastRvaSection
;
102 ULONG NumberOfSections
;
103 PIMAGE_SECTION_HEADER Sections
;
104 ULONG Characteristics
;
105 BOOLEAN fSystemImage
;
109 } LOADED_IMAGE
,*PLOADED_IMAGE
;
110 typedef struct _IMAGE_DEBUG_INFORMATION
{
115 USHORT Characteristics
;
119 DWORD NumberOfSections
;
120 PIMAGE_SECTION_HEADER Sections
;
121 DWORD ExportedNamesSize
;
123 DWORD NumberOfFunctionTableEntries
;
124 PIMAGE_FUNCTION_ENTRY FunctionTableEntries
;
125 DWORD LowestFunctionStartingAddress
;
126 DWORD HighestFunctionEndingAddress
;
127 DWORD NumberOfFpoTableEntries
;
128 PFPO_DATA FpoTableEntries
;
129 DWORD SizeOfCoffSymbols
;
130 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols
;
131 DWORD SizeOfCodeViewSymbols
;
132 PVOID CodeViewSymbols
;
138 PIMAGE_DEBUG_DIRECTORY DebugDirectory
;
139 DWORD NumberOfDebugDirectories
;
141 } IMAGE_DEBUG_INFORMATION
,*PIMAGE_DEBUG_INFORMATION
;
148 typedef struct _tagADDRESS
{
152 } ADDRESS
,*LPADDRESS
;
153 typedef struct _KDHELP
{
155 DWORD ThCallbackStack
;
158 DWORD KiCallUserMode
;
159 DWORD KeUserCallbackDispatcher
;
160 DWORD SystemRangeStart
;
162 typedef struct _tagSTACKFRAME
{
167 LPVOID FuncTableEntry
;
173 } STACKFRAME
,*LPSTACKFRAME
;
174 typedef BOOL(STDCALL
*PREAD_PROCESS_MEMORY_ROUTINE
)(HANDLE
,LPCVOID
,LPVOID
,DWORD
,LPDWORD
);
175 typedef LPVOID(STDCALL
*PFUNCTION_TABLE_ACCESS_ROUTINE
)(HANDLE
,DWORD
);
176 typedef DWORD(STDCALL
*PGET_MODULE_BASE_ROUTINE
)(HANDLE
,DWORD
);
177 typedef DWORD(STDCALL
*PTRANSLATE_ADDRESS_ROUTINE
)(HANDLE
,HANDLE
,LPADDRESS
);
178 typedef struct API_VERSION
{
183 } API_VERSION
,*LPAPI_VERSION
;
184 typedef BOOL(CALLBACK
*PSYM_ENUMMODULES_CALLBACK
)(LPSTR
,ULONG
,PVOID
);
185 typedef BOOL(CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK
)(LPSTR
,ULONG
,ULONG
,PVOID
);
186 typedef BOOL(CALLBACK
*PENUMLOADED_MODULES_CALLBACK
)(LPSTR
,ULONG
,ULONG
,PVOID
);
187 typedef BOOL(CALLBACK
*PSYMBOL_REGISTERED_CALLBACK
)(HANDLE
,ULONG
,PVOID
,PVOID
);
197 typedef struct _IMAGEHLP_SYMBOL
{
204 } IMAGEHLP_SYMBOL
,*PIMAGEHLP_SYMBOL
;
205 typedef struct _IMAGEHLP_MODULE
{
215 CHAR LoadedImageName
[256];
216 } IMAGEHLP_MODULE
,*PIMAGEHLP_MODULE
;
217 typedef struct _IMAGEHLP_LINE
{
223 } IMAGEHLP_LINE
,*PIMAGEHLP_LINE
;
224 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
{
229 CHAR FileName
[MAX_PATH
];
231 } IMAGEHLP_DEFERRED_SYMBOL_LOAD
,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD
;
232 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
{
235 PIMAGEHLP_SYMBOL Symbol
;
236 ULONG SelectedSymbol
;
237 } IMAGEHLP_DUPLICATE_SYMBOL
,*PIMAGEHLP_DUPLICATE_SYMBOL
;
238 typedef PVOID DIGEST_HANDLE
;
239 typedef BOOL(WINAPI
*DIGEST_FUNCTION
)(DIGEST_HANDLE refdata
,PBYTE pData
,DWORD dwLength
);
241 PIMAGE_NT_HEADERS _IMAGEHLPAPI
CheckSumMappedFile(LPVOID
,DWORD
,LPDWORD
,LPDWORD
);
242 DWORD _IMAGEHLPAPI
MapFileAndCheckSumA(LPSTR
,LPDWORD
,LPDWORD
);
243 DWORD _IMAGEHLPAPI
MapFileAndCheckSumW(PWSTR
,LPDWORD
,LPDWORD
);
244 BOOL _IMAGEHLPAPI
TouchFileTimes(HANDLE
,LPSYSTEMTIME
);
245 BOOL _IMAGEHLPAPI
SplitSymbols(LPSTR
,LPSTR
,LPSTR
,DWORD
);
246 HANDLE _IMAGEHLPAPI
FindDebugInfoFile(LPSTR
,LPSTR
,LPSTR
);
247 HANDLE _IMAGEHLPAPI
FindExecutableImage(LPSTR
,LPSTR
,LPSTR
);
248 BOOL _IMAGEHLPAPI
UpdateDebugInfoFile(LPSTR
,LPSTR
,LPSTR
,PIMAGE_NT_HEADERS
);
249 BOOL _IMAGEHLPAPI
UpdateDebugInfoFileEx(LPSTR
,LPSTR
,LPSTR
,PIMAGE_NT_HEADERS
,DWORD
);
250 BOOL _IMAGEHLPAPI
BindImage(IN LPSTR
,IN LPSTR
,IN LPSTR
);
251 BOOL _IMAGEHLPAPI
BindImageEx(IN DWORD
,IN LPSTR
,IN LPSTR
,IN LPSTR
,IN PIMAGEHLP_STATUS_ROUTINE
);
252 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
);
254 PLOADED_IMAGE _IMAGEHLPAPI
ImageLoad(LPSTR
,LPSTR
);
255 BOOL _IMAGEHLPAPI
ImageUnload(PLOADED_IMAGE
);
256 PIMAGE_NT_HEADERS _IMAGEHLPAPI
ImageNtHeader(IN PVOID
);
257 PVOID _IMAGEHLPAPI
ImageDirectoryEntryToData(IN PVOID
,IN BOOLEAN
,IN USHORT
,OUT PULONG
);
258 PIMAGE_SECTION_HEADER _IMAGEHLPAPI
ImageRvaToSection(IN PIMAGE_NT_HEADERS
,IN PVOID
,IN ULONG
);
259 PVOID _IMAGEHLPAPI
ImageRvaToVa(IN PIMAGE_NT_HEADERS
,IN PVOID
,IN ULONG
,IN OUT PIMAGE_SECTION_HEADER
*);
260 BOOL _IMAGEHLPAPI
MapAndLoad(LPSTR
,LPSTR
,PLOADED_IMAGE
,BOOL
,BOOL
);
261 BOOL _IMAGEHLPAPI
GetImageConfigInformation(PLOADED_IMAGE
,PIMAGE_LOAD_CONFIG_DIRECTORY
);
262 DWORD _IMAGEHLPAPI
GetImageUnusedHeaderBytes(PLOADED_IMAGE
,LPDWORD
);
263 BOOL _IMAGEHLPAPI
SetImageConfigInformation(PLOADED_IMAGE
,PIMAGE_LOAD_CONFIG_DIRECTORY
);
264 BOOL _IMAGEHLPAPI
UnMapAndLoad(PLOADED_IMAGE
);
265 PIMAGE_DEBUG_INFORMATION _IMAGEHLPAPI
MapDebugInformation(HANDLE
,LPSTR
,LPSTR
,DWORD
);
266 BOOL _IMAGEHLPAPI
UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION
);
267 HANDLE _IMAGEHLPAPI
FindExecutableImage(LPSTR
,LPSTR
,LPSTR
);
268 BOOL _IMAGEHLPAPI
SearchTreeForFile(LPSTR
,LPSTR
,LPSTR
);
269 BOOL _IMAGEHLPAPI
MakeSureDirectoryPathExists(LPCSTR
);
270 DWORD _IMAGEHLPAPI WINAPI
UnDecorateSymbolName(LPCSTR
,LPSTR
,DWORD
, DWORD
);
273 StackWalk(DWORD
,HANDLE
,HANDLE
,LPSTACKFRAME
,LPVOID
,PREAD_PROCESS_MEMORY_ROUTINE
,PFUNCTION_TABLE_ACCESS_ROUTINE
,PGET_MODULE_BASE_ROUTINE
,PTRANSLATE_ADDRESS_ROUTINE
);
274 LPAPI_VERSION _IMAGEHLPAPI
ImagehlpApiVersion(VOID
);
275 LPAPI_VERSION _IMAGEHLPAPI
ImagehlpApiVersionEx(LPAPI_VERSION
);
276 DWORD _IMAGEHLPAPI
GetTimestampForLoadedLibrary(HMODULE
);
277 BOOL _IMAGEHLPAPI
RemovePrivateCvSymbolic(PCHAR
,PCHAR
*,ULONG
*);
278 VOID _IMAGEHLPAPI
RemoveRelocations(PCHAR
);
279 DWORD _IMAGEHLPAPI
SymSetOptions(IN DWORD
);
280 DWORD _IMAGEHLPAPI
SymGetOptions(VOID
);
281 BOOL _IMAGEHLPAPI
SymCleanup(IN HANDLE
);
282 BOOL _IMAGEHLPAPI
SymEnumerateModules(IN HANDLE
,IN PSYM_ENUMMODULES_CALLBACK
,IN PVOID
);
283 BOOL _IMAGEHLPAPI
SymEnumerateSymbols(IN HANDLE
,IN DWORD
,IN PSYM_ENUMSYMBOLS_CALLBACK
,IN PVOID
);
284 BOOL _IMAGEHLPAPI
EnumerateLoadedModules(IN HANDLE
,IN PENUMLOADED_MODULES_CALLBACK
,IN PVOID
);
285 LPVOID _IMAGEHLPAPI
SymFunctionTableAccess(HANDLE
,DWORD
);
286 BOOL _IMAGEHLPAPI
SymGetModuleInfo(IN HANDLE
,IN DWORD
,OUT PIMAGEHLP_MODULE
);
287 DWORD _IMAGEHLPAPI
SymGetModuleBase(IN HANDLE
,IN DWORD
);
288 BOOL _IMAGEHLPAPI
SymGetSymFromAddr(IN HANDLE
,IN DWORD
,OUT PDWORD
,OUT PIMAGEHLP_SYMBOL
);
289 BOOL _IMAGEHLPAPI
SymGetSymFromName(IN HANDLE
,IN LPSTR
,OUT PIMAGEHLP_SYMBOL
);
290 BOOL _IMAGEHLPAPI
SymGetSymNext(IN HANDLE
,IN OUT PIMAGEHLP_SYMBOL
);
291 BOOL _IMAGEHLPAPI
SymGetSymPrev(IN HANDLE
,IN OUT PIMAGEHLP_SYMBOL
);
292 BOOL _IMAGEHLPAPI
SymGetLineFromAddr(IN HANDLE
,IN DWORD
,OUT PDWORD
,OUT PIMAGEHLP_LINE
);
293 BOOL _IMAGEHLPAPI
SymGetLineFromName(IN HANDLE
,IN LPSTR
,IN LPSTR
,IN DWORD
,OUT PLONG
,IN OUT PIMAGEHLP_LINE
);
294 BOOL _IMAGEHLPAPI
SymGetLineNext(IN HANDLE
,IN OUT PIMAGEHLP_LINE
);
295 BOOL _IMAGEHLPAPI
SymGetLinePrev(IN HANDLE
,IN OUT PIMAGEHLP_LINE
);
296 BOOL _IMAGEHLPAPI
SymMatchFileName(IN LPSTR
,IN LPSTR
,OUT LPSTR
*,OUT LPSTR
*);
297 BOOL _IMAGEHLPAPI
SymInitialize(IN HANDLE
,IN LPSTR
,IN BOOL
);
298 BOOL _IMAGEHLPAPI
SymGetSearchPath(IN HANDLE
,OUT LPSTR
,IN DWORD
);
299 BOOL _IMAGEHLPAPI
SymSetSearchPath(IN HANDLE
,IN LPSTR
);
300 BOOL _IMAGEHLPAPI
SymLoadModule(IN HANDLE
,IN HANDLE
,IN PSTR
,IN PSTR
,IN DWORD
,IN DWORD
);
301 BOOL _IMAGEHLPAPI
SymUnloadModule(IN HANDLE
,IN DWORD
);
302 BOOL _IMAGEHLPAPI
SymUnDName(IN PIMAGEHLP_SYMBOL
,OUT LPSTR
,IN DWORD
);
303 BOOL _IMAGEHLPAPI
SymRegisterCallback(IN HANDLE
,IN PSYMBOL_REGISTERED_CALLBACK
,IN PVOID
);
304 BOOL _IMAGEHLPAPI
ImageGetDigestStream(IN HANDLE
,IN DWORD
,IN DIGEST_FUNCTION
,IN DIGEST_HANDLE
);
305 BOOL _IMAGEHLPAPI
ImageAddCertificate(IN HANDLE
,IN LPWIN_CERTIFICATE
,OUT PDWORD
);
306 BOOL _IMAGEHLPAPI
ImageRemoveCertificate(IN HANDLE
,IN DWORD
);
307 BOOL _IMAGEHLPAPI
ImageEnumerateCertificates(IN HANDLE
,IN WORD
,OUT PDWORD
,IN OUT PDWORD OPTIONAL
,IN OUT DWORD OPTIONAL
);
308 BOOL _IMAGEHLPAPI
ImageGetCertificateData(IN HANDLE
,IN DWORD
,OUT LPWIN_CERTIFICATE
,IN OUT PDWORD
);
309 BOOL _IMAGEHLPAPI
ImageGetCertificateHeader(IN HANDLE
,IN DWORD
,IN OUT LPWIN_CERTIFICATE
);
310 BOOL _IMAGEHLPAPI
CopyPdb(CHAR
const*,CHAR
const*,BOOL
);
311 BOOL _IMAGEHLPAPI
RemovePrivateCvSymbolicEx(PCHAR
,ULONG
,PCHAR
*,ULONG
*);
313 #endif /* RC_INVOKED */
316 #define MapFileAndCheckSum MapFileAndCheckSumW
318 #define MapFileAndCheckSum MapFileAndCheckSumA
325 #endif /* _IMAGEHLP_H */