krnl386.exe16: Don't overflow when calculating size.
[wine.git] / include / dbghelp.h
blob84fa7e105952c1c996938647af389da1867bf64d
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 #define IMAGEAPI WINAPI
37 #define DBHLPAPI IMAGEAPI
39 typedef struct _LOADED_IMAGE
41 PSTR ModuleName;
42 HANDLE hFile;
43 PUCHAR MappedAddress;
44 PIMAGE_NT_HEADERS FileHeader;
45 PIMAGE_SECTION_HEADER LastRvaSection;
46 ULONG NumberOfSections;
47 PIMAGE_SECTION_HEADER Sections;
48 ULONG Characteristics;
49 BOOLEAN fSystemImage;
50 BOOLEAN fDOSImage;
51 BOOLEAN fReadOnly;
52 UCHAR Version;
53 LIST_ENTRY Links;
54 ULONG SizeOfImage;
55 } LOADED_IMAGE, *PLOADED_IMAGE;
57 /*************************
58 * IMAGEHLP equiv *
59 *************************/
61 typedef enum
63 AddrMode1616,
64 AddrMode1632,
65 AddrModeReal,
66 AddrModeFlat
67 } ADDRESS_MODE;
69 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
70 #define ADDRESS ADDRESS64
71 #define LPADDRESS LPADDRESS64
72 #else
73 typedef struct _tagADDRESS
75 DWORD Offset;
76 WORD Segment;
77 ADDRESS_MODE Mode;
78 } ADDRESS, *LPADDRESS;
79 #endif
81 typedef struct _tagADDRESS64
83 DWORD64 Offset;
84 WORD Segment;
85 ADDRESS_MODE Mode;
86 } ADDRESS64, *LPADDRESS64;
88 #define SYMF_OMAP_GENERATED 0x00000001
89 #define SYMF_OMAP_MODIFIED 0x00000002
90 #define SYMF_USER_GENERATED 0x00000004
91 #define SYMF_REGISTER 0x00000008
92 #define SYMF_REGREL 0x00000010
93 #define SYMF_FRAMEREL 0x00000020
94 #define SYMF_PARAMETER 0x00000040
95 #define SYMF_LOCAL 0x00000080
96 #define SYMF_CONSTANT 0x00000100
97 #define SYMF_EXPORT 0x00000200
98 #define SYMF_FORWARDER 0x00000400
99 #define SYMF_FUNCTION 0x00000800
100 #define SYMF_VIRTUAL 0x00001000
101 #define SYMF_THUNK 0x00002000
102 #define SYMF_TLSREL 0x00004000
104 typedef enum
106 SymNone = 0,
107 SymCoff,
108 SymCv,
109 SymPdb,
110 SymExport,
111 SymDeferred,
112 SymSym,
113 SymDia,
114 SymVirtual,
115 NumSymTypes
116 } SYM_TYPE;
118 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
119 #define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64
120 #define IMAGEHLP_SYMBOLW IMAGEHLP_SYMBOLW64
121 #define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64
122 #define PIMAGEHLP_SYMBOLW PIMAGEHLP_SYMBOLW64
123 #else
124 typedef struct _IMAGEHLP_SYMBOL
126 DWORD SizeOfStruct;
127 DWORD Address;
128 DWORD Size;
129 DWORD Flags;
130 DWORD MaxNameLength;
131 CHAR Name[1];
132 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
134 typedef struct _IMAGEHLP_SYMBOLW
136 DWORD SizeOfStruct;
137 DWORD Address;
138 DWORD Size;
139 DWORD Flags;
140 DWORD MaxNameLength;
141 WCHAR Name[1];
142 } IMAGEHLP_SYMBOLW, *PIMAGEHLP_SYMBOLW;
143 #endif
145 typedef struct _IMAGEHLP_SYMBOL64
147 DWORD SizeOfStruct;
148 DWORD64 Address;
149 DWORD Size;
150 DWORD Flags;
151 DWORD MaxNameLength;
152 CHAR Name[1];
153 } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
155 typedef struct _IMAGEHLP_SYMBOLW64
157 DWORD SizeOfStruct;
158 DWORD64 Address;
159 DWORD Size;
160 DWORD Flags;
161 DWORD MaxNameLength;
162 WCHAR Name[1];
163 } IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64;
165 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
166 #define IMAGEHLP_MODULE IMAGEHLP_MODULE64
167 #define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64
168 #define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64
169 #define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64
170 #else
171 typedef struct _IMAGEHLP_MODULE
173 DWORD SizeOfStruct;
174 DWORD BaseOfImage;
175 DWORD ImageSize;
176 DWORD TimeDateStamp;
177 DWORD CheckSum;
178 DWORD NumSyms;
179 SYM_TYPE SymType;
180 CHAR ModuleName[32];
181 CHAR ImageName[256];
182 CHAR LoadedImageName[256];
183 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
185 typedef struct _IMAGEHLP_MODULEW
187 DWORD SizeOfStruct;
188 DWORD BaseOfImage;
189 DWORD ImageSize;
190 DWORD TimeDateStamp;
191 DWORD CheckSum;
192 DWORD NumSyms;
193 SYM_TYPE SymType;
194 WCHAR ModuleName[32];
195 WCHAR ImageName[256];
196 WCHAR LoadedImageName[256];
197 } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
198 #endif
200 typedef struct _IMAGEHLP_MODULE64
202 DWORD SizeOfStruct;
203 DWORD64 BaseOfImage;
204 DWORD ImageSize;
205 DWORD TimeDateStamp;
206 DWORD CheckSum;
207 DWORD NumSyms;
208 SYM_TYPE SymType;
209 CHAR ModuleName[32];
210 CHAR ImageName[256];
211 CHAR LoadedImageName[256];
212 CHAR LoadedPdbName[256];
213 DWORD CVSig;
214 CHAR CVData[MAX_PATH*3];
215 DWORD PdbSig;
216 GUID PdbSig70;
217 DWORD PdbAge;
218 BOOL PdbUnmatched;
219 BOOL DbgUnmatched;
220 BOOL LineNumbers;
221 BOOL GlobalSymbols;
222 BOOL TypeInfo;
223 BOOL SourceIndexed;
224 BOOL Publics;
225 DWORD MachineType;
226 DWORD Reserved;
227 } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
229 typedef struct _IMAGEHLP_MODULEW64
231 DWORD SizeOfStruct;
232 DWORD64 BaseOfImage;
233 DWORD ImageSize;
234 DWORD TimeDateStamp;
235 DWORD CheckSum;
236 DWORD NumSyms;
237 SYM_TYPE SymType;
238 WCHAR ModuleName[32];
239 WCHAR ImageName[256];
240 WCHAR LoadedImageName[256];
241 WCHAR LoadedPdbName[256];
242 DWORD CVSig;
243 WCHAR CVData[MAX_PATH*3];
244 DWORD PdbSig;
245 GUID PdbSig70;
246 DWORD PdbAge;
247 BOOL PdbUnmatched;
248 BOOL DbgUnmatched;
249 BOOL LineNumbers;
250 BOOL GlobalSymbols;
251 BOOL TypeInfo;
252 BOOL SourceIndexed;
253 BOOL Publics;
254 DWORD MachineType;
255 DWORD Reserved;
256 } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
258 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
259 #define IMAGEHLP_LINE IMAGEHLP_LINE64
260 #define PIMAGEHLP_LINE PIMAGEHLP_LINE64
261 #define IMAGEHLP_LINEW IMAGEHLP_LINEW64
262 #define PIMAGEHLP_LINEW PIMAGEHLP_LINEW64
263 #else
264 typedef struct _IMAGEHLP_LINE
266 DWORD SizeOfStruct;
267 PVOID Key;
268 DWORD LineNumber;
269 PCHAR FileName;
270 DWORD Address;
271 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
273 typedef struct _IMAGEHLP_LINEW
275 DWORD SizeOfStruct;
276 PVOID Key;
277 DWORD LineNumber;
278 PWSTR FileName;
279 DWORD Address;
280 } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW;
281 #endif
283 typedef struct _IMAGEHLP_LINE64
285 DWORD SizeOfStruct;
286 PVOID Key;
287 DWORD LineNumber;
288 PCHAR FileName;
289 DWORD64 Address;
290 } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
292 typedef struct _IMAGEHLP_LINEW64
294 DWORD SizeOfStruct;
295 PVOID Key;
296 DWORD LineNumber;
297 PWSTR FileName;
298 DWORD64 Address;
299 } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
301 typedef struct _SOURCEFILE
303 DWORD64 ModBase;
304 PCHAR FileName;
305 } SOURCEFILE, *PSOURCEFILE;
307 typedef struct _SOURCEFILEW
309 DWORD64 ModBase;
310 PWSTR FileName;
311 } SOURCEFILEW, *PSOURCEFILEW;
313 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
314 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
315 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
316 #define CBA_SYMBOLS_UNLOADED 0x00000004
317 #define CBA_DUPLICATE_SYMBOL 0x00000005
318 #define CBA_READ_MEMORY 0x00000006
319 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007
320 #define CBA_SET_OPTIONS 0x00000008
321 #define CBA_EVENT 0x00000010
322 #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL 0x00000020
323 #define CBA_DEBUG_INFO 0x10000000
325 typedef struct _IMAGEHLP_CBA_READ_MEMORY
327 DWORD64 addr;
328 PVOID buf;
329 DWORD bytes;
330 DWORD *bytesread;
331 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
333 enum
335 sevInfo = 0,
336 sevProblem,
337 sevAttn,
338 sevFatal,
339 sevMax
342 #define EVENT_SRCSPEW_START 100
343 #define EVENT_SRCSPEW 100
344 #define EVENT_SRCSPEW_END 199
346 typedef struct _IMAGEHLP_CBA_EVENT
348 DWORD severity;
349 DWORD code;
350 PCHAR desc;
351 PVOID object;
352 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
354 typedef struct _IMAGEHLP_CBA_EVENTW
356 DWORD severity;
357 DWORD code;
358 PCWSTR desc;
359 PVOID object;
360 } IMAGEHLP_CBA_EVENTW, *PIMAGEHLP_CBA_EVENTW;
362 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
363 #define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64
364 #define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64
365 #else
366 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
368 DWORD SizeOfStruct;
369 DWORD BaseOfImage;
370 DWORD CheckSum;
371 DWORD TimeDateStamp;
372 CHAR FileName[MAX_PATH];
373 BOOLEAN Reparse;
374 HANDLE hFile;
375 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
376 #endif
378 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
380 DWORD SizeOfStruct;
381 DWORD64 BaseOfImage;
382 DWORD CheckSum;
383 DWORD TimeDateStamp;
384 CHAR FileName[MAX_PATH];
385 BOOLEAN Reparse;
386 HANDLE hFile;
387 DWORD Flags;
388 } IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
390 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
392 DWORD SizeOfStruct;
393 DWORD64 BaseOfImage;
394 DWORD CheckSum;
395 DWORD TimeDateStamp;
396 WCHAR FileName[MAX_PATH + 1];
397 BOOLEAN Reparse;
398 HANDLE hFile;
399 DWORD Flags;
400 } IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
402 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
403 #define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64
404 #define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64
405 #else
406 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
408 DWORD SizeOfStruct;
409 DWORD NumberOfDups;
410 PIMAGEHLP_SYMBOL Symbol;
411 DWORD SelectedSymbol;
412 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
413 #endif
415 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
417 DWORD SizeOfStruct;
418 DWORD NumberOfDups;
419 PIMAGEHLP_SYMBOL64 Symbol;
420 DWORD SelectedSymbol;
421 } IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64;
423 #define SYMOPT_CASE_INSENSITIVE 0x00000001
424 #define SYMOPT_UNDNAME 0x00000002
425 #define SYMOPT_DEFERRED_LOADS 0x00000004
426 #define SYMOPT_NO_CPP 0x00000008
427 #define SYMOPT_LOAD_LINES 0x00000010
428 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
429 #define SYMOPT_LOAD_ANYTHING 0x00000040
430 #define SYMOPT_IGNORE_CVREC 0x00000080
431 #define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100
432 #define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200
433 #define SYMOPT_EXACT_SYMBOLS 0x00000400
434 #define SYMOPT_WILD_UNDERSCORE 0x00000800
435 #define SYMOPT_USE_DEFAULTS 0x00001000
436 /* latest SDK defines:
437 #define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS 0x00000800
438 #define SYMOPT_IGNORE_NT_SYMPATH 0x00001000
440 #define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000
441 #define SYMOPT_PUBLICS_ONLY 0x00004000
442 #define SYMOPT_NO_PUBLICS 0x00008000
443 #define SYMOPT_AUTO_PUBLICS 0x00010000
444 #define SYMOPT_NO_IMAGE_SEARCH 0x00020000
445 #define SYMOPT_SECURE 0x00040000
446 #define SYMOPT_NO_PROMPTS 0x00080000
447 #define SYMOPT_OVERWRITE 0x00100000
448 #define SYMOPT_IGNORE_IMAGEDIR 0x00200000
449 #define SYMOPT_FLAT_DIRECTORY 0x00400000
450 #define SYMOPT_FAVOR_COMPRESSED 0x00800000
451 #define SYMOPT_ALLOW_ZERO_ADDRESS 0x01000000
452 #define SYMOPT_DISABLE_SYMSRV_AUTODETECT 0x02000000
453 #define SYMOPT_READONLY_CACHE 0x04000000
454 #define SYMOPT_SYMPATH_LAST 0x08000000
455 #define SYMOPT_DISABLE_FAST_SYMBOLS 0x10000000
456 #define SYMOPT_DISABLE_SYMSRV_TIMEOUT 0x20000000
457 #define SYMOPT_DISABLE_SRVSTAR_ON_STARTUP 0x40000000
458 #define SYMOPT_DEBUG 0x80000000
460 typedef struct _IMAGEHLP_STACK_FRAME
462 ULONG64 InstructionOffset;
463 ULONG64 ReturnOffset;
464 ULONG64 FrameOffset;
465 ULONG64 StackOffset;
466 ULONG64 BackingStoreOffset;
467 ULONG64 FuncTableEntry;
468 ULONG64 Params[4];
469 ULONG64 Reserved[5];
470 BOOL Virtual;
471 ULONG Reserved2;
472 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
474 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
476 #define DBHHEADER_DEBUGDIRS 0x1
477 typedef struct _DBGHELP_MODLOAD_DATA
479 DWORD ssize;
480 DWORD ssig;
481 PVOID data;
482 DWORD size;
483 DWORD flags;
484 } MODLOAD_DATA, *PMODLOAD_DATA;
486 /*************************
487 * MODULE handling *
488 *************************/
490 /* flags for SymLoadModuleEx */
491 #define SLMFLAG_VIRTUAL 0x1
492 #define SLMFLAG_NO_SYMBOLS 0x4
494 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
495 BOOL WINAPI EnumerateLoadedModules64(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
496 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PCWSTR, DWORD64, ULONG, PVOID);
497 BOOL WINAPI EnumerateLoadedModulesW64(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
498 BOOL WINAPI EnumerateLoadedModulesEx(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
499 BOOL WINAPI EnumerateLoadedModulesExW(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
500 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PCSTR, DWORD64, PVOID);
501 BOOL WINAPI SymEnumerateModules64(HANDLE, PSYM_ENUMMODULES_CALLBACK64, PVOID);
502 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(PCWSTR, DWORD64, PVOID);
503 BOOL WINAPI SymEnumerateModulesW64(HANDLE, PSYM_ENUMMODULES_CALLBACKW64, PVOID);
504 BOOL WINAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
505 BOOL WINAPI SymGetModuleInfoW64(HANDLE, DWORD64, PIMAGEHLP_MODULEW64);
506 DWORD64 WINAPI SymGetModuleBase64(HANDLE, DWORD64);
507 DWORD64 WINAPI SymLoadModule64(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD);
508 DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD,
509 PMODLOAD_DATA, DWORD);
510 DWORD64 WINAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64, DWORD,
511 PMODLOAD_DATA, DWORD);
512 BOOL WINAPI SymUnloadModule64(HANDLE, DWORD64);
513 BOOL WINAPI SymRefreshModuleList(HANDLE);
515 /*************************
516 * Symbol Handling *
517 *************************/
519 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
520 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER /* 0x08 */
521 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL /* 0x10 */
522 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL /* 0x20 */
523 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER /* 0x40 */
524 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL /* 0x80 */
525 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT /* 0x100 */
526 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION /* 0x800 */
528 #define SYMFLAG_VALUEPRESENT 0x00000001
529 #define SYMFLAG_REGISTER 0x00000008
530 #define SYMFLAG_REGREL 0x00000010
531 #define SYMFLAG_FRAMEREL 0x00000020
532 #define SYMFLAG_PARAMETER 0x00000040
533 #define SYMFLAG_LOCAL 0x00000080
534 #define SYMFLAG_CONSTANT 0x00000100
535 #define SYMFLAG_EXPORT 0x00000200
536 #define SYMFLAG_FORWARDER 0x00000400
537 #define SYMFLAG_FUNCTION 0x00000800
538 #define SYMFLAG_VIRTUAL 0x00001000
539 #define SYMFLAG_THUNK 0x00002000
540 #define SYMFLAG_TLSREL 0x00004000
541 #define SYMFLAG_SLOT 0x00008000
542 #define SYMFLAG_ILREL 0x00010000
543 #define SYMFLAG_METADATA 0x00020000
544 #define SYMFLAG_CLR_TOKEN 0x00040000
545 #define SYMFLAG_NULL 0x00080000
546 #define SYMFLAG_FUNC_NO_RETURN 0x00100000
547 #define SYMFLAG_SYNTHETIC_ZEROBASE 0x00200000
548 #define SYMFLAG_PUBLIC_CODE 0x00400000
550 #define MAX_SYM_NAME 2000
552 typedef struct _SYMBOL_INFO
554 ULONG SizeOfStruct;
555 ULONG TypeIndex;
556 ULONG64 Reserved[2];
557 ULONG Index;
558 ULONG Size;
559 ULONG64 ModBase;
560 ULONG Flags;
561 ULONG64 Value;
562 ULONG64 Address;
563 ULONG Register;
564 ULONG Scope;
565 ULONG Tag;
566 ULONG NameLen;
567 ULONG MaxNameLen;
568 CHAR Name[1];
569 } SYMBOL_INFO, *PSYMBOL_INFO;
571 typedef struct _SYMBOL_INFOW
573 ULONG SizeOfStruct;
574 ULONG TypeIndex;
575 ULONG64 Reserved[2];
576 ULONG Index;
577 ULONG Size;
578 ULONG64 ModBase;
579 ULONG Flags;
580 ULONG64 Value;
581 ULONG64 Address;
582 ULONG Register;
583 ULONG Scope;
584 ULONG Tag;
585 ULONG NameLen;
586 ULONG MaxNameLen;
587 WCHAR Name[1];
588 } SYMBOL_INFOW, *PSYMBOL_INFOW;
590 typedef struct _SYMBOL_INFO_PACKAGE
592 SYMBOL_INFO si;
593 CHAR name[MAX_SYM_NAME+1];
594 } SYMBOL_INFO_PACKAGE, *PSYMBOL_INFO_PACKAGE;
596 typedef struct _SYMBOL_INFO_PACKAGEW
598 SYMBOL_INFOW si;
599 WCHAR name[MAX_SYM_NAME+1];
600 } SYMBOL_INFO_PACKAGEW, *PSYMBOL_INFO_PACKAGEW;
602 typedef struct _SYMSRV_INDEX_INFO
604 DWORD sizeofstruct;
605 CHAR file[MAX_PATH + 1];
606 BOOL stripped;
607 DWORD timestamp;
608 DWORD size;
609 CHAR dbgfile[MAX_PATH + 1];
610 CHAR pdbfile[MAX_PATH + 1];
611 GUID guid;
612 DWORD sig;
613 DWORD age;
614 } SYMSRV_INDEX_INFO, *PSYMSRV_INDEX_INFO;
616 typedef struct
618 DWORD sizeofstruct;
619 WCHAR file[MAX_PATH + 1];
620 BOOL stripped;
621 DWORD timestamp;
622 DWORD size;
623 WCHAR dbgfile[MAX_PATH + 1];
624 WCHAR pdbfile[MAX_PATH + 1];
625 GUID guid;
626 DWORD sig;
627 DWORD age;
628 } SYMSRV_INDEX_INFOW, *PSYMSRV_INDEX_INFOW;
630 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
632 TI_GET_SYMTAG,
633 TI_GET_SYMNAME,
634 TI_GET_LENGTH,
635 TI_GET_TYPE,
636 TI_GET_TYPEID,
637 TI_GET_BASETYPE,
638 TI_GET_ARRAYINDEXTYPEID,
639 TI_FINDCHILDREN,
640 TI_GET_DATAKIND,
641 TI_GET_ADDRESSOFFSET,
642 TI_GET_OFFSET,
643 TI_GET_VALUE,
644 TI_GET_COUNT,
645 TI_GET_CHILDRENCOUNT,
646 TI_GET_BITPOSITION,
647 TI_GET_VIRTUALBASECLASS,
648 TI_GET_VIRTUALTABLESHAPEID,
649 TI_GET_VIRTUALBASEPOINTEROFFSET,
650 TI_GET_CLASSPARENTID,
651 TI_GET_NESTED,
652 TI_GET_SYMINDEX,
653 TI_GET_LEXICALPARENT,
654 TI_GET_ADDRESS,
655 TI_GET_THISADJUST,
656 TI_GET_UDTKIND,
657 TI_IS_EQUIV_TO,
658 TI_GET_CALLING_CONVENTION,
659 TI_IS_CLOSE_EQUIV_TO,
660 TI_GTIEX_REQS_VALID,
661 TI_GET_VIRTUALBASEOFFSET,
662 TI_GET_VIRTUALBASEDISPINDEX,
663 TI_GET_IS_REFERENCE,
664 TI_GET_INDIRECTVIRTUALBASECLASS,
665 TI_GET_VIRTUALBASETABLETYPE,
666 TI_GET_OBJECTPOINTERTYPE,
667 IMAGEHLP_SYMBOL_TYPE_INFO_MAX
668 } IMAGEHLP_SYMBOL_TYPE_INFO;
670 #define IMAGEHLP_GET_TYPE_INFO_UNCACHED 0x00000001
671 #define IMAGEHLP_GET_TYPE_INFO_CHILDREN 0x00000002
672 typedef struct _IMAGEHLP_GET_TYPE_INFO_PARAMS
674 ULONG SizeOfStruct;
675 ULONG Flags;
676 ULONG NumIds;
677 PULONG TypeIds;
678 ULONG64 TagFilter;
679 ULONG NumReqs;
680 IMAGEHLP_SYMBOL_TYPE_INFO* ReqKinds;
681 PULONG_PTR ReqOffsets;
682 PULONG ReqSizes;
683 ULONG_PTR ReqStride;
684 ULONG_PTR BufferSize;
685 PVOID Buffer;
686 ULONG EntriesMatched;
687 ULONG EntriesFilled;
688 ULONG64 TagsFound;
689 ULONG64 AllReqsValid;
690 ULONG NumReqsValid;
691 PULONG64 ReqsValid;
692 } IMAGEHLP_GET_TYPE_INFO_PARAMS, *PIMAGEHLP_GET_TYPE_INFO_PARAMS;
694 typedef struct _TI_FINDCHILDREN_PARAMS
696 ULONG Count;
697 ULONG Start;
698 ULONG ChildId[1];
699 } TI_FINDCHILDREN_PARAMS;
701 #define UNDNAME_COMPLETE (0x0000)
702 #define UNDNAME_NO_LEADING_UNDERSCORES (0x0001)
703 #define UNDNAME_NO_MS_KEYWORDS (0x0002)
704 #define UNDNAME_NO_FUNCTION_RETURNS (0x0004)
705 #define UNDNAME_NO_ALLOCATION_MODEL (0x0008)
706 #define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010)
707 #define UNDNAME_NO_MS_THISTYPE (0x0020)
708 #define UNDNAME_NO_CV_THISTYPE (0x0040)
709 #define UNDNAME_NO_THISTYPE (0x0060)
710 #define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080)
711 #define UNDNAME_NO_THROW_SIGNATURES (0x0100)
712 #define UNDNAME_NO_MEMBER_TYPE (0x0200)
713 #define UNDNAME_NO_RETURN_UDT_MODEL (0x0400)
714 #define UNDNAME_32_BIT_DECODE (0x0800)
715 #define UNDNAME_NAME_ONLY (0x1000)
716 #define UNDNAME_NO_ARGUMENTS (0x2000)
717 #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
719 #define SYMSEARCH_MASKOBJS 0x01
720 #define SYMSEARCH_RECURSE 0x02
721 #define SYMSEARCH_GLOBALSONLY 0x04
723 BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
724 BOOL WINAPI SymGetTypeInfoEx(HANDLE, DWORD64, PIMAGEHLP_GET_TYPE_INFO_PARAMS);
725 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
726 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW, ULONG, PVOID);
727 BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
728 BOOL WINAPI SymEnumTypesW(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
729 BOOL WINAPI SymEnumTypesByName(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
730 BOOL WINAPI SymEnumTypesByNameW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
731 BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
732 BOOL WINAPI SymFromAddrW(HANDLE, DWORD64, DWORD64*, SYMBOL_INFOW*);
733 BOOL WINAPI SymFromInlineContext(HANDLE, DWORD64, ULONG, PDWORD64, PSYMBOL_INFO);
734 BOOL WINAPI SymFromInlineContextW(HANDLE, DWORD64, ULONG, PDWORD64, PSYMBOL_INFOW);
735 BOOL WINAPI SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
736 BOOL WINAPI SymFromTokenW(HANDLE, DWORD64, DWORD, PSYMBOL_INFOW);
737 BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
738 BOOL WINAPI SymFromNameW(HANDLE, PCWSTR, PSYMBOL_INFOW);
739 BOOL WINAPI SymGetSymFromAddr64(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
740 BOOL WINAPI SymGetSymFromName64(HANDLE, PCSTR, PIMAGEHLP_SYMBOL64);
741 BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, PCSTR, PSYMBOL_INFO);
742 BOOL WINAPI SymGetTypeFromNameW(HANDLE, ULONG64, PCWSTR, PSYMBOL_INFOW);
743 BOOL WINAPI SymGetSymNext64(HANDLE, PIMAGEHLP_SYMBOL64);
744 BOOL WINAPI SymGetSymNextW64(HANDLE, PIMAGEHLP_SYMBOLW64);
745 BOOL WINAPI SymGetSymPrev64(HANDLE, PIMAGEHLP_SYMBOL64);
746 BOOL WINAPI SymGetSymPrevW64(HANDLE, PIMAGEHLP_SYMBOLW64);
747 BOOL WINAPI SymEnumSym(HANDLE,ULONG64,PSYM_ENUMERATESYMBOLS_CALLBACK,PVOID);
748 BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK,
749 PVOID);
750 BOOL WINAPI SymEnumSymbolsW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMERATESYMBOLS_CALLBACKW,
751 PVOID);
752 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PCSTR, DWORD64, ULONG, PVOID);
753 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(PCWSTR, DWORD64, ULONG, PVOID);
754 BOOL WINAPI SymEnumerateSymbols64(HANDLE, ULONG64, PSYM_ENUMSYMBOLS_CALLBACK64, PVOID);
755 BOOL WINAPI SymEnumerateSymbolsW64(HANDLE, ULONG64, PSYM_ENUMSYMBOLS_CALLBACK64W, PVOID);
756 BOOL WINAPI SymEnumSymbolsForAddr(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
757 BOOL WINAPI SymEnumSymbolsForAddrW(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
758 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
759 BOOL WINAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
760 BOOL WINAPI SymRegisterCallbackW64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
761 BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64, PSTR, DWORD);
762 BOOL WINAPI SymMatchString(PCSTR, PCSTR, BOOL);
763 BOOL WINAPI SymMatchStringA(PCSTR, PCSTR, BOOL);
764 BOOL WINAPI SymMatchStringW(PCWSTR, PCWSTR, BOOL);
765 BOOL WINAPI SymSearch(HANDLE, ULONG64, DWORD, DWORD, PCSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID, DWORD);
766 BOOL WINAPI SymSearchW(HANDLE, ULONG64, DWORD, DWORD, PCWSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID, DWORD);
767 DWORD WINAPI UnDecorateSymbolName(PCSTR, PSTR, DWORD, DWORD);
768 DWORD WINAPI UnDecorateSymbolNameW(PCWSTR, PWSTR, DWORD, DWORD);
769 BOOL WINAPI SymGetScope(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
770 BOOL WINAPI SymGetScopeW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
771 BOOL WINAPI SymFromIndex(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
772 BOOL WINAPI SymFromIndexW(HANDLE, ULONG64, DWORD, PSYMBOL_INFOW);
773 BOOL WINAPI SymAddSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD, DWORD);
774 BOOL WINAPI SymAddSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD, DWORD);
775 BOOL WINAPI SymDeleteSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD);
776 BOOL WINAPI SymDeleteSymbolW(HANDLE, ULONG64, PCWSTR, DWORD64, DWORD);
778 typedef struct _OMAP
780 ULONG rva;
781 ULONG rvaTo;
782 } OMAP, *POMAP;
784 BOOL WINAPI SymGetOmaps(HANDLE, DWORD64, POMAP*, PDWORD64, POMAP*, PDWORD64);
786 /*************************
787 * Source Files *
788 *************************/
789 typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(PSOURCEFILE, PVOID);
790 typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACKW)(PSOURCEFILEW, PVOID);
792 BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, PCSTR, PSYM_ENUMSOURCEFILES_CALLBACK,
793 PVOID);
794 BOOL WINAPI SymEnumSourceFilesW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMSOURCEFILES_CALLBACKW, PVOID);
795 BOOL WINAPI SymGetLineFromAddr64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
796 BOOL WINAPI SymGetLineFromAddrW64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
797 BOOL WINAPI SymGetLineFromInlineContext(HANDLE, DWORD64, ULONG, DWORD64, PDWORD, PIMAGEHLP_LINE64);
798 BOOL WINAPI SymGetLineFromInlineContextW(HANDLE, DWORD64, ULONG, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
799 BOOL WINAPI SymGetLinePrev64(HANDLE, PIMAGEHLP_LINE64);
800 BOOL WINAPI SymGetLinePrevW64(HANDLE, PIMAGEHLP_LINEW64);
801 BOOL WINAPI SymGetLineNext64(HANDLE, PIMAGEHLP_LINE64);
802 BOOL WINAPI SymGetLineNextW64(HANDLE, PIMAGEHLP_LINEW64);
803 BOOL WINAPI SymGetLineFromName64(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE64);
804 BOOL WINAPI SymGetLineFromNameW64(HANDLE, PCWSTR, PCWSTR, DWORD, PLONG, PIMAGEHLP_LINEW64);
805 ULONG WINAPI SymGetFileLineOffsets64(HANDLE, PCSTR, PCSTR, PDWORD64, ULONG);
806 BOOL WINAPI SymGetSourceFile(HANDLE, ULONG64, PCSTR, PCSTR, PSTR, DWORD);
807 BOOL WINAPI SymGetSourceFileW(HANDLE, ULONG64, PCWSTR, PCWSTR, PWSTR, DWORD);
808 BOOL WINAPI SymGetSourceFileToken(HANDLE, ULONG64, PCSTR, PVOID*, DWORD*);
809 BOOL WINAPI SymGetSourceFileTokenW(HANDLE, ULONG64, PCWSTR, PVOID*, DWORD*);
810 BOOL WINAPI SymGetSourceFileFromToken(HANDLE, PVOID, PCSTR, PSTR, DWORD);
811 BOOL WINAPI SymGetSourceFileFromTokenW(HANDLE, PVOID, PCWSTR, PWSTR, DWORD);
812 BOOL WINAPI SymGetSourceVarFromToken(HANDLE, PVOID, PCSTR, PCSTR, PSTR, DWORD);
813 BOOL WINAPI SymGetSourceVarFromTokenW(HANDLE, PVOID, PCWSTR, PCWSTR, PWSTR, DWORD);
815 typedef struct _SRCCODEINFO
817 DWORD SizeOfStruct;
818 PVOID Key;
819 DWORD64 ModBase;
820 CHAR Obj[MAX_PATH+1];
821 CHAR FileName[MAX_PATH+1];
822 DWORD LineNumber;
823 DWORD64 Address;
824 } SRCCODEINFO, *PSRCCODEINFO;
826 typedef struct _SRCCODEINFOW
828 DWORD SizeOfStruct;
829 PVOID Key;
830 DWORD64 ModBase;
831 WCHAR Obj[MAX_PATH+1];
832 WCHAR FileName[MAX_PATH+1];
833 DWORD LineNumber;
834 DWORD64 Address;
835 } SRCCODEINFOW, *PSRCCODEINFOW;
837 typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO, PVOID);
838 typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACKW)(PSRCCODEINFOW, PVOID);
839 BOOL WINAPI SymEnumLines(HANDLE, ULONG64, PCSTR, PCSTR, PSYM_ENUMLINES_CALLBACK, PVOID);
840 BOOL WINAPI SymEnumLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, PSYM_ENUMLINES_CALLBACKW, PVOID);
841 BOOL WINAPI SymEnumSourceLines(HANDLE, ULONG64, PCSTR, PCSTR, DWORD, DWORD, PSYM_ENUMLINES_CALLBACK, PVOID);
842 BOOL WINAPI SymEnumSourceLinesW(HANDLE, ULONG64, PCWSTR, PCWSTR, DWORD, DWORD, PSYM_ENUMLINES_CALLBACKW, PVOID);
844 /*************************
845 * File & image handling *
846 *************************/
847 BOOL WINAPI SymInitialize(HANDLE, PCSTR, BOOL);
848 BOOL WINAPI SymInitializeW(HANDLE, PCWSTR, BOOL);
849 BOOL WINAPI SymCleanup(HANDLE);
851 HANDLE WINAPI FindDebugInfoFile(PCSTR, PCSTR, PSTR);
852 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PCSTR, PVOID);
853 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
854 HANDLE WINAPI FindDebugInfoFileEx(PCSTR, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
855 HANDLE WINAPI FindDebugInfoFileExW(PCWSTR, PCWSTR, PWSTR, PFIND_DEBUG_FILE_CALLBACKW, PVOID);
856 HANDLE WINAPI SymFindDebugInfoFile(HANDLE, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
857 HANDLE WINAPI SymFindDebugInfoFileW(HANDLE, PCWSTR, PWSTR, PFIND_DEBUG_FILE_CALLBACKW, PVOID);
858 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PCSTR, PVOID);
859 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACKW)(PCWSTR, PVOID);
860 BOOL WINAPI FindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
861 PSTR, PFINDFILEINPATHCALLBACK, PVOID);
862 BOOL WINAPI SymFindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
863 PSTR, PFINDFILEINPATHCALLBACK, PVOID);
864 BOOL WINAPI SymFindFileInPathW(HANDLE, PCWSTR, PCWSTR, PVOID, DWORD, DWORD, DWORD,
865 PWSTR, PFINDFILEINPATHCALLBACKW, PVOID);
866 HANDLE WINAPI FindExecutableImage(PCSTR, PCSTR, PSTR);
867 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PCSTR, PVOID);
868 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PCWSTR, PVOID);
869 HANDLE WINAPI FindExecutableImageEx(PCSTR, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
870 HANDLE WINAPI FindExecutableImageExW(PCWSTR, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
871 HANDLE WINAPI SymFindExecutableImage(HANDLE, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
872 HANDLE WINAPI SymFindExecutableImageW(HANDLE, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
873 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
874 PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
875 PIMAGE_SECTION_HEADER *);
876 PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
877 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
878 PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
879 BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
880 BOOL WINAPI SymGetSearchPathW(HANDLE, PWSTR, DWORD);
881 BOOL WINAPI SymSetSearchPath(HANDLE, PCSTR);
882 BOOL WINAPI SymSetSearchPathW(HANDLE, PCWSTR);
883 DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
884 BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
885 BOOL WINAPI SearchTreeForFile(PCSTR, PCSTR, PSTR);
886 BOOL WINAPI SearchTreeForFileW(PCWSTR, PCWSTR, PWSTR);
887 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(PCSTR, PVOID);
888 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACKW)(PCWSTR, PVOID);
889 BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, PSTR, PENUMDIRTREE_CALLBACK, PVOID);
890 BOOL WINAPI EnumDirTreeW(HANDLE, PCWSTR, PCWSTR, PWSTR, PENUMDIRTREE_CALLBACKW, PVOID);
891 BOOL WINAPI SymMatchFileName(PCSTR, PCSTR, PSTR*, PSTR*);
892 BOOL WINAPI SymMatchFileNameW(PCWSTR, PCWSTR, PWSTR*, PWSTR*);
893 PCHAR WINAPI SymSetHomeDirectory(HANDLE, PCSTR);
894 PWSTR WINAPI SymSetHomeDirectoryW(HANDLE, PCWSTR);
895 PCHAR WINAPI SymGetHomeDirectory(DWORD, PSTR, size_t);
896 PWSTR WINAPI SymGetHomeDirectoryW(DWORD, PWSTR, size_t);
897 #define hdBase 0
898 #define hdSym 1
899 #define hdSrc 2
900 #define hdMax 3
902 /*************************
903 * Context management *
904 *************************/
905 BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
906 BOOL WINAPI SymSetScopeFromIndex(HANDLE, ULONG64, ULONG);
907 BOOL WINAPI SymSetScopeFromAddr(HANDLE, ULONG64);
908 BOOL WINAPI SymSetScopeFromInlineContext(HANDLE, ULONG64, ULONG);
910 /*************************
911 * Stack management *
912 *************************/
914 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
915 #define KDHELP KDHELP64
916 #define PKDHELP PKDHELP64
917 #else
918 typedef struct _KDHELP
920 DWORD Thread;
921 DWORD ThCallbackStack;
922 DWORD NextCallback;
923 DWORD FramePointer;
924 DWORD KiCallUserMode;
925 DWORD KeUserCallbackDispatcher;
926 DWORD SystemRangeStart;
927 } KDHELP, *PKDHELP;
928 #endif
930 typedef struct _KDHELP64
932 DWORD64 Thread;
933 DWORD ThCallbackStack;
934 DWORD ThCallbackBStore;
935 DWORD NextCallback;
936 DWORD FramePointer;
937 DWORD64 KiCallUserMode;
938 DWORD64 KeUserCallbackDispatcher;
939 DWORD64 SystemRangeStart;
940 DWORD64 Reserved[8];
941 } KDHELP64, *PKDHELP64;
943 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
944 #define STACKFRAME STACKFRAME64
945 #define LPSTACKFRAME LPSTACKFRAME64
946 #else
947 typedef struct _STACKFRAME
949 ADDRESS AddrPC;
950 ADDRESS AddrReturn;
951 ADDRESS AddrFrame;
952 ADDRESS AddrStack;
953 PVOID FuncTableEntry;
954 DWORD Params[4];
955 BOOL Far;
956 BOOL Virtual;
957 DWORD Reserved[3];
958 KDHELP KdHelp;
959 ADDRESS AddrBStore;
960 } STACKFRAME, *LPSTACKFRAME;
961 #endif
963 typedef struct _STACKFRAME64
965 ADDRESS64 AddrPC;
966 ADDRESS64 AddrReturn;
967 ADDRESS64 AddrFrame;
968 ADDRESS64 AddrStack;
969 ADDRESS64 AddrBStore;
970 PVOID FuncTableEntry;
971 DWORD64 Params[4];
972 BOOL Far;
973 BOOL Virtual;
974 DWORD64 Reserved[3];
975 KDHELP64 KdHelp;
976 } STACKFRAME64, *LPSTACKFRAME64;
978 #define INLINE_FRAME_CONTEXT_INIT 0
979 #define INLINE_FRAME_CONTEXT_IGNORE 0xFFFFFFFF
981 typedef struct _tagSTACKFRAME_EX
983 ADDRESS64 AddrPC;
984 ADDRESS64 AddrReturn;
985 ADDRESS64 AddrFrame;
986 ADDRESS64 AddrStack;
987 ADDRESS64 AddrBStore;
988 PVOID FuncTableEntry;
989 DWORD64 Params[4];
990 BOOL Far;
991 BOOL Virtual;
992 DWORD64 Reserved[3];
993 KDHELP64 KdHelp;
995 DWORD StackFrameSize;
996 DWORD InlineFrameContext;
997 } STACKFRAME_EX, *LPSTACKFRAME_EX;
1000 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE64)
1001 (HANDLE, DWORD64, PVOID, DWORD, PDWORD);
1002 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE, DWORD64);
1003 typedef DWORD64 (CALLBACK *PGET_MODULE_BASE_ROUTINE64)(HANDLE, DWORD64);
1004 typedef DWORD64 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE, HANDLE, LPADDRESS64);
1005 BOOL WINAPI StackWalk64(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID,
1006 PREAD_PROCESS_MEMORY_ROUTINE64,
1007 PFUNCTION_TABLE_ACCESS_ROUTINE64,
1008 PGET_MODULE_BASE_ROUTINE64,
1009 PTRANSLATE_ADDRESS_ROUTINE64);
1010 #define SYM_STKWALK_DEFAULT 0x00000000
1011 #define SYM_STKWALK_FORCE_FRAMEPTR 0x00000001
1012 BOOL WINAPI StackWalkEx(DWORD, HANDLE, HANDLE, LPSTACKFRAME_EX, PVOID,
1013 PREAD_PROCESS_MEMORY_ROUTINE64,
1014 PFUNCTION_TABLE_ACCESS_ROUTINE64,
1015 PGET_MODULE_BASE_ROUTINE64,
1016 PTRANSLATE_ADDRESS_ROUTINE64,
1017 DWORD);
1018 PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
1020 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE, ULONG64, ULONG64);
1022 BOOL WINAPI SymRegisterFunctionEntryCallback64(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK64, ULONG64);
1023 BOOL WINAPI SymGetUnwindInfo(HANDLE, DWORD64, PVOID, PULONG);
1025 /* Inline context related APIs */
1026 DWORD WINAPI SymAddrIncludeInlineTrace(HANDLE, DWORD64);
1028 #define SYM_INLINE_COMP_ERROR 0
1029 #define SYM_INLINE_COMP_IDENTICAL 1
1030 #define SYM_INLINE_COMP_STEPIN 2
1031 #define SYM_INLINE_COMP_STEPOUT 3
1032 #define SYM_INLINE_COMP_STEPOVER 4
1033 #define SYM_INLINE_COMP_DIFFERENT 5
1035 DWORD WINAPI SymCompareInlineTrace(HANDLE, DWORD64, DWORD, DWORD64, DWORD64, DWORD64);
1036 BOOL WINAPI SymQueryInlineTrace(HANDLE, DWORD64, DWORD, DWORD64, DWORD64, LPDWORD, LPDWORD);
1038 /*************************
1039 * Version, global stuff *
1040 *************************/
1042 #define API_VERSION_NUMBER 9
1044 typedef struct API_VERSION
1046 USHORT MajorVersion;
1047 USHORT MinorVersion;
1048 USHORT Revision;
1049 USHORT Reserved;
1050 } API_VERSION, *LPAPI_VERSION;
1052 LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
1053 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
1055 #ifndef _WIN64
1056 typedef struct _IMAGE_DEBUG_INFORMATION
1058 LIST_ENTRY List;
1059 DWORD ReservedSize;
1060 PVOID ReservedMappedBase;
1061 USHORT ReservedMachine;
1062 USHORT ReservedCharacteristics;
1063 DWORD ReservedCheckSum;
1064 DWORD ImageBase;
1065 DWORD SizeOfImage;
1066 DWORD ReservedNumberOfSections;
1067 PIMAGE_SECTION_HEADER ReservedSections;
1068 DWORD ReservedExportedNamesSize;
1069 PSTR ReservedExportedNames;
1070 DWORD ReservedNumberOfFunctionTableEntries;
1071 PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries;
1072 DWORD ReservedLowestFunctionStartingAddress;
1073 DWORD ReservedHighestFunctionEndingAddress;
1074 DWORD ReservedNumberOfFpoTableEntries;
1075 PFPO_DATA ReservedFpoTableEntries;
1076 DWORD SizeOfCoffSymbols;
1077 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols;
1078 DWORD ReservedSizeOfCodeViewSymbols;
1079 PVOID ReservedCodeViewSymbols;
1080 PSTR ImageFilePath;
1081 PSTR ImageFileName;
1082 PSTR ReservedDebugFilePath;
1083 DWORD ReservedTimeDateStamp;
1084 BOOL ReservedRomImage;
1085 PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory;
1086 DWORD ReservedNumberOfDebugDirectories;
1087 DWORD ReservedOriginalFunctionTableBaseAddress;
1088 DWORD Reserved[ 2 ];
1089 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
1091 PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PCSTR, PCSTR, ULONG);
1092 BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
1093 #endif
1095 typedef enum
1097 SYMOPT_EX_DISABLEACCESSTIMEUPDATE,
1098 SYMOPT_EX_MAX,
1100 #ifdef __WINESRC__
1101 /* Include ELF/Mach-O modules in module operations */
1102 SYMOPT_EX_WINE_NATIVE_MODULES = 1000,
1103 /* Return the Unix actual path of loaded module */
1104 SYMOPT_EX_WINE_MODULE_REAL_PATH,
1105 /* Return the raw source file path from debug info (not always mapped to DOS) */
1106 SYMOPT_EX_WINE_SOURCE_ACTUAL_PATH,
1107 #endif
1108 } IMAGEHLP_EXTENDED_OPTIONS;
1110 DWORD WINAPI SymGetOptions(void);
1111 DWORD WINAPI SymSetOptions(DWORD);
1113 BOOL WINAPI SymGetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option);
1114 BOOL WINAPI SymSetExtendedOption(IMAGEHLP_EXTENDED_OPTIONS option, BOOL value);
1116 BOOL WINAPI SymSetParentWindow(HWND);
1118 /*************************
1119 * Version, global stuff *
1120 *************************/
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
1154 /* 32-bit functions */
1156 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
1158 #define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64
1159 #define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64
1160 #define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64
1161 #define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64
1162 #define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64
1163 #define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64
1164 #define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64
1165 #define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64
1166 #define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACKW64
1167 #define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64
1169 #define EnumerateLoadedModules EnumerateLoadedModules64
1170 #define StackWalk StackWalk64
1171 #define SymEnumerateModules SymEnumerateModules64
1172 #define SymEnumerateSymbols SymEnumerateSymbols64
1173 #define SymEnumerateSymbolsW SymEnumerateSymbolsW64
1174 #define SymFunctionTableAccess SymFunctionTableAccess64
1175 #define SymGetLineFromAddr SymGetLineFromAddr64
1176 #define SymGetLineFromAddrW SymGetLineFromAddrW64
1177 #define SymGetLineFromName SymGetLineFromName64
1178 #define SymGetLineNext SymGetLineNext64
1179 #define SymGetLineNextW SymGetLineNextW64
1180 #define SymGetLinePrev SymGetLinePrev64
1181 #define SymGetLinePrevW SymGetLinePrevW64
1182 #define SymGetModuleBase SymGetModuleBase64
1183 #define SymGetModuleInfo SymGetModuleInfo64
1184 #define SymGetModuleInfoW SymGetModuleInfoW64
1185 #define SymGetSymFromAddr SymGetSymFromAddr64
1186 #define SymGetSymFromName SymGetSymFromName64
1187 #define SymGetSymNext SymGetSymNext64
1188 #define SymGetSymNextW SymGetSymNextW64
1189 #define SymGetSymPrev SymGetSymPrev64
1190 #define SymGetSymPrevW SymGetSymPrevW64
1191 #define SymLoadModule SymLoadModule64
1192 #define SymRegisterCallback SymRegisterCallback64
1193 #define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64
1194 #define SymUnDName SymUnDName64
1195 #define SymUnloadModule SymUnloadModule64
1197 #else
1199 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PCSTR, ULONG, ULONG, PVOID);
1200 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
1201 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
1202 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)(HANDLE, DWORD, PVOID, DWORD, PDWORD);
1203 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PCSTR, ULONG, PVOID);
1204 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PCSTR, ULONG, ULONG, PVOID);
1205 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(PCWSTR, ULONG, ULONG, PVOID);
1206 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
1207 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE, DWORD, PVOID);
1208 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
1210 BOOL WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
1211 BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID, PREAD_PROCESS_MEMORY_ROUTINE, PFUNCTION_TABLE_ACCESS_ROUTINE, PGET_MODULE_BASE_ROUTINE, PTRANSLATE_ADDRESS_ROUTINE);
1212 BOOL WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
1213 BOOL WINAPI SymEnumerateSymbols(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
1214 BOOL WINAPI SymEnumerateSymbolsW(HANDLE, ULONG, PSYM_ENUMSYMBOLS_CALLBACKW, PVOID);
1215 PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
1216 BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
1217 BOOL WINAPI SymGetLineFromAddrW(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINEW);
1218 BOOL WINAPI SymGetLineFromName(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE);
1219 BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
1220 BOOL WINAPI SymGetLineNextW(HANDLE, PIMAGEHLP_LINEW);
1221 BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
1222 BOOL WINAPI SymGetLinePrevW(HANDLE, PIMAGEHLP_LINEW);
1223 DWORD WINAPI SymGetModuleBase(HANDLE, DWORD);
1224 BOOL WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
1225 BOOL WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
1226 BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
1227 BOOL WINAPI SymGetSymFromName(HANDLE, PCSTR, PIMAGEHLP_SYMBOL);
1228 BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
1229 BOOL WINAPI SymGetSymNextW(HANDLE, PIMAGEHLP_SYMBOLW);
1230 BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
1231 BOOL WINAPI SymGetSymPrevW(HANDLE, PIMAGEHLP_SYMBOLW);
1232 DWORD WINAPI SymLoadModule(HANDLE, HANDLE, PCSTR, PCSTR, DWORD, DWORD);
1233 BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
1234 BOOL WINAPI SymRegisterFunctionEntryCallback(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK, PVOID);
1235 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
1236 BOOL WINAPI SymUnloadModule(HANDLE, DWORD);
1238 #endif
1240 #ifdef __cplusplus
1241 } /* extern "C" */
1242 #endif /* defined(__cplusplus) */
1244 #endif /* __WINE_DBGHELP_H */