Commit /bin/cc.exe (a hardlink of /bin/gcc.exe)
[msysgit.git] / include / imagehlp.h
blob2a3eb6f08f4b38fc5e07745ac17a225ccf440f6c
1 /*
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.
18 #ifndef _IMAGEHLP_H
19 #define _IMAGEHLP_H
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
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
77 #ifndef RC_INVOKED
79 typedef enum _IMAGEHLP_STATUS_REASON {
80 BindOutOfMemory,
81 BindRvaToVaFailed,
82 BindNoRoomInImage,
83 BindImportModuleFailed,
84 BindImportProcedureFailed,
85 BindImportModule,
86 BindImportProcedure,
87 BindForwarder,
88 BindForwarderNOT,
89 BindImageModified,
90 BindExpandFileHeaders,
91 BindImageComplete,
92 BindMismatchedSymbols,
93 BindSymbolsNotUpdated
94 } IMAGEHLP_STATUS_REASON;
95 typedef BOOL(STDCALL*PIMAGEHLP_STATUS_ROUTINE)(IMAGEHLP_STATUS_REASON,LPSTR,LPSTR,ULONG,ULONG);
96 typedef struct _LOADED_IMAGE {
97 LPSTR ModuleName;
98 HANDLE hFile;
99 PUCHAR MappedAddress;
100 PIMAGE_NT_HEADERS FileHeader;
101 PIMAGE_SECTION_HEADER LastRvaSection;
102 ULONG NumberOfSections;
103 PIMAGE_SECTION_HEADER Sections;
104 ULONG Characteristics;
105 BOOLEAN fSystemImage;
106 BOOLEAN fDOSImage;
107 LIST_ENTRY Links;
108 ULONG SizeOfImage;
109 } LOADED_IMAGE,*PLOADED_IMAGE;
110 typedef struct _IMAGE_DEBUG_INFORMATION {
111 LIST_ENTRY List;
112 DWORD Size;
113 PVOID MappedBase;
114 USHORT Machine;
115 USHORT Characteristics;
116 DWORD CheckSum;
117 DWORD ImageBase;
118 DWORD SizeOfImage;
119 DWORD NumberOfSections;
120 PIMAGE_SECTION_HEADER Sections;
121 DWORD ExportedNamesSize;
122 LPSTR ExportedNames;
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;
133 LPSTR ImageFilePath;
134 LPSTR ImageFileName;
135 LPSTR DebugFilePath;
136 DWORD TimeDateStamp;
137 BOOL RomImage;
138 PIMAGE_DEBUG_DIRECTORY DebugDirectory;
139 DWORD NumberOfDebugDirectories;
140 DWORD Reserved[3];
141 } IMAGE_DEBUG_INFORMATION,*PIMAGE_DEBUG_INFORMATION;
142 typedef enum {
143 AddrMode1616,
144 AddrMode1632,
145 AddrModeReal,
146 AddrModeFlat
147 } ADDRESS_MODE;
148 typedef struct _tagADDRESS {
149 DWORD Offset;
150 WORD Segment;
151 ADDRESS_MODE Mode;
152 } ADDRESS,*LPADDRESS;
153 typedef struct _KDHELP {
154 DWORD Thread;
155 DWORD ThCallbackStack;
156 DWORD NextCallback;
157 DWORD FramePointer;
158 DWORD KiCallUserMode;
159 DWORD KeUserCallbackDispatcher;
160 DWORD SystemRangeStart;
161 } KDHELP,*PKDHELP;
162 typedef struct _tagSTACKFRAME {
163 ADDRESS AddrPC;
164 ADDRESS AddrReturn;
165 ADDRESS AddrFrame;
166 ADDRESS AddrStack;
167 LPVOID FuncTableEntry;
168 DWORD Params[4];
169 BOOL Far;
170 BOOL Virtual;
171 DWORD Reserved[3];
172 KDHELP KdHelp;
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 {
179 USHORT MajorVersion;
180 USHORT MinorVersion;
181 USHORT Revision;
182 USHORT Reserved;
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);
188 typedef enum {
189 SymNone,
190 SymCoff,
191 SymCv,
192 SymPdb,
193 SymExport,
194 SymDeferred,
195 SymSym
196 } SYM_TYPE;
197 typedef struct _IMAGEHLP_SYMBOL {
198 DWORD SizeOfStruct;
199 DWORD Address;
200 DWORD Size;
201 DWORD Flags;
202 DWORD MaxNameLength;
203 CHAR Name[1];
204 } IMAGEHLP_SYMBOL,*PIMAGEHLP_SYMBOL;
205 typedef struct _IMAGEHLP_MODULE {
206 DWORD SizeOfStruct;
207 DWORD BaseOfImage;
208 DWORD ImageSize;
209 DWORD TimeDateStamp;
210 DWORD CheckSum;
211 DWORD NumSyms;
212 SYM_TYPE SymType;
213 CHAR ModuleName[32];
214 CHAR ImageName[256];
215 CHAR LoadedImageName[256];
216 } IMAGEHLP_MODULE,*PIMAGEHLP_MODULE;
217 typedef struct _IMAGEHLP_LINE {
218 DWORD SizeOfStruct;
219 DWORD Key;
220 DWORD LineNumber;
221 PCHAR FileName;
222 DWORD Address;
223 } IMAGEHLP_LINE,*PIMAGEHLP_LINE;
224 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD {
225 DWORD SizeOfStruct;
226 DWORD BaseOfImage;
227 DWORD CheckSum;
228 DWORD TimeDateStamp;
229 CHAR FileName[MAX_PATH];
230 BOOLEAN Reparse;
231 } IMAGEHLP_DEFERRED_SYMBOL_LOAD,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
232 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL {
233 DWORD SizeOfStruct;
234 DWORD NumberOfDups;
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);
271 BOOL
272 _IMAGEHLPAPI
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 */
315 #ifdef UNICODE
316 #define MapFileAndCheckSum MapFileAndCheckSumW
317 #else
318 #define MapFileAndCheckSum MapFileAndCheckSumA
319 #endif
321 #ifdef __cplusplus
323 #endif
325 #endif /* _IMAGEHLP_H */