source: Daodan/MinGW/include/imagehlp.h@ 1133

Last change on this file since 1133 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 12.2 KB
Line 
1/*
2 imagehlp.h - Include file for IMAGEHLP.DLL APIs
3
4 Written by Mumit Khan <khan@nanotech.wisc.edu>
5
6 This file is part of a free library for the Win32 API.
7
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.
11
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.
15
16*/
17
18#ifndef _IMAGEHLP_H
19#define _IMAGEHLP_H
20#if __GNUC__ >=3
21#pragma GCC system_header
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
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
77
78#define _IMAGEHLPAPI DECLSPEC_IMPORT WINAPI
79
80#ifndef RC_INVOKED
81
82typedef enum _IMAGEHLP_STATUS_REASON {
83 BindOutOfMemory,
84 BindRvaToVaFailed,
85 BindNoRoomInImage,
86 BindImportModuleFailed,
87 BindImportProcedureFailed,
88 BindImportModule,
89 BindImportProcedure,
90 BindForwarder,
91 BindForwarderNOT,
92 BindImageModified,
93 BindExpandFileHeaders,
94 BindImageComplete,
95 BindMismatchedSymbols,
96 BindSymbolsNotUpdated
97} IMAGEHLP_STATUS_REASON;
98typedef BOOL(STDCALL*PIMAGEHLP_STATUS_ROUTINE)(IMAGEHLP_STATUS_REASON,LPSTR,LPSTR,ULONG,ULONG);
99typedef struct _LOADED_IMAGE {
100 LPSTR ModuleName;
101 HANDLE hFile;
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;
109 BOOLEAN fDOSImage;
110 LIST_ENTRY Links;
111 ULONG SizeOfImage;
112} LOADED_IMAGE,*PLOADED_IMAGE;
113typedef struct _IMAGE_DEBUG_INFORMATION {
114 LIST_ENTRY List;
115 DWORD Size;
116 PVOID MappedBase;
117 USHORT Machine;
118 USHORT Characteristics;
119 DWORD CheckSum;
120 DWORD ImageBase;
121 DWORD SizeOfImage;
122 DWORD NumberOfSections;
123 PIMAGE_SECTION_HEADER Sections;
124 DWORD ExportedNamesSize;
125 LPSTR ExportedNames;
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;
136 LPSTR ImageFilePath;
137 LPSTR ImageFileName;
138 LPSTR DebugFilePath;
139 DWORD TimeDateStamp;
140 BOOL RomImage;
141 PIMAGE_DEBUG_DIRECTORY DebugDirectory;
142 DWORD NumberOfDebugDirectories;
143 DWORD Reserved[3];
144} IMAGE_DEBUG_INFORMATION,*PIMAGE_DEBUG_INFORMATION;
145typedef enum {
146 AddrMode1616,
147 AddrMode1632,
148 AddrModeReal,
149 AddrModeFlat
150} ADDRESS_MODE;
151typedef struct _tagADDRESS {
152 DWORD Offset;
153 WORD Segment;
154 ADDRESS_MODE Mode;
155} ADDRESS,*LPADDRESS;
156typedef struct _KDHELP {
157 DWORD Thread;
158 DWORD ThCallbackStack;
159 DWORD NextCallback;
160 DWORD FramePointer;
161 DWORD KiCallUserMode;
162 DWORD KeUserCallbackDispatcher;
163 DWORD SystemRangeStart;
164} KDHELP,*PKDHELP;
165typedef struct _tagSTACKFRAME {
166 ADDRESS AddrPC;
167 ADDRESS AddrReturn;
168 ADDRESS AddrFrame;
169 ADDRESS AddrStack;
170 LPVOID FuncTableEntry;
171 DWORD Params[4];
172 BOOL Far;
173 BOOL Virtual;
174 DWORD Reserved[3];
175 KDHELP KdHelp;
176} STACKFRAME,*LPSTACKFRAME;
177typedef BOOL(STDCALL*PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE,DWORD,PVOID,DWORD,PDWORD);
178typedef LPVOID(STDCALL*PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE,DWORD);
179typedef DWORD(STDCALL*PGET_MODULE_BASE_ROUTINE)(HANDLE,DWORD);
180typedef DWORD(STDCALL*PTRANSLATE_ADDRESS_ROUTINE)(HANDLE,HANDLE,LPADDRESS);
181typedef struct API_VERSION {
182 USHORT MajorVersion;
183 USHORT MinorVersion;
184 USHORT Revision;
185 USHORT Reserved;
186} API_VERSION,*LPAPI_VERSION;
187typedef BOOL(CALLBACK*PSYM_ENUMMODULES_CALLBACK)(LPSTR,ULONG,PVOID);
188typedef BOOL(CALLBACK*PSYM_ENUMSYMBOLS_CALLBACK)(LPSTR,ULONG,ULONG,PVOID);
189typedef BOOL(CALLBACK*PENUMLOADED_MODULES_CALLBACK)(LPSTR,ULONG,ULONG,PVOID);
190typedef BOOL(CALLBACK*PSYMBOL_REGISTERED_CALLBACK)(HANDLE,ULONG,PVOID,PVOID);
191typedef enum {
192 SymNone,
193 SymCoff,
194 SymCv,
195 SymPdb,
196 SymExport,
197 SymDeferred,
198 SymSym
199} SYM_TYPE;
200typedef struct _IMAGEHLP_SYMBOL {
201 DWORD SizeOfStruct;
202 DWORD Address;
203 DWORD Size;
204 DWORD Flags;
205 DWORD MaxNameLength;
206 CHAR Name[1];
207} IMAGEHLP_SYMBOL,*PIMAGEHLP_SYMBOL;
208typedef struct _IMAGEHLP_MODULE {
209 DWORD SizeOfStruct;
210 DWORD BaseOfImage;
211 DWORD ImageSize;
212 DWORD TimeDateStamp;
213 DWORD CheckSum;
214 DWORD NumSyms;
215 SYM_TYPE SymType;
216 CHAR ModuleName[32];
217 CHAR ImageName[256];
218 CHAR LoadedImageName[256];
219} IMAGEHLP_MODULE,*PIMAGEHLP_MODULE;
220typedef struct _IMAGEHLP_LINE {
221 DWORD SizeOfStruct;
222 DWORD Key;
223 DWORD LineNumber;
224 PCHAR FileName;
225 DWORD Address;
226} IMAGEHLP_LINE,*PIMAGEHLP_LINE;
227typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD {
228 DWORD SizeOfStruct;
229 DWORD BaseOfImage;
230 DWORD CheckSum;
231 DWORD TimeDateStamp;
232 CHAR FileName[MAX_PATH];
233 BOOLEAN Reparse;
234} IMAGEHLP_DEFERRED_SYMBOL_LOAD,*PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
235typedef struct _IMAGEHLP_DUPLICATE_SYMBOL {
236 DWORD SizeOfStruct;
237 DWORD NumberOfDups;
238 PIMAGEHLP_SYMBOL Symbol;
239 ULONG SelectedSymbol;
240} IMAGEHLP_DUPLICATE_SYMBOL,*PIMAGEHLP_DUPLICATE_SYMBOL;
241typedef PVOID DIGEST_HANDLE;
242typedef BOOL(WINAPI*DIGEST_FUNCTION)(DIGEST_HANDLE refdata,PBYTE pData,DWORD dwLength);
243
244PIMAGE_NT_HEADERS _IMAGEHLPAPI CheckSumMappedFile(LPVOID,DWORD,LPDWORD,LPDWORD);
245DWORD _IMAGEHLPAPI MapFileAndCheckSumA(LPSTR,LPDWORD,LPDWORD);
246DWORD _IMAGEHLPAPI MapFileAndCheckSumW(PWSTR,LPDWORD,LPDWORD);
247BOOL _IMAGEHLPAPI TouchFileTimes(HANDLE,LPSYSTEMTIME);
248BOOL _IMAGEHLPAPI SplitSymbols(LPSTR,LPSTR,LPSTR,DWORD);
249HANDLE _IMAGEHLPAPI FindDebugInfoFile(LPSTR,LPSTR,LPSTR);
250HANDLE _IMAGEHLPAPI FindExecutableImage(LPSTR,LPSTR,LPSTR);
251BOOL _IMAGEHLPAPI UpdateDebugInfoFile(LPSTR,LPSTR,LPSTR,PIMAGE_NT_HEADERS);
252BOOL _IMAGEHLPAPI UpdateDebugInfoFileEx(LPSTR,LPSTR,LPSTR,PIMAGE_NT_HEADERS,DWORD);
253BOOL _IMAGEHLPAPI BindImage(/*IN*/ LPSTR,/*IN*/ LPSTR,/*IN*/ LPSTR);
254BOOL _IMAGEHLPAPI BindImageEx(/*IN*/ DWORD,/*IN*/ LPSTR,/*IN*/ LPSTR,/*IN*/ LPSTR,/*IN*/ PIMAGEHLP_STATUS_ROUTINE);
255BOOL _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);
256
257PLOADED_IMAGE _IMAGEHLPAPI ImageLoad(LPSTR,LPSTR);
258BOOL _IMAGEHLPAPI ImageUnload(PLOADED_IMAGE);
259PIMAGE_NT_HEADERS _IMAGEHLPAPI ImageNtHeader(/*IN*/ PVOID);
260PVOID _IMAGEHLPAPI ImageDirectoryEntryToData(/*IN*/ PVOID,/*IN*/ BOOLEAN,/*IN*/ USHORT,/*OUT*/ PULONG);
261PIMAGE_SECTION_HEADER _IMAGEHLPAPI ImageRvaToSection(/*IN*/ PIMAGE_NT_HEADERS,/*IN*/ PVOID,/*IN*/ ULONG);
262PVOID _IMAGEHLPAPI ImageRvaToVa(/*IN*/ PIMAGE_NT_HEADERS,/*IN*/ PVOID,/*IN*/ ULONG,/*IN OUT*/ PIMAGE_SECTION_HEADER*);
263BOOL _IMAGEHLPAPI MapAndLoad(LPSTR,LPSTR,PLOADED_IMAGE,BOOL,BOOL);
264BOOL _IMAGEHLPAPI GetImageConfigInformation(PLOADED_IMAGE,PIMAGE_LOAD_CONFIG_DIRECTORY);
265DWORD _IMAGEHLPAPI GetImageUnusedHeaderBytes(PLOADED_IMAGE,LPDWORD);
266BOOL _IMAGEHLPAPI SetImageConfigInformation(PLOADED_IMAGE,PIMAGE_LOAD_CONFIG_DIRECTORY);
267BOOL _IMAGEHLPAPI UnMapAndLoad(PLOADED_IMAGE);
268PIMAGE_DEBUG_INFORMATION _IMAGEHLPAPI MapDebugInformation(HANDLE,LPSTR,LPSTR,DWORD);
269BOOL _IMAGEHLPAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
270HANDLE _IMAGEHLPAPI FindExecutableImage(LPSTR,LPSTR,LPSTR);
271BOOL _IMAGEHLPAPI SearchTreeForFile(LPSTR,LPSTR,LPSTR);
272BOOL _IMAGEHLPAPI MakeSureDirectoryPathExists(LPCSTR);
273DWORD _IMAGEHLPAPI WINAPI UnDecorateSymbolName(LPCSTR,LPSTR,DWORD, DWORD);
274BOOL
275_IMAGEHLPAPI
276StackWalk(DWORD,HANDLE,HANDLE,LPSTACKFRAME,LPVOID,PREAD_PROCESS_MEMORY_ROUTINE,PFUNCTION_TABLE_ACCESS_ROUTINE,PGET_MODULE_BASE_ROUTINE,PTRANSLATE_ADDRESS_ROUTINE);
277LPAPI_VERSION _IMAGEHLPAPI ImagehlpApiVersion(VOID);
278LPAPI_VERSION _IMAGEHLPAPI ImagehlpApiVersionEx(LPAPI_VERSION);
279DWORD _IMAGEHLPAPI GetTimestampForLoadedLibrary(HMODULE);
280BOOL _IMAGEHLPAPI RemovePrivateCvSymbolic(PCHAR,PCHAR*,ULONG*);
281VOID _IMAGEHLPAPI RemoveRelocations(PCHAR);
282DWORD _IMAGEHLPAPI SymSetOptions(/*IN*/ DWORD);
283DWORD _IMAGEHLPAPI SymGetOptions(VOID);
284BOOL _IMAGEHLPAPI SymCleanup(/*IN*/ HANDLE);
285BOOL _IMAGEHLPAPI SymEnumerateModules(/*IN*/ HANDLE,/*IN*/ PSYM_ENUMMODULES_CALLBACK,/*IN*/ PVOID);
286BOOL _IMAGEHLPAPI SymEnumerateSymbols(/*IN*/ HANDLE,/*IN*/ DWORD,/*IN*/ PSYM_ENUMSYMBOLS_CALLBACK,/*IN*/ PVOID);
287BOOL _IMAGEHLPAPI EnumerateLoadedModules(/*IN*/ HANDLE,/*IN*/ PENUMLOADED_MODULES_CALLBACK,/*IN*/ PVOID);
288LPVOID _IMAGEHLPAPI SymFunctionTableAccess(HANDLE,DWORD);
289BOOL _IMAGEHLPAPI SymGetModuleInfo(/*IN*/ HANDLE,/*IN*/ DWORD,/*OUT*/ PIMAGEHLP_MODULE);
290DWORD _IMAGEHLPAPI SymGetModuleBase(/*IN*/ HANDLE,/*IN*/ DWORD);
291BOOL _IMAGEHLPAPI SymGetSymFromAddr(/*IN*/ HANDLE,/*IN*/ DWORD,/*OUT*/ PDWORD,/*OUT*/ PIMAGEHLP_SYMBOL);
292BOOL _IMAGEHLPAPI SymGetSymFromName(/*IN*/ HANDLE,/*IN*/ LPSTR,/*OUT*/ PIMAGEHLP_SYMBOL);
293BOOL _IMAGEHLPAPI SymGetSymNext(/*IN*/ HANDLE,/*IN OUT*/ PIMAGEHLP_SYMBOL);
294BOOL _IMAGEHLPAPI SymGetSymPrev(/*IN*/ HANDLE,/*IN OUT*/ PIMAGEHLP_SYMBOL);
295BOOL _IMAGEHLPAPI SymGetLineFromAddr(/*IN*/ HANDLE,/*IN*/ DWORD,/*OUT*/ PDWORD,/*OUT*/ PIMAGEHLP_LINE);
296BOOL _IMAGEHLPAPI SymGetLineFromName(/*IN*/ HANDLE,/*IN*/ LPSTR,/*IN*/ LPSTR,/*IN*/ DWORD,/*OUT*/ PLONG,/*IN OUT*/ PIMAGEHLP_LINE);
297BOOL _IMAGEHLPAPI SymGetLineNext(/*IN*/ HANDLE,/*IN OUT*/ PIMAGEHLP_LINE);
298BOOL _IMAGEHLPAPI SymGetLinePrev(/*IN*/ HANDLE,/*IN OUT*/ PIMAGEHLP_LINE);
299BOOL _IMAGEHLPAPI SymMatchFileName(/*IN*/ LPSTR,/*IN*/ LPSTR,/*OUT*/ LPSTR*,/*OUT*/ LPSTR*);
300BOOL _IMAGEHLPAPI SymInitialize(/*IN*/ HANDLE,/*IN*/ LPSTR,/*IN*/ BOOL);
301BOOL _IMAGEHLPAPI SymGetSearchPath(/*IN*/ HANDLE,/*OUT*/ LPSTR,/*IN*/ DWORD);
302BOOL _IMAGEHLPAPI SymSetSearchPath(/*IN*/ HANDLE,/*IN*/ LPSTR);
303BOOL _IMAGEHLPAPI SymLoadModule(/*IN*/ HANDLE,/*IN*/ HANDLE,/*IN*/ PSTR,/*IN*/ PSTR,/*IN*/ DWORD,/*IN*/ DWORD);
304BOOL _IMAGEHLPAPI SymUnloadModule(/*IN*/ HANDLE,/*IN*/ DWORD);
305BOOL _IMAGEHLPAPI SymUnDName(/*IN*/ PIMAGEHLP_SYMBOL,/*OUT*/ LPSTR,/*IN*/ DWORD);
306BOOL _IMAGEHLPAPI SymRegisterCallback(/*IN*/ HANDLE,/*IN*/ PSYMBOL_REGISTERED_CALLBACK,/*IN*/ PVOID);
307BOOL _IMAGEHLPAPI ImageGetDigestStream(/*IN*/ HANDLE,/*IN*/ DWORD,/*IN*/ DIGEST_FUNCTION,/*IN*/ DIGEST_HANDLE);
308BOOL _IMAGEHLPAPI ImageAddCertificate(/*IN*/ HANDLE,/*IN*/ LPWIN_CERTIFICATE,/*OUT*/ PDWORD);
309BOOL _IMAGEHLPAPI ImageRemoveCertificate(/*IN*/ HANDLE,/*IN*/ DWORD);
310BOOL _IMAGEHLPAPI ImageEnumerateCertificates(/*IN*/ HANDLE,/*IN*/ WORD,/*OUT*/ PDWORD,/*IN OUT*/ PDWORD /*OPTIONAL*/,/*IN OUT*/ DWORD /*OPTIONAL*/);
311BOOL _IMAGEHLPAPI ImageGetCertificateData(/*IN*/ HANDLE,/*IN*/ DWORD,/*OUT*/ LPWIN_CERTIFICATE,/*IN OUT*/ PDWORD);
312BOOL _IMAGEHLPAPI ImageGetCertificateHeader(/*IN*/ HANDLE,/*IN*/ DWORD,/*IN OUT*/ LPWIN_CERTIFICATE);
313BOOL _IMAGEHLPAPI CopyPdb(CHAR const*,CHAR const*,BOOL);
314BOOL _IMAGEHLPAPI RemovePrivateCvSymbolicEx(PCHAR,ULONG,PCHAR*,ULONG*);
315
316#endif /* RC_INVOKED */
317
318#ifdef UNICODE
319#define MapFileAndCheckSum MapFileAndCheckSumW
320#else
321#define MapFileAndCheckSum MapFileAndCheckSumA
322#endif
323
324#ifdef __cplusplus
325}
326#endif
327
328#endif /* _IMAGEHLP_H */
329
Note: See TracBrowser for help on using the repository browser.