dmime/tests: Avoid discarding old notifications in test.
[wine.git] / include / dbghelp.h
blob9672b667f1ead64023808b53724182ba08f6c348
1 /*
2 * Declarations for DBGHELP
4 * Copyright (C) 2003 Eric Pouech
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_DBGHELP_H
22 #define __WINE_DBGHELP_H
24 #include <minidumpapiset.h>
26 #ifdef __cplusplus
27 extern "C" {
28 #endif /* defined(__cplusplus) */
30 #ifdef _WIN64
31 #ifndef _IMAGEHLP64
32 #define _IMAGEHLP64
33 #endif
34 #endif
36 #ifdef _IMAGEHLP_SOURCE_
37 #define IMAGEAPI WINAPI
38 #else
39 #define IMAGEAPI DECLSPEC_IMPORT WINAPI
40 #endif
42 #define DBHLPAPI IMAGEAPI
44 typedef struct _LOADED_IMAGE
46 PSTR ModuleName;
47 HANDLE hFile;
48 PUCHAR MappedAddress;
49 PIMAGE_NT_HEADERS FileHeader;
50 PIMAGE_SECTION_HEADER LastRvaSection;
51 ULONG NumberOfSections;
52 PIMAGE_SECTION_HEADER Sections;
53 ULONG Characteristics;
54 BOOLEAN fSystemImage;
55 BOOLEAN fDOSImage;
56 BOOLEAN fReadOnly;
57 UCHAR Version;
58 LIST_ENTRY Links;
59 ULONG SizeOfImage;
60 } LOADED_IMAGE, *PLOADED_IMAGE;
62 /*************************
63 * IMAGEHLP equiv *
64 *************************/
66 typedef enum
68 AddrMode1616,
69 AddrMode1632,
70 AddrModeReal,
71 AddrModeFlat
72 } ADDRESS_MODE;
74 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
75 #define ADDRESS ADDRESS64
76 #define LPADDRESS LPADDRESS64
77 #else
78 typedef struct _tagADDRESS
80 DWORD Offset;
81 WORD Segment;
82 ADDRESS_MODE Mode;
83 } ADDRESS, *LPADDRESS;
84 #endif
86 typedef struct _tagADDRESS64
88 DWORD64 Offset;
89 WORD Segment;
90 ADDRESS_MODE Mode;
91 } ADDRESS64, *LPADDRESS64;
93 #define SYMF_OMAP_GENERATED 0x00000001
94 #define SYMF_OMAP_MODIFIED 0x00000002
95 #define SYMF_USER_GENERATED 0x00000004
96 #define SYMF_REGISTER 0x00000008
97 #define SYMF_REGREL 0x00000010
98 #define SYMF_FRAMEREL 0x00000020
99 #define SYMF_PARAMETER 0x00000040
100 #define SYMF_LOCAL 0x00000080
101 #define SYMF_CONSTANT 0x00000100
102 #define SYMF_EXPORT 0x00000200
103 #define SYMF_FORWARDER 0x00000400
104 #define SYMF_FUNCTION 0x00000800
105 #define SYMF_VIRTUAL 0x00001000
106 #define SYMF_THUNK 0x00002000
107 #define SYMF_TLSREL 0x00004000
109 typedef enum
111 SymNone = 0,
112 SymCoff,
113 SymCv,
114 SymPdb,
115 SymExport,
116 SymDeferred,
117 SymSym,
118 SymDia,
119 SymVirtual,
120 NumSymTypes
121 } SYM_TYPE;
123 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
124 #define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64
125 #define IMAGEHLP_SYMBOLW IMAGEHLP_SYMBOLW64
126 #define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64
127 #define PIMAGEHLP_SYMBOLW PIMAGEHLP_SYMBOLW64
128 #else
129 typedef struct _IMAGEHLP_SYMBOL
131 DWORD SizeOfStruct;
132 DWORD Address;
133 DWORD Size;
134 DWORD Flags;
135 DWORD MaxNameLength;
136 CHAR Name[1];
137 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
139 typedef struct _IMAGEHLP_SYMBOLW
141 DWORD SizeOfStruct;
142 DWORD Address;
143 DWORD Size;
144 DWORD Flags;
145 DWORD MaxNameLength;
146 WCHAR Name[1];
147 } IMAGEHLP_SYMBOLW, *PIMAGEHLP_SYMBOLW;
148 #endif
150 typedef struct _IMAGEHLP_SYMBOL64
152 DWORD SizeOfStruct;
153 DWORD64 Address;
154 DWORD Size;
155 DWORD Flags;
156 DWORD MaxNameLength;
157 CHAR Name[1];
158 } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
160 typedef struct _IMAGEHLP_SYMBOLW64
162 DWORD SizeOfStruct;
163 DWORD64 Address;
164 DWORD Size;
165 DWORD Flags;
166 DWORD MaxNameLength;
167 WCHAR Name[1];
168 } IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64;
170 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
171 #define IMAGEHLP_MODULE IMAGEHLP_MODULE64
172 #define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64
173 #define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64
174 #define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64
175 #else
176 typedef struct _IMAGEHLP_MODULE
178 DWORD SizeOfStruct;
179 DWORD BaseOfImage;
180 DWORD ImageSize;
181 DWORD TimeDateStamp;
182 DWORD CheckSum;
183 DWORD NumSyms;
184 SYM_TYPE SymType;
185 CHAR ModuleName[32];
186 CHAR ImageName[256];
187 CHAR LoadedImageName[256];
188 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
190 typedef struct _IMAGEHLP_MODULEW
192 DWORD SizeOfStruct;
193 DWORD BaseOfImage;
194 DWORD ImageSize;
195 DWORD TimeDateStamp;
196 DWORD CheckSum;
197 DWORD NumSyms;
198 SYM_TYPE SymType;
199 WCHAR ModuleName[32];
200 WCHAR ImageName[256];
201 WCHAR LoadedImageName[256];
202 } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
203 #endif
205 typedef struct _IMAGEHLP_MODULE64
207 DWORD SizeOfStruct;
208 DWORD64 BaseOfImage;
209 DWORD ImageSize;
210 DWORD TimeDateStamp;
211 DWORD CheckSum;
212 DWORD NumSyms;
213 SYM_TYPE SymType;
214 CHAR ModuleName[32];
215 CHAR ImageName[256];
216 CHAR LoadedImageName[256];
217 CHAR LoadedPdbName[256];
218 DWORD CVSig;
219 CHAR CVData[MAX_PATH*3];
220 DWORD PdbSig;
221 GUID PdbSig70;
222 DWORD PdbAge;
223 BOOL PdbUnmatched;
224 BOOL DbgUnmatched;
225 BOOL LineNumbers;
226 BOOL GlobalSymbols;
227 BOOL TypeInfo;
228 BOOL SourceIndexed;
229 BOOL Publics;
230 DWORD MachineType;
231 DWORD Reserved;
232 } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
234 typedef struct _IMAGEHLP_MODULEW64
236 DWORD SizeOfStruct;
237 DWORD64 BaseOfImage;
238 DWORD ImageSize;
239 DWORD TimeDateStamp;
240 DWORD CheckSum;
241 DWORD NumSyms;
242 SYM_TYPE SymType;
243 WCHAR ModuleName[32];
244 WCHAR ImageName[256];
245 WCHAR LoadedImageName[256];
246 WCHAR LoadedPdbName[256];
247 DWORD CVSig;
248 WCHAR CVData[MAX_PATH*3];
249 DWORD PdbSig;
250 GUID PdbSig70;
251 DWORD PdbAge;
252 BOOL PdbUnmatched;
253 BOOL DbgUnmatched;
254 BOOL LineNumbers;
255 BOOL GlobalSymbols;
256 BOOL TypeInfo;
257 BOOL SourceIndexed;
258 BOOL Publics;
259 DWORD MachineType;
260 DWORD Reserved;
261 } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
263 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
264 #define IMAGEHLP_LINE IMAGEHLP_LINE64
265 #define PIMAGEHLP_LINE PIMAGEHLP_LINE64
266 #define IMAGEHLP_LINEW IMAGEHLP_LINEW64
267 #define PIMAGEHLP_LINEW PIMAGEHLP_LINEW64
268 #else
269 typedef struct _IMAGEHLP_LINE
271 DWORD SizeOfStruct;
272 PVOID Key;
273 DWORD LineNumber;
274 PCHAR FileName;
275 DWORD Address;
276 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
278 typedef struct _IMAGEHLP_LINEW
280 DWORD SizeOfStruct;
281 PVOID Key;
282 DWORD LineNumber;
283 PWSTR FileName;
284 DWORD Address;
285 } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW;
286 #endif
288 typedef struct _IMAGEHLP_LINE64
290 DWORD SizeOfStruct;
291 PVOID Key;
292 DWORD LineNumber;
293 PCHAR FileName;
294 DWORD64 Address;
295 } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
297 typedef struct _IMAGEHLP_LINEW64
299 DWORD SizeOfStruct;
300 PVOID Key;
301 DWORD LineNumber;
302 PWSTR FileName;
303 DWORD64 Address;
304 } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
306 typedef struct _SOURCEFILE
308 DWORD64 ModBase;
309 PCHAR FileName;
310 } SOURCEFILE, *PSOURCEFILE;
312 typedef struct _SOURCEFILEW
314 DWORD64 ModBase;
315 PWSTR FileName;
316 } SOURCEFILEW, *PSOURCEFILEW;
318 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
319 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
320 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
321 #define CBA_SYMBOLS_UNLOADED 0x00000004
322 #define CBA_DUPLICATE_SYMBOL 0x00000005
323 #define CBA_READ_MEMORY 0x00000006
324 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007
325 #define CBA_SET_OPTIONS 0x00000008
326 #define CBA_EVENT 0x00000010
327 #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020
328 #define CBA_DEBUG_INFO 0x10000000
329 #define CBA_SRCSRV_INFO 0x20000000
330 #define CBA_SRCSRV_EVENT 0x40000000
332 typedef struct _IMAGEHLP_CBA_READ_MEMORY
334 DWORD64 addr;
335 PVOID buf;
336 DWORD bytes;
337 DWORD *bytesread;
338 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
340 enum
342 sevInfo = 0,
343 sevProblem,
344 sevAttn,
345 sevFatal,
346 sevMax
349 #define EVENT_SRCSPEW_START 100
350 #define EVENT_SRCSPEW 100
351 #define EVENT_SRCSPEW_END 199
353 typedef struct _IMAGEHLP_CBA_EVENT
355 DWORD severity;
356 DWORD code;
357 PCHAR desc;
358 PVOID object;
359 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
361 typedef struct _IMAGEHLP_CBA_EVENTW
363 DWORD severity;
364 DWORD code;
365 PCWSTR desc;
366 PVOID object;
367 } IMAGEHLP_CBA_EVENTW, *PIMAGEHLP_CBA_EVENTW;
369 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
370 #define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64
371 #define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64
372 #else
373 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
375 DWORD SizeOfStruct;
376 DWORD BaseOfImage;
377 DWORD CheckSum;
378 DWORD TimeDateStamp;
379 CHAR FileName[MAX_PATH];
380 BOOLEAN Reparse;
381 HANDLE hFile;
382 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
383 #endif
385 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
387 DWORD SizeOfStruct;
388 DWORD64 BaseOfImage;
389 DWORD CheckSum;
390 DWORD TimeDateStamp;
391 CHAR FileName[MAX_PATH];
392 BOOLEAN Reparse;
393 HANDLE hFile;
394 DWORD Flags;
395 } IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
397 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
399 DWORD SizeOfStruct;
400 DWORD64 BaseOfImage;
401 DWORD CheckSum;
402 DWORD TimeDateStamp;
403 WCHAR FileName[MAX_PATH + 1];
404 BOOLEAN Reparse;
405 HANDLE hFile;
406 DWORD Flags;
407 } IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
409 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
410 #define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64
411 #define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64
412 #else
413 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
415 DWORD SizeOfStruct;
416 DWORD NumberOfDups;
417 PIMAGEHLP_SYMBOL Symbol;
418 DWORD SelectedSymbol;
419 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
420 #endif
422 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
424 DWORD SizeOfStruct;
425 DWORD NumberOfDups;
426 PIMAGEHLP_SYMBOL64 Symbol;
427 DWORD SelectedSymbol;
428 } IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64;
430 #define SYMOPT_CASE_INSENSITIVE 0x00000001
431 #define SYMOPT_UNDNAME 0x00000002
432 #define SYMOPT_DEFERRED_LOADS 0x00000004
433 #define SYMOPT_NO_CPP 0x00000008
434 #define SYMOPT_LOAD_LINES 0x00000010
435 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
436 #define SYMOPT_LOAD_ANYTHING 0x00000040
437 #define SYMOPT_IGNORE_CVREC 0x00000080
438 #define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100
439 #define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200
440 #define SYMOPT_EXACT_SYMBOLS 0x00000400
441 #define SYMOPT_WILD_UNDERSCORE 0x00000800
442 #define SYMOPT_USE_DEFAULTS 0x00001000
443 /* latest SDK defines:
444 #define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800
445 #define SYMOPT_IGNORE_NT_SYMPATH 0x00001000
447 #define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000
448 #define SYMOPT_PUBLICS_ONLY 0x00004000
449 #define SYMOPT_NO_PUBLICS 0x00008000
450 #define SYMOPT_AUTO_PUBLICS 0x00010000
451 #define SYMOPT_NO_IMAGE_SEARCH 0x00020000
452 #define SYMOPT_SECURE 0x00040000
453 #define SYMOPT_NO_PROMPTS 0x00080000
454 #define SYMOPT_OVERWRITE 0x00100000
455 #define SYMOPT_IGNORE_IMAGEDIR 0x00200000
456 #define SYMOPT_FLAT_DIRECTORY 0x00400000
457 #define SYMOPT_FAVOR_COMPRESSED 0x00800000
458 #define SYMOPT_ALLOW_ZERO_ADDRESS 0x01000000
459 #define SYMOPT_DISABLE_SYMSRV_AUTODETECT 0x02000000
460 #define SYMOPT_READONLY_CACHE 0x04000000
461 #define SYMOPT_SYMPATH_LAST 0x08000000
462 #define SYMOPT_DISABLE_FAST_SYMBOLS 0x10000000
463 #define SYMOPT_DISABLE_SYMSRV_TIMEOUT 0x20000000
464 #define SYMOPT_DISABLE_SRVSTAR_ON_STARTUP 0x40000000
465 #define SYMOPT_DEBUG 0x80000000
467 typedef struct _IMAGEHLP_STACK_FRAME
469 ULONG64 InstructionOffset;
470 ULONG64 ReturnOffset;
471 ULONG64 FrameOffset;
472 ULONG64 StackOffset;
473 ULONG64 BackingStoreOffset;
474 ULONG64 FuncTableEntry;
475 ULONG64 Params[4];
476 ULONG64 Reserved[5];
477 BOOL Virtual;
478 ULONG Reserved2;
479 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
481 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
483 #define DBHHEADER_DEBUGDIRS 0x1
484 typedef struct _DBGHELP_MODLOAD_DATA
486 DWORD ssize;
487 DWORD ssig;
488 PVOID data;
489 DWORD size;
490 DWORD flags;
491 } MODLOAD_DATA, *PMODLOAD_DATA;
493 /*************************
494 * MODULE handling *
495 *************************/
497 /* flags for SymLoadModuleEx */
498 #define SLMFLAG_VIRTUAL 0x1
499 #define SLMFLAG_NO_SYMBOLS 0x4
501 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
502 BOOL IMAGEAPI EnumerateLoadedModules64(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
503 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PCWSTR, DWORD64, ULONG, PVOID);
504 BOOL IMAGEAPI EnumerateLoadedModulesW64(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
505 BOOL IMAGEAPI EnumerateLoadedModulesEx(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
506 BOOL IMAGEAPI EnumerateLoadedModulesExW(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
507 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PCSTR, DWORD64, PVOID);
508 BOOL IMAGEAPI SymEnumerateModules64(HANDLE, PSYM_ENUMMODULES_CALLBACK64, PVOID);
509 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(PCWSTR, DWORD64, PVOID);
510 BOOL IMAGEAPI SymEnumerateModulesW64(HANDLE, PSYM_ENUMMODULES_CALLBACKW64, PVOID);
511 BOOL IMAGEAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
512 BOOL IMAGEAPI SymGetModuleInfoW64(HANDLE, DWORD64, PIMAGEHLP_MODULEW64);
513 DWORD64 IMAGEAPI SymGetModuleBase64(HANDLE, DWORD64);
514 DWORD64 IMAGEAPI SymLoadModule64(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD);
515 DWORD64 IMAGEAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD, PMODLOAD_DATA, DWORD);
516 DWORD64 IMAGEAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64, DWORD, PMODLOAD_DATA, DWORD);
517 BOOL IMAGEAPI SymUnloadModule64(HANDLE, DWORD64);
518 BOOL IMAGEAPI SymRefreshModuleList(HANDLE);
520 /*************************
521 * Symbol Handling *
522 *************************/
524 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
525 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER /* 0x08 */
526 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL /* 0x10 */
527 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL /* 0x20 */
528 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER /* 0x40 */
529 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL /* 0x80 */
530 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT /* 0x100 */
531 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION /* 0x800 */
533 #define SYMFLAG_VALUEPRESENT 0x00000001
534 #define SYMFLAG_REGISTER 0x00000008
535 #define SYMFLAG_REGREL 0x00000010
536 #define SYMFLAG_FRAMEREL 0x00000020
537 #define SYMFLAG_PARAMETER 0x00000040
538 #define SYMFLAG_LOCAL 0x00000080
539 #define SYMFLAG_CONSTANT 0x00000100
540 #define SYMFLAG_EXPORT 0x00000200
541 #define SYMFLAG_FORWARDER 0x00000400
542 #define SYMFLAG_FUNCTION 0x00000800
543 #define SYMFLAG_VIRTUAL 0x00001000
544 #define SYMFLAG_THUNK 0x00002000
545 #define SYMFLAG_TLSREL 0x00004000
546 #define SYMFLAG_SLOT 0x00008000
547 #define SYMFLAG_ILREL 0x00010000
548 #define SYMFLAG_METADATA 0x00020000
549 #define SYMFLAG_CLR_TOKEN 0x00040000
550 #define SYMFLAG_NULL 0x00080000
551 #define SYMFLAG_FUNC_NO_RETURN 0x00100000
552 #define SYMFLAG_SYNTHETIC_ZEROBASE 0x00200000
553 #define SYMFLAG_PUBLIC_CODE 0x00400000
555 #define MAX_SYM_NAME 2000
557 typedef struct _SYMBOL_INFO
559 ULONG SizeOfStruct;
560 ULONG TypeIndex;
561 ULONG64 Reserved[2];
562 ULONG Index;
563 ULONG Size;
564 ULONG64 ModBase;
565 ULONG Flags;
566 ULONG64 Value;
567 ULONG64 Address;
568 ULONG Register;
569 ULONG Scope;
570 ULONG Tag;
571 ULONG NameLen;
572 ULONG MaxNameLen;
573 CHAR Name[1];
574 } SYMBOL_INFO, *PSYMBOL_INFO;
576 typedef struct _SYMBOL_INFOW
578 ULONG SizeOfStruct;
579 ULONG TypeIndex;
580 ULONG64 Reserved[2];
581 ULONG Index;
582 ULONG Size;
583 ULONG64 ModBase;
584 ULONG Flags;
585 ULONG64 Value;
586 ULONG64 Address;
587 ULONG Register;
588 ULONG Scope;
589 ULONG Tag;
590 ULONG NameLen;
591 ULONG MaxNameLen;
592 WCHAR Name[1];
593 } SYMBOL_INFOW, *PSYMBOL_INFOW;
595 typedef struct _SYMBOL_INFO_PACKAGE
597 SYMBOL_INFO si;
598 CHAR name[MAX_SYM_NAME+1];
599 } SYMBOL_INFO_PACKAGE, *PSYMBOL_INFO_PACKAGE;
601 typedef struct _SYMBOL_INFO_PACKAGEW
603 SYMBOL_INFOW si;
604 WCHAR name[MAX_SYM_NAME+1];
605 } SYMBOL_INFO_PACKAGEW, *PSYMBOL_INFO_PACKAGEW;
607 typedef struct _SYMSRV_INDEX_INFO
609 DWORD sizeofstruct;
610 CHAR file[MAX_PATH + 1];
611 BOOL stripped;
612 DWORD timestamp;
613 DWORD size;
614 CHAR dbgfile[MAX_PATH + 1];
615 CHAR pdbfile[MAX_PATH + 1];
616 GUID guid;
617 DWORD sig;
618 DWORD age;
619 } SYMSRV_INDEX_INFO, *PSYMSRV_INDEX_INFO;
621 typedef struct
623 DWORD sizeofstruct;
624 WCHAR file[MAX_PATH + 1];
625 BOOL stripped;
626 DWORD timestamp;
627 DWORD size;
628 WCHAR dbgfile[MAX_PATH + 1];
629 WCHAR pdbfile[MAX_PATH + 1];
630 GUID guid;
631 DWORD sig;
632 DWORD age;
633 } SYMSRV_INDEX_INFOW, *PSYMSRV_INDEX_INFOW;
635 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
637 TI_GET_SYMTAG,
638 TI_GET_SYMNAME,
639 TI_GET_LENGTH,
640 TI_GET_TYPE,
641 TI_GET_TYPEID,
642 TI_GET_BASETYPE,
643 TI_GET_ARRAYINDEXTYPEID,
644 TI_FINDCHILDREN,
645 TI_GET_DATAKIND,
646 TI_GET_ADDRESSOFFSET,
647 TI_GET_OFFSET,
648 TI_GET_VALUE,
649 TI_GET_COUNT,
650 TI_GET_CHILDRENCOUNT,
651 TI_GET_BITPOSITION,
652 TI_GET_VIRTUALBASECLASS,
653 TI_GET_VIRTUALTABLESHAPEID,
654 TI_GET_VIRTUALBASEPOINTEROFFSET,
655 TI_GET_CLASSPARENTID,
656 TI_GET_NESTED,
657 TI_GET_SYMINDEX,
658 TI_GET_LEXICALPARENT,
659 TI_GET_ADDRESS,
660 TI_GET_THISADJUST,
661 TI_GET_UDTKIND,
662 TI_IS_EQUIV_TO,
663 TI_GET_CALLING_CONVENTION,
664 TI_IS_CLOSE_EQUIV_TO,
665 TI_GTIEX_REQS_VALID,
666 TI_GET_VIRTUALBASEOFFSET,
667 TI_GET_VIRTUALBASEDISPINDEX,
668 TI_GET_IS_REFERENCE,
669 TI_GET_INDIRECTVIRTUALBASECLASS,
670 TI_GET_VIRTUALBASETABLETYPE,
671 TI_GET_OBJECTPOINTERTYPE,
672 IMAGEHLP_SYMBOL_TYPE_INFO_MAX
673 } IMAGEHLP_SYMBOL_TYPE_INFO;
675 #define IMAGEHLP_GET_TYPE_INFO_UNCACHED 0x00000001
676 #define IMAGEHLP_GET_TYPE_INFO_CHILDREN 0x00000002
677 typedef struct _IMAGEHLP_GET_TYPE_INFO_PARAMS
679 ULONG SizeOfStruct;
680 ULONG Flags;
681 ULONG NumIds;
682 PULONG TypeIds;
683 ULONG64 TagFilter;
684 ULONG NumReqs;
685 IMAGEHLP_SYMBOL_TYPE_INFO* ReqKinds;
686 PULONG_PTR ReqOffsets;
687 PULONG ReqSizes;
688 ULONG_PTR ReqStride;
689 ULONG_PTR BufferSize;
690 PVOID Buffer;
691 ULONG EntriesMatched;
692 ULONG EntriesFilled;
693 ULONG64 TagsFound;
694 ULONG64 AllReqsValid;
695 ULONG NumReqsValid;
696 PULONG64 ReqsValid;
697 } IMAGEHLP_GET_TYPE_INFO_PARAMS, *PIMAGEHLP_GET_TYPE_INFO_PARAMS;
699 typedef struct _TI_FINDCHILDREN_PARAMS
701 ULONG Count;
702 ULONG Start;
703 ULONG ChildId[1];
704 } TI_FINDCHILDREN_PARAMS;
706 #define UNDNAME_COMPLETE (0x0000)
707 #define UNDNAME_NO_LEADING_UNDERSCORES (0x0001)
708 #define UNDNAME_NO_MS_KEYWORDS (0x0002)
709 #define UNDNAME_NO_FUNCTION_RETURNS (0x0004)
710 #define UNDNAME_NO_ALLOCATION_MODEL (0x0008)
711 #define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010)
712 #define UNDNAME_NO_MS_THISTYPE (0x0020)
713 #define UNDNAME_NO_CV_THISTYPE (0x0040)
714 #define UNDNAME_NO_THISTYPE (0x0060)
715 #define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080)
716 #define UNDNAME_NO_THROW_SIGNATURES (0x0100)
717 #define UNDNAME_NO_MEMBER_TYPE (0x0200)
718 #define UNDNAME_NO_RETURN_UDT_MODEL (0x0400)
719 #define UNDNAME_32_BIT_DECODE (0x0800)
720 #define UNDNAME_NAME_ONLY (0x1000)
721 #define UNDNAME_NO_ARGUMENTS (0x2000)
722 #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
724 #define SYMSEARCH_MASKOBJS 0x01
725 #define SYMSEARCH_RECURSE 0x02
726 #define SYMSEARCH_GLOBALSONLY 0x04
728 BOOL IMAGEAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
729 BOOL IMAGEAPI SymGetTypeInfoEx(HANDLE, DWORD64, PIMAGEHLP_GET_TYPE_INFO_PARAMS);
730 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
731 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW, ULONG, PVOID);
732 BOOL IMAGEAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
733 BOOL IMAGEAPI SymEnumTypesW(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
734 BOOL IMAGEAPI SymEnumTypesByName(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
735 BOOL IMAGEAPI SymEnumTypesByNameW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
736 BOOL IMAGEAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
737 BOOL IMAGEAPI SymFromAddrW(HANDLE, DWORD64, DWORD64*, SYMBOL_INFOW*);
738 BOOL IMAGEAPI SymFromInlineContext(HANDLE, DWORD64, ULONG, PDWORD64, PSYMBOL_INFO);
739 BOOL IMAGEAPI SymFromInlineContextW(HANDLE, DWORD64, ULONG, PDWORD64, PSYMBOL_INFOW);
740 BOOL IMAGEAPI SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
741 BOOL IMAGEAPI SymFromTokenW(HANDLE, DWORD64, DWORD, PSYMBOL_INFOW);
742 BOOL IMAGEAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
743 BOOL IMAGEAPI SymFromNameW(HANDLE, PCWSTR, PSYMBOL_INFOW);
744 BOOL IMAGEAPI SymGetSymFromAddr64(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
745 BOOL IMAGEAPI SymGetSymFromName64(HANDLE, PCSTR, PIMAGEHLP_SYMBOL64);
746 BOOL IMAGEAPI SymGetTypeFromName(HANDLE, ULONG64, PCSTR, PSYMBOL_INFO);
747 BOOL IMAGEAPI SymGetTypeFromNameW(HANDLE, ULONG64, PCWSTR, PSYMBOL_INFOW);
748 BOOL IMAGEAPI SymGetSymNext64(HANDLE, PIMAGEHLP_SYMBOL64);
749 BOOL IMAGEAPI SymGetSymNextW64(HANDLE, PIMAGEHLP_SYMBOLW64);
750 BOOL IMAGEAPI SymGetSymPrev64(HANDLE, PIMAGEHLP_SYMBOL64);
751 BOOL IMAGEAPI SymGetSymPrevW64(HANDLE, PIMAGEHLP_SYMBOLW64);
752 BOOL IMAGEAPI SymEnumSym(HANDLE,ULONG64,PSYM_ENUMERATESYMBOLS_CALLBACK,PVOID);
753 BOOL IMAGEAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
754 BOOL IMAGEAPI SymEnumSymbolsW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
755 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
756 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PCWSTR, DWORD64, ULONG, PVOID);
757 BOOL IMAGEAPI SymEnumerateSymbols64(HANDLE, ULONG64, PSYM_ENUMSYMBOLS_CALLBACK64, PVOID);
758 BOOL IMAGEAPI SymEnumerateSymbolsW64(HANDLE, ULONG64, PSYM_ENUMSYMBOLS_CALLBACK64W, PVOID);
759 BOOL IMAGEAPI SymEnumSymbolsForAddr(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
760 BOOL IMAGEAPI SymEnumSymbolsForAddrW(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
761 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
762 BOOL IMAGEAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
763 BOOL IMAGEAPI SymRegisterCallbackW64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
764 BOOL IMAGEAPI SymUnDName64(PIMAGEHLP_SYMBOL64, PSTR, DWORD);
765 BOOL IMAGEAPI SymMatchString(PCSTR, PCSTR, BOOL);
766 BOOL IMAGEAPI SymMatchStringA(PCSTR, PCSTR, BOOL);
767 BOOL IMAGEAPI SymMatchStringW(PCWSTR, PCWSTR, BOOL);
768 BOOL IMAGEAPI SymSearch(HANDLE, ULONG64, DWORD, DWORD, PCSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID, DWORD);
769 BOOL IMAGEAPI SymSearchW(HANDLE, ULONG64, DWORD, DWORD, PCWSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID, DWORD);
770 DWORD IMAGEAPI UnDecorateSymbolName(PCSTR, PSTR, DWORD, DWORD);
771 DWORD IMAGEAPI UnDecorateSymbolNameW(PCWSTR, PWSTR, DWORD, DWORD);
772 BOOL IMAGEAPI SymGetScope(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
773 BOOL IMAGEAPI SymGetScopeW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
774 BOOL IMAGEAPI SymFromIndex(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
775 BOOL IMAGEAPI SymFromIndexW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
776 BOOL IMAGEAPI SymAddSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD, DWORD);
777 BOOL IMAGEAPI SymAddSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD, DWORD);
778 BOOL IMAGEAPI SymDeleteSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD);
779 BOOL IMAGEAPI SymDeleteSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD);
781 typedef struct _OMAP
783 ULONG rva;
784 ULONG rvaTo;
785 } OMAP, *POMAP;
787 BOOL IMAGEAPI SymGetOmaps(HANDLE, DWORD64, POMAP*, PDWORD64, POMAP*, PDWORD64);
789 /*************************
790 * Source Files *
791 *************************/
792 typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(PSOURCEFILE, PVOID);
793 typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACKW)(PSOURCEFILEW, PVOID);
795 BOOL IMAGEAPI SymEnumSourceFiles(HANDLE, ULONG64, PCSTR, PSYM_ENUMSOURCEFILES_CALLBACK, PVOID);
796 BOOL IMAGEAPI SymEnumSourceFilesW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMSOURCEFILES_CALLBACKW, PVOID);
797 BOOL IMAGEAPI SymGetLineFromAddr64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
798 BOOL IMAGEAPI SymGetLineFromAddrW64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
799 BOOL IMAGEAPI SymGetLineFromInlineContext(HANDLE, DWORD64, ULONG, DWORD64, PDWORD, PIMAGEHLP_LINE64);
800 BOOL IMAGEAPI SymGetLineFromInlineContextW(HANDLE, DWORD64, ULONG, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
801 BOOL IMAGEAPI SymGetLinePrev64(HANDLE, PIMAGEHLP_LINE64);
802 BOOL IMAGEAPI SymGetLinePrevW64(HANDLE, PIMAGEHLP_LINEW64);
803 BOOL IMAGEAPI SymGetLineNext64(HANDLE, PIMAGEHLP_LINE64);
804 BOOL IMAGEAPI SymGetLineNextW64(HANDLE, PIMAGEHLP_LINEW64);
805 BOOL IMAGEAPI SymGetLineFromName64(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE64);
806 BOOL IMAGEAPI SymGetLineFromNameW64(HANDLE, PCWSTR, PCWSTR, DWORD, PLONG, PIMAGEHLP_LINEW64);
807 ULONG IMAGEAPI SymGetFileLineOffsets64(HANDLE, PCSTR, PCSTR, PDWORD64, ULONG);
808 BOOL IMAGEAPI SymGetSourceFile(HANDLE, ULONG64, PCSTR, PCSTR, PSTR, DWORD);
809 BOOL IMAGEAPI SymGetSourceFileW(HANDLE, ULONG64, PCWSTR, PCWSTR, PWSTR, DWORD);
810 BOOL IMAGEAPI SymGetSourceFileToken(HANDLE, ULONG64, PCSTR, PVOID*, DWORD*);
811 BOOL IMAGEAPI SymGetSourceFileTokenW(HANDLE, ULONG64, PCWSTR, PVOID*, DWORD*);
812 BOOL IMAGEAPI SymGetSourceFileFromToken(HANDLE, PVOID, PCSTR, PSTR, DWORD);
813 BOOL IMAGEAPI SymGetSourceFileFromTokenW(HANDLE, PVOID, PCWSTR, PWSTR, DWORD);
814 BOOL IMAGEAPI SymGetSourceVarFromToken(HANDLE, PVOID, PCSTR, PCSTR, PSTR, DWORD);
815 BOOL IMAGEAPI SymGetSourceVarFromTokenW(HANDLE, PVOID, PCWSTR, PCWSTR, PWSTR, DWORD);
817 typedef struct _SRCCODEINFO
819 DWORD SizeOfStruct;
820 PVOID Key;
821 DWORD64 ModBase;
822 CHAR Obj[MAX_PATH+1];
823 CHAR FileName[MAX_PATH+1];
824 DWORD LineNumber;
825 DWORD64 Address;
826 } SRCCODEINFO, *PSRCCODEINFO;
828 typedef struct _SRCCODEINFOW
830 DWORD SizeOfStruct;
831 PVOID Key;
832 DWORD64 ModBase;
833 WCHAR Obj[MAX_PATH+1];
834 WCHAR FileName[MAX_PATH+1];
835 DWORD LineNumber;
836 DWORD64 Address;
837 } SRCCODEINFOW, *PSRCCODEINFOW;
839 typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO, PVOID);
840 typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACKW)(PSRCCODEINFOW, PVOID);
841 BOOL IMAGEAPI SymEnumLines(HANDLE, ULONG64, PCSTR, PCSTR, PSYM_ENUMLINES_CALLBACK, PVOID);
842 BOOL IMAGEAPI SymEnumLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, PSYM_ENUMLINES_CALLBACKW, PVOID);
843 BOOL IMAGEAPI SymEnumSourceLines(HANDLE, ULONG64, PCSTR, PCSTR, DWORD, DWORD, PSYM_ENUMLINES_CALLBACK, PVOID);
844 BOOL IMAGEAPI SymEnumSourceLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, DWORD, DWORD, PSYM_ENUMLINES_CALLBACKW, PVOID);
846 /*************************
847 * File & image handling *
848 *************************/
849 BOOL IMAGEAPI SymInitialize(HANDLE, PCSTR, BOOL);
850 BOOL IMAGEAPI SymInitializeW(HANDLE, PCWSTR, BOOL);
851 BOOL IMAGEAPI SymCleanup(HANDLE);
853 HANDLE IMAGEAPI FindDebugInfoFile(PCSTR, PCSTR, PSTR);
854 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PCSTR, PVOID);
855 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
856 HANDLE IMAGEAPI FindDebugInfoFileEx(PCSTR, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
857 HANDLE IMAGEAPI FindDebugInfoFileExW(PCWSTR, PCWSTR, PWSTR, PFIND_DEBUG_FILE_CALLBACKW, PVOID);
858 HANDLE IMAGEAPI SymFindDebugInfoFile(HANDLE, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
859 HANDLE IMAGEAPI SymFindDebugInfoFileW(HANDLE, PCWSTR, PWSTR, PFIND_DEBUG_FILE_CALLBACKW, PVOID);
860 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PCSTR, PVOID);
861 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACKW)(PCWSTR, PVOID);
862 BOOL IMAGEAPI FindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD, PSTR, PFINDFILEINPATHCALLBACK, PVOID);
863 BOOL IMAGEAPI SymFindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD, PSTR, PFINDFILEINPATHCALLBACK, PVOID);
864 BOOL IMAGEAPI SymFindFileInPathW(HANDLE, PCWSTR, PCWSTR, PVOID, DWORD, DWORD, DWORD, PWSTR, PFINDFILEINPATHCALLBACKW, PVOID);
865 HANDLE IMAGEAPI FindExecutableImage(PCSTR, PCSTR, PSTR);
866 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PCSTR, PVOID);
867 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
868 HANDLE IMAGEAPI FindExecutableImageEx(PCSTR, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
869 HANDLE IMAGEAPI FindExecutableImageExW(PCWSTR, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
870 HANDLE IMAGEAPI SymFindExecutableImage(HANDLE, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
871 HANDLE IMAGEAPI SymFindExecutableImageW(HANDLE, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
872 PIMAGE_NT_HEADERS IMAGEAPI ImageNtHeader(PVOID);
873 PVOID IMAGEAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG, PIMAGE_SECTION_HEADER *);
874 PVOID IMAGEAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
875 PIMAGE_SECTION_HEADER IMAGEAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
876 PVOID IMAGEAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
877 BOOL IMAGEAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
878 BOOL IMAGEAPI SymGetSearchPathW(HANDLE, PWSTR, DWORD);
879 BOOL IMAGEAPI SymSetSearchPath(HANDLE, PCSTR);
880 BOOL IMAGEAPI SymSetSearchPathW(HANDLE, PCWSTR);
881 DWORD IMAGEAPI GetTimestampForLoadedLibrary(HMODULE);
882 BOOL IMAGEAPI MakeSureDirectoryPathExists(PCSTR);
883 BOOL IMAGEAPI SearchTreeForFile(PCSTR, PCSTR, PSTR);
884 BOOL IMAGEAPI SearchTreeForFileW(PCWSTR, PCWSTR, PWSTR);
885 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(PCSTR, PVOID);
886 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACKW)(PCWSTR, PVOID);
887 BOOL IMAGEAPI EnumDirTree(HANDLE, PCSTR, PCSTR, PSTR, PENUMDIRTREE_CALLBACK, PVOID);
888 BOOL IMAGEAPI EnumDirTreeW(HANDLE, PCWSTR, PCWSTR, PWSTR, PENUMDIRTREE_CALLBACKW, PVOID);
889 BOOL IMAGEAPI SymMatchFileName(PCSTR, PCSTR, PSTR*, PSTR*);
890 BOOL IMAGEAPI SymMatchFileNameW(PCWSTR, PCWSTR, PWSTR*, PWSTR*);
891 PCHAR IMAGEAPI SymSetHomeDirectory(HANDLE, PCSTR);
892 PWSTR IMAGEAPI SymSetHomeDirectoryW(HANDLE, PCWSTR);
893 PCHAR IMAGEAPI SymGetHomeDirectory(DWORD, PSTR, size_t);
894 PWSTR IMAGEAPI SymGetHomeDirectoryW(DWORD, PWSTR, size_t);
895 #define hdBase 0
896 #define hdSym 1
897 #define hdSrc 2
898 #define hdMax 3
900 /*************************
901 * Context management *
902 *************************/
903 BOOL IMAGEAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
904 BOOL IMAGEAPI SymSetScopeFromIndex(HANDLE, ULONG64, ULONG);
905 BOOL IMAGEAPI SymSetScopeFromAddr(HANDLE, ULONG64);
906 BOOL IMAGEAPI SymSetScopeFromInlineContext(HANDLE, ULONG64, ULONG);
908 /*************************
909 * Stack management *
910 *************************/
912 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
913 #define KDHELP KDHELP64
914 #define PKDHELP PKDHELP64
915 #else
916 typedef struct _KDHELP
918 DWORD Thread;
919 DWORD ThCallbackStack;
920 DWORD NextCallback;
921 DWORD FramePointer;
922 DWORD KiCallUserMode;
923 DWORD KeUserCallbackDispatcher;
924 DWORD SystemRangeStart;
925 } KDHELP, *PKDHELP;
926 #endif
928 typedef struct _KDHELP64
930 DWORD64 Thread;
931 DWORD ThCallbackStack;
932 DWORD ThCallbackBStore;
933 DWORD NextCallback;
934 DWORD FramePointer;
935 DWORD64 KiCallUserMode;
936 DWORD64 KeUserCallbackDispatcher;
937 DWORD64 SystemRangeStart;
938 DWORD64 Reserved[8];
939 } KDHELP64, *PKDHELP64;
941 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
942 #define STACKFRAME STACKFRAME64
943 #define LPSTACKFRAME LPSTACKFRAME64
944 #else
945 typedef struct _STACKFRAME
947 ADDRESS AddrPC;
948 ADDRESS AddrReturn;
949 ADDRESS AddrFrame;
950 ADDRESS AddrStack;
951 PVOID FuncTableEntry;
952 DWORD Params[4];
953 BOOL Far;
954 BOOL Virtual;
955 DWORD Reserved[3];
956 KDHELP KdHelp;
957 ADDRESS AddrBStore;
958 } STACKFRAME, *LPSTACKFRAME;
959 #endif
961 typedef struct _STACKFRAME64
963 ADDRESS64 AddrPC;
964 ADDRESS64 AddrReturn;
965 ADDRESS64 AddrFrame;
966 ADDRESS64 AddrStack;
967 ADDRESS64 AddrBStore;
968 PVOID FuncTableEntry;
969 DWORD64 Params[4];
970 BOOL Far;
971 BOOL Virtual;
972 DWORD64 Reserved[3];
973 KDHELP64 KdHelp;
974 } STACKFRAME64, *LPSTACKFRAME64;
976 #define INLINE_FRAME_CONTEXT_INIT 0
977 #define INLINE_FRAME_CONTEXT_IGNORE 0xFFFFFFFF
979 typedef struct _tagSTACKFRAME_EX
981 ADDRESS64 AddrPC;
982 ADDRESS64 AddrReturn;
983 ADDRESS64 AddrFrame;
984 ADDRESS64 AddrStack;
985 ADDRESS64 AddrBStore;
986 PVOID FuncTableEntry;
987 DWORD64 Params[4];
988 BOOL Far;
989 BOOL Virtual;
990 DWORD64 Reserved[3];
991 KDHELP64 KdHelp;
993 DWORD StackFrameSize;
994 DWORD InlineFrameContext;
995 } STACKFRAME_EX, *LPSTACKFRAME_EX;
998 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE64)
999 (HANDLE, DWORD64, PVOID, DWORD, PDWORD);
1000 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE, DWORD64);
1001 typedef DWORD64 (CALLBACK *PGET_MODULE_BASE_ROUTINE64)(HANDLE, DWORD64);
1002 typedef DWORD64 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE, HANDLE, LPADDRESS64);
1003 BOOL IMAGEAPI StackWalk64(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID,
1004 PREAD_PROCESS_MEMORY_ROUTINE64,
1005 PFUNCTION_TABLE_ACCESS_ROUTINE64,
1006 PGET_MODULE_BASE_ROUTINE64,
1007 PTRANSLATE_ADDRESS_ROUTINE64);
1008 #define SYM_STKWALK_DEFAULT 0x00000000
1009 #define SYM_STKWALK_FORCE_FRAMEPTR 0x00000001
1010 BOOL IMAGEAPI StackWalkEx(DWORD, HANDLE, HANDLE, LPSTACKFRAME_EX, PVOID,
1011 PREAD_PROCESS_MEMORY_ROUTINE64,
1012 PFUNCTION_TABLE_ACCESS_ROUTINE64,
1013 PGET_MODULE_BASE_ROUTINE64,
1014 PTRANSLATE_ADDRESS_ROUTINE64,
1015 DWORD);
1016 PVOID IMAGEAPI SymFunctionTableAccess64(HANDLE, DWORD64);
1018 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE, ULONG64, ULONG64);
1020 BOOL IMAGEAPI SymRegisterFunctionEntryCallback64(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK64, ULONG64);
1021 BOOL IMAGEAPI SymGetUnwindInfo(HANDLE, DWORD64, PVOID, PULONG);
1023 /* Inline context related APIs */
1024 DWORD IMAGEAPI SymAddrIncludeInlineTrace(HANDLE, DWORD64);
1026 #define SYM_INLINE_COMP_ERROR 0
1027 #define SYM_INLINE_COMP_IDENTICAL 1
1028 #define SYM_INLINE_COMP_STEPIN 2
1029 #define SYM_INLINE_COMP_STEPOUT 3
1030 #define SYM_INLINE_COMP_STEPOVER 4
1031 #define SYM_INLINE_COMP_DIFFERENT 5
1033 DWORD IMAGEAPI SymCompareInlineTrace(HANDLE, DWORD64, DWORD, DWORD64, DWORD64, DWORD64);
1034 BOOL IMAGEAPI SymQueryInlineTrace(HANDLE, DWORD64, DWORD, DWORD64, DWORD64, LPDWORD, LPDWORD);
1036 /*************************
1037 * Version, global stuff *
1038 *************************/
1040 #define API_VERSION_NUMBER 9
1042 typedef struct API_VERSION
1044 USHORT MajorVersion;
1045 USHORT MinorVersion;
1046 USHORT Revision;
1047 USHORT Reserved;
1048 } API_VERSION, *LPAPI_VERSION;
1050 LPAPI_VERSION IMAGEAPI ImagehlpApiVersion(void);
1051 LPAPI_VERSION IMAGEAPI ImagehlpApiVersionEx(LPAPI_VERSION);
1053 #ifndef _WIN64
1054 typedef struct _IMAGE_DEBUG_INFORMATION
1056 LIST_ENTRY List;
1057 DWORD ReservedSize;
1058 PVOID ReservedMappedBase;
1059 USHORT ReservedMachine;
1060 USHORT ReservedCharacteristics;
1061 DWORD ReservedCheckSum;
1062 DWORD ImageBase;
1063 DWORD SizeOfImage;
1064 DWORD ReservedNumberOfSections;
1065 PIMAGE_SECTION_HEADER ReservedSections;
1066 DWORD ReservedExportedNamesSize;
1067 PSTR ReservedExportedNames;
1068 DWORD ReservedNumberOfFunctionTableEntries;
1069 PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries;
1070 DWORD ReservedLowestFunctionStartingAddress;
1071 DWORD ReservedHighestFunctionEndingAddress;
1072 DWORD ReservedNumberOfFpoTableEntries;
1073 PFPO_DATA ReservedFpoTableEntries;
1074 DWORD SizeOfCoffSymbols;
1075 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols;
1076 DWORD ReservedSizeOfCodeViewSymbols;
1077 PVOID ReservedCodeViewSymbols;
1078 PSTR ImageFilePath;
1079 PSTR ImageFileName;
1080 PSTR ReservedDebugFilePath;
1081 DWORD ReservedTimeDateStamp;
1082 BOOL ReservedRomImage;
1083 PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory;
1084 DWORD ReservedNumberOfDebugDirectories;
1085 DWORD ReservedOriginalFunctionTableBaseAddress;
1086 DWORD Reserved[ 2 ];
1087 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
1089 PIMAGE_DEBUG_INFORMATION IMAGEAPI MapDebugInformation(HANDLE, PCSTR, PCSTR, ULONG);
1090 BOOL IMAGEAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
1091 #endif
1093 typedef enum
1095 SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
1096 SYMOPT_EX_MAX,
1098 #ifdef __WINESRC__
1099 /* Include ELF/Mach-O modules in module operations */
1100 SYMOPT_EX_WINE_NATIVE_MODULES = 1000,
1101 /* Return the Unix actual path of loaded module */
1102 SYMOPT_EX_WINE_MODULE_REAL_PATH,
1103 /* Return the raw source file path from debug info (not always mapped to DOS) */
1104 SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH,
1105 #endif
1106 } IMAGEHLP_EXTENDED_OPTIONS;
1108 DWORD IMAGEAPI SymGetOptions(void);
1109 DWORD IMAGEAPI SymSetOptions(DWORD);
1110 BOOL IMAGEAPI SymGetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option);
1111 BOOL IMAGEAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value);
1112 BOOL IMAGEAPI SymSetParentWindow(HWND);
1114 /***************************
1115 * Symbol servers & stores *
1116 ***************************/
1117 BOOL IMAGEAPI SymSrvGetFileIndexes(PCSTR, GUID *, PDWORD, PDWORD, DWORD);
1118 BOOL IMAGEAPI SymSrvGetFileIndexesW(PCWSTR, GUID *, PDWORD, PDWORD, DWORD);
1119 BOOL IMAGEAPI SymSrvGetFileIndexInfo(PCSTR, PSYMSRV_INDEX_INFO, DWORD);
1120 BOOL IMAGEAPI SymSrvGetFileIndexInfoW(PCWSTR, PSYMSRV_INDEX_INFOW, DWORD);
1122 typedef BOOL (WINAPI* PSYMBOLSERVERPROC)(PCSTR, PCSTR, PVOID, DWORD, DWORD, PSTR);
1123 typedef BOOL (WINAPI* PSYMBOLSERVERPROCA)(PCSTR, PCSTR, PVOID, DWORD, DWORD, PSTR);
1124 typedef BOOL (WINAPI* PSYMBOLSERVERPROCW)(PCWSTR, PCWSTR, PVOID, DWORD, DWORD, PWSTR);
1125 typedef BOOL (WINAPI* PSYMBOLSERVEROPENPROC)(void);
1126 typedef BOOL (WINAPI* PSYMBOLSERVERCLOSEPROC)(void);
1127 typedef BOOL (WINAPI* PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR, ULONG64);
1128 typedef BOOL (CALLBACK* PSYMBOLSERVERCALLBACKPROC)(UINT_PTR, ULONG64, ULONG64);
1129 typedef UINT_PTR (WINAPI* PSYMBOLSERVERGETOPTIONSPROC)(void);
1130 typedef BOOL (WINAPI* PSYMBOLSERVERPINGPROC)(PCSTR);
1131 typedef BOOL (WINAPI* PSYMBOLSERVERPINGPROCA)(PCSTR);
1132 typedef BOOL (WINAPI* PSYMBOLSERVERPINGPROCW)(PCWSTR);
1134 #define SSRVOPT_CALLBACK 0x0001
1135 #define SSRVOPT_DWORD 0x0002
1136 #define SSRVOPT_DWORDPTR 0x0004
1137 #define SSRVOPT_GUIDPTR 0x0008
1138 #define SSRVOPT_OLDGUIDPTR 0x0010
1139 #define SSRVOPT_UNATTENDED 0x0020
1140 #define SSRVOPT_NOCOPY 0x0040
1141 #define SSRVOPT_PARENTWIN 0x0080
1142 #define SSRVOPT_PARAMTYPE 0x0100
1143 #define SSRVOPT_SECURE 0x0200
1144 #define SSRVOPT_TRACE 0x0400
1145 #define SSRVOPT_SETCONTEXT 0x0800
1146 #define SSRVOPT_PROXY 0x1000
1147 #define SSRVOPT_DOWNSTREAM_STORE 0x2000
1148 #define SSRVOPT_RESET ((ULONG_PTR)-1)
1150 #define SSRVACTION_TRACE 1
1151 #define SSRVACTION_QUERYCANCEL 2
1152 #define SSRVACTION_EVENT 3
1153 #define SSRVACTION_EVENTW 4
1154 #define SSRVACTION_SIZE 5
1155 #define SSRVACTION_HTTPSTATUS 6
1157 /* 32-bit functions */
1159 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
1161 #define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64
1162 #define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64
1163 #define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64
1164 #define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64
1165 #define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64
1166 #define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64
1167 #define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64
1168 #define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64
1169 #define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACKW64
1170 #define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64
1172 #define EnumerateLoadedModules EnumerateLoadedModules64
1173 #define StackWalk StackWalk64
1174 #define SymEnumerateModules SymEnumerateModules64
1175 #define SymEnumerateSymbols SymEnumerateSymbols64
1176 #define SymEnumerateSymbolsW SymEnumerateSymbolsW64
1177 #define SymFunctionTableAccess SymFunctionTableAccess64
1178 #define SymGetLineFromAddr SymGetLineFromAddr64
1179 #define SymGetLineFromAddrW SymGetLineFromAddrW64
1180 #define SymGetLineFromName SymGetLineFromName64
1181 #define SymGetLineNext SymGetLineNext64
1182 #define SymGetLineNextW SymGetLineNextW64
1183 #define SymGetLinePrev SymGetLinePrev64
1184 #define SymGetLinePrevW SymGetLinePrevW64
1185 #define SymGetModuleBase SymGetModuleBase64
1186 #define SymGetModuleInfo SymGetModuleInfo64
1187 #define SymGetModuleInfoW SymGetModuleInfoW64
1188 #define SymGetSymFromAddr SymGetSymFromAddr64
1189 #define SymGetSymFromName SymGetSymFromName64
1190 #define SymGetSymNext SymGetSymNext64
1191 #define SymGetSymNextW SymGetSymNextW64
1192 #define SymGetSymPrev SymGetSymPrev64
1193 #define SymGetSymPrevW SymGetSymPrevW64
1194 #define SymLoadModule SymLoadModule64
1195 #define SymRegisterCallback SymRegisterCallback64
1196 #define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64
1197 #define SymUnDName SymUnDName64
1198 #define SymUnloadModule SymUnloadModule64
1200 #else
1202 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PCSTR, ULONG, ULONG, PVOID);
1203 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
1204 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
1205 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE, DWORD, PVOID, DWORD, PDWORD);
1206 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PCSTR, ULONG, PVOID);
1207 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PCSTR, ULONG, ULONG, PVOID);
1208 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PCWSTR, ULONG, ULONG, PVOID);
1209 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
1210 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE, DWORD, PVOID);
1211 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
1213 BOOL IMAGEAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
1214 BOOL IMAGEAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
1215 BOOL IMAGEAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
1216 BOOL IMAGEAPI SymEnumerateSymbols(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
1217 BOOL IMAGEAPI SymEnumerateSymbolsW(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACKW, PVOID);
1218 PVOID IMAGEAPI SymFunctionTableAccess(HANDLE, DWORD);
1219 BOOL IMAGEAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
1220 BOOL IMAGEAPI SymGetLineFromAddrW(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINEW);
1221 BOOL IMAGEAPI SymGetLineFromName(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE);
1222 BOOL IMAGEAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
1223 BOOL IMAGEAPI SymGetLineNextW(HANDLE, PIMAGEHLP_LINEW);
1224 BOOL IMAGEAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
1225 BOOL IMAGEAPI SymGetLinePrevW(HANDLE, PIMAGEHLP_LINEW);
1226 DWORD IMAGEAPI SymGetModuleBase(HANDLE, DWORD);
1227 BOOL IMAGEAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
1228 BOOL IMAGEAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
1229 BOOL IMAGEAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
1230 BOOL IMAGEAPI SymGetSymFromName(HANDLE, PCSTR, PIMAGEHLP_SYMBOL);
1231 BOOL IMAGEAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
1232 BOOL IMAGEAPI SymGetSymNextW(HANDLE, PIMAGEHLP_SYMBOLW);
1233 BOOL IMAGEAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
1234 BOOL IMAGEAPI SymGetSymPrevW(HANDLE, PIMAGEHLP_SYMBOLW);
1235 DWORD IMAGEAPI SymLoadModule(HANDLE, HANDLE, PCSTR, PCSTR, DWORD, DWORD);
1236 BOOL IMAGEAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
1237 BOOL IMAGEAPI SymRegisterFunctionEntryCallback(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK, PVOID);
1238 BOOL IMAGEAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
1239 BOOL IMAGEAPI SymUnloadModule(HANDLE, DWORD);
1241 #endif
1243 #ifdef __cplusplus
1244 } /* extern "C" */
1245 #endif /* defined(__cplusplus) */
1247 #endif /* __WINE_DBGHELP_H */