server: Remove the extra apc_arg parameter now that user APCs all require the same...
[wine] / include / dbghelp.h
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 #ifdef __cplusplus
25 extern "C" {
26 #endif /* defined(__cplusplus) */
27
28 typedef struct _LOADED_IMAGE
29 {
30     LPSTR                       ModuleName;
31     HANDLE                      hFile;
32     PUCHAR                      MappedAddress;
33     PIMAGE_NT_HEADERS           FileHeader;
34     PIMAGE_SECTION_HEADER       LastRvaSection;
35     ULONG                       NumberOfSections;
36     PIMAGE_SECTION_HEADER       Sections;
37     ULONG                       Characteristics;
38     BOOLEAN                     fSystemImage;
39     BOOLEAN                     fDOSImage;
40     LIST_ENTRY                  Links;
41     ULONG                       SizeOfImage;
42 } LOADED_IMAGE, *PLOADED_IMAGE;
43
44 /*************************
45  *    IMAGEHLP equiv     *
46  *************************/
47
48 typedef enum
49 {
50     AddrMode1616,
51     AddrMode1632,
52     AddrModeReal,
53     AddrModeFlat
54 } ADDRESS_MODE;
55
56 typedef struct _tagADDRESS
57 {
58     DWORD                       Offset;
59     WORD                        Segment;
60     ADDRESS_MODE                Mode;
61 } ADDRESS, *LPADDRESS;
62
63 typedef struct _tagADDRESS64
64 {
65     DWORD64                     Offset;
66     WORD                        Segment;
67     ADDRESS_MODE                Mode;
68 } ADDRESS64, *LPADDRESS64;
69
70 #define SYMF_OMAP_GENERATED   0x00000001
71 #define SYMF_OMAP_MODIFIED    0x00000002
72 #define SYMF_USER_GENERATED   0x00000004
73 #define SYMF_REGISTER         0x00000008
74 #define SYMF_REGREL           0x00000010
75 #define SYMF_FRAMEREL         0x00000020
76 #define SYMF_PARAMETER        0x00000040
77 #define SYMF_LOCAL            0x00000080
78 #define SYMF_CONSTANT         0x00000100
79 #define SYMF_EXPORT           0x00000200
80 #define SYMF_FORWARDER        0x00000400
81 #define SYMF_FUNCTION         0x00000800
82 #define SYMF_VIRTUAL          0x00001000
83 #define SYMF_THUNK            0x00002000
84 #define SYMF_TLSREL           0x00004000
85
86 typedef enum 
87 {
88     SymNone = 0,
89     SymCoff,
90     SymCv,
91     SymPdb,
92     SymExport,
93     SymDeferred,
94     SymSym,
95     SymDia,
96     SymVirtual,
97     NumSymTypes
98 } SYM_TYPE;
99
100 typedef struct _IMAGEHLP_SYMBOL
101 {
102     DWORD                       SizeOfStruct;
103     DWORD                       Address;
104     DWORD                       Size;
105     DWORD                       Flags;
106     DWORD                       MaxNameLength;
107     CHAR                        Name[1];
108 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
109
110 typedef struct _IMAGEHLP_SYMBOL64
111 {
112     DWORD                       SizeOfStruct;
113     DWORD64                     Address;
114     DWORD                       Size;
115     DWORD                       Flags;
116     DWORD                       MaxNameLength;
117     CHAR                        Name[1];
118 } IMAGEHLP_SYMBOL64, *PIMAGEHLP_SYMBOL64;
119
120 typedef struct _IMAGEHLP_MODULE
121 {
122     DWORD                       SizeOfStruct;
123     DWORD                       BaseOfImage;
124     DWORD                       ImageSize;
125     DWORD                       TimeDateStamp;
126     DWORD                       CheckSum;
127     DWORD                       NumSyms;
128     SYM_TYPE                    SymType;
129     CHAR                        ModuleName[32];
130     CHAR                        ImageName[256];
131     CHAR                        LoadedImageName[256];
132 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
133
134 typedef struct _IMAGEHLP_MODULEW
135 {
136     DWORD                       SizeOfStruct;
137     DWORD                       BaseOfImage;
138     DWORD                       ImageSize;
139     DWORD                       TimeDateStamp;
140     DWORD                       CheckSum;
141     DWORD                       NumSyms;
142     SYM_TYPE                    SymType;
143     WCHAR                       ModuleName[32];
144     WCHAR                       ImageName[256];
145     WCHAR                       LoadedImageName[256];
146 } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
147
148 typedef struct _IMAGEHLP_MODULE64
149 {
150     DWORD                       SizeOfStruct;
151     DWORD64                     BaseOfImage;
152     DWORD                       ImageSize;
153     DWORD                       TimeDateStamp;
154     DWORD                       CheckSum;
155     DWORD                       NumSyms;
156     SYM_TYPE                    SymType;
157     CHAR                        ModuleName[32];
158     CHAR                        ImageName[256];
159     CHAR                        LoadedImageName[256];
160     CHAR                        LoadedPdbName[256];
161     DWORD                       CVSig;
162     CHAR                        CVData[MAX_PATH*3];
163     DWORD                       PdbSig;
164     GUID                        PdbSig70;
165     DWORD                       PdbAge;
166     BOOL                        PdbUnmatched;
167     BOOL                        DbgUnmatched;
168     BOOL                        LineNumbers;
169     BOOL                        GlobalSymbols;
170     BOOL                        TypeInfo;
171     BOOL                        SourceIndexed;
172     BOOL                        Publics;
173 } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
174
175 typedef struct _IMAGEHLP_MODULEW64
176 {
177     DWORD                       SizeOfStruct;
178     DWORD64                     BaseOfImage;
179     DWORD                       ImageSize;
180     DWORD                       TimeDateStamp;
181     DWORD                       CheckSum;
182     DWORD                       NumSyms;
183     SYM_TYPE                    SymType;
184     WCHAR                       ModuleName[32];
185     WCHAR                       ImageName[256];
186     WCHAR                       LoadedImageName[256];
187     WCHAR                       LoadedPdbName[256];
188     DWORD                       CVSig;
189     WCHAR                       CVData[MAX_PATH*3];
190     DWORD                       PdbSig;
191     GUID                        PdbSig70;
192     DWORD                       PdbAge;
193     BOOL                        PdbUnmatched;
194     BOOL                        DbgUnmatched;
195     BOOL                        LineNumbers;
196     BOOL                        GlobalSymbols;
197     BOOL                        TypeInfo;
198     BOOL                        SourceIndexed;
199     BOOL                        Publics;
200 } IMAGEHLP_MODULEW64, *PIMAGEHLP_MODULEW64;
201
202 typedef struct _IMAGEHLP_LINE
203 {
204     DWORD                       SizeOfStruct;
205     PVOID                       Key;
206     DWORD                       LineNumber;
207     PCHAR                       FileName;
208     DWORD                       Address;
209 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
210
211 typedef struct _IMAGEHLP_LINE64
212 {
213     DWORD                       SizeOfStruct;
214     PVOID                       Key;
215     DWORD                       LineNumber;
216     PCHAR                       FileName;
217     DWORD64                     Address;
218 } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
219
220 typedef struct _IMAGEHLP_LINEW64
221 {
222     DWORD                       SizeOfStruct;
223     PVOID                       Key;
224     DWORD                       LineNumber;
225     PWCHAR                      FileName;
226     DWORD64                     Address;
227 } IMAGEHLP_LINEW64, *PIMAGEHLP_LINEW64;
228
229 typedef struct _SOURCEFILE
230 {
231     DWORD64                     ModBase;
232     PCHAR                       FileName;
233 } SOURCEFILE, *PSOURCEFILE;
234
235 #define CBA_DEFERRED_SYMBOL_LOAD_START          0x00000001
236 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE       0x00000002
237 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE        0x00000003
238 #define CBA_SYMBOLS_UNLOADED                    0x00000004
239 #define CBA_DUPLICATE_SYMBOL                    0x00000005
240 #define CBA_READ_MEMORY                         0x00000006
241 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL         0x00000007
242 #define CBA_SET_OPTIONS                         0x00000008
243 #define CBA_EVENT                               0x00000010
244 #define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL        0x00000020
245 #define CBA_DEBUG_INFO                          0x10000000
246
247 typedef struct _IMAGEHLP_CBA_READ_MEMORY
248 {
249     DWORD64   addr;
250     PVOID     buf;
251     DWORD     bytes;
252     DWORD    *bytesread;
253 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
254
255 enum
256 {
257     sevInfo = 0,
258     sevProblem,
259     sevAttn,
260     sevFatal,
261     sevMax
262 };
263
264 #define EVENT_SRCSPEW_START 100
265 #define EVENT_SRCSPEW       100
266 #define EVENT_SRCSPEW_END   199
267
268 typedef struct _IMAGEHLP_CBA_EVENT
269 {
270     DWORD       severity;
271     DWORD       code;
272     PCHAR       desc;
273     PVOID       object;
274 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
275
276 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
277 {
278     DWORD                       SizeOfStruct;
279     DWORD                       BaseOfImage;
280     DWORD                       CheckSum;
281     DWORD                       TimeDateStamp;
282     CHAR                        FileName[MAX_PATH];
283     BOOLEAN                     Reparse;
284     HANDLE                      hFile;
285 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
286
287 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD64
288 {
289     DWORD                       SizeOfStruct;
290     DWORD64                     BaseOfImage;
291     DWORD                       CheckSum;
292     DWORD                       TimeDateStamp;
293     CHAR                        FileName[MAX_PATH];
294     BOOLEAN                     Reparse;
295     HANDLE                      hFile;
296     DWORD                       Flags;
297 } IMAGEHLP_DEFERRED_SYMBOL_LOAD64, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD64;
298
299 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOADW64
300 {
301     DWORD                       SizeOfStruct;
302     DWORD64                     BaseOfImage;
303     DWORD                       CheckSum;
304     DWORD                       TimeDateStamp;
305     WCHAR                       FileName[MAX_PATH + 1];
306     BOOLEAN                     Reparse;
307     HANDLE                      hFile;
308     DWORD                       Flags;
309 } IMAGEHLP_DEFERRED_SYMBOL_LOADW64, *PIMAGEHLP_DEFERRED_SYMBOL_LOADW64;
310
311 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
312 {
313     DWORD                       SizeOfStruct;
314     DWORD                       NumberOfDups;
315     PIMAGEHLP_SYMBOL            Symbol;
316     DWORD                       SelectedSymbol;
317 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
318
319 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL64
320 {
321     DWORD                       SizeOfStruct;
322     DWORD                       NumberOfDups;
323     PIMAGEHLP_SYMBOL64          Symbol;
324     DWORD                       SelectedSymbol;
325 } IMAGEHLP_DUPLICATE_SYMBOL64, *PIMAGEHLP_DUPLICATE_SYMBOL64;
326
327 #define SYMOPT_CASE_INSENSITIVE         0x00000001
328 #define SYMOPT_UNDNAME                  0x00000002
329 #define SYMOPT_DEFERRED_LOADS           0x00000004
330 #define SYMOPT_NO_CPP                   0x00000008
331 #define SYMOPT_LOAD_LINES               0x00000010
332 #define SYMOPT_OMAP_FIND_NEAREST        0x00000020
333 #define SYMOPT_LOAD_ANYTHING            0x00000040
334 #define SYMOPT_IGNORE_CVREC             0x00000080
335 #define SYMOPT_NO_UNQUALIFIED_LOADS     0x00000100
336 #define SYMOPT_FAIL_CRITICAL_ERRORS     0x00000200
337 #define SYMOPT_EXACT_SYMBOLS            0x00000400
338 #define SYMOPT_WILD_UNDERSCORE          0x00000800
339 #define SYMOPT_USE_DEFAULTS             0x00001000
340 /* latest SDK defines:
341 #define SYMOPT_ALLOW_ABSOLUTE_SYMBOLS   0x00000800
342 #define SYMOPT_IGNORE_NT_SYMPATH        0x00001000
343 */
344 #define SYMOPT_INCLUDE_32BIT_MODULES    0x00002000
345 #define SYMOPT_PUBLICS_ONLY             0x00004000
346 #define SYMOPT_NO_PUBLICS               0x00008000
347 #define SYMOPT_AUTO_PUBLICS             0x00010000
348 #define SYMOPT_NO_IMAGE_SEARCH          0x00020000
349 #define SYMOPT_SECURE                   0x00040000
350 #define SYMOPT_NO_PROMPTS               0x00080000
351 #define SYMOPT_OVERWRITE                0x00100000
352 #define SYMOPT_IGNORE_IMAGEDIR          0x00200000
353
354 #define SYMOPT_DEBUG                    0x80000000
355
356 typedef struct _IMAGEHLP_STACK_FRAME
357 {
358     ULONG64     InstructionOffset;
359     ULONG64     ReturnOffset;
360     ULONG64     FrameOffset;
361     ULONG64     StackOffset;
362     ULONG64     BackingStoreOffset;
363     ULONG64     FuncTableEntry;
364     ULONG64     Params[4];
365     ULONG64     Reserved[5];
366     BOOL        Virtual;
367     ULONG       Reserved2;
368 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
369
370 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
371
372 #define DBHHEADER_DEBUGDIRS     0x1
373 typedef struct _DBGHELP_MODLOAD_DATA
374 {
375     DWORD               ssize;
376     DWORD               ssig;
377     PVOID               data;
378     DWORD               size;
379     DWORD               flags;
380 } MODLOAD_DATA, *PMODLOAD_DATA;
381
382 /*************************
383  *       MiniDUMP        *
384  *************************/
385
386 #include <pshpack4.h>
387 /* DebugHelp */
388
389 #define MINIDUMP_SIGNATURE 0x504D444D /* 'MDMP' */
390 #define MINIDUMP_VERSION   (42899)
391
392 typedef DWORD   RVA;
393 typedef ULONG64 RVA64;
394
395 typedef enum _MINIDUMP_TYPE 
396 {
397     MiniDumpNormal                              = 0x0000,
398     MiniDumpWithDataSegs                        = 0x0001,
399     MiniDumpWithFullMemory                      = 0x0002,
400     MiniDumpWithHandleData                      = 0x0004,
401     MiniDumpFilterMemory                        = 0x0008,
402     MiniDumpScanMemory                          = 0x0010,
403     MiniDumpWithUnloadedModules                 = 0x0020,
404     MiniDumpWithIndirectlyReferencedMemory      = 0x0040,
405     MiniDumpFilterModulePaths                   = 0x0080,
406     MiniDumpWithProcessThreadData               = 0x0100,
407     MiniDumpWithPrivateReadWriteMemory          = 0x0200,
408     MiniDumpWithoutOptionalData                 = 0x0400,
409     MiniDumpWithFullMemoryInfo                  = 0x0800,
410     MiniDumpWithThreadInfo                      = 0x1000,
411     MiniDumpWithCodeSegs                        = 0x2000
412 } MINIDUMP_TYPE;
413
414 typedef enum _MINIDUMP_CALLBACK_TYPE
415 {
416     ModuleCallback,
417     ThreadCallback,
418     ThreadExCallback,
419     IncludeThreadCallback,
420     IncludeModuleCallback,
421     MemoryCallback,
422 } MINIDUMP_CALLBACK_TYPE;
423
424 typedef struct _MINIDUMP_THREAD_CALLBACK
425 {
426     ULONG                       ThreadId;
427     HANDLE                      ThreadHandle;
428     CONTEXT                     Context;
429     ULONG                       SizeOfContext;
430     ULONG64                     StackBase;
431     ULONG64                     StackEnd;
432 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
433
434 typedef struct _MINIDUMP_THREAD_EX_CALLBACK 
435 {
436     ULONG                       ThreadId;
437     HANDLE                      ThreadHandle;
438     CONTEXT                     Context;
439     ULONG                       SizeOfContext;
440     ULONG64                     StackBase;
441     ULONG64                     StackEnd;
442     ULONG64                     BackingStoreBase;
443     ULONG64                     BackingStoreEnd;
444 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
445
446 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
447 {
448     ULONG ThreadId;
449 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
450
451 typedef enum _THREAD_WRITE_FLAGS 
452 {
453     ThreadWriteThread            = 0x0001,
454     ThreadWriteStack             = 0x0002,
455     ThreadWriteContext           = 0x0004,
456     ThreadWriteBackingStore      = 0x0008,
457     ThreadWriteInstructionWindow = 0x0010,
458     ThreadWriteThreadData        = 0x0020,
459     ThreadWriteThreadInfo        = 0x0040
460 } THREAD_WRITE_FLAGS;
461
462 typedef struct _MINIDUMP_MODULE_CALLBACK 
463 {
464     PWCHAR                      FullPath;
465     ULONG64                     BaseOfImage;
466     ULONG                       SizeOfImage;
467     ULONG                       CheckSum;
468     ULONG                       TimeDateStamp;
469     VS_FIXEDFILEINFO            VersionInfo;
470     PVOID                       CvRecord;
471     ULONG                       SizeOfCvRecord;
472     PVOID                       MiscRecord;
473     ULONG                       SizeOfMiscRecord;
474 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
475
476 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK 
477 {
478     ULONG64 BaseOfImage;
479 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
480
481 typedef enum _MODULE_WRITE_FLAGS 
482 {
483     ModuleWriteModule        = 0x0001,
484     ModuleWriteDataSeg       = 0x0002,
485     ModuleWriteMiscRecord    = 0x0004,
486     ModuleWriteCvRecord      = 0x0008,
487     ModuleReferencedByMemory = 0x0010,
488     ModuleWriteTlsData       = 0x0020,
489     ModuleWriteCodeSegs      = 0x0040,
490 } MODULE_WRITE_FLAGS;
491
492 typedef struct _MINIDUMP_CALLBACK_INPUT 
493 {
494     ULONG                       ProcessId;
495     HANDLE                      ProcessHandle;
496     ULONG                       CallbackType;
497     union 
498     {
499         MINIDUMP_THREAD_CALLBACK        Thread;
500         MINIDUMP_THREAD_EX_CALLBACK     ThreadEx;
501         MINIDUMP_MODULE_CALLBACK        Module;
502         MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
503         MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
504     } DUMMYUNIONNAME;
505 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
506
507 typedef struct _MINIDUMP_CALLBACK_OUTPUT
508 {
509     union 
510     {
511         ULONG                           ModuleWriteFlags;
512         ULONG                           ThreadWriteFlags;
513         struct
514         {
515             ULONG64                     MemoryBase;
516             ULONG                       MemorySize;
517         } DUMMYSTRUCTNAME;
518     } DUMMYUNIONNAME;
519 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
520
521 typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID, const PMINIDUMP_CALLBACK_INPUT, PMINIDUMP_CALLBACK_OUTPUT);
522
523 typedef struct _MINIDUMP_CALLBACK_INFORMATION 
524 {
525     MINIDUMP_CALLBACK_ROUTINE   CallbackRoutine;
526     void*                       CallbackParam;
527 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
528
529 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR 
530 {
531     ULONG                       DataSize;
532     RVA                         Rva;
533 } MINIDUMP_LOCATION_DESCRIPTOR;
534
535 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR64 
536 {
537     ULONG64                     DataSize;
538     RVA64                       Rva;
539 } MINIDUMP_LOCATION_DESCRIPTOR64;
540
541 typedef struct _MINIDUMP_DIRECTORY 
542 {
543     ULONG                       StreamType;
544     MINIDUMP_LOCATION_DESCRIPTOR Location;
545 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
546
547 typedef struct _MINIDUMP_EXCEPTION
548 {
549     ULONG                       ExceptionCode;
550     ULONG                       ExceptionFlags;
551     ULONG64                     ExceptionRecord;
552     ULONG64                     ExceptionAddress;
553     ULONG                       NumberParameters;
554     ULONG                        __unusedAlignment;
555     ULONG64                     ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
556 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
557
558 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
559 {
560     DWORD                       ThreadId;
561     PEXCEPTION_POINTERS         ExceptionPointers;
562     BOOL                        ClientPointers;
563 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
564
565 typedef struct MINIDUMP_EXCEPTION_STREAM 
566 {
567     ULONG                       ThreadId;
568     ULONG                       __alignment;
569     MINIDUMP_EXCEPTION          ExceptionRecord;
570     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
571 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
572
573 typedef struct _MINIDUMP_HEADER 
574 {
575     DWORD                       Signature;
576     DWORD                       Version;
577     DWORD                       NumberOfStreams;
578     RVA                         StreamDirectoryRva;
579     DWORD                       CheckSum;
580     union 
581     {
582         DWORD                           Reserved;
583         DWORD                           TimeDateStamp;
584     } DUMMYUNIONNAME;
585     ULONG64                     Flags;
586 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
587
588 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR 
589 {
590     ULONG64                     StartOfMemoryRange;
591     MINIDUMP_LOCATION_DESCRIPTOR Memory;
592 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
593
594 typedef struct _MINIDUMP_MEMORY_LIST
595 {
596     ULONG                       NumberOfMemoryRanges;
597     MINIDUMP_MEMORY_DESCRIPTOR  MemoryRanges[1]; /* FIXME: 0-sized array not supported */
598 } MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
599
600 #define MINIDUMP_MISC1_PROCESS_ID       0x00000001
601 #define MINIDUMP_MISC1_PROCESS_TIMES    0x00000002
602
603 typedef struct _MINIDUMP_MISC_INFO
604 {
605     ULONG                       SizeOfInfo;
606     ULONG                       Flags1;
607     ULONG                       ProcessId;
608     ULONG                       ProcessCreateTime;
609     ULONG                       ProcessUserTime;
610     ULONG                       ProcessKernelTime;
611 } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
612
613 typedef struct _MINIDUMP_MODULE
614 {
615     ULONG64                     BaseOfImage;
616     ULONG                       SizeOfImage;
617     ULONG                       CheckSum;
618     ULONG                       TimeDateStamp;
619     RVA                         ModuleNameRva;
620     VS_FIXEDFILEINFO            VersionInfo;
621     MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
622     MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
623     ULONG64                     Reserved0;
624     ULONG64                     Reserved1;
625 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
626
627 typedef struct _MINIDUMP_MODULE_LIST 
628 {
629     ULONG                       NumberOfModules;
630     MINIDUMP_MODULE             Modules[1]; /* FIXME: 0-sized array not supported */
631 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
632
633 typedef struct _MINIDUMP_STRING
634 {
635     ULONG                       Length;
636     WCHAR                       Buffer[1]; /* FIXME: O-sized array not supported */
637 } MINIDUMP_STRING, *PMINIDUMP_STRING;
638
639 typedef struct _MINIDUMP_SYSTEM_INFO
640 {
641     USHORT                      ProcessorArchitecture;
642     USHORT                      ProcessorLevel;
643     USHORT                      ProcessorRevision;
644     union
645     {
646         USHORT                          Reserved0;
647         struct
648         {
649             UCHAR                       NumberOfProcessors;
650             UCHAR                       ProductType;
651         } DUMMYSTRUCTNAME;
652     } DUMMYUNIONNAME;
653
654     ULONG                       MajorVersion;
655     ULONG                       MinorVersion;
656     ULONG                       BuildNumber;
657     ULONG                       PlatformId;
658
659     RVA                         CSDVersionRva;
660     union
661     {
662         ULONG                           Reserved1;
663         struct
664         {
665             USHORT                      SuiteMask;
666             USHORT                      Reserved2;
667         } DUMMYSTRUCTNAME;
668     } DUMMYUNIONNAME1;
669     union _CPU_INFORMATION 
670     {
671         struct 
672         {
673             ULONG                       VendorId[3];
674             ULONG                       VersionInformation;
675             ULONG                       FeatureInformation;
676             ULONG                       AMDExtendedCpuFeatures;
677         } X86CpuInfo;
678         struct 
679         {
680             ULONG64                     ProcessorFeatures[2];
681         } OtherCpuInfo;
682     } Cpu;
683
684 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
685
686 typedef struct _MINIDUMP_THREAD
687 {
688     ULONG                       ThreadId;
689     ULONG                       SuspendCount;
690     ULONG                       PriorityClass;
691     ULONG                       Priority;
692     ULONG64                     Teb;
693     MINIDUMP_MEMORY_DESCRIPTOR  Stack;
694     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
695 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
696
697 typedef struct _MINIDUMP_THREAD_LIST
698 {
699     ULONG                       NumberOfThreads;
700     MINIDUMP_THREAD             Threads[1]; /* FIXME: no support of 0 sized array */
701 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
702
703 typedef struct _MINIDUMP_USER_STREAM
704 {
705     ULONG                       Type;
706     ULONG                       BufferSize;
707     void*                       Buffer;
708 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
709
710 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
711 {
712     ULONG                       UserStreamCount;
713     PMINIDUMP_USER_STREAM       UserStreamArray;
714 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
715
716 typedef enum _MINIDUMP_STREAM_TYPE
717 {
718     UnusedStream                = 0,
719     ReservedStream0             = 1,
720     ReservedStream1             = 2,
721     ThreadListStream            = 3,
722     ModuleListStream            = 4,
723     MemoryListStream            = 5,
724     ExceptionStream             = 6,
725     SystemInfoStream            = 7,
726     ThreadExListStream          = 8,
727     Memory64ListStream          = 9,
728     CommentStreamA              = 10,
729     CommentStreamW              = 11,
730     HandleDataStream            = 12,
731     FunctionTableStream         = 13,
732     UnloadedModuleListStream    = 14,
733     MiscInfoStream              = 15,
734     MemoryInfoListStream        = 16,
735     ThreadInfoListStream        = 17,
736
737     LastReservedStream          = 0xffff
738 } MINIDUMP_STREAM_TYPE;
739
740 BOOL WINAPI MiniDumpWriteDump(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
741                               const PMINIDUMP_EXCEPTION_INFORMATION,
742                               const PMINIDUMP_USER_STREAM_INFORMATION,
743                               const PMINIDUMP_CALLBACK_INFORMATION);
744 BOOL WINAPI MiniDumpReadDumpStream(PVOID, ULONG, PMINIDUMP_DIRECTORY*, PVOID*,
745                                    ULONG*);
746
747 #include <poppack.h>
748
749 /*************************
750  *    MODULE handling    *
751  *************************/
752
753 /* flags for SymLoadModuleEx */
754 #define SLMFLAG_VIRTUAL         0x1
755 #define SLMFLAG_NO_SYMBOLS      0x4
756
757 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR, ULONG, ULONG, PVOID);
758 BOOL   WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
759 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK64)(PSTR, DWORD64, ULONG, PVOID);
760 BOOL   WINAPI EnumerateLoadedModules64(HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
761 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACKW64)(PWSTR, DWORD64, ULONG, PVOID);
762 BOOL   WINAPI EnumerateLoadedModulesW64(HANDLE, PENUMLOADED_MODULES_CALLBACKW64, PVOID);
763 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR, ULONG, PVOID);
764 BOOL    WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
765 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK64)(PSTR, DWORD64, PVOID);
766 BOOL    WINAPI SymEnumerateModules64(HANDLE, PSYM_ENUMMODULES_CALLBACK64, PVOID);
767 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACKW64)(PWSTR, DWORD64, PVOID);
768 BOOL    WINAPI SymEnumerateModulesW64(HANDLE, PSYM_ENUMMODULES_CALLBACKW64, PVOID);
769 BOOL    WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
770 BOOL    WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
771 BOOL    WINAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
772 BOOL    WINAPI SymGetModuleInfoW64(HANDLE, DWORD64, PIMAGEHLP_MODULEW64);
773 DWORD   WINAPI SymGetModuleBase(HANDLE, DWORD);
774 DWORD64 WINAPI SymGetModuleBase64(HANDLE, DWORD64);
775 DWORD   WINAPI SymLoadModule(HANDLE, HANDLE, PCSTR, PCSTR, DWORD, DWORD);
776 DWORD64 WINAPI SymLoadModule64(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD);
777 DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD,
778                                PMODLOAD_DATA, DWORD);
779 DWORD64 WINAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64, DWORD,
780                                 PMODLOAD_DATA, DWORD);
781 BOOL    WINAPI SymUnloadModule(HANDLE, DWORD);
782 BOOL    WINAPI SymUnloadModule64(HANDLE, DWORD64);
783
784 /*************************
785  *    Symbol Handling    *
786  *************************/
787
788 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT          1
789 #define IMAGEHLP_SYMBOL_INFO_REGISTER              SYMF_REGISTER        /*  0x08 */
790 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE           SYMF_REGREL          /*  0x10 */
791 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE         SYMF_FRAMEREL        /*  0x20 */
792 #define IMAGEHLP_SYMBOL_INFO_PARAMETER             SYMF_PARAMETER       /*  0x40 */
793 #define IMAGEHLP_SYMBOL_INFO_LOCAL                 SYMF_LOCAL           /*  0x80 */
794 #define IMAGEHLP_SYMBOL_INFO_CONSTANT              SYMF_CONSTANT        /* 0x100 */
795 #define IMAGEHLP_SYMBOL_FUNCTION                   SYMF_FUNCTION        /* 0x800 */
796
797 #define SYMFLAG_VALUEPRESENT     0x00000001
798 #define SYMFLAG_REGISTER         0x00000008
799 #define SYMFLAG_REGREL           0x00000010
800 #define SYMFLAG_FRAMEREL         0x00000020
801 #define SYMFLAG_PARAMETER        0x00000040
802 #define SYMFLAG_LOCAL            0x00000080
803 #define SYMFLAG_CONSTANT         0x00000100
804 #define SYMFLAG_EXPORT           0x00000200
805 #define SYMFLAG_FORWARDER        0x00000400
806 #define SYMFLAG_FUNCTION         0x00000800
807 #define SYMFLAG_VIRTUAL          0x00001000
808 #define SYMFLAG_THUNK            0x00002000
809 #define SYMFLAG_TLSREL           0x00004000
810 #define SYMFLAG_SLOT             0x00008000
811
812 #define MAX_SYM_NAME    2000
813
814 typedef struct _SYMBOL_INFO
815 {
816     ULONG       SizeOfStruct;
817     ULONG       TypeIndex;
818     ULONG64     Reserved[2];
819     ULONG       info;   /* sdk states info, while MSDN says it's Index... */
820     ULONG       Size;
821     ULONG64     ModBase;
822     ULONG       Flags;
823     ULONG64     Value;
824     ULONG64     Address;
825     ULONG       Register;
826     ULONG       Scope;
827     ULONG       Tag;
828     ULONG       NameLen;
829     ULONG       MaxNameLen;
830     CHAR        Name[1];
831 } SYMBOL_INFO, *PSYMBOL_INFO;
832
833 typedef struct _SYMBOL_INFOW
834 {
835     ULONG       SizeOfStruct;
836     ULONG       TypeIndex;
837     ULONG64     Reserved[2];
838     ULONG       Index;
839     ULONG       Size;
840     ULONG64     ModBase;
841     ULONG       Flags;
842     ULONG64     Value;
843     ULONG64     Address;
844     ULONG       Register;
845     ULONG       Scope;
846     ULONG       Tag;
847     ULONG       NameLen;
848     ULONG       MaxNameLen;
849     WCHAR       Name[1];
850 } SYMBOL_INFOW, *PSYMBOL_INFOW;
851
852 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO 
853 {
854     TI_GET_SYMTAG,
855     TI_GET_SYMNAME,
856     TI_GET_LENGTH,
857     TI_GET_TYPE,
858     TI_GET_TYPEID,
859     TI_GET_BASETYPE,
860     TI_GET_ARRAYINDEXTYPEID,
861     TI_FINDCHILDREN,
862     TI_GET_DATAKIND,
863     TI_GET_ADDRESSOFFSET,
864     TI_GET_OFFSET,
865     TI_GET_VALUE,
866     TI_GET_COUNT,
867     TI_GET_CHILDRENCOUNT,
868     TI_GET_BITPOSITION,
869     TI_GET_VIRTUALBASECLASS,
870     TI_GET_VIRTUALTABLESHAPEID,
871     TI_GET_VIRTUALBASEPOINTEROFFSET,
872     TI_GET_CLASSPARENTID,
873     TI_GET_NESTED,
874     TI_GET_SYMINDEX,
875     TI_GET_LEXICALPARENT,
876     TI_GET_ADDRESS,
877     TI_GET_THISADJUST,
878     TI_GET_UDTKIND,
879     TI_IS_EQUIV_TO,
880     TI_GET_CALLING_CONVENTION,
881 } IMAGEHLP_SYMBOL_TYPE_INFO;
882
883 typedef struct _TI_FINDCHILDREN_PARAMS 
884 {
885     ULONG Count;
886     ULONG Start;
887     ULONG ChildId[1];
888 } TI_FINDCHILDREN_PARAMS;
889
890 #define UNDNAME_COMPLETE                 (0x0000)
891 #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001)
892 #define UNDNAME_NO_MS_KEYWORDS           (0x0002)
893 #define UNDNAME_NO_FUNCTION_RETURNS      (0x0004)
894 #define UNDNAME_NO_ALLOCATION_MODEL      (0x0008)
895 #define UNDNAME_NO_ALLOCATION_LANGUAGE   (0x0010)
896 #define UNDNAME_NO_MS_THISTYPE           (0x0020)
897 #define UNDNAME_NO_CV_THISTYPE           (0x0040)
898 #define UNDNAME_NO_THISTYPE              (0x0060)
899 #define UNDNAME_NO_ACCESS_SPECIFIERS     (0x0080)
900 #define UNDNAME_NO_THROW_SIGNATURES      (0x0100)
901 #define UNDNAME_NO_MEMBER_TYPE           (0x0200)
902 #define UNDNAME_NO_RETURN_UDT_MODEL      (0x0400)
903 #define UNDNAME_32_BIT_DECODE            (0x0800)
904 #define UNDNAME_NAME_ONLY                (0x1000)
905 #define UNDNAME_NO_ARGUMENTS             (0x2000)
906 #define UNDNAME_NO_SPECIAL_SYMS          (0x4000)
907
908 #define SYMSEARCH_MASKOBJS              0x01
909 #define SYMSEARCH_RECURSE               0x02
910 #define SYMSEARCH_GLOBALSONLY           0x04
911
912 BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
913 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
914 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACKW)(PSYMBOL_INFOW, ULONG, PVOID);
915 BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
916 BOOL WINAPI SymEnumTypesW(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID);
917 BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
918 BOOL WINAPI SymFromAddrW(HANDLE, DWORD64, DWORD64*, SYMBOL_INFOW*);
919 BOOL WINAPI SymFromToken(HANDLE, DWORD64, DWORD, PSYMBOL_INFO);
920 BOOL WINAPI SymFromName(HANDLE, PCSTR, PSYMBOL_INFO);
921 BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
922 BOOL WINAPI SymGetSymFromAddr64(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
923 BOOL WINAPI SymGetSymFromName(HANDLE, PCSTR, PIMAGEHLP_SYMBOL);
924 BOOL WINAPI SymGetSymFromName64(HANDLE, PCSTR, PIMAGEHLP_SYMBOL64);
925 BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, PCSTR, PSYMBOL_INFO);
926 BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
927 BOOL WINAPI SymGetSymNext64(HANDLE, PIMAGEHLP_SYMBOL64);
928 BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
929 BOOL WINAPI SymGetSymPrev64(HANDLE, PIMAGEHLP_SYMBOL64);
930 BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK,
931                            PVOID);
932 BOOL WINAPI SymEnumSymbolsW(HANDLE, ULONG64, PCWSTR, PSYM_ENUMERATESYMBOLS_CALLBACKW,
933                             PVOID);
934 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
935 BOOL WINAPI SymEnumerateSymbols(HANDLE, DWORD, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
936 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK64)(PSTR, DWORD64, ULONG, PVOID);
937 BOOL WINAPI SymEnumerateSymbols64(HANDLE, DWORD64, PSYM_ENUMSYMBOLS_CALLBACK64, PVOID);
938 BOOL WINAPI SymEnumSymbolsForAddr(HANDLE, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
939 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
940 BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
941 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
942 BOOL WINAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
943 BOOL WINAPI SymRegisterCallbackW64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
944 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
945 BOOL WINAPI SymUnDName64(PIMAGEHLP_SYMBOL64, PSTR, DWORD);
946 DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD);
947 BOOL WINAPI SymMatchString(PCSTR, PCSTR, BOOL);
948 BOOL WINAPI SymMatchStringW(PCWSTR, PCWSTR, BOOL);
949 BOOL WINAPI SymSearch(HANDLE, ULONG64, DWORD, DWORD, PCSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID, DWORD);
950 BOOL WINAPI SymSearchW(HANDLE, ULONG64, DWORD, DWORD, PCWSTR, DWORD64, PSYM_ENUMERATESYMBOLS_CALLBACKW, PVOID, DWORD);
951 DWORD WINAPI UnDecorateSymbolName(PCSTR, PSTR, DWORD, DWORD);
952 BOOL WINAPI SymGetScope(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
953 BOOL WINAPI SymFromIndex(HANDLE, ULONG64, DWORD, PSYMBOL_INFO);
954 BOOL WINAPI SymAddSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD, DWORD);
955 BOOL WINAPI SymDeleteSymbol(HANDLE, ULONG64, PCSTR, DWORD64, DWORD);
956
957 /*************************
958  *      Source Files     *
959  *************************/
960 typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(PSOURCEFILE, PVOID);
961
962 BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, PCSTR, PSYM_ENUMSOURCEFILES_CALLBACK,
963                                PVOID);
964 BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
965 BOOL WINAPI SymGetLineFromAddr64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
966 BOOL WINAPI SymGetLineFromAddrW64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINEW64);
967 BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
968 BOOL WINAPI SymGetLinePrev64(HANDLE, PIMAGEHLP_LINE64);
969 BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
970 BOOL WINAPI SymGetLineNext64(HANDLE, PIMAGEHLP_LINE64);
971 BOOL WINAPI SymGetLineFromName(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE);
972 BOOL WINAPI SymGetLineFromName64(HANDLE, PCSTR, PCSTR, DWORD, PLONG, PIMAGEHLP_LINE64);
973 ULONG WINAPI SymGetFileLineOffsets64(HANDLE, LPSTR, LPSTR, PDWORD64, ULONG);
974 ULONG WINAPI SymGetFileLineOffsetsW64(HANDLE, PWCH, PWCH, PDWORD64, ULONG);
975 BOOL WINAPI SymGetSourceFile(HANDLE, ULONG64, PCSTR, PCSTR, PSTR, DWORD);
976 BOOL WINAPI SymGetSourceFileToken(HANDLE, ULONG64, PCSTR, PVOID*, DWORD*);
977 BOOL WINAPI SymGetSourceFileTokenW(HANDLE, ULONG64, PCWSTR, PVOID*, DWORD*);
978 BOOL WINAPI SymGetSourceFileFromToken(HANDLE, PVOID, PCSTR, PSTR, DWORD);
979 BOOL WINAPI SymGetSourceVarFromToken(HANDLE, PVOID, PCSTR, PCSTR, PSTR, DWORD);
980
981 typedef struct _SRCCODEINFO
982 {
983     DWORD       SizeOfStruct;
984     PVOID       Key;
985     DWORD64     ModBase;
986     char        Obj[MAX_PATH+1];
987     char        FileName[MAX_PATH+1];
988     DWORD       LineNumber;
989     DWORD64     Address;
990 } SRCCODEINFO, *PSRCCODEINFO;
991
992 typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO, PVOID);
993 BOOL WINAPI SymEnumLines(HANDLE, ULONG64, PCSTR, PCSTR, PSYM_ENUMLINES_CALLBACK, PVOID);
994
995 /*************************
996  * File & image handling *
997  *************************/
998 BOOL WINAPI SymInitialize(HANDLE, PCSTR, BOOL);
999 BOOL WINAPI SymInitializeW(HANDLE, PCWSTR, BOOL);
1000 BOOL WINAPI SymCleanup(HANDLE);
1001
1002 HANDLE WINAPI FindDebugInfoFile(PCSTR, PCSTR, PSTR);
1003 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
1004 HANDLE WINAPI FindDebugInfoFileEx(PCSTR, PCSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
1005 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PCSTR, PVOID);
1006 BOOL WINAPI SymFindFileInPath(HANDLE, PCSTR, PCSTR, PVOID, DWORD, DWORD, DWORD,
1007                               PSTR, PFINDFILEINPATHCALLBACK, PVOID);
1008 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACKW)(PCWSTR, PVOID);
1009 BOOL WINAPI SymFindFileInPathW(HANDLE, PCWSTR, PCWSTR, PVOID, DWORD, DWORD, DWORD,
1010                               PWSTR, PFINDFILEINPATHCALLBACKW, PVOID);
1011 HANDLE WINAPI FindExecutableImage(PCSTR, PCSTR, PSTR);
1012 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
1013 HANDLE WINAPI FindExecutableImageEx(PCSTR, PCSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
1014 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACKW)(HANDLE, PWSTR, PVOID);
1015 HANDLE WINAPI FindExecutableImageExW(PCWSTR, PCWSTR, PWSTR, PFIND_EXE_FILE_CALLBACKW, PVOID);
1016 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
1017 PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
1018                                          PIMAGE_SECTION_HEADER *);
1019 PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
1020 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
1021 PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
1022 BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
1023 BOOL WINAPI SymGetSearchPathW(HANDLE, PWSTR, DWORD);
1024 BOOL WINAPI SymSetSearchPath(HANDLE, PCSTR);
1025 BOOL WINAPI SymSetSearchPathW(HANDLE, PCWSTR);
1026 DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
1027 BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
1028 BOOL WINAPI SearchTreeForFile(PCSTR, PCSTR, PSTR);
1029 BOOL WINAPI SearchTreeForFileW(PCWSTR, PCWSTR, PWSTR);
1030 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR, PVOID);
1031 BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, PSTR, PENUMDIRTREE_CALLBACK, void*);
1032 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACKW)(LPCWSTR, PVOID);
1033 BOOL WINAPI EnumDirTreeW(HANDLE, PCWSTR, PCWSTR, PWSTR, PENUMDIRTREE_CALLBACKW, void*);
1034 BOOL WINAPI SymMatchFileName(PSTR, PSTR, PSTR*, PSTR*);
1035 BOOL WINAPI SymMatchFileNameW(PWSTR, PWSTR, PWSTR*, PWSTR*);
1036 PCHAR WINAPI SymSetHomeDirectory(HANDLE, PCSTR);
1037 PCHAR WINAPI SymGetHomeDirectory(DWORD, PSTR, size_t);
1038 #define hdBase  0
1039 #define hdSym   1
1040 #define hdSrc   2
1041 #define hdMax   3
1042
1043 /*************************
1044  *   Context management  *
1045  *************************/
1046 BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
1047
1048
1049 /*************************
1050  *    Stack management   *
1051  *************************/
1052
1053 typedef struct _KDHELP
1054 {
1055     DWORD       Thread;
1056     DWORD       ThCallbackStack;
1057     DWORD       NextCallback;
1058     DWORD       FramePointer;
1059     DWORD       KiCallUserMode;
1060     DWORD       KeUserCallbackDispatcher;
1061     DWORD       SystemRangeStart;
1062 } KDHELP, *PKDHELP;
1063
1064 typedef struct _KDHELP64
1065 {
1066     DWORD64     Thread;
1067     DWORD       ThCallbackStack;
1068     DWORD       ThCallbackBStore;
1069     DWORD       NextCallback;
1070     DWORD       FramePointer;
1071     DWORD64     KiCallUserMode;
1072     DWORD64     KeUserCallbackDispatcher;
1073     DWORD64     SystemRangeStart;
1074     DWORD64     Reserved[8];
1075 } KDHELP64, *PKDHELP64;
1076
1077 typedef struct _STACKFRAME
1078 {
1079     ADDRESS     AddrPC;
1080     ADDRESS     AddrReturn;
1081     ADDRESS     AddrFrame;
1082     ADDRESS     AddrStack;
1083     PVOID       FuncTableEntry;
1084     DWORD       Params[4];
1085     BOOL        Far;
1086     BOOL        Virtual;
1087     DWORD       Reserved[3];
1088     KDHELP      KdHelp;
1089     ADDRESS     AddrBStore;
1090 } STACKFRAME, *LPSTACKFRAME;
1091
1092 typedef struct _STACKFRAME64
1093 {
1094     ADDRESS64   AddrPC;
1095     ADDRESS64   AddrReturn;
1096     ADDRESS64   AddrFrame;
1097     ADDRESS64   AddrStack;
1098     ADDRESS64   AddrBStore;
1099     PVOID       FuncTableEntry;
1100     DWORD64     Params[4];
1101     BOOL        Far;
1102     BOOL        Virtual;
1103     DWORD64     Reserved[3];
1104     KDHELP64    KdHelp;
1105 } STACKFRAME64, *LPSTACKFRAME64;
1106
1107 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)
1108     (HANDLE, DWORD, PVOID, DWORD, PDWORD);
1109 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
1110 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
1111 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
1112 BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID,
1113                       PREAD_PROCESS_MEMORY_ROUTINE,
1114                       PFUNCTION_TABLE_ACCESS_ROUTINE,
1115                       PGET_MODULE_BASE_ROUTINE,
1116                       PTRANSLATE_ADDRESS_ROUTINE);
1117
1118 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE64)
1119     (HANDLE, DWORD64, PVOID, DWORD, PDWORD);
1120 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE64)(HANDLE, DWORD64);
1121 typedef DWORD64 (CALLBACK *PGET_MODULE_BASE_ROUTINE64)(HANDLE, DWORD64);
1122 typedef DWORD64 (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE64)(HANDLE, HANDLE, LPADDRESS64);
1123 BOOL WINAPI StackWalk64(DWORD, HANDLE, HANDLE, LPSTACKFRAME64, PVOID,
1124                         PREAD_PROCESS_MEMORY_ROUTINE64,
1125                         PFUNCTION_TABLE_ACCESS_ROUTINE64,
1126                         PGET_MODULE_BASE_ROUTINE64,
1127                         PTRANSLATE_ADDRESS_ROUTINE64);
1128
1129 PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
1130 PVOID WINAPI SymFunctionTableAccess64(HANDLE, DWORD64);
1131
1132 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE, DWORD, PVOID);
1133 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE, ULONG64, ULONG64);
1134
1135 BOOL WINAPI SymRegisterFunctionEntryCallback(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK, PVOID);
1136 BOOL WINAPI SymRegisterFunctionEntryCallback64(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK64, ULONG64);
1137
1138 /*************************
1139  * Version, global stuff *
1140  *************************/
1141
1142 #define API_VERSION_NUMBER 9
1143
1144 typedef struct API_VERSION
1145 {
1146     USHORT  MajorVersion;
1147     USHORT  MinorVersion;
1148     USHORT  Revision;
1149     USHORT  Reserved;
1150 } API_VERSION, *LPAPI_VERSION;
1151
1152 LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
1153 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
1154
1155 typedef struct _IMAGE_DEBUG_INFORMATION
1156 {
1157     LIST_ENTRY                  List;
1158     DWORD                       ReservedSize;
1159     PVOID                       ReservedMappedBase;
1160     USHORT                      ReservedMachine;
1161     USHORT                      ReservedCharacteristics;
1162     DWORD                       ReservedCheckSum;
1163     DWORD                       ImageBase;
1164     DWORD                       SizeOfImage;
1165     DWORD                       ReservedNumberOfSections;
1166     PIMAGE_SECTION_HEADER       ReservedSections;
1167     DWORD                       ReservedExportedNamesSize;
1168     PSTR                        ReservedExportedNames;
1169     DWORD                       ReservedNumberOfFunctionTableEntries;
1170     PIMAGE_FUNCTION_ENTRY       ReservedFunctionTableEntries;
1171     DWORD                       ReservedLowestFunctionStartingAddress;
1172     DWORD                       ReservedHighestFunctionEndingAddress;
1173     DWORD                       ReservedNumberOfFpoTableEntries;
1174     PFPO_DATA                   ReservedFpoTableEntries;
1175     DWORD                       SizeOfCoffSymbols;
1176     PIMAGE_COFF_SYMBOLS_HEADER  CoffSymbols;
1177     DWORD                       ReservedSizeOfCodeViewSymbols;
1178     PVOID                       ReservedCodeViewSymbols;
1179     PSTR                        ImageFilePath;
1180     PSTR                        ImageFileName;
1181     PSTR                        ReservedDebugFilePath;
1182     DWORD                       ReservedTimeDateStamp;
1183     BOOL                        ReservedRomImage;
1184     PIMAGE_DEBUG_DIRECTORY      ReservedDebugDirectory;
1185     DWORD                       ReservedNumberOfDebugDirectories;
1186     DWORD                       ReservedOriginalFunctionTableBaseAddress;
1187     DWORD                       Reserved[ 2 ];
1188 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
1189
1190
1191 PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PSTR, PSTR, DWORD);
1192
1193 BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
1194
1195 DWORD   WINAPI  SymGetOptions(void);
1196 DWORD   WINAPI  SymSetOptions(DWORD);
1197
1198 BOOL WINAPI SymSetParentWindow(HWND);
1199
1200 /*************************
1201  * Version, global stuff *
1202  *************************/
1203
1204 typedef BOOL     (WINAPI* PSYMBOLSERVERPROC)(LPCSTR, LPCSTR, PVOID, DWORD, DWORD, LPSTR);
1205 typedef BOOL     (WINAPI* PSYMBOLSERVEROPENPROC)(void);
1206 typedef BOOL     (WINAPI* PSYMBOLSERVERCLOSEPROC)(void);
1207 typedef BOOL     (WINAPI* PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR, ULONG64);
1208 typedef BOOL     (CALLBACK* PSYMBOLSERVERCALLBACKPROC)(UINT_PTR, ULONG64, ULONG64);
1209 typedef UINT_PTR (WINAPI* PSYMBOLSERVERGETOPTIONSPROC)(void);
1210 typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROC)(LPCSTR);
1211
1212 #define SSRVOPT_CALLBACK            0x0001
1213 #define SSRVOPT_DWORD               0x0002
1214 #define SSRVOPT_DWORDPTR            0x0004
1215 #define SSRVOPT_GUIDPTR             0x0008
1216 #define SSRVOPT_OLDGUIDPTR          0x0010
1217 #define SSRVOPT_UNATTENDED          0x0020
1218 #define SSRVOPT_NOCOPY              0x0040
1219 #define SSRVOPT_PARENTWIN           0x0080
1220 #define SSRVOPT_PARAMTYPE           0x0100
1221 #define SSRVOPT_SECURE              0x0200
1222 #define SSRVOPT_TRACE               0x0400
1223 #define SSRVOPT_SETCONTEXT          0x0800
1224 #define SSRVOPT_PROXY               0x1000
1225 #define SSRVOPT_DOWNSTREAM_STORE    0x2000
1226 #define SSRVOPT_RESET               ((ULONG_PTR)-1)
1227
1228 #define SSRVACTION_TRACE        1
1229 #define SSRVACTION_QUERYCANCEL  2
1230 #define SSRVACTION_EVENT        3
1231
1232 #ifdef __cplusplus
1233 } /* extern "C" */
1234 #endif /* defined(__cplusplus) */
1235
1236 #endif  /* __WINE_DBGHELP_H */