xref: /reactos/sdk/include/psdk/dbghelp.h (revision 6e4f0365)
1 /*
2  * Declarations for DBGHELP
3  *
4  * Copyright (C) 2003 Eric Pouech
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef __WINE_DBGHELP_H
22 #define __WINE_DBGHELP_H
23 
24 /* A set of documentation macros (see also imagehlp.h) */
25 #ifndef __deref_out
26 # define __deref_out
27 #endif
28 #ifndef __deref_out_opt
29 # define __deref_out_opt
30 #endif
31 #ifndef __deref_opt_out
32 # define __deref_opt_out
33 #endif
34 #ifndef __in
35 # define __in
36 #endif
37 #ifndef __in_opt
38 # define __in_opt
39 #endif
40 #ifndef __in_bcount
41 # define __in_bcount(x)
42 #endif
43 #ifndef __in_bcount_opt
44 # define __in_bcount_opt(x)
45 #endif
46 #ifndef __in_ecount
47 # define __in_ecount(x)
48 #endif
49 #ifndef __inout
50 # define __inout
51 #endif
52 #ifndef __inout_opt
53 # define __inout_opt
54 #endif
55 #ifndef __inout_bcount
56 # define __inout_bcount(x)
57 #endif
58 #ifndef __inout_ecount
59 # define __inout_ecount(x)
60 #endif
61 #ifndef __out
62 # define __out
63 #endif
64 #ifndef __out_opt
65 # define __out_opt
66 #endif
67 #ifndef __out_bcount
68 # define __out_bcount(x)
69 #endif
70 #ifndef __out_bcount_opt
71 # define __out_bcount_opt(x)
72 #endif
73 #ifndef __out_ecount
74 # define __out_ecount(x)
75 #endif
76 #ifndef __out_ecount_opt
77 # define __out_ecount_opt(x)
78 #endif
79 #ifndef __out_xcount
80 # define __out_xcount(x)
81 #endif
82 
83 
84 #ifdef __cplusplus
85 extern "C" {
86 #endif /* defined(__cplusplus) */
87 
88 #ifdef _WIN64
89 #ifndef _IMAGEHLP64
90 #define _IMAGEHLP64
91 #endif
92 #endif
93 
94 #define IMAGEAPI WINAPI
95 #define DBHLPAPI IMAGEAPI
96 
97 typedef struct _LOADED_IMAGE
98 {
99     PSTR                        ModuleName;
100     HANDLE                      hFile;
101     PUCHAR                      MappedAddress;
102     PIMAGE_NT_HEADERS           FileHeader;
103     PIMAGE_SECTION_HEADER       LastRvaSection;
104     ULONG                       NumberOfSections;
105     PIMAGE_SECTION_HEADER       Sections;
106     ULONG                       Characteristics;
107     BOOLEAN                     fSystemImage;
108     BOOLEAN                     fDOSImage;
109     BOOLEAN                     fReadOnly;
110     UCHAR                       Version;
111     LIST_ENTRY                  Links;
112     ULONG                       SizeOfImage;
113 } LOADED_IMAGE, *PLOADED_IMAGE;
114 
115 /*************************
116  *    IMAGEHLP equiv     *
117  *************************/
118 
119 typedef enum
120 {
121     AddrMode1616,
122     AddrMode1632,
123     AddrModeReal,
124     AddrModeFlat
125 } ADDRESS_MODE;
126 
127 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
128 #define ADDRESS ADDRESS64
129 #define LPADDRESS LPADDRESS64
130 #else
131 typedef struct _tagADDRESS
132 {
133     DWORD                       Offset;
134     WORD                        Segment;
135     ADDRESS_MODE                Mode;
136 } ADDRESS, *LPADDRESS;
137 #endif
138 
139 typedef struct _tagADDRESS64
140 {
141     DWORD64                     Offset;
142     WORD                        Segment;
143     ADDRESS_MODE                Mode;
144 } ADDRESS64, *LPADDRESS64;
145 
146 #define SYMF_OMAP_GENERATED   0x00000001
147 #define SYMF_OMAP_MODIFIED    0x00000002
148 #define SYMF_USER_GENERATED   0x00000004
149 #define SYMF_REGISTER         0x00000008
150 #define SYMF_REGREL           0x00000010
151 #define SYMF_FRAMEREL         0x00000020
152 #define SYMF_PARAMETER        0x00000040
153 #define SYMF_LOCAL            0x00000080
154 #define SYMF_CONSTANT         0x00000100
155 #define SYMF_EXPORT           0x00000200
156 #define SYMF_FORWARDER        0x00000400
157 #define SYMF_FUNCTION         0x00000800
158 #define SYMF_VIRTUAL          0x00001000
159 #define SYMF_THUNK            0x00002000
160 #define SYMF_TLSREL           0x00004000
161 
162 typedef enum
163 {
164     SymNone = 0,
165     SymCoff,
166     SymCv,
167     SymPdb,
168     SymExport,
169     SymDeferred,
170     SymSym,
171     SymDia,
172     SymVirtual,
173     NumSymTypes
174 } SYM_TYPE;
175 
176 #ifdef _NO_CVCONST_H
177 enum SymTagEnum
178 {
179     SymTagNull,
180     SymTagExe,
181     SymTagCompiland,
182     SymTagCompilandDetails,
183     SymTagCompilandEnv,
184     SymTagFunction,
185     SymTagBlock,
186     SymTagData,
187     SymTagAnnotation,
188     SymTagLabel,
189     SymTagPublicSymbol,
190     SymTagUDT,
191     SymTagEnum,
192     SymTagFunctionType,
193     SymTagPointerType,
194     SymTagArrayType,
195     SymTagBaseType,
196     SymTagTypedef,
197     SymTagBaseClass,
198     SymTagFriend,
199     SymTagFunctionArgType,
200     SymTagFuncDebugStart,
201     SymTagFuncDebugEnd,
202     SymTagUsingNamespace,
203     SymTagVTableShape,
204     SymTagVTable,
205     SymTagCustom,
206     SymTagThunk,
207     SymTagCustomType,
208     SymTagManagedType,
209     SymTagDimension,
210     SymTagCallSite,
211     SymTagInlineSite,
212     SymTagBaseInterface,
213     SymTagVectorType,
214     SymTagMatrixType,
215     SymTagHLSLType,
216     SymTagCaller,
217     SymTagCallee,
218     SymTagExport,
219     SymTagHeapAllocationSite,
220     SymTagCoffGroup,
221     SymTagMax
222 };
223 #endif // _NO_CVCONST_H
224 
225 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
226 #define IMAGEHLP_SYMBOL IMAGEHLP_SYMBOL64
227 #define IMAGEHLP_SYMBOLW IMAGEHLP_SYMBOLW64
228 #define PIMAGEHLP_SYMBOL PIMAGEHLP_SYMBOL64
229 #define PIMAGEHLP_SYMBOLW PIMAGEHLP_SYMBOLW64
230 #else
231 typedef struct _IMAGEHLP_SYMBOL
232 {
233     DWORD                       SizeOfStruct;
234     DWORD                       Address;
235     DWORD                       Size;
236     DWORD                       Flags;
237     DWORD                       MaxNameLength;
238     CHAR                        Name[1];
239 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
240 
241 typedef struct _IMAGEHLP_SYMBOLW
242 {
243     DWORD                       SizeOfStruct;
244     DWORD                       Address;
245     DWORD                       Size;
246     DWORD                       Flags;
247     DWORD                       MaxNameLength;
248     WCHAR                       Name[1];
249 } IMAGEHLP_SYMBOLW, *PIMAGEHLP_SYMBOLW;
250 #endif
251 
252 typedef struct _IMAGEHLP_SYMBOL64
253 {
254     DWORD                       SizeOfStruct;
255     DWORD64                     Address;
256     DWORD                       Size;
257     DWORD                       Flags;
258     DWORD                       MaxNameLength;
259     CHAR                        Name[1];
260 } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
261 
262 typedef struct _IMAGEHLP_SYMBOLW64
263 {
264     DWORD                       SizeOfStruct;
265     DWORD64                     Address;
266     DWORD                       Size;
267     DWORD                       Flags;
268     DWORD                       MaxNameLength;
269     WCHAR                       Name[1];
270 } IMAGEHLP_SYMBOLW64, *PIMAGEHLP_SYMBOLW64;
271 
272 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
273 #define IMAGEHLP_MODULE IMAGEHLP_MODULE64
274 #define PIMAGEHLP_MODULE PIMAGEHLP_MODULE64
275 #define IMAGEHLP_MODULEW IMAGEHLP_MODULEW64
276 #define PIMAGEHLP_MODULEW PIMAGEHLP_MODULEW64
277 #else
278 typedef struct _IMAGEHLP_MODULE
279 {
280     DWORD                       SizeOfStruct;
281     DWORD                       BaseOfImage;
282     DWORD                       ImageSize;
283     DWORD                       TimeDateStamp;
284     DWORD                       CheckSum;
285     DWORD                       NumSyms;
286     SYM_TYPE                    SymType;
287     CHAR                        ModuleName[32];
288     CHAR                        ImageName[256];
289     CHAR                        LoadedImageName[256];
290 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
291 
292 typedef struct _IMAGEHLP_MODULEW
293 {
294     DWORD                       SizeOfStruct;
295     DWORD                       BaseOfImage;
296     DWORD                       ImageSize;
297     DWORD                       TimeDateStamp;
298     DWORD                       CheckSum;
299     DWORD                       NumSyms;
300     SYM_TYPE                    SymType;
301     WCHAR                       ModuleName[32];
302     WCHAR                       ImageName[256];
303     WCHAR                       LoadedImageName[256];
304 } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
305 #endif
306 
307 typedef struct _IMAGEHLP_MODULE64
308 {
309     DWORD                       SizeOfStruct;
310     DWORD64                     BaseOfImage;
311     DWORD                       ImageSize;
312     DWORD                       TimeDateStamp;
313     DWORD                       CheckSum;
314     DWORD                       NumSyms;
315     SYM_TYPE                    SymType;
316     CHAR                        ModuleName[32];
317     CHAR                        ImageName[256];
318     CHAR                        LoadedImageName[256];
319     CHAR                        LoadedPdbName[256];
320     DWORD                       CVSig;
321     CHAR                        CVData[MAX_PATH*3];
322     DWORD                       PdbSig;
323     GUID                        PdbSig70;
324     DWORD                       PdbAge;
325     BOOL                        PdbUnmatched;
326     BOOL                        DbgUnmatched;
327     BOOL                        LineNumbers;
328     BOOL                        GlobalSymbols;
329     BOOL                        TypeInfo;
330     BOOL                        SourceIndexed;
331     BOOL                        Publics;
332 } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
333 
334 typedef struct _IMAGEHLP_MODULEW64
335 {
336     DWORD                       SizeOfStruct;
337     DWORD64                     BaseOfImage;
338     DWORD                       ImageSize;
339     DWORD                       TimeDateStamp;
340     DWORD                       CheckSum;
341     DWORD                       NumSyms;
342     SYM_TYPE                    SymType;
343     WCHAR                       ModuleName[32];
344     WCHAR                       ImageName[256];
345     WCHAR                       LoadedImageName[256];
346     WCHAR                       LoadedPdbName[256];
347     DWORD                       CVSig;
348     WCHAR                       CVData[MAX_PATH*3];
349     DWORD                       PdbSig;
350     GUID                        PdbSig70;
351     DWORD                       PdbAge;
352     BOOL                        PdbUnmatched;
353     BOOL                        DbgUnmatched;
354     BOOL                        LineNumbers;
355     BOOL                        GlobalSymbols;
356     BOOL                        TypeInfo;
357     BOOL                        SourceIndexed;
358     BOOL                        Publics;
359 } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
360 
361 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
362 #define IMAGEHLP_LINE IMAGEHLP_LINE64
363 #define PIMAGEHLP_LINE PIMAGEHLP_LINE64
364 #define IMAGEHLP_LINEW IMAGEHLP_LINEW64
365 #define PIMAGEHLP_LINEW PIMAGEHLP_LINEW64
366 #else
367 typedef struct _IMAGEHLP_LINE
368 {
369     DWORD                       SizeOfStruct;
370     PVOID                       Key;
371     DWORD                       LineNumber;
372     PCHAR                       FileName;
373     DWORD                       Address;
374 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
375 
376 typedef struct _IMAGEHLP_LINEW
377 {
378     DWORD                       SizeOfStruct;
379     PVOID                       Key;
380     DWORD                       LineNumber;
381     PWSTR                       FileName;
382     DWORD                       Address;
383 } IMAGEHLP_LINEW, *PIMAGEHLP_LINEW;
384 #endif
385 
386 typedef struct _IMAGEHLP_LINE64
387 {
388     DWORD                       SizeOfStruct;
389     PVOID                       Key;
390     DWORD                       LineNumber;
391     PCHAR                       FileName;
392     DWORD64                     Address;
393 } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
394 
395 typedef struct _IMAGEHLP_LINEW64
396 {
397     DWORD                       SizeOfStruct;
398     PVOID                       Key;
399     DWORD                       LineNumber;
400     PWSTR                       FileName;
401     DWORD64                     Address;
402 } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
403 
404 typedef struct _SOURCEFILE
405 {
406     DWORD64                     ModBase;
407     PCHAR                       FileName;
408 } SOURCEFILE, *PSOURCEFILE;
409 
410 typedef struct _SOURCEFILEW
411 {
412     DWORD64                     ModBase;
413     PWSTR                       FileName;
414 } SOURCEFILEW, *PSOURCEFILEW;
415 
416 #define CBA_DEFERRED_SYMBOL_LOAD_START          0x00000001
417 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE       0x00000002
418 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE        0x00000003
419 #define CBA_SYMBOLS_UNLOADED                    0x00000004
420 #define CBA_DUPLICATE_SYMBOL                    0x00000005
421 #define CBA_READ_MEMORY                         0x00000006
422 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL         0x00000007
423 #define CBA_SET_OPTIONS                         0x00000008
424 #define CBA_EVENT                               0x00000010
425 #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL        0x00000020
426 #define CBA_DEBUG_INFO                          0x10000000
427 
428 typedef struct _IMAGEHLP_CBA_READ_MEMORY
429 {
430     DWORD64   addr;
431     PVOID     buf;
432     DWORD     bytes;
433     DWORD    *bytesread;
434 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
435 
436 enum
437 {
438     sevInfo = 0,
439     sevProblem,
440     sevAttn,
441     sevFatal,
442     sevMax
443 };
444 
445 #define EVENT_SRCSPEW_START 100
446 #define EVENT_SRCSPEW       100
447 #define EVENT_SRCSPEW_END   199
448 
449 typedef struct _IMAGEHLP_CBA_EVENT
450 {
451     DWORD       severity;
452     DWORD       code;
453     PCHAR       desc;
454     PVOID       object;
455 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
456 
457 typedef struct _IMAGEHLP_CBA_EVENTW
458 {
459     DWORD       severity;
460     DWORD       code;
461     PCWSTR      desc;
462     PVOID       object;
463 } IMAGEHLP_CBA_EVENTW, *PIMAGEHLP_CBA_EVENTW;
464 
465 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
466 #define IMAGEHLP_DEFERRED_SYMBOL_LOAD IMAGEHLP_DEFERRED_SYMBOL_LOAD64
467 #define PIMAGEHLP_DEFERRED_SYMBOL_LOAD PIMAGEHLP_DEFERRED_SYMBOL_LOAD64
468 #else
469 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
470 {
471     DWORD                       SizeOfStruct;
472     DWORD                       BaseOfImage;
473     DWORD                       CheckSum;
474     DWORD                       TimeDateStamp;
475     CHAR                        FileName[MAX_PATH];
476     BOOLEAN                     Reparse;
477     HANDLE                      hFile;
478 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
479 #endif
480 
481 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
482 {
483     DWORD                       SizeOfStruct;
484     DWORD64                     BaseOfImage;
485     DWORD                       CheckSum;
486     DWORD                       TimeDateStamp;
487     CHAR                        FileName[MAX_PATH];
488     BOOLEAN                     Reparse;
489     HANDLE                      hFile;
490     DWORD                       Flags;
491 } IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
492 
493 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
494 {
495     DWORD                       SizeOfStruct;
496     DWORD64                     BaseOfImage;
497     DWORD                       CheckSum;
498     DWORD                       TimeDateStamp;
499     WCHAR                       FileName[MAX_PATH + 1];
500     BOOLEAN                     Reparse;
501     HANDLE                      hFile;
502     DWORD                       Flags;
503 } IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
504 
505 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
506 #define IMAGEHLP_DUPLICATE_SYMBOL IMAGEHLP_DUPLICATE_SYMBOL64
507 #define PIMAGEHLP_DUPLICATE_SYMBOL PIMAGEHLP_DUPLICATE_SYMBOL64
508 #else
509 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
510 {
511     DWORD                       SizeOfStruct;
512     DWORD                       NumberOfDups;
513     PIMAGEHLP_SYMBOL            Symbol;
514     DWORD                       SelectedSymbol;
515 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
516 #endif
517 
518 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
519 {
520     DWORD                       SizeOfStruct;
521     DWORD                       NumberOfDups;
522     PIMAGEHLP_SYMBOL64          Symbol;
523     DWORD                       SelectedSymbol;
524 } IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64;
525 
526 #define SYMOPT_CASE_INSENSITIVE         0x00000001
527 #define SYMOPT_UNDNAME                  0x00000002
528 #define SYMOPT_DEFERRED_LOADS           0x00000004
529 #define SYMOPT_NO_CPP                   0x00000008
530 #define SYMOPT_LOAD_LINES               0x00000010
531 #define SYMOPT_OMAP_FIND_NEAREST        0x00000020
532 #define SYMOPT_LOAD_ANYTHING            0x00000040
533 #define SYMOPT_IGNORE_CVREC             0x00000080
534 #define SYMOPT_NO_UNQUALIFIED_LOADS     0x00000100
535 #define SYMOPT_FAIL_CRITICAL_ERRORS     0x00000200
536 #define SYMOPT_EXACT_SYMBOLS            0x00000400
537 #define SYMOPT_WILD_UNDERSCORE          0x00000800
538 #define SYMOPT_USE_DEFAULTS             0x00001000
539 #define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS   0x00000800
540 #define SYMOPT_IGNORE_NT_SYMPATH        0x00001000
541 #define SYMOPT_INCLUDE_32BIT_MODULES    0x00002000
542 #define SYMOPT_PUBLICS_ONLY             0x00004000
543 #define SYMOPT_NO_PUBLICS               0x00008000
544 #define SYMOPT_AUTO_PUBLICS             0x00010000
545 #define SYMOPT_NO_IMAGE_SEARCH          0x00020000
546 #define SYMOPT_SECURE                   0x00040000
547 #define SYMOPT_NO_PROMPTS               0x00080000
548 #define SYMOPT_OVERWRITE                0x00100000
549 #define SYMOPT_IGNORE_IMAGEDIR          0x00200000
550 #define SYMOPT_FLAT_DIRECTORY           0x00400000
551 #define SYMOPT_FAVOR_COMPRESSED         0x00800000
552 #define SYMOPT_ALLOW_ZERO_ADDRESS       0x01000000
553 #define SYMOPT_DISABLE_SYMSRV_AUTODETECT 0x02000000
554 #define SYMOPT_READONLY_CACHE           0x04000000
555 #define SYMOPT_SYMPATH_LAST             0x08000000
556 #define SYMOPT_DEBUG                    0x80000000
557 
558 typedef struct _IMAGEHLP_STACK_FRAME
559 {
560     ULONG64     InstructionOffset;
561     ULONG64     ReturnOffset;
562     ULONG64     FrameOffset;
563     ULONG64     StackOffset;
564     ULONG64     BackingStoreOffset;
565     ULONG64     FuncTableEntry;
566     ULONG64     Params[4];
567     ULONG64     Reserved[5];
568     BOOL        Virtual;
569     ULONG       Reserved2;
570 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
571 
572 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
573 
574 #define DBHHEADER_DEBUGDIRS     0x1
575 typedef struct _DBGHELP_MODLOAD_DATA
576 {
577     DWORD               ssize;
578     DWORD               ssig;
579     PVOID               data;
580     DWORD               size;
581     DWORD               flags;
582 } MODLOAD_DATA, *PMODLOAD_DATA;
583 
584 /*************************
585  *       MiniDUMP        *
586  *************************/
587 
588 #include <pshpack4.h>
589 /* DebugHelp */
590 
591 #define MINIDUMP_SIGNATURE 0x504D444D /* 'MDMP' */
592 #define MINIDUMP_VERSION   (42899)
593 
594 typedef DWORD   RVA;
595 typedef ULONG64 RVA64;
596 
597 typedef enum _MINIDUMP_TYPE
598 {
599     MiniDumpNormal                              = 0x0000,
600     MiniDumpWithDataSegs                        = 0x0001,
601     MiniDumpWithFullMemory                      = 0x0002,
602     MiniDumpWithHandleData                      = 0x0004,
603     MiniDumpFilterMemory                        = 0x0008,
604     MiniDumpScanMemory                          = 0x0010,
605     MiniDumpWithUnloadedModules                 = 0x0020,
606     MiniDumpWithIndirectlyReferencedMemory      = 0x0040,
607     MiniDumpFilterModulePaths                   = 0x0080,
608     MiniDumpWithProcessThreadData               = 0x0100,
609     MiniDumpWithPrivateReadWriteMemory          = 0x0200,
610     MiniDumpWithoutOptionalData                 = 0x0400,
611     MiniDumpWithFullMemoryInfo                  = 0x0800,
612     MiniDumpWithThreadInfo                      = 0x1000,
613     MiniDumpWithCodeSegs                        = 0x2000
614 } MINIDUMP_TYPE;
615 
616 typedef enum _MINIDUMP_CALLBACK_TYPE
617 {
618     ModuleCallback,
619     ThreadCallback,
620     ThreadExCallback,
621     IncludeThreadCallback,
622     IncludeModuleCallback,
623     MemoryCallback,
624 } MINIDUMP_CALLBACK_TYPE;
625 
626 typedef struct _MINIDUMP_THREAD_CALLBACK
627 {
628     ULONG                       ThreadId;
629     HANDLE                      ThreadHandle;
630     CONTEXT                     Context;
631     ULONG                       SizeOfContext;
632     ULONG64                     StackBase;
633     ULONG64                     StackEnd;
634 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
635 
636 typedef struct _MINIDUMP_THREAD_EX_CALLBACK
637 {
638     ULONG                       ThreadId;
639     HANDLE                      ThreadHandle;
640     CONTEXT                     Context;
641     ULONG                       SizeOfContext;
642     ULONG64                     StackBase;
643     ULONG64                     StackEnd;
644     ULONG64                     BackingStoreBase;
645     ULONG64                     BackingStoreEnd;
646 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
647 
648 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
649 {
650     ULONG ThreadId;
651 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
652 
653 typedef enum _THREAD_WRITE_FLAGS
654 {
655     ThreadWriteThread            = 0x0001,
656     ThreadWriteStack             = 0x0002,
657     ThreadWriteContext           = 0x0004,
658     ThreadWriteBackingStore      = 0x0008,
659     ThreadWriteInstructionWindow = 0x0010,
660     ThreadWriteThreadData        = 0x0020,
661     ThreadWriteThreadInfo        = 0x0040
662 } THREAD_WRITE_FLAGS;
663 
664 typedef struct _MINIDUMP_MODULE_CALLBACK
665 {
666     PWCHAR                      FullPath;
667     ULONG64                     BaseOfImage;
668     ULONG                       SizeOfImage;
669     ULONG                       CheckSum;
670     ULONG                       TimeDateStamp;
671     VS_FIXEDFILEINFO            VersionInfo;
672     PVOID                       CvRecord;
673     ULONG                       SizeOfCvRecord;
674     PVOID                       MiscRecord;
675     ULONG                       SizeOfMiscRecord;
676 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
677 
678 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK
679 {
680     ULONG64 BaseOfImage;
681 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
682 
683 typedef enum _MODULE_WRITE_FLAGS
684 {
685     ModuleWriteModule        = 0x0001,
686     ModuleWriteDataSeg       = 0x0002,
687     ModuleWriteMiscRecord    = 0x0004,
688     ModuleWriteCvRecord      = 0x0008,
689     ModuleReferencedByMemory = 0x0010,
690     ModuleWriteTlsData       = 0x0020,
691     ModuleWriteCodeSegs      = 0x0040,
692 } MODULE_WRITE_FLAGS;
693 
694 typedef struct _MINIDUMP_CALLBACK_INPUT
695 {
696     ULONG                       ProcessId;
697     HANDLE                      ProcessHandle;
698     ULONG                       CallbackType;
699     union
700     {
701         MINIDUMP_THREAD_CALLBACK        Thread;
702         MINIDUMP_THREAD_EX_CALLBACK     ThreadEx;
703         MINIDUMP_MODULE_CALLBACK        Module;
704         MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
705         MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
706     } DUMMYUNIONNAME;
707 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
708 
709 typedef struct _MINIDUMP_CALLBACK_OUTPUT
710 {
711     union
712     {
713         ULONG                           ModuleWriteFlags;
714         ULONG                           ThreadWriteFlags;
715         struct
716         {
717             ULONG64                     MemoryBase;
718             ULONG                       MemorySize;
719         } DUMMYSTRUCTNAME;
720     } DUMMYUNIONNAME;
721 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
722 
723 typedef BOOL
724 (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(
725   _Inout_ PVOID,
726   _In_ const PMINIDUMP_CALLBACK_INPUT,
727   _Inout_ PMINIDUMP_CALLBACK_OUTPUT);
728 
729 typedef struct _MINIDUMP_CALLBACK_INFORMATION
730 {
731     MINIDUMP_CALLBACK_ROUTINE   CallbackRoutine;
732     void*                       CallbackParam;
733 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
734 
735 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR
736 {
737     ULONG                       DataSize;
738     RVA                         Rva;
739 } MINIDUMP_LOCATION_DESCRIPTOR;
740 
741 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64
742 {
743     ULONG64                     DataSize;
744     RVA64                       Rva;
745 } MINIDUMP_LOCATION_DESCRIPTOR64;
746 
747 typedef struct _MINIDUMP_DIRECTORY
748 {
749     ULONG                       StreamType;
750     MINIDUMP_LOCATION_DESCRIPTOR Location;
751 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
752 
753 typedef struct _MINIDUMP_EXCEPTION
754 {
755     ULONG                       ExceptionCode;
756     ULONG                       ExceptionFlags;
757     ULONG64                     ExceptionRecord;
758     ULONG64                     ExceptionAddress;
759     ULONG                       NumberParameters;
760     ULONG                        __unusedAlignment;
761     ULONG64                     ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
762 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
763 
764 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
765 {
766     DWORD                       ThreadId;
767     PEXCEPTION_POINTERS         ExceptionPointers;
768     BOOL                        ClientPointers;
769 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
770 
771 typedef struct MINIDUMP_EXCEPTION_STREAM
772 {
773     ULONG                       ThreadId;
774     ULONG                       __alignment;
775     MINIDUMP_EXCEPTION          ExceptionRecord;
776     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
777 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
778 
779 typedef struct _MINIDUMP_HEADER
780 {
781     DWORD                       Signature;
782     DWORD                       Version;
783     DWORD                       NumberOfStreams;
784     RVA                         StreamDirectoryRva;
785     DWORD                       CheckSum;
786     union
787     {
788         DWORD                           Reserved;
789         DWORD                           TimeDateStamp;
790     } DUMMYUNIONNAME;
791     ULONG64                     Flags;
792 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
793 
794 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR
795 {
796     ULONG64                     StartOfMemoryRange;
797     MINIDUMP_LOCATION_DESCRIPTOR Memory;
798 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
799 
800 typedef struct _MINIDUMP_MEMORY_LIST
801 {
802     ULONG                       NumberOfMemoryRanges;
803     MINIDUMP_MEMORY_DESCRIPTOR  MemoryRanges[1]; /* FIXME: 0-sized array not supported */
804 } MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
805 
806 #define MINIDUMP_MISC1_PROCESS_ID       0x00000001
807 #define MINIDUMP_MISC1_PROCESS_TIMES    0x00000002
808 
809 typedef struct _MINIDUMP_MISC_INFO
810 {
811     ULONG                       SizeOfInfo;
812     ULONG                       Flags1;
813     ULONG                       ProcessId;
814     ULONG                       ProcessCreateTime;
815     ULONG                       ProcessUserTime;
816     ULONG                       ProcessKernelTime;
817 } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
818 
819 typedef struct _MINIDUMP_MODULE
820 {
821     ULONG64                     BaseOfImage;
822     ULONG                       SizeOfImage;
823     ULONG                       CheckSum;
824     ULONG                       TimeDateStamp;
825     RVA                         ModuleNameRva;
826     VS_FIXEDFILEINFO            VersionInfo;
827     MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
828     MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
829     ULONG64                     Reserved0;
830     ULONG64                     Reserved1;
831 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
832 
833 typedef struct _MINIDUMP_MODULE_LIST
834 {
835     ULONG                       NumberOfModules;
836     MINIDUMP_MODULE             Modules[1]; /* FIXME: 0-sized array not supported */
837 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
838 
839 typedef struct _MINIDUMP_STRING
840 {
841     ULONG                       Length;
842     WCHAR                       Buffer[1]; /* FIXME: O-sized array not supported */
843 } MINIDUMP_STRING, *PMINIDUMP_STRING;
844 
845 typedef struct _MINIDUMP_SYSTEM_INFO
846 {
847     USHORT                      ProcessorArchitecture;
848     USHORT                      ProcessorLevel;
849     USHORT                      ProcessorRevision;
850     union
851     {
852         USHORT                          Reserved0;
853         struct
854         {
855             UCHAR                       NumberOfProcessors;
856             UCHAR                       ProductType;
857         } DUMMYSTRUCTNAME;
858     } DUMMYUNIONNAME;
859 
860     ULONG                       MajorVersion;
861     ULONG                       MinorVersion;
862     ULONG                       BuildNumber;
863     ULONG                       PlatformId;
864 
865     RVA                         CSDVersionRva;
866     union
867     {
868         ULONG                           Reserved1;
869         struct
870         {
871             USHORT                      SuiteMask;
872             USHORT                      Reserved2;
873         } DUMMYSTRUCTNAME;
874     } DUMMYUNIONNAME1;
875     union _CPU_INFORMATION
876     {
877         struct
878         {
879             ULONG                       VendorId[3];
880             ULONG                       VersionInformation;
881             ULONG                       FeatureInformation;
882             ULONG                       AMDExtendedCpuFeatures;
883         } X86CpuInfo;
884         struct
885         {
886             ULONG64                     ProcessorFeatures[2];
887         } OtherCpuInfo;
888     } Cpu;
889 
890 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
891 
892 typedef struct _MINIDUMP_THREAD
893 {
894     ULONG                       ThreadId;
895     ULONG                       SuspendCount;
896     ULONG                       PriorityClass;
897     ULONG                       Priority;
898     ULONG64                     Teb;
899     MINIDUMP_MEMORY_DESCRIPTOR  Stack;
900     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
901 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
902 
903 typedef struct _MINIDUMP_THREAD_LIST
904 {
905     ULONG                       NumberOfThreads;
906     MINIDUMP_THREAD             Threads[1]; /* FIXME: no support of 0 sized array */
907 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
908 
909 typedef struct _MINIDUMP_USER_STREAM
910 {
911     ULONG                       Type;
912     ULONG                       BufferSize;
913     void*                       Buffer;
914 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
915 
916 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
917 {
918     ULONG                       UserStreamCount;
919     PMINIDUMP_USER_STREAM       UserStreamArray;
920 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
921 
922 typedef enum _MINIDUMP_STREAM_TYPE
923 {
924     UnusedStream                = 0,
925     ReservedStream0             = 1,
926     ReservedStream1             = 2,
927     ThreadListStream            = 3,
928     ModuleListStream            = 4,
929     MemoryListStream            = 5,
930     ExceptionStream             = 6,
931     SystemInfoStream            = 7,
932     ThreadExListStream          = 8,
933     Memory64ListStream          = 9,
934     CommentStreamA              = 10,
935     CommentStreamW              = 11,
936     HandleDataStream            = 12,
937     FunctionTableStream         = 13,
938     UnloadedModuleListStream    = 14,
939     MiscInfoStream              = 15,
940     MemoryInfoListStream        = 16,
941     ThreadInfoListStream        = 17,
942 
943     LastReservedStream          = 0xffff
944 } MINIDUMP_STREAM_TYPE;
945 
946 BOOL
947 WINAPI
948 MiniDumpWriteDump(
949   _In_ HANDLE,
950   _In_ DWORD,
951   _In_ HANDLE,
952   _In_ MINIDUMP_TYPE,
953   _In_opt_ PMINIDUMP_EXCEPTION_INFORMATION,
954   _In_opt_ PMINIDUMP_USER_STREAM_INFORMATION,
955   _In_opt_ PMINIDUMP_CALLBACK_INFORMATION);
956 
957 BOOL
958 WINAPI
959 MiniDumpReadDumpStream(
960   _In_ PVOID,
961   _In_ ULONG,
962   _Outptr_result_maybenull_ PMINIDUMP_DIRECTORY*,
963   _Outptr_result_maybenull_ PVOID*,
964   _Out_opt_ ULONG*);
965 
966 #include <poppack.h>
967 
968 /*************************
969  *    MODULE handling    *
970  *************************/
971 
972 /* flags for SymLoadModuleEx */
973 #define SLMFLAG_VIRTUAL         0x1
974 #define SLMFLAG_NO_SYMBOLS      0x4
975 
976 typedef BOOL
977 (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(
978   _In_ PCSTR,
979   _In_ DWORD64,
980   _In_ ULONG,
981   _In_opt_ PVOID);
982 
983 BOOL
984 WINAPI
985 EnumerateLoadedModules64(
986   _In_ HANDLE,
987   _In_ PENUMLOADED_MODULES_CALLBACK64,
988   _In_opt_ PVOID);
989 
990 typedef BOOL
991 (CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(
992   _In_ PCWSTR,
993   _In_ DWORD64,
994   _In_ ULONG,
995   _In_opt_ PVOID);
996 
997 BOOL
998 WINAPI
999 EnumerateLoadedModulesW64(
1000   _In_ HANDLE,
1001   _In_ PENUMLOADED_MODULES_CALLBACKW64,
1002   _In_opt_ PVOID);
1003 
1004 typedef BOOL
1005 (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(
1006   _In_ PCSTR,
1007   _In_ DWORD64,
1008   _In_opt_ PVOID);
1009 
1010 BOOL
1011 WINAPI
1012 SymEnumerateModules64(
1013   _In_ HANDLE,
1014   _In_ PSYM_ENUMMODULES_CALLBACK64,
1015   _In_opt_ PVOID);
1016 
1017 typedef BOOL
1018 (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(
1019   _In_ PCWSTR,
1020   _In_ DWORD64,
1021   _In_opt_ PVOID);
1022 
1023 BOOL
1024 WINAPI
1025 SymEnumerateModulesW64(
1026   _In_ HANDLE,
1027   _In_ PSYM_ENUMMODULES_CALLBACKW64,
1028   _In_opt_ PVOID);
1029 
1030 BOOL
1031 WINAPI
1032 SymGetModuleInfo64(
1033   _In_ HANDLE,
1034   _In_ DWORD64,
1035   _Out_ PIMAGEHLP_MODULE64);
1036 
1037 BOOL
1038 WINAPI
1039 SymGetModuleInfoW64(
1040   _In_ HANDLE,
1041   _In_ DWORD64,
1042   _Out_ PIMAGEHLP_MODULEW64);
1043 
1044 DWORD64 WINAPI SymGetModuleBase64(_In_ HANDLE, _In_ DWORD64);
1045 
1046 DWORD64
1047 WINAPI
1048 SymLoadModule64(
1049   _In_ HANDLE,
1050   _In_opt_ HANDLE,
1051   _In_opt_ PCSTR,
1052   _In_opt_ PCSTR,
1053   _In_ DWORD64,
1054   _In_ DWORD);
1055 
1056 DWORD64
1057 WINAPI
1058 SymLoadModuleEx(
1059   _In_ HANDLE,
1060   _In_opt_ HANDLE,
1061   _In_opt_ PCSTR,
1062   _In_opt_ PCSTR,
1063   _In_ DWORD64,
1064   _In_ DWORD,
1065   _In_opt_ PMODLOAD_DATA,
1066   _In_opt_ DWORD);
1067 
1068 DWORD64
1069 WINAPI
1070 SymLoadModuleExW(
1071   _In_ HANDLE,
1072   _In_opt_ HANDLE,
1073   _In_opt_ PCWSTR,
1074   _In_opt_ PCWSTR,
1075   _In_ DWORD64,
1076   _In_ DWORD,
1077   _In_opt_ PMODLOAD_DATA,
1078   _In_opt_ DWORD);
1079 
1080 BOOL WINAPI SymUnloadModule64(_In_ HANDLE, _In_ DWORD64);
1081 
1082 /*************************
1083  *    Symbol Handling    *
1084  *************************/
1085 
1086 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT          1
1087 #define IMAGEHLP_SYMBOL_INFO_REGISTER              SYMF_REGISTER        /*  0x08 */
1088 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE           SYMF_REGREL          /*  0x10 */
1089 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE         SYMF_FRAMEREL        /*  0x20 */
1090 #define IMAGEHLP_SYMBOL_INFO_PARAMETER             SYMF_PARAMETER       /*  0x40 */
1091 #define IMAGEHLP_SYMBOL_INFO_LOCAL                 SYMF_LOCAL           /*  0x80 */
1092 #define IMAGEHLP_SYMBOL_INFO_CONSTANT              SYMF_CONSTANT        /* 0x100 */
1093 #define IMAGEHLP_SYMBOL_FUNCTION                   SYMF_FUNCTION        /* 0x800 */
1094 
1095 #define SYMFLAG_VALUEPRESENT     0x00000001
1096 #define SYMFLAG_REGISTER         0x00000008
1097 #define SYMFLAG_REGREL           0x00000010
1098 #define SYMFLAG_FRAMEREL         0x00000020
1099 #define SYMFLAG_PARAMETER        0x00000040
1100 #define SYMFLAG_LOCAL            0x00000080
1101 #define SYMFLAG_CONSTANT         0x00000100
1102 #define SYMFLAG_EXPORT           0x00000200
1103 #define SYMFLAG_FORWARDER        0x00000400
1104 #define SYMFLAG_FUNCTION         0x00000800
1105 #define SYMFLAG_VIRTUAL          0x00001000
1106 #define SYMFLAG_THUNK            0x00002000
1107 #define SYMFLAG_TLSREL           0x00004000
1108 #define SYMFLAG_SLOT             0x00008000
1109 #define SYMFLAG_ILREL            0x00010000
1110 #define SYMFLAG_METADATA         0x00020000
1111 #define SYMFLAG_CLR_TOKEN        0x00040000
1112 #define SYMFLAG_NULL             0x00080000
1113 #define SYMFLAG_FUNC_NO_RETURN   0x00100000
1114 #define SYMFLAG_SYNTHETIC_ZEROBASE 0x00200000
1115 #define SYMFLAG_PUBLIC_CODE      0x00400000
1116 
1117 #define MAX_SYM_NAME    2000
1118 
1119 typedef struct _SYMBOL_INFO
1120 {
1121     ULONG       SizeOfStruct;
1122     ULONG       TypeIndex;
1123     ULONG64     Reserved[2];
1124     ULONG       Index;
1125     ULONG       Size;
1126     ULONG64     ModBase;
1127     ULONG       Flags;
1128     ULONG64     Value;
1129     ULONG64     Address;
1130     ULONG       Register;
1131     ULONG       Scope;
1132     ULONG       Tag;
1133     ULONG       NameLen;
1134     ULONG       MaxNameLen;
1135     CHAR        Name[1];
1136 } SYMBOL_INFO, *PSYMBOL_INFO;
1137 
1138 typedef struct _SYMBOL_INFOW
1139 {
1140     ULONG       SizeOfStruct;
1141     ULONG       TypeIndex;
1142     ULONG64     Reserved[2];
1143     ULONG       Index;
1144     ULONG       Size;
1145     ULONG64     ModBase;
1146     ULONG       Flags;
1147     ULONG64     Value;
1148     ULONG64     Address;
1149     ULONG       Register;
1150     ULONG       Scope;
1151     ULONG       Tag;
1152     ULONG       NameLen;
1153     ULONG       MaxNameLen;
1154     WCHAR       Name[1];
1155 } SYMBOL_INFOW, *PSYMBOL_INFOW;
1156 
1157 typedef struct _SYMBOL_INFO_PACKAGE
1158 {
1159     SYMBOL_INFO si;
1160     CHAR        name[MAX_SYM_NAME+1];
1161 } SYMBOL_INFO_PACKAGE, *PSYMBOL_INFO_PACKAGE;
1162 
1163 typedef struct _SYMBOL_INFO_PACKAGEW
1164 {
1165     SYMBOL_INFOW si;
1166     WCHAR        name[MAX_SYM_NAME+1];
1167 } SYMBOL_INFO_PACKAGEW, *PSYMBOL_INFO_PACKAGEW;
1168 
1169 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
1170 {
1171     TI_GET_SYMTAG,
1172     TI_GET_SYMNAME,
1173     TI_GET_LENGTH,
1174     TI_GET_TYPE,
1175     TI_GET_TYPEID,
1176     TI_GET_BASETYPE,
1177     TI_GET_ARRAYINDEXTYPEID,
1178     TI_FINDCHILDREN,
1179     TI_GET_DATAKIND,
1180     TI_GET_ADDRESSOFFSET,
1181     TI_GET_OFFSET,
1182     TI_GET_VALUE,
1183     TI_GET_COUNT,
1184     TI_GET_CHILDRENCOUNT,
1185     TI_GET_BITPOSITION,
1186     TI_GET_VIRTUALBASECLASS,
1187     TI_GET_VIRTUALTABLESHAPEID,
1188     TI_GET_VIRTUALBASEPOINTEROFFSET,
1189     TI_GET_CLASSPARENTID,
1190     TI_GET_NESTED,
1191     TI_GET_SYMINDEX,
1192     TI_GET_LEXICALPARENT,
1193     TI_GET_ADDRESS,
1194     TI_GET_THISADJUST,
1195     TI_GET_UDTKIND,
1196     TI_IS_EQUIV_TO,
1197     TI_GET_CALLING_CONVENTION,
1198 } IMAGEHLP_SYMBOL_TYPE_INFO;
1199 
1200 #define IMAGEHLP_GET_TYPE_INFO_UNCACHED            0x00000001
1201 #define IMAGEHLP_GET_TYPE_INFO_CHILDREN            0x00000002
1202 typedef struct _IMAGEHLP_GET_TYPE_INFO_PARAMS
1203 {
1204     ULONG       SizeOfStruct;
1205     ULONG       Flags;
1206     ULONG       NumIds;
1207     PULONG      TypeIds;
1208     ULONG64     TagFilter;
1209     ULONG       NumReqs;
1210     IMAGEHLP_SYMBOL_TYPE_INFO* ReqKinds;
1211     PULONG_PTR  ReqOffsets;
1212     PULONG      ReqSizes;
1213     ULONG_PTR   ReqStride;
1214     ULONG_PTR   BufferSize;
1215     PVOID       Buffer;
1216     ULONG       EntriesMatched;
1217     ULONG       EntriesFilled;
1218     ULONG64     TagsFound;
1219     ULONG64     AllReqsValid;
1220     ULONG       NumReqsValid;
1221     PULONG64    ReqsValid;
1222 } IMAGEHLP_GET_TYPE_INFO_PARAMS, *PIMAGEHLP_GET_TYPE_INFO_PARAMS;
1223 
1224 typedef struct _TI_FINDCHILDREN_PARAMS
1225 {
1226     ULONG Count;
1227     ULONG Start;
1228     ULONG ChildId[1];
1229 } TI_FINDCHILDREN_PARAMS;
1230 
1231 #define UNDNAME_COMPLETE                 (0x0000)
1232 #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001)
1233 #define UNDNAME_NO_MS_KEYWORDS           (0x0002)
1234 #define UNDNAME_NO_FUNCTION_RETURNS      (0x0004)
1235 #define UNDNAME_NO_ALLOCATION_MODEL      (0x0008)
1236 #define UNDNAME_NO_ALLOCATION_LANGUAGE   (0x0010)
1237 #define UNDNAME_NO_MS_THISTYPE           (0x0020)
1238 #define UNDNAME_NO_CV_THISTYPE           (0x0040)
1239 #define UNDNAME_NO_THISTYPE              (0x0060)
1240 #define UNDNAME_NO_ACCESS_SPECIFIERS     (0x0080)
1241 #define UNDNAME_NO_THROW_SIGNATURES      (0x0100)
1242 #define UNDNAME_NO_MEMBER_TYPE           (0x0200)
1243 #define UNDNAME_NO_RETURN_UDT_MODEL      (0x0400)
1244 #define UNDNAME_32_BIT_DECODE            (0x0800)
1245 #define UNDNAME_NAME_ONLY                (0x1000)
1246 #define UNDNAME_NO_ARGUMENTS             (0x2000)
1247 #define UNDNAME_NO_SPECIAL_SYMS          (0x4000)
1248 
1249 #define SYMSEARCH_MASKOBJS              0x01
1250 #define SYMSEARCH_RECURSE               0x02
1251 #define SYMSEARCH_GLOBALSONLY           0x04
1252 
1253 BOOL
1254 WINAPI
1255 SymGetTypeInfo(
1256   _In_ HANDLE,
1257   _In_ DWORD64,
1258   _In_ ULONG,
1259   _In_ IMAGEHLP_SYMBOL_TYPE_INFO,
1260   _Out_ PVOID);
1261 
1262 BOOL
1263 WINAPI
1264 SymGetTypeInfoEx(
1265   _In_ HANDLE,
1266   _In_ DWORD64,
1267   _Inout_ PIMAGEHLP_GET_TYPE_INFO_PARAMS);
1268 
1269 typedef BOOL
1270 (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(
1271   _In_ PSYMBOL_INFO,
1272   _In_ ULONG,
1273   _In_opt_ PVOID);
1274 
1275 typedef BOOL
1276 (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(
1277   _In_ PSYMBOL_INFOW,
1278   _In_ ULONG,
1279   _In_opt_ PVOID);
1280 
1281 BOOL
1282 WINAPI
1283 SymEnumTypes(
1284   _In_ HANDLE,
1285   _In_ ULONG64,
1286   _In_ PSYM_ENUMERATESYMBOLS_CALLBACK,
1287   _In_opt_ PVOID);
1288 
1289 BOOL
1290 WINAPI
1291 SymEnumTypesW(
1292   _In_ HANDLE,
1293   _In_ ULONG64,
1294   _In_ PSYM_ENUMERATESYMBOLS_CALLBACKW,
1295   _In_opt_ PVOID);
1296 
1297 BOOL
1298 WINAPI
1299 SymFromAddr(
1300   _In_ HANDLE,
1301   _In_ DWORD64,
1302   _Out_opt_ DWORD64*,
1303   _Inout_ SYMBOL_INFO*);
1304 
1305 BOOL
1306 WINAPI
1307 SymFromAddrW(
1308   _In_ HANDLE,
1309   _In_ DWORD64,
1310   _Out_opt_ DWORD64*,
1311   _Inout_ SYMBOL_INFOW*);
1312 
1313 BOOL
1314 WINAPI
1315 SymFromToken(
1316   _In_ HANDLE,
1317   _In_ DWORD64,
1318   _In_ DWORD,
1319   _Inout_ PSYMBOL_INFO);
1320 
1321 BOOL
1322 WINAPI
1323 SymFromTokenW(
1324   _In_ HANDLE,
1325   _In_ DWORD64,
1326   _In_ DWORD,
1327   _Inout_ PSYMBOL_INFOW);
1328 
1329 BOOL WINAPI SymFromName(_In_ HANDLE, _In_ PCSTR, _Inout_ PSYMBOL_INFO);
1330 BOOL WINAPI SymFromNameW(_In_ HANDLE, _In_ PCWSTR, _Inout_ PSYMBOL_INFOW);
1331 
1332 BOOL
1333 WINAPI
1334 SymGetSymFromAddr64(
1335   _In_ HANDLE,
1336   _In_ DWORD64,
1337   _Out_opt_ PDWORD64,
1338   _Inout_ PIMAGEHLP_SYMBOL64);
1339 
1340 BOOL
1341 WINAPI
1342 SymGetSymFromName64(
1343   _In_ HANDLE,
1344   _In_ PCSTR,
1345   _Inout_ PIMAGEHLP_SYMBOL64);
1346 
1347 BOOL
1348 WINAPI
1349 SymGetTypeFromName(
1350   _In_ HANDLE,
1351   _In_ ULONG64,
1352   _In_ PCSTR,
1353   _Inout_ PSYMBOL_INFO);
1354 
1355 BOOL
1356 WINAPI
1357 SymGetTypeFromNameW(
1358   _In_ HANDLE,
1359   _In_ ULONG64,
1360   _In_ PCWSTR,
1361   _Inout_ PSYMBOL_INFOW);
1362 
1363 BOOL WINAPI SymGetSymNext64(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOL64);
1364 BOOL WINAPI SymGetSymNextW64(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOLW64);
1365 BOOL WINAPI SymGetSymPrev64(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOL64);
1366 BOOL WINAPI SymGetSymPrevW64(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOLW64);
1367 
1368 BOOL
1369 WINAPI
1370 SymEnumSym(
1371   _In_ HANDLE,
1372   _In_ ULONG64,
1373   _In_ PSYM_ENUMERATESYMBOLS_CALLBACK,
1374   _In_opt_ PVOID);
1375 
1376 BOOL
1377 WINAPI
1378 SymEnumSymbols(
1379   _In_ HANDLE,
1380   _In_ ULONG64,
1381   _In_opt_ PCSTR,
1382   _In_ PSYM_ENUMERATESYMBOLS_CALLBACK,
1383   _In_opt_ PVOID);
1384 
1385 BOOL
1386 WINAPI
1387 SymEnumSymbolsW(
1388   _In_ HANDLE,
1389   _In_ ULONG64,
1390   _In_opt_ PCWSTR,
1391   _In_ PSYM_ENUMERATESYMBOLS_CALLBACKW,
1392   _In_opt_ PVOID);
1393 
1394 typedef BOOL
1395 (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(
1396   _In_ PCSTR,
1397   _In_ DWORD64,
1398   _In_ ULONG,
1399   _In_opt_ PVOID);
1400 
1401 typedef BOOL
1402 (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64W)(
1403   _In_ PCWSTR,
1404   _In_ DWORD64,
1405   _In_ ULONG,
1406   _In_opt_ PVOID);
1407 
1408 BOOL
1409 WINAPI
1410 SymEnumerateSymbols64(
1411   _In_ HANDLE,
1412   _In_ ULONG64,
1413   _In_ PSYM_ENUMSYMBOLS_CALLBACK64,
1414   _In_opt_ PVOID);
1415 
1416 BOOL
1417 WINAPI
1418 SymEnumerateSymbolsW64(
1419   _In_ HANDLE,
1420   _In_ ULONG64,
1421   _In_ PSYM_ENUMSYMBOLS_CALLBACK64W,
1422   _In_opt_ PVOID);
1423 
1424 BOOL
1425 WINAPI
1426 SymEnumSymbolsForAddr(
1427   _In_ HANDLE,
1428   _In_ DWORD64,
1429   _In_ PSYM_ENUMERATESYMBOLS_CALLBACK,
1430   _In_opt_ PVOID);
1431 
1432 BOOL
1433 WINAPI
1434 SymEnumSymbolsForAddrW(
1435   _In_ HANDLE,
1436   _In_ DWORD64,
1437   _In_ PSYM_ENUMERATESYMBOLS_CALLBACKW,
1438   _In_opt_ PVOID);
1439 
1440 typedef BOOL
1441 (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(
1442   _In_ HANDLE,
1443   _In_ ULONG,
1444   _In_opt_ ULONG64,
1445   _In_opt_ ULONG64);
1446 
1447 BOOL
1448 WINAPI
1449 SymRegisterCallback64(
1450   _In_ HANDLE,
1451   _In_ PSYMBOL_REGISTERED_CALLBACK64,
1452   _In_ ULONG64);
1453 
1454 BOOL
1455 WINAPI
1456 SymRegisterCallbackW64(
1457   _In_ HANDLE,
1458   _In_ PSYMBOL_REGISTERED_CALLBACK64,
1459   _In_ ULONG64);
1460 
1461 BOOL
1462 WINAPI
1463 SymUnDName64(
1464   _In_ PIMAGEHLP_SYMBOL64,
1465   _Out_writes_(UnDecNameLength) PSTR,
1466   _In_ DWORD UnDecNameLength);
1467 
1468 BOOL WINAPI SymMatchString(_In_ PCSTR, _In_ PCSTR, _In_ BOOL);
1469 BOOL WINAPI SymMatchStringA(_In_ PCSTR, _In_ PCSTR, _In_ BOOL);
1470 BOOL WINAPI SymMatchStringW(_In_ PCWSTR, _In_ PCWSTR, _In_ BOOL);
1471 
1472 BOOL
1473 WINAPI
1474 SymSearch(
1475   _In_ HANDLE,
1476   _In_ ULONG64,
1477   _In_opt_ DWORD,
1478   _In_opt_ DWORD,
1479   _In_opt_ PCSTR,
1480   _In_opt_ DWORD64,
1481   _In_ PSYM_ENUMERATESYMBOLS_CALLBACK,
1482   _In_opt_ PVOID,
1483   _In_ DWORD);
1484 
1485 BOOL
1486 WINAPI
1487 SymSearchW(
1488   _In_ HANDLE,
1489   _In_ ULONG64,
1490   _In_opt_ DWORD,
1491   _In_opt_ DWORD,
1492   _In_opt_ PCWSTR,
1493   _In_opt_ DWORD64,
1494   _In_ PSYM_ENUMERATESYMBOLS_CALLBACKW,
1495   _In_opt_ PVOID,
1496   _In_ DWORD);
1497 
1498 DWORD
1499 WINAPI
1500 UnDecorateSymbolName(
1501   _In_ PCSTR,
1502   _Out_writes_(maxStringLength) PSTR,
1503   _In_ DWORD maxStringLength,
1504   _In_ DWORD);
1505 
1506 DWORD
1507 WINAPI
1508 UnDecorateSymbolNameW(
1509   _In_ PCWSTR,
1510   _Out_writes_(maxStringLength) PWSTR,
1511   _In_ DWORD maxStringLength,
1512   _In_ DWORD);
1513 
1514 BOOL
1515 WINAPI
1516 SymGetScope(
1517   _In_ HANDLE,
1518   _In_ ULONG64,
1519   _In_ DWORD,
1520   _Inout_ PSYMBOL_INFO);
1521 
1522 BOOL
1523 WINAPI
1524 SymGetScopeW(
1525   _In_ HANDLE,
1526   _In_ ULONG64,
1527   _In_ DWORD,
1528   _Inout_ PSYMBOL_INFOW);
1529 
1530 BOOL
1531 WINAPI
1532 SymFromIndex(
1533   _In_ HANDLE,
1534   _In_ ULONG64,
1535   _In_ DWORD,
1536   _Inout_ PSYMBOL_INFO);
1537 
1538 BOOL
1539 WINAPI
1540 SymFromIndexW(
1541   _In_ HANDLE,
1542   _In_ ULONG64,
1543   _In_ DWORD,
1544   _Inout_ PSYMBOL_INFOW);
1545 
1546 BOOL
1547 WINAPI
1548 SymAddSymbol(
1549   _In_ HANDLE,
1550   _In_ ULONG64,
1551   _In_ PCSTR,
1552   _In_ DWORD64,
1553   _In_ DWORD,
1554   _In_ DWORD);
1555 
1556 BOOL
1557 WINAPI
1558 SymAddSymbolW(
1559   _In_ HANDLE,
1560   _In_ ULONG64,
1561   _In_ PCWSTR,
1562   _In_ DWORD64,
1563   _In_ DWORD,
1564   _In_ DWORD);
1565 
1566 BOOL
1567 WINAPI
1568 SymDeleteSymbol(
1569   _In_ HANDLE,
1570   _In_ ULONG64,
1571   _In_opt_ PCSTR,
1572   _In_ DWORD64,
1573   _In_ DWORD);
1574 
1575 BOOL
1576 WINAPI
1577 SymDeleteSymbolW(
1578   _In_ HANDLE,
1579   _In_ ULONG64,
1580   _In_opt_ PCWSTR,
1581   _In_ DWORD64,
1582   _In_ DWORD);
1583 
1584 /*************************
1585  *      Source Files     *
1586  *************************/
1587 
1588 typedef BOOL
1589 (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(
1590   _In_ PSOURCEFILE,
1591   _In_opt_ PVOID);
1592 
1593 typedef BOOL
1594 (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACKW)(
1595   _In_ PSOURCEFILEW,
1596   _In_opt_ PVOID);
1597 
1598 BOOL
1599 WINAPI
1600 SymEnumSourceFiles(
1601   _In_ HANDLE,
1602   _In_ ULONG64,
1603   _In_opt_ PCSTR,
1604   _In_ PSYM_ENUMSOURCEFILES_CALLBACK,
1605   _In_opt_ PVOID);
1606 
1607 BOOL
1608 WINAPI
1609 SymEnumSourceFilesW(
1610   _In_ HANDLE,
1611   _In_ ULONG64,
1612   _In_opt_ PCWSTR,
1613   _In_ PSYM_ENUMSOURCEFILES_CALLBACKW,
1614   _In_opt_ PVOID);
1615 
1616 BOOL
1617 WINAPI
1618 SymGetLineFromAddr64(
1619   _In_ HANDLE,
1620   _In_ DWORD64,
1621   _Out_ PDWORD,
1622   _Out_ PIMAGEHLP_LINE64);
1623 
1624 BOOL
1625 WINAPI
1626 SymGetLineFromAddrW64(
1627   _In_ HANDLE,
1628   _In_ DWORD64,
1629   _Out_ PDWORD,
1630   _Out_ PIMAGEHLP_LINEW64);
1631 
1632 BOOL WINAPI SymGetLinePrev64(_In_ HANDLE, _Inout_ PIMAGEHLP_LINE64);
1633 BOOL WINAPI SymGetLinePrevW64(_In_ HANDLE, _Inout_ PIMAGEHLP_LINEW64);
1634 BOOL WINAPI SymGetLineNext64(_In_ HANDLE, _Inout_ PIMAGEHLP_LINE64);
1635 BOOL WINAPI SymGetLineNextW64(_In_ HANDLE, _Inout_ PIMAGEHLP_LINEW64);
1636 
1637 BOOL
1638 WINAPI
1639 SymGetLineFromName64(
1640   _In_ HANDLE,
1641   _In_opt_ PCSTR,
1642   _In_opt_ PCSTR,
1643   _In_ DWORD,
1644   _Out_ PLONG,
1645   _Inout_ PIMAGEHLP_LINE64);
1646 
1647 BOOL
1648 WINAPI
1649 SymGetLineFromNameW64(
1650   _In_ HANDLE,
1651   _In_opt_ PCWSTR,
1652   _In_opt_ PCWSTR,
1653   _In_ DWORD,
1654   _Out_ PLONG,
1655   _Inout_ PIMAGEHLP_LINEW64);
1656 
1657 ULONG
1658 WINAPI
1659 SymGetFileLineOffsets64(
1660   _In_ HANDLE,
1661   _In_opt_ PCSTR,
1662   _In_ PCSTR,
1663   _Out_writes_(BufferLines) PDWORD64,
1664   _In_ ULONG BufferLines);
1665 
1666 BOOL
1667 WINAPI
1668 SymGetSourceFile(
1669   _In_ HANDLE,
1670   _In_ ULONG64,
1671   _In_opt_ PCSTR,
1672   _In_ PCSTR,
1673   _Out_writes_(Size) PSTR,
1674   _In_ DWORD Size);
1675 
1676 BOOL
1677 WINAPI
1678 SymGetSourceFileW(
1679   _In_ HANDLE,
1680   _In_ ULONG64,
1681   _In_opt_ PCWSTR,
1682   _In_ PCWSTR,
1683   _Out_writes_(Size) PWSTR,
1684   _In_ DWORD Size);
1685 
1686 BOOL
1687 WINAPI
1688 SymGetSourceFileToken(
1689   _In_ HANDLE,
1690   _In_ ULONG64,
1691   _In_ PCSTR,
1692   _Outptr_ PVOID*,
1693   _Out_ DWORD*);
1694 
1695 BOOL
1696 WINAPI
1697 SymGetSourceFileTokenW(
1698   _In_ HANDLE,
1699   _In_ ULONG64,
1700   _In_ PCWSTR,
1701   _Outptr_ PVOID*,
1702   _Out_ DWORD*);
1703 
1704 BOOL
1705 WINAPI
1706 SymGetSourceFileFromToken(
1707   _In_ HANDLE,
1708   _In_ PVOID,
1709   _In_opt_ PCSTR,
1710   _Out_writes_(Size) PSTR,
1711   _In_ DWORD Size);
1712 
1713 BOOL
1714 WINAPI
1715 SymGetSourceFileFromTokenW(
1716   _In_ HANDLE,
1717   _In_ PVOID,
1718   _In_opt_ PCWSTR,
1719   _Out_writes_(Size) PWSTR,
1720   _In_ DWORD Size);
1721 
1722 BOOL
1723 WINAPI
1724 SymGetSourceVarFromToken(
1725   _In_ HANDLE,
1726   _In_ PVOID,
1727   _In_opt_ PCSTR,
1728   _In_ PCSTR,
1729   _Out_writes_(Size) PSTR,
1730   _In_ DWORD Size);
1731 
1732 BOOL
1733 WINAPI
1734 SymGetSourceVarFromTokenW(
1735   _In_ HANDLE,
1736   _In_ PVOID,
1737   _In_opt_ PCWSTR,
1738   _In_ PCWSTR,
1739   _Out_writes_(Size) PWSTR,
1740   _In_ DWORD Size);
1741 
1742 typedef struct _SRCCODEINFO
1743 {
1744     DWORD       SizeOfStruct;
1745     PVOID       Key;
1746     DWORD64     ModBase;
1747     CHAR        Obj[MAX_PATH+1];
1748     CHAR        FileName[MAX_PATH+1];
1749     DWORD       LineNumber;
1750     DWORD64     Address;
1751 } SRCCODEINFO, *PSRCCODEINFO;
1752 
1753 typedef struct _SRCCODEINFOW
1754 {
1755     DWORD       SizeOfStruct;
1756     PVOID       Key;
1757     DWORD64     ModBase;
1758     WCHAR       Obj[MAX_PATH+1];
1759     WCHAR       FileName[MAX_PATH+1];
1760     DWORD       LineNumber;
1761     DWORD64     Address;
1762 } SRCCODEINFOW, *PSRCCODEINFOW;
1763 
1764 typedef BOOL
1765 (CALLBACK* PSYM_ENUMLINES_CALLBACK)(
1766   _In_ PSRCCODEINFO,
1767   _In_opt_ PVOID);
1768 
1769 typedef BOOL
1770 (CALLBACK* PSYM_ENUMLINES_CALLBACKW)(
1771   _In_ PSRCCODEINFOW,
1772   _In_opt_ PVOID);
1773 
1774 BOOL
1775 WINAPI
1776 SymEnumLines(
1777   _In_ HANDLE,
1778   _In_ ULONG64,
1779   _In_opt_ PCSTR,
1780   _In_opt_ PCSTR,
1781   _In_ PSYM_ENUMLINES_CALLBACK,
1782   _In_opt_ PVOID);
1783 
1784 BOOL
1785 WINAPI
1786 SymEnumLinesW(
1787   _In_ HANDLE,
1788   _In_ ULONG64,
1789   _In_opt_ PCWSTR,
1790   _In_opt_ PCWSTR,
1791   _In_ PSYM_ENUMLINES_CALLBACKW,
1792   _In_opt_ PVOID);
1793 
1794 BOOL
1795 WINAPI
1796 SymEnumSourceLines(
1797   _In_ HANDLE,
1798   _In_ ULONG64,
1799   _In_opt_ PCSTR,
1800   _In_opt_ PCSTR,
1801   _In_opt_ DWORD,
1802   _In_ DWORD,
1803   _In_ PSYM_ENUMLINES_CALLBACK,
1804   _In_opt_ PVOID);
1805 
1806 BOOL
1807 WINAPI
1808 SymEnumSourceLinesW(
1809   _In_ HANDLE,
1810   _In_ ULONG64,
1811   _In_opt_ PCWSTR,
1812   _In_opt_ PCWSTR,
1813   _In_opt_ DWORD,
1814   _In_ DWORD,
1815   _In_ PSYM_ENUMLINES_CALLBACKW,
1816   _In_opt_ PVOID);
1817 
1818 /*************************
1819  * File & image handling *
1820  *************************/
1821 
1822 BOOL WINAPI SymInitialize(_In_ HANDLE, _In_opt_ PCSTR, _In_ BOOL);
1823 BOOL WINAPI SymInitializeW(_In_ HANDLE, _In_opt_ PCWSTR, _In_ BOOL);
1824 BOOL WINAPI SymCleanup(_In_ HANDLE);
1825 
1826 HANDLE
1827 WINAPI
1828 FindDebugInfoFile(
1829   _In_ PCSTR,
1830   _In_ PCSTR,
1831   _Out_writes_(MAX_PATH + 1) PSTR);
1832 
1833 typedef BOOL
1834 (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(
1835   _In_ HANDLE,
1836   _In_ PCSTR,
1837   _In_ PVOID);
1838 
1839 typedef BOOL
1840 (CALLBACK *PFIND_DEBUG_FILE_CALLBACKW)(
1841   _In_ HANDLE,
1842   _In_ PCWSTR,
1843   _In_ PVOID);
1844 
1845 HANDLE
1846 WINAPI
1847 FindDebugInfoFileEx(
1848   _In_ PCSTR,
1849   _In_ PCSTR,
1850   _Out_writes_(MAX_PATH + 1) PSTR,
1851   _In_opt_ PFIND_DEBUG_FILE_CALLBACK,
1852   _In_opt_ PVOID);
1853 
1854 HANDLE
1855 WINAPI
1856 FindDebugInfoFileExW(
1857   _In_ PCWSTR,
1858   _In_ PCWSTR,
1859   _Out_writes_(MAX_PATH + 1) PWSTR,
1860   _In_opt_ PFIND_DEBUG_FILE_CALLBACKW,
1861   _In_opt_ PVOID);
1862 
1863 HANDLE
1864 WINAPI
1865 SymFindDebugInfoFile(
1866   _In_ HANDLE,
1867   _In_ PCSTR,
1868   _Out_writes_(MAX_PATH + 1) PSTR,
1869   _In_opt_ PFIND_DEBUG_FILE_CALLBACK,
1870   _In_opt_ PVOID);
1871 
1872 HANDLE
1873 WINAPI
1874 SymFindDebugInfoFileW(
1875   _In_ HANDLE,
1876   _In_ PCWSTR,
1877   _Out_writes_(MAX_PATH + 1) PWSTR,
1878   _In_opt_ PFIND_DEBUG_FILE_CALLBACKW,
1879   _In_opt_ PVOID);
1880 
1881 typedef BOOL
1882 (CALLBACK *PFINDFILEINPATHCALLBACK)(
1883   _In_ PCSTR,
1884   _In_ PVOID);
1885 
1886 typedef BOOL
1887 (CALLBACK *PFINDFILEINPATHCALLBACKW)(
1888   _In_ PCWSTR,
1889   _In_ PVOID);
1890 
1891 BOOL WINAPI FindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
1892                            PSTR, PFINDFILEINPATHCALLBACK, PVOID);
1893 
1894 BOOL
1895 WINAPI
1896 SymFindFileInPath(
1897   _In_ HANDLE,
1898   _In_opt_ PCSTR,
1899   _In_ PCSTR,
1900   _In_opt_ PVOID,
1901   _In_ DWORD,
1902   _In_ DWORD,
1903   _In_ DWORD,
1904   _Out_writes_(MAX_PATH + 1) PSTR,
1905   _In_opt_ PFINDFILEINPATHCALLBACK,
1906   _In_opt_ PVOID);
1907 
1908 BOOL
1909 WINAPI
1910 SymFindFileInPathW(
1911   _In_ HANDLE,
1912   _In_opt_ PCWSTR,
1913   _In_ PCWSTR,
1914   _In_opt_ PVOID,
1915   _In_ DWORD,
1916   _In_ DWORD,
1917   _In_ DWORD,
1918   _Out_writes_(MAX_PATH + 1) PWSTR,
1919   _In_opt_ PFINDFILEINPATHCALLBACKW,
1920   _In_opt_ PVOID);
1921 
1922 HANDLE
1923 WINAPI
1924 FindExecutableImage(
1925   _In_ PCSTR,
1926   _In_ PCSTR,
1927   _Out_writes_(MAX_PATH + 1) PSTR);
1928 
1929 typedef BOOL
1930 (CALLBACK *PFIND_EXE_FILE_CALLBACK)(
1931   _In_ HANDLE,
1932   _In_ PCSTR,
1933   _In_opt_ PVOID);
1934 
1935 typedef BOOL
1936 (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(
1937   _In_ HANDLE,
1938   _In_ PCWSTR,
1939   _In_opt_ PVOID);
1940 
1941 HANDLE
1942 WINAPI
1943 FindExecutableImageEx(
1944   _In_ PCSTR,
1945   _In_ PCSTR,
1946   _Out_writes_(MAX_PATH + 1) PSTR,
1947   _In_opt_ PFIND_EXE_FILE_CALLBACK,
1948   _In_opt_ PVOID);
1949 
1950 HANDLE
1951 WINAPI
1952 FindExecutableImageExW(
1953   _In_ PCWSTR,
1954   _In_ PCWSTR,
1955   _Out_writes_(MAX_PATH + 1) PWSTR,
1956   _In_opt_ PFIND_EXE_FILE_CALLBACKW,
1957   _In_opt_ PVOID);
1958 
1959 HANDLE
1960 WINAPI
1961 SymFindExecutableImage(
1962   _In_ HANDLE,
1963   _In_ PCSTR,
1964   _Out_writes_(MAX_PATH + 1) PSTR,
1965   _In_ PFIND_EXE_FILE_CALLBACK,
1966   _In_ PVOID);
1967 
1968 HANDLE
1969 WINAPI
1970 SymFindExecutableImageW(
1971   _In_ HANDLE,
1972   _In_ PCWSTR,
1973   _Out_writes_(MAX_PATH + 1) PWSTR,
1974   _In_ PFIND_EXE_FILE_CALLBACKW,
1975   _In_ PVOID);
1976 
1977 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(_In_ PVOID);
1978 
1979 PVOID
1980 WINAPI
1981 ImageDirectoryEntryToDataEx(
1982   _In_ PVOID,
1983   _In_ BOOLEAN,
1984   _In_ USHORT,
1985   _Out_ PULONG,
1986   _Out_opt_ PIMAGE_SECTION_HEADER *);
1987 
1988 PVOID
1989 WINAPI
1990 ImageDirectoryEntryToData(
1991   _In_ PVOID,
1992   _In_ BOOLEAN,
1993   _In_ USHORT,
1994   _Out_ PULONG);
1995 
1996 PIMAGE_SECTION_HEADER
1997 WINAPI
1998 ImageRvaToSection(
1999   _In_ PIMAGE_NT_HEADERS,
2000   _In_ PVOID,
2001   _In_ ULONG);
2002 
2003 PVOID
2004 WINAPI
2005 ImageRvaToVa(
2006   _In_ PIMAGE_NT_HEADERS,
2007   _In_ PVOID,
2008   _In_ ULONG,
2009   _In_opt_ PIMAGE_SECTION_HEADER*);
2010 
2011 BOOL
2012 WINAPI
2013 SymGetSearchPath(
2014   _In_ HANDLE,
2015   _Out_writes_(SearchPathLength) PSTR,
2016   _In_ DWORD SearchPathLength);
2017 
2018 BOOL
2019 WINAPI
2020 SymGetSearchPathW(
2021   _In_ HANDLE,
2022   _Out_writes_(SearchPathLength) PWSTR,
2023   _In_ DWORD SearchPathLength);
2024 
2025 BOOL WINAPI SymSetSearchPath(_In_ HANDLE, _In_opt_ PCSTR);
2026 BOOL WINAPI SymSetSearchPathW(_In_ HANDLE, _In_opt_ PCWSTR);
2027 DWORD WINAPI GetTimestampForLoadedLibrary(_In_ HMODULE);
2028 BOOL WINAPI MakeSureDirectoryPathExists(_In_ PCSTR);
2029 
2030 BOOL
2031 WINAPI
2032 SearchTreeForFile(
2033   _In_ PCSTR,
2034   _In_ PCSTR,
2035   _Out_writes_(MAX_PATH + 1) PSTR);
2036 
2037 BOOL
2038 WINAPI
2039 SearchTreeForFileW(
2040   _In_ PCWSTR,
2041   _In_ PCWSTR,
2042   _Out_writes_(MAX_PATH + 1) PWSTR);
2043 
2044 typedef BOOL
2045 (CALLBACK *PENUMDIRTREE_CALLBACK)(
2046   _In_ PCSTR,
2047   _In_opt_ PVOID);
2048 
2049 typedef BOOL
2050 (CALLBACK *PENUMDIRTREE_CALLBACKW)(
2051   _In_ PCWSTR,
2052   _In_opt_ PVOID);
2053 
2054 BOOL
2055 WINAPI
2056 EnumDirTree(
2057   _In_opt_ HANDLE,
2058   _In_ PCSTR,
2059   _In_ PCSTR,
2060   _Out_writes_opt_(MAX_PATH + 1) PSTR,
2061   _In_opt_ PENUMDIRTREE_CALLBACK,
2062   _In_opt_ PVOID);
2063 
2064 BOOL
2065 WINAPI
2066 EnumDirTreeW(
2067   _In_opt_ HANDLE,
2068   _In_ PCWSTR,
2069   _In_ PCWSTR,
2070   _Out_writes_opt_(MAX_PATH + 1) PWSTR,
2071   _In_opt_ PENUMDIRTREE_CALLBACKW,
2072   _In_opt_ PVOID);
2073 
2074 BOOL
2075 WINAPI
2076 SymMatchFileName(
2077   _In_ PCSTR,
2078   _In_ PCSTR,
2079   _Outptr_opt_ PSTR*,
2080   _Outptr_opt_ PSTR*);
2081 
2082 BOOL
2083 WINAPI
2084 SymMatchFileNameW(
2085   _In_ PCWSTR,
2086   _In_ PCWSTR,
2087   _Outptr_opt_ PWSTR*,
2088   _Outptr_opt_ PWSTR*);
2089 
2090 PCHAR WINAPI SymSetHomeDirectory(_In_opt_ HANDLE, _In_opt_ PCSTR);
2091 PWSTR WINAPI SymSetHomeDirectoryW(_In_opt_ HANDLE, _In_opt_ PCWSTR);
2092 
2093 PCHAR
2094 WINAPI
2095 SymGetHomeDirectory(
2096   _In_ DWORD,
2097   _Out_writes_(size) PSTR,
2098   _In_ size_t size);
2099 
2100 PWSTR
2101 WINAPI
2102 SymGetHomeDirectoryW(
2103   _In_ DWORD,
2104   _Out_writes_(size) PWSTR,
2105   _In_ size_t size);
2106 
2107 #define hdBase  0
2108 #define hdSym   1
2109 #define hdSrc   2
2110 #define hdMax   3
2111 
2112 /*************************
2113  *   Context management  *
2114  *************************/
2115 
2116 BOOL
2117 WINAPI
2118 SymSetContext(
2119   _In_ HANDLE,
2120   _In_ PIMAGEHLP_STACK_FRAME,
2121   _In_opt_ PIMAGEHLP_CONTEXT);
2122 
2123 
2124 /*************************
2125  *    Stack management   *
2126  *************************/
2127 
2128 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
2129 #define KDHELP KDHELP64
2130 #define PKDHELP PKDHELP64
2131 #else
2132 typedef struct _KDHELP
2133 {
2134     DWORD       Thread;
2135     DWORD       ThCallbackStack;
2136     DWORD       NextCallback;
2137     DWORD       FramePointer;
2138     DWORD       KiCallUserMode;
2139     DWORD       KeUserCallbackDispatcher;
2140     DWORD       SystemRangeStart;
2141 } KDHELP, *PKDHELP;
2142 #endif
2143 
2144 typedef struct _KDHELP64
2145 {
2146     DWORD64     Thread;
2147     DWORD       ThCallbackStack;
2148     DWORD       ThCallbackBStore;
2149     DWORD       NextCallback;
2150     DWORD       FramePointer;
2151     DWORD64     KiCallUserMode;
2152     DWORD64     KeUserCallbackDispatcher;
2153     DWORD64     SystemRangeStart;
2154     DWORD64     Reserved[8];
2155 } KDHELP64, *PKDHELP64;
2156 
2157 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
2158 #define STACKFRAME STACKFRAME64
2159 #define LPSTACKFRAME LPSTACKFRAME64
2160 #else
2161 typedef struct _STACKFRAME
2162 {
2163     ADDRESS     AddrPC;
2164     ADDRESS     AddrReturn;
2165     ADDRESS     AddrFrame;
2166     ADDRESS     AddrStack;
2167     PVOID       FuncTableEntry;
2168     DWORD       Params[4];
2169     BOOL        Far;
2170     BOOL        Virtual;
2171     DWORD       Reserved[3];
2172     KDHELP      KdHelp;
2173     ADDRESS     AddrBStore;
2174 } STACKFRAME, *LPSTACKFRAME;
2175 #endif
2176 
2177 typedef struct _STACKFRAME64
2178 {
2179     ADDRESS64   AddrPC;
2180     ADDRESS64   AddrReturn;
2181     ADDRESS64   AddrFrame;
2182     ADDRESS64   AddrStack;
2183     ADDRESS64   AddrBStore;
2184     PVOID       FuncTableEntry;
2185     DWORD64     Params[4];
2186     BOOL        Far;
2187     BOOL        Virtual;
2188     DWORD64     Reserved[3];
2189     KDHELP64    KdHelp;
2190 } STACKFRAME64, *LPSTACKFRAME64;
2191 
2192 typedef BOOL
2193 (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE64)(
2194   _In_ HANDLE,
2195   _In_ DWORD64,
2196   _Out_writes_bytes_(nSize) PVOID,
2197   _In_ DWORD nSize,
2198   _Out_ PDWORD);
2199 
2200 typedef PVOID
2201 (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE64)(
2202   _In_ HANDLE,
2203   _In_ DWORD64);
2204 
2205 typedef DWORD64
2206 (CALLBACK *PGET_MODULE_BASE_ROUTINE64)(
2207   _In_ HANDLE,
2208   _In_ DWORD64);
2209 
2210 typedef DWORD64
2211 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE64)(
2212   _In_ HANDLE,
2213   _In_ HANDLE,
2214   _In_ LPADDRESS64);
2215 
2216 BOOL
2217 WINAPI
2218 StackWalk64(
2219   _In_ DWORD,
2220   _In_ HANDLE,
2221   _In_ HANDLE,
2222   _Inout_ LPSTACKFRAME64,
2223   _Inout_ PVOID,
2224   _In_opt_ PREAD_PROCESS_MEMORY_ROUTINE64,
2225   _In_opt_ PFUNCTION_TABLE_ACCESS_ROUTINE64,
2226   _In_opt_ PGET_MODULE_BASE_ROUTINE64,
2227   _In_opt_ PTRANSLATE_ADDRESS_ROUTINE64);
2228 
2229 PVOID WINAPI SymFunctionTableAccess64(_In_ HANDLE, _In_ DWORD64);
2230 
2231 typedef PVOID
2232 (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(
2233   _In_ HANDLE,
2234   _In_ ULONG64,
2235   _In_ ULONG64);
2236 
2237 BOOL
2238 WINAPI
2239 SymRegisterFunctionEntryCallback64(
2240   _In_ HANDLE,
2241   _In_ PSYMBOL_FUNCENTRY_CALLBACK64,
2242   _In_ ULONG64);
2243 
2244 /*************************
2245  * Version, global stuff *
2246  *************************/
2247 
2248 #define API_VERSION_NUMBER 9
2249 
2250 typedef struct API_VERSION
2251 {
2252     USHORT  MajorVersion;
2253     USHORT  MinorVersion;
2254     USHORT  Revision;
2255     USHORT  Reserved;
2256 } API_VERSION, *LPAPI_VERSION;
2257 
2258 LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
2259 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(_In_ LPAPI_VERSION);
2260 
2261 typedef struct _IMAGE_DEBUG_INFORMATION
2262 {
2263     LIST_ENTRY                  List;
2264     DWORD                       ReservedSize;
2265     PVOID                       ReservedMappedBase;
2266     USHORT                      ReservedMachine;
2267     USHORT                      ReservedCharacteristics;
2268     DWORD                       ReservedCheckSum;
2269     DWORD                       ImageBase;
2270     DWORD                       SizeOfImage;
2271     DWORD                       ReservedNumberOfSections;
2272     PIMAGE_SECTION_HEADER       ReservedSections;
2273     DWORD                       ReservedExportedNamesSize;
2274     PSTR                        ReservedExportedNames;
2275     DWORD                       ReservedNumberOfFunctionTableEntries;
2276     PIMAGE_FUNCTION_ENTRY       ReservedFunctionTableEntries;
2277     DWORD                       ReservedLowestFunctionStartingAddress;
2278     DWORD                       ReservedHighestFunctionEndingAddress;
2279     DWORD                       ReservedNumberOfFpoTableEntries;
2280     PFPO_DATA                   ReservedFpoTableEntries;
2281     DWORD                       SizeOfCoffSymbols;
2282     PIMAGE_COFF_SYMBOLS_HEADER  CoffSymbols;
2283     DWORD                       ReservedSizeOfCodeViewSymbols;
2284     PVOID                       ReservedCodeViewSymbols;
2285     PSTR                        ImageFilePath;
2286     PSTR                        ImageFileName;
2287     PSTR                        ReservedDebugFilePath;
2288     DWORD                       ReservedTimeDateStamp;
2289     BOOL                        ReservedRomImage;
2290     PIMAGE_DEBUG_DIRECTORY      ReservedDebugDirectory;
2291     DWORD                       ReservedNumberOfDebugDirectories;
2292     DWORD                       ReservedOriginalFunctionTableBaseAddress;
2293     DWORD                       Reserved[ 2 ];
2294 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
2295 
2296 
2297 PIMAGE_DEBUG_INFORMATION
2298 WINAPI
2299 MapDebugInformation(
2300   _In_opt_ HANDLE,
2301   _In_ PCSTR,
2302   _In_opt_ PCSTR,
2303   _In_ ULONG);
2304 
2305 BOOL WINAPI UnmapDebugInformation(_Out_ PIMAGE_DEBUG_INFORMATION);
2306 
2307 DWORD WINAPI SymGetOptions(void);
2308 DWORD WINAPI SymSetOptions(_In_ DWORD);
2309 
2310 BOOL WINAPI SymSetParentWindow(_In_ HWND);
2311 
2312 BOOL
2313 IMAGEAPI
2314 SymSrvIsStore(
2315   _In_opt_ HANDLE hProcess,
2316   _In_ PCSTR path);
2317 
2318 BOOL
2319 IMAGEAPI
2320 SymSrvIsStoreW(
2321     _In_opt_ HANDLE hProcess,
2322     _In_ PCWSTR path);
2323 
2324 /*************************
2325  * Version, global stuff *
2326  *************************/
2327 
2328 typedef BOOL     (WINAPI* PSYMBOLSERVERPROC)(PCSTR, PCSTR, PVOID, DWORD, DWORD, PSTR);
2329 typedef BOOL     (WINAPI* PSYMBOLSERVERPROCA)(PCSTR, PCSTR, PVOID, DWORD, DWORD, PSTR);
2330 typedef BOOL     (WINAPI* PSYMBOLSERVERPROCW)(PCWSTR, PCWSTR, PVOID, DWORD, DWORD, PWSTR);
2331 typedef BOOL     (WINAPI* PSYMBOLSERVEROPENPROC)(void);
2332 typedef BOOL     (WINAPI* PSYMBOLSERVERCLOSEPROC)(void);
2333 typedef BOOL     (WINAPI* PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR, ULONG64);
2334 typedef BOOL     (CALLBACK* PSYMBOLSERVERCALLBACKPROC)(UINT_PTR, ULONG64, ULONG64);
2335 typedef UINT_PTR (WINAPI* PSYMBOLSERVERGETOPTIONSPROC)(void);
2336 typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROC)(PCSTR);
2337 typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROCA)(PCSTR);
2338 typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROCW)(PCWSTR);
2339 
2340 #define SSRVOPT_CALLBACK            0x0001
2341 #define SSRVOPT_DWORD               0x0002
2342 #define SSRVOPT_DWORDPTR            0x0004
2343 #define SSRVOPT_GUIDPTR             0x0008
2344 #define SSRVOPT_OLDGUIDPTR          0x0010
2345 #define SSRVOPT_UNATTENDED          0x0020
2346 #define SSRVOPT_NOCOPY              0x0040
2347 #define SSRVOPT_PARENTWIN           0x0080
2348 #define SSRVOPT_PARAMTYPE           0x0100
2349 #define SSRVOPT_SECURE              0x0200
2350 #define SSRVOPT_TRACE               0x0400
2351 #define SSRVOPT_SETCONTEXT          0x0800
2352 #define SSRVOPT_PROXY               0x1000
2353 #define SSRVOPT_DOWNSTREAM_STORE    0x2000
2354 #define SSRVOPT_RESET               ((ULONG_PTR)-1)
2355 
2356 #define SSRVACTION_TRACE        1
2357 #define SSRVACTION_QUERYCANCEL  2
2358 #define SSRVACTION_EVENT        3
2359 
2360 /* 32-bit functions */
2361 
2362 #if !defined(_IMAGEHLP_SOURCE_) && defined(_IMAGEHLP64)
2363 
2364 #define PENUMLOADED_MODULES_CALLBACK PENUMLOADED_MODULES_CALLBACK64
2365 #define PFUNCTION_TABLE_ACCESS_ROUTINE PFUNCTION_TABLE_ACCESS_ROUTINE64
2366 #define PGET_MODULE_BASE_ROUTINE PGET_MODULE_BASE_ROUTINE64
2367 #define PREAD_PROCESS_MEMORY_ROUTINE PREAD_PROCESS_MEMORY_ROUTINE64
2368 #define PSYMBOL_FUNCENTRY_CALLBACK PSYMBOL_FUNCENTRY_CALLBACK64
2369 #define PSYMBOL_REGISTERED_CALLBACK PSYMBOL_REGISTERED_CALLBACK64
2370 #define PSYM_ENUMMODULES_CALLBACK PSYM_ENUMMODULES_CALLBACK64
2371 #define PSYM_ENUMSYMBOLS_CALLBACK PSYM_ENUMSYMBOLS_CALLBACK64
2372 #define PSYM_ENUMSYMBOLS_CALLBACKW PSYM_ENUMSYMBOLS_CALLBACKW64
2373 #define PTRANSLATE_ADDRESS_ROUTINE PTRANSLATE_ADDRESS_ROUTINE64
2374 
2375 #define EnumerateLoadedModules EnumerateLoadedModules64
2376 #define StackWalk StackWalk64
2377 #define SymEnumerateModules SymEnumerateModules64
2378 #define SymEnumerateSymbols SymEnumerateSymbols64
2379 #define SymEnumerateSymbolsW SymEnumerateSymbolsW64
2380 #define SymFunctionTableAccess SymFunctionTableAccess64
2381 #define SymGetLineFromAddr SymGetLineFromAddr64
2382 #define SymGetLineFromAddrW SymGetLineFromAddrW64
2383 #define SymGetLineFromName SymGetLineFromName64
2384 #define SymGetLineNext SymGetLineNext64
2385 #define SymGetLineNextW SymGetLineNextW64
2386 #define SymGetLinePrev SymGetLinePrev64
2387 #define SymGetLinePrevW SymGetLinePrevW64
2388 #define SymGetModuleBase SymGetModuleBase64
2389 #define SymGetModuleInfo SymGetModuleInfo64
2390 #define SymGetModuleInfoW SymGetModuleInfoW64
2391 #define SymGetSymFromAddr SymGetSymFromAddr64
2392 #define SymGetSymFromName SymGetSymFromName64
2393 #define SymGetSymNext SymGetSymNext64
2394 #define SymGetSymNextW SymGetSymNextW64
2395 #define SymGetSymPrev SymGetSymPrev64
2396 #define SymGetSymPrevW SymGetSymPrevW64
2397 #define SymLoadModule SymLoadModule64
2398 #define SymRegisterCallback SymRegisterCallback64
2399 #define SymRegisterFunctionEntryCallback SymRegisterFunctionEntryCallback64
2400 #define SymUnDName SymUnDName64
2401 #define SymUnloadModule SymUnloadModule64
2402 
2403 #else
2404 
2405 typedef BOOL
2406 (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(
2407   _In_ PCSTR,
2408   _In_ ULONG,
2409   _In_ ULONG,
2410   _In_opt_ PVOID);
2411 
2412 typedef PVOID
2413 (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(
2414   _In_ HANDLE,
2415   _In_ DWORD);
2416 
2417 typedef DWORD
2418 (CALLBACK *PGET_MODULE_BASE_ROUTINE)(
2419   _In_ HANDLE,
2420   _In_ DWORD);
2421 
2422 typedef BOOL
2423 (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)(
2424   _In_ HANDLE,
2425   _In_ DWORD,
2426   _Out_writes_bytes_(nSize) PVOID,
2427   _In_ DWORD nSize,
2428   _Out_ PDWORD);
2429 
2430 typedef BOOL
2431 (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(
2432   _In_ PCSTR,
2433   _In_ ULONG,
2434   _In_opt_ PVOID);
2435 
2436 typedef BOOL
2437 (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(
2438   _In_ PCSTR,
2439   _In_ ULONG,
2440   _In_ ULONG,
2441   _In_opt_ PVOID);
2442 
2443 typedef BOOL
2444 (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACKW)(
2445   _In_ PCWSTR,
2446   _In_ ULONG,
2447   _In_ ULONG,
2448   _In_opt_ PVOID);
2449 
2450 typedef BOOL
2451 (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(
2452   _In_ HANDLE,
2453   _In_ ULONG,
2454   _In_opt_ PVOID,
2455   _In_opt_ PVOID);
2456 
2457 typedef PVOID
2458 (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(
2459   _In_ HANDLE,
2460   _In_ DWORD,
2461   _In_opt_ PVOID);
2462 
2463 typedef DWORD
2464 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(
2465   _In_ HANDLE,
2466   _In_ HANDLE,
2467   _Out_ LPADDRESS);
2468 
2469 BOOL
2470 WINAPI
2471 EnumerateLoadedModules(
2472   _In_ HANDLE,
2473   _In_ PENUMLOADED_MODULES_CALLBACK,
2474   _In_opt_ PVOID);
2475 
2476 BOOL
2477 WINAPI
2478 StackWalk(
2479   _In_ DWORD,
2480   _In_ HANDLE,
2481   _In_ HANDLE,
2482   _Inout_ LPSTACKFRAME,
2483   _Inout_ PVOID,
2484   _In_opt_ PREAD_PROCESS_MEMORY_ROUTINE,
2485   _In_opt_ PFUNCTION_TABLE_ACCESS_ROUTINE,
2486   _In_opt_ PGET_MODULE_BASE_ROUTINE,
2487   _In_opt_ PTRANSLATE_ADDRESS_ROUTINE);
2488 
2489 BOOL
2490 WINAPI
2491 SymEnumerateModules(
2492   _In_ HANDLE,
2493   _In_ PSYM_ENUMMODULES_CALLBACK,
2494   _In_opt_ PVOID);
2495 
2496 BOOL
2497 WINAPI
2498 SymEnumerateSymbols(
2499   _In_ HANDLE,
2500   _In_ ULONG,
2501   _In_ PSYM_ENUMSYMBOLS_CALLBACK,
2502   _In_opt_ PVOID);
2503 
2504 BOOL
2505 WINAPI
2506 SymEnumerateSymbolsW(
2507   _In_ HANDLE,
2508   _In_ ULONG,
2509   _In_ PSYM_ENUMSYMBOLS_CALLBACKW,
2510   _In_opt_ PVOID);
2511 
2512 PVOID WINAPI SymFunctionTableAccess(_In_ HANDLE, _In_ DWORD);
2513 
2514 BOOL
2515 WINAPI
2516 SymGetLineFromAddr(
2517   _In_ HANDLE,
2518   _In_ DWORD,
2519   _Out_ PDWORD,
2520   _Out_ PIMAGEHLP_LINE);
2521 
2522 BOOL
2523 WINAPI
2524 SymGetLineFromAddrW(
2525   _In_ HANDLE,
2526   _In_ DWORD,
2527   _Out_ PDWORD,
2528   _Out_ PIMAGEHLP_LINEW);
2529 
2530 BOOL
2531 WINAPI
2532 SymGetLineFromName(
2533   _In_ HANDLE,
2534   _In_opt_ PCSTR,
2535   _In_opt_ PCSTR,
2536   _In_ DWORD,
2537   _Out_ PLONG,
2538   _Inout_ PIMAGEHLP_LINE);
2539 
2540 BOOL WINAPI SymGetLineNext(_In_ HANDLE, _Inout_ PIMAGEHLP_LINE);
2541 BOOL WINAPI SymGetLineNextW(_In_ HANDLE, _Inout_ PIMAGEHLP_LINEW);
2542 BOOL WINAPI SymGetLinePrev(_In_ HANDLE, _Inout_ PIMAGEHLP_LINE);
2543 BOOL WINAPI SymGetLinePrevW(_In_ HANDLE, _Inout_ PIMAGEHLP_LINEW);
2544 DWORD WINAPI SymGetModuleBase(_In_ HANDLE, _In_ DWORD);
2545 
2546 BOOL
2547 WINAPI
2548 SymGetModuleInfo(
2549   _In_ HANDLE,
2550   _In_ DWORD,
2551   _Out_ PIMAGEHLP_MODULE);
2552 
2553 BOOL
2554 WINAPI
2555 SymGetModuleInfoW(
2556   _In_ HANDLE,
2557   _In_ DWORD,
2558   _Out_ PIMAGEHLP_MODULEW);
2559 
2560 BOOL
2561 WINAPI
2562 SymGetSymFromAddr(
2563   _In_ HANDLE,
2564   _In_ DWORD,
2565   _Out_opt_ PDWORD,
2566   _Inout_ PIMAGEHLP_SYMBOL);
2567 
2568 BOOL
2569 WINAPI
2570 SymGetSymFromName(
2571   _In_ HANDLE,
2572   _In_ PCSTR,
2573   _Inout_ PIMAGEHLP_SYMBOL);
2574 
2575 BOOL WINAPI SymGetSymNext(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOL);
2576 BOOL WINAPI SymGetSymNextW(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOLW);
2577 BOOL WINAPI SymGetSymPrev(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOL);
2578 BOOL WINAPI SymGetSymPrevW(_In_ HANDLE, _Inout_ PIMAGEHLP_SYMBOLW);
2579 
2580 DWORD
2581 WINAPI
2582 SymLoadModule(
2583   _In_ HANDLE,
2584   _In_opt_ HANDLE,
2585   _In_opt_ PCSTR,
2586   _In_opt_ PCSTR,
2587   _In_ DWORD,
2588   _In_ DWORD);
2589 
2590 BOOL
2591 WINAPI
2592 SymRegisterCallback(
2593   _In_ HANDLE,
2594   _In_ PSYMBOL_REGISTERED_CALLBACK,
2595   _In_opt_ PVOID);
2596 
2597 BOOL
2598 WINAPI
2599 SymRegisterFunctionEntryCallback(
2600   _In_ HANDLE,
2601   _In_ PSYMBOL_FUNCENTRY_CALLBACK,
2602   _In_opt_ PVOID);
2603 
2604 BOOL WINAPI SymRefreshModuleList(_In_ HANDLE);
2605 
2606 BOOL
2607 WINAPI
2608 SymUnDName(
2609   _In_ PIMAGEHLP_SYMBOL,
2610   _Out_writes_(UnDecNameLength) PSTR,
2611   _In_ DWORD UnDecNameLength);
2612 
2613 BOOL WINAPI SymUnloadModule(_In_ HANDLE, _In_ DWORD);
2614 
2615 #endif
2616 
2617 #ifdef __cplusplus
2618 } /* extern "C" */
2619 #endif /* defined(__cplusplus) */
2620 
2621 #endif  /* __WINE_DBGHELP_H */
2622