Added support for 'loading' virtual modules.
[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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 #define SYMF_OMAP_GENERATED   0x00000001
64 #define SYMF_OMAP_MODIFIED    0x00000002
65 #define SYMF_USER_GENERATED   0x00000004
66 #define SYMF_REGISTER         0x00000008
67 #define SYMF_REGREL           0x00000010
68 #define SYMF_FRAMEREL         0x00000020
69 #define SYMF_PARAMETER        0x00000040
70 #define SYMF_LOCAL            0x00000080
71 #define SYMF_CONSTANT         0x00000100
72 #define SYMF_EXPORT           0x00000200
73 #define SYMF_FORWARDER        0x00000400
74 #define SYMF_FUNCTION         0x00000800
75 #define SYMF_VIRTUAL          0x00001000
76 #define SYMF_THUNK            0x00002000
77 #define SYMF_TLSREL           0x00004000
78
79 typedef enum 
80 {
81     SymNone = 0,
82     SymCoff,
83     SymCv,
84     SymPdb,
85     SymExport,
86     SymDeferred,
87     SymSym,
88     SymDia,
89     NumSymTypes
90 } SYM_TYPE;
91
92 typedef struct _IMAGEHLP_SYMBOL
93 {
94     DWORD                       SizeOfStruct;
95     DWORD                       Address;
96     DWORD                       Size;
97     DWORD                       Flags;
98     DWORD                       MaxNameLength;
99     CHAR                        Name[1];
100 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
101
102 typedef struct _IMAGEHLP_MODULE
103 {
104     DWORD                       SizeOfStruct;
105     DWORD                       BaseOfImage;
106     DWORD                       ImageSize;
107     DWORD                       TimeDateStamp;
108     DWORD                       CheckSum;
109     DWORD                       NumSyms;
110     SYM_TYPE                    SymType;
111     CHAR                        ModuleName[32];
112     CHAR                        ImageName[256];
113     CHAR                        LoadedImageName[256];
114 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
115
116 typedef struct _IMAGEHLP_MODULEW
117 {
118     DWORD                       SizeOfStruct;
119     DWORD                       BaseOfImage;
120     DWORD                       ImageSize;
121     DWORD                       TimeDateStamp;
122     DWORD                       CheckSum;
123     DWORD                       NumSyms;
124     SYM_TYPE                    SymType;
125     WCHAR                       ModuleName[32];
126     WCHAR                       ImageName[256];
127     WCHAR                       LoadedImageName[256];
128 } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
129
130 typedef struct _IMAGEHLP_MODULE64
131 {
132     DWORD                       SizeOfStruct;
133     DWORD64                     BaseOfImage;
134     DWORD                       ImageSize;
135     DWORD                       TimeDateStamp;
136     DWORD                       CheckSum;
137     DWORD                       NumSyms;
138     SYM_TYPE                    SymType;
139     CHAR                        ModuleName[32];
140     CHAR                        ImageName[256];
141     CHAR                        LoadedImageName[256];
142     CHAR                        LoadedPdbName[256];
143     DWORD                       CVSig;
144     CHAR                        CVData[MAX_PATH*3];
145     DWORD                       PdbSig;
146     GUID                        PdbSig70;
147     DWORD                       PdbAge;
148     BOOL                        PdbUnmatched;
149     BOOL                        DbgUnmatched;
150     BOOL                        LineNumbers;
151     BOOL                        GlobalSymbols;
152     BOOL                        TypeInfo;
153     BOOL                        SourceIndexed;
154     BOOL                        Publics;
155 } IMAGEHLP_MODULE64, *PIMAGEHLP_MODULE64;
156
157 typedef struct _IMAGEHLP_LINE
158 {
159     DWORD                       SizeOfStruct;
160     PVOID                       Key;
161     DWORD                       LineNumber;
162     PCHAR                       FileName;
163     DWORD                       Address;
164 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
165
166 typedef struct _IMAGEHLP_LINE64
167 {
168     DWORD                       SizeOfStruct;
169     PVOID                       Key;
170     DWORD                       LineNumber;
171     PCHAR                       FileName;
172     DWORD64                     Address;
173 } IMAGEHLP_LINE64, *PIMAGEHLP_LINE64;
174
175 typedef struct _SOURCEFILE
176 {
177     DWORD64                     ModBase;
178     PCHAR                       FileName;
179 } SOURCEFILE, *PSOURCEFILE;
180
181 #define CBA_DEFERRED_SYMBOL_LOAD_START          0x00000001
182 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE       0x00000002
183 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE        0x00000003
184 #define CBA_SYMBOLS_UNLOADED                    0x00000004
185 #define CBA_DUPLICATE_SYMBOL                    0x00000005
186 #define CBA_READ_MEMORY                         0x00000006
187 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL         0x00000007
188 #define CBA_SET_OPTIONS                         0x00000008
189 #define CBA_EVENT                               0x00000010
190 #define CBA_DEBUG_INFO                          0x10000000
191
192 typedef struct _IMAGEHLP_CBA_READ_MEMORY
193 {
194     DWORD64   addr;
195     PVOID     buf;
196     DWORD     bytes;
197     DWORD    *bytesread;
198 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
199
200 enum
201 {
202     sevInfo = 0,
203     sevProblem,
204     sevAttn,
205     sevFatal,
206     sevMax
207 };
208
209 typedef struct _IMAGEHLP_CBA_EVENT
210 {
211     DWORD       severity;
212     DWORD       code;
213     PCHAR       desc;
214     PVOID       object;
215 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
216
217 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
218 {
219     DWORD                       SizeOfStruct;
220     DWORD                       BaseOfImage;
221     DWORD                       CheckSum;
222     DWORD                       TimeDateStamp;
223     CHAR                        FileName[MAX_PATH];
224     BOOLEAN                     Reparse;
225 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
226
227 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
228 {
229     DWORD                       SizeOfStruct;
230     DWORD                       NumberOfDups;
231     PIMAGEHLP_SYMBOL            Symbol;
232     DWORD                       SelectedSymbol;
233 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
234
235 #define SYMOPT_CASE_INSENSITIVE         0x00000001
236 #define SYMOPT_UNDNAME                  0x00000002
237 #define SYMOPT_DEFERRED_LOADS           0x00000004
238 #define SYMOPT_NO_CPP                   0x00000008
239 #define SYMOPT_LOAD_LINES               0x00000010
240 #define SYMOPT_OMAP_FIND_NEAREST        0x00000020
241 #define SYMOPT_LOAD_ANYTHING            0x00000040
242 #define SYMOPT_IGNORE_CVREC             0x00000080
243 #define SYMOPT_NO_UNQUALIFIED_LOADS     0x00000100
244 #define SYMOPT_FAIL_CRITICAL_ERRORS     0x00000200
245 #define SYMOPT_EXACT_SYMBOLS            0x00000400
246 #define SYMOPT_WILD_UNDERSCORE          0x00000800
247 #define SYMOPT_USE_DEFAULTS             0x00001000
248 #define SYMOPT_INCLUDE_32BIT_MODULES    0x00002000
249 #define SYMOPT_PUBLICS_ONLY             0x00004000
250 #define SYMOPT_NO_PUBLICS               0x00008000
251 #define SYMOPT_AUTO_PUBLICS             0x00010000
252 #define SYMOPT_NO_IMAGE_SEARCH          0x00020000
253 #define SYMOPT_SECURE                   0x00040000
254 #define SYMOPT_NO_PROMPTS               0x00080000
255
256 #define SYMOPT_DEBUG                    0x80000000
257
258 typedef struct _IMAGEHLP_STACK_FRAME
259 {
260     ULONG64     InstructionOffset;
261     ULONG64     ReturnOffset;
262     ULONG64     FrameOffset;
263     ULONG64     StackOffset;
264     ULONG64     BackingStoreOffset;
265     ULONG64     FuncTableEntry;
266     ULONG64     Params[4];
267     ULONG64     Reserved[5];
268     BOOL        Virtual;
269     ULONG       Reserved2;
270 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
271
272 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
273
274 #define DBHHEADER_DEBUGDIRS     0x1
275 typedef struct _DBGHELP_MODLOAD_DATA
276 {
277     DWORD               ssize;
278     DWORD               ssig;
279     PVOID               data;
280     DWORD               size;
281     DWORD               flags;
282 } MODLOAD_DATA, *PMODLOAD_DATA;
283
284 /*************************
285  *       MiniDUMP        *
286  *************************/
287
288 /* DebugHelp */
289
290 #define MINIDUMP_SIGNATURE 0x504D444D /* 'MDMP' */
291 #define MINIDUMP_VERSION   (42899)
292
293 typedef DWORD   RVA;
294 typedef ULONG64 RVA64;
295
296 typedef enum _MINIDUMP_TYPE 
297 {
298     MiniDumpNormal                              = 0x0000,
299     MiniDumpWithDataSegs                        = 0x0001,
300     MiniDumpWithFullMemory                      = 0x0002,
301     MiniDumpWithHandleData                      = 0x0004,
302     MiniDumpFilterMemory                        = 0x0008,
303     MiniDumpScanMemory                          = 0x0010,
304     MiniDumpWithUnloadedModules                 = 0x0020,
305     MiniDumpWithIndirectlyReferencedMemory      = 0x0040,
306     MiniDumpFilterModulePaths                   = 0x0080,
307     MiniDumpWithProcessThreadData               = 0x0100,
308     MiniDumpWithPrivateReadWriteMemory          = 0x0200,
309     MiniDumpWithoutOptionalData                 = 0x0400,
310     MiniDumpWithFullMemoryInfo                  = 0x0800,
311     MiniDumpWithThreadInfo                      = 0x1000,
312     MiniDumpWithCodeSegs                        = 0x2000
313 } MINIDUMP_TYPE;
314
315 typedef enum _MINIDUMP_CALLBACK_TYPE
316 {
317     ModuleCallback,
318     ThreadCallback,
319     ThreadExCallback,
320     IncludeThreadCallback,
321     IncludeModuleCallback,
322     MemoryCallback,
323 } MINIDUMP_CALLBACK_TYPE;
324
325 typedef struct _MINIDUMP_THREAD_CALLBACK
326 {
327     ULONG                       ThreadId;
328     HANDLE                      ThreadHandle;
329     CONTEXT                     Context;
330     ULONG                       SizeOfContext;
331     ULONG64                     StackBase;
332     ULONG64                     StackEnd;
333 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
334
335 typedef struct _MINIDUMP_THREAD_EX_CALLBACK 
336 {
337     ULONG                       ThreadId;
338     HANDLE                      ThreadHandle;
339     CONTEXT                     Context;
340     ULONG                       SizeOfContext;
341     ULONG64                     StackBase;
342     ULONG64                     StackEnd;
343     ULONG64                     BackingStoreBase;
344     ULONG64                     BackingStoreEnd;
345 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
346
347 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
348 {
349     ULONG ThreadId;
350 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
351
352 typedef enum _THREAD_WRITE_FLAGS 
353 {
354     ThreadWriteThread            = 0x0001,
355     ThreadWriteStack             = 0x0002,
356     ThreadWriteContext           = 0x0004,
357     ThreadWriteBackingStore      = 0x0008,
358     ThreadWriteInstructionWindow = 0x0010,
359     ThreadWriteThreadData        = 0x0020,
360     ThreadWriteThreadInfo        = 0x0040
361 } THREAD_WRITE_FLAGS;
362
363 typedef struct _MINIDUMP_MODULE_CALLBACK 
364 {
365     PWCHAR                      FullPath;
366     ULONG64                     BaseOfImage;
367     ULONG                       SizeOfImage;
368     ULONG                       CheckSum;
369     ULONG                       TimeDateStamp;
370     VS_FIXEDFILEINFO            VersionInfo;
371     PVOID                       CvRecord;
372     ULONG                       SizeOfCvRecord;
373     PVOID                       MiscRecord;
374     ULONG                       SizeOfMiscRecord;
375 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
376
377 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK 
378 {
379     ULONG64 BaseOfImage;
380 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
381
382 typedef enum _MODULE_WRITE_FLAGS 
383 {
384     ModuleWriteModule        = 0x0001,
385     ModuleWriteDataSeg       = 0x0002,
386     ModuleWriteMiscRecord    = 0x0004,
387     ModuleWriteCvRecord      = 0x0008,
388     ModuleReferencedByMemory = 0x0010,
389     ModuleWriteTlsData       = 0x0020,
390     ModuleWriteCodeSegs      = 0x0040,
391 } MODULE_WRITE_FLAGS;
392
393 typedef struct _MINIDUMP_CALLBACK_INPUT 
394 {
395     ULONG                       ProcessId;
396     HANDLE                      ProcessHandle;
397     ULONG                       CallbackType;
398     union 
399     {
400         MINIDUMP_THREAD_CALLBACK        Thread;
401         MINIDUMP_THREAD_EX_CALLBACK     ThreadEx;
402         MINIDUMP_MODULE_CALLBACK        Module;
403         MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
404         MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
405     } DUMMYUNIONNAME;
406 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
407
408 typedef struct _MINIDUMP_CALLBACK_OUTPUT
409 {
410     union 
411     {
412         ULONG                           ModuleWriteFlags;
413         ULONG                           ThreadWriteFlags;
414         struct
415         {
416             ULONG64                     MemoryBase;
417             ULONG                       MemorySize;
418         } DUMMYSTRUCTNAME;
419     } DUMMYUNIONNAME;
420 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
421
422 typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID, const PMINIDUMP_CALLBACK_INPUT, PMINIDUMP_CALLBACK_OUTPUT);
423
424 typedef struct _MINIDUMP_CALLBACK_INFORMATION 
425 {
426     MINIDUMP_CALLBACK_ROUTINE   CallbackRoutine;
427     void*                       CallbackParam;
428 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
429
430 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR 
431 {
432     ULONG                       DataSize;
433     RVA                         Rva;
434 } MINIDUMP_LOCATION_DESCRIPTOR;
435
436 typedef struct _MINIDUMP_DIRECTORY 
437 {
438     ULONG                       StreamType;
439     MINIDUMP_LOCATION_DESCRIPTOR Location;
440 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
441
442 typedef struct _MINIDUMP_EXCEPTION
443 {
444     ULONG                       ExceptionCode;
445     ULONG                       ExceptionFlags;
446     ULONG64                     ExceptionRecord;
447     ULONG64                     ExceptionAddress;
448     ULONG                       NumberParameters;
449     ULONG                        __unusedAlignment;
450     ULONG64                     ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
451 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
452
453 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
454 {
455     DWORD                       ThreadId;
456     PEXCEPTION_POINTERS         ExceptionPointers;
457     BOOL                        ClientPointers;
458 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
459
460 typedef struct MINIDUMP_EXCEPTION_STREAM 
461 {
462     ULONG                       ThreadId;
463     ULONG                       __alignment;
464     MINIDUMP_EXCEPTION          ExceptionRecord;
465     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
466 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
467
468 typedef struct _MINIDUMP_HEADER 
469 {
470     DWORD                       Signature;
471     DWORD                       Version;
472     DWORD                       NumberOfStreams;
473     RVA                         StreamDirectoryRva;
474     DWORD                       CheckSum;
475     union 
476     {
477         DWORD                           Reserved;
478         DWORD                           TimeDateStamp;
479     } DUMMYUNIONNAME;
480     ULONG64                     Flags;
481 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
482
483 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR 
484 {
485     ULONG64                     StartOfMemoryRange;
486     MINIDUMP_LOCATION_DESCRIPTOR Memory;
487 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
488
489 typedef struct _MINIDUMP_MEMORY_LIST
490 {
491     ULONG                       NumberOfMemoryRanges;
492     MINIDUMP_MEMORY_DESCRIPTOR  MemoryRanges[1]; /* FIXME: 0-sized array not supported */
493 } MINIDUMP_MEMORY_LIST, *PMINIDUMP_MEMORY_LIST;
494
495 #define MINIDUMP_MISC1_PROCESS_ID       0x00000001
496 #define MINIDUMP_MISC1_PROCESS_TIMES    0x00000002
497
498 typedef struct _MINIDUMP_MISC_INFO
499 {
500     ULONG                       SizeOfInfo;
501     ULONG                       Flags1;
502     ULONG                       ProcessId;
503     ULONG                       ProcessCreateTime;
504     ULONG                       ProcessUserTime;
505     ULONG                       ProcessKernelTime;
506 } MINIDUMP_MISC_INFO, *PMINIDUMP_MISC_INFO;
507
508 typedef struct _MINIDUMP_MODULE
509 {
510     ULONG64                     BaseOfImage;
511     ULONG                       SizeOfImage;
512     ULONG                       CheckSum;
513     ULONG                       TimeDateStamp;
514     RVA                         ModuleNameRva;
515     VS_FIXEDFILEINFO            VersionInfo;
516     MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
517     MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
518     ULONG64                     Reserved0;
519     ULONG64                     Reserved1;
520 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
521
522 typedef struct _MINIDUMP_MODULE_LIST 
523 {
524     ULONG                       NumberOfModules;
525     MINIDUMP_MODULE             Modules[1]; /* FIXME: 0-sized array not supported */
526 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
527
528 typedef struct _MINIDUMP_STRING
529 {
530     ULONG                       Length;
531     WCHAR                       Buffer[1]; /* FIXME: O-sized array not supported */
532 } MINIDUMP_STRING, *PMINIDUMP_STRING;
533
534 typedef struct _MINIDUMP_SYSTEM_INFO
535 {
536     USHORT                      ProcessorArchitecture;
537     USHORT                      ProcessorLevel;
538     USHORT                      ProcessorRevision;
539     union
540     {
541         USHORT                          Reserved0;
542         struct
543         {
544             UCHAR                       NumberOfProcessors;
545             UCHAR                       ProductType;
546         } DUMMYSTRUCTNAME;
547     } DUMMYUNIONNAME;
548
549     ULONG                       MajorVersion;
550     ULONG                       MinorVersion;
551     ULONG                       BuildNumber;
552     ULONG                       PlatformId;
553
554     RVA                         CSDVersionRva;
555     union
556     {
557         ULONG                           Reserved1;
558         struct
559         {
560             USHORT                      SuiteMask;
561             USHORT                      Reserved2;
562         } DUMMYSTRUCTNAME;
563     } DUMMYUNIONNAME1;
564     union _CPU_INFORMATION 
565     {
566         struct 
567         {
568             ULONG                       VendorId[3];
569             ULONG                       VersionInformation;
570             ULONG                       FeatureInformation;
571             ULONG                       AMDExtendedCpuFeatures;
572         } X86CpuInfo;
573         struct 
574         {
575             ULONG64                     ProcessorFeatures[2];
576         } OtherCpuInfo;
577     } Cpu;
578
579 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
580
581 typedef struct _MINIDUMP_THREAD
582 {
583     ULONG                       ThreadId;
584     ULONG                       SuspendCount;
585     ULONG                       PriorityClass;
586     ULONG                       Priority;
587     ULONG64                     Teb;
588     MINIDUMP_MEMORY_DESCRIPTOR  Stack;
589     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
590 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
591
592 typedef struct _MINIDUMP_THREAD_LIST
593 {
594     ULONG                       NumberOfThreads;
595     MINIDUMP_THREAD             Threads[1]; /* FIXME: no support of 0 sized array */
596 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
597
598 typedef struct _MINIDUMP_USER_STREAM
599 {
600     ULONG                       Type;
601     ULONG                       BufferSize;
602     void*                       Buffer;
603 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
604
605 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
606 {
607     ULONG                       UserStreamCount;
608     PMINIDUMP_USER_STREAM       UserStreamArray;
609 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
610
611 typedef enum _MINIDUMP_STREAM_TYPE
612 {
613     UnusedStream                = 0,
614     ReservedStream0             = 1,
615     ReservedStream1             = 2,
616     ThreadListStream            = 3,
617     ModuleListStream            = 4,
618     MemoryListStream            = 5,
619     ExceptionStream             = 6,
620     SystemInfoStream            = 7,
621     ThreadExListStream          = 8,
622     Memory64ListStream          = 9,
623     CommentStreamA              = 10,
624     CommentStreamW              = 11,
625     HandleDataStream            = 12,
626     FunctionTableStream         = 13,
627     UnloadedModuleListStream    = 14,
628     MiscInfoStream              = 15,
629     MemoryInfoListStream        = 16,
630     ThreadInfoListStream        = 17,
631
632     LastReservedStream          = 0xffff
633 } MINIDUMP_STREAM_TYPE;
634
635 BOOL WINAPI MiniDumpWriteDump(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE,
636                               const PMINIDUMP_EXCEPTION_INFORMATION,
637                               const PMINIDUMP_USER_STREAM_INFORMATION,
638                               const PMINIDUMP_CALLBACK_INFORMATION);
639 BOOL WINAPI MiniDumpReadDumpStream(PVOID, ULONG, PMINIDUMP_DIRECTORY*, PVOID*,
640                                    ULONG*);
641
642
643 /*************************
644  *    MODULE handling    *
645  *************************/
646
647 /* flags for SymLoadModuleEx */
648 #define SLMFLAG_VIRTUAL         0x1
649 #define SLMFLAG_NO_SYMBOLS      0x4
650
651 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
652 BOOL   WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
653 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR, DWORD, PVOID);
654 BOOL    WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
655 BOOL    WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
656 BOOL    WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
657 BOOL    WINAPI SymGetModuleInfo64(HANDLE, DWORD64, PIMAGEHLP_MODULE64);
658 DWORD   WINAPI SymGetModuleBase(HANDLE, DWORD);
659 DWORD   WINAPI SymLoadModule(HANDLE, HANDLE, PSTR, PSTR, DWORD, DWORD);
660 DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD,
661                                PMODLOAD_DATA, DWORD);
662 BOOL    WINAPI SymUnloadModule(HANDLE, DWORD);
663 BOOL    WINAPI SymUnloadModule64(HANDLE, DWORD64);
664
665 /*************************
666  *    Symbol Handling    *
667  *************************/
668
669 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT          1
670 #define IMAGEHLP_SYMBOL_INFO_REGISTER              SYMF_REGISTER        /*  0x08 */
671 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE           SYMF_REGREL          /*  0x10 */
672 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE         SYMF_FRAMEREL        /*  0x20 */
673 #define IMAGEHLP_SYMBOL_INFO_PARAMETER             SYMF_PARAMETER       /*  0x40 */
674 #define IMAGEHLP_SYMBOL_INFO_LOCAL                 SYMF_LOCAL           /*  0x80 */
675 #define IMAGEHLP_SYMBOL_INFO_CONSTANT              SYMF_CONSTANT        /* 0x100 */
676 #define IMAGEHLP_SYMBOL_FUNCTION                   SYMF_FUNCTION        /* 0x800 */
677
678 #define SYMFLAG_VALUEPRESENT     0x00000001
679 #define SYMFLAG_REGISTER         0x00000008
680 #define SYMFLAG_REGREL           0x00000010
681 #define SYMFLAG_FRAMEREL         0x00000020
682 #define SYMFLAG_PARAMETER        0x00000040
683 #define SYMFLAG_LOCAL            0x00000080
684 #define SYMFLAG_CONSTANT         0x00000100
685 #define SYMFLAG_EXPORT           0x00000200
686 #define SYMFLAG_FORWARDER        0x00000400
687 #define SYMFLAG_FUNCTION         0x00000800
688 #define SYMFLAG_VIRTUAL          0x00001000
689 #define SYMFLAG_THUNK            0x00002000
690 #define SYMFLAG_TLSREL           0x00004000
691
692 typedef struct _SYMBOL_INFO
693 {
694     ULONG       SizeOfStruct;
695     ULONG       TypeIndex;
696     ULONG64     Reserved[2];
697     ULONG       info;   /* sdk states info, while MSDN says it's Index... */
698     ULONG       Size;
699     ULONG64     ModBase;
700     ULONG       Flags;
701     ULONG64     Value;
702     ULONG64     Address;
703     ULONG       Register;
704     ULONG       Scope;
705     ULONG       Tag;
706     ULONG       NameLen;
707     ULONG       MaxNameLen;
708     CHAR        Name[1];
709 } SYMBOL_INFO, *PSYMBOL_INFO;
710
711 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO 
712 {
713     TI_GET_SYMTAG,
714     TI_GET_SYMNAME,
715     TI_GET_LENGTH,
716     TI_GET_TYPE,
717     TI_GET_TYPEID,
718     TI_GET_BASETYPE,
719     TI_GET_ARRAYINDEXTYPEID,
720     TI_FINDCHILDREN,
721     TI_GET_DATAKIND,
722     TI_GET_ADDRESSOFFSET,
723     TI_GET_OFFSET,
724     TI_GET_VALUE,
725     TI_GET_COUNT,
726     TI_GET_CHILDRENCOUNT,
727     TI_GET_BITPOSITION,
728     TI_GET_VIRTUALBASECLASS,
729     TI_GET_VIRTUALTABLESHAPEID,
730     TI_GET_VIRTUALBASEPOINTEROFFSET,
731     TI_GET_CLASSPARENTID,
732     TI_GET_NESTED,
733     TI_GET_SYMINDEX,
734     TI_GET_LEXICALPARENT,
735     TI_GET_ADDRESS,
736     TI_GET_THISADJUST,
737     TI_GET_UDTKIND,
738     TI_IS_EQUIV_TO,
739     TI_GET_CALLING_CONVENTION,
740 } IMAGEHLP_SYMBOL_TYPE_INFO;
741
742 typedef struct _TI_FINDCHILDREN_PARAMS 
743 {
744     ULONG Count;
745     ULONG Start;
746     ULONG ChildId[1];
747 } TI_FINDCHILDREN_PARAMS;
748
749 #define UNDNAME_COMPLETE                 (0x0000)
750 #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001)
751 #define UNDNAME_NO_MS_KEYWORDS           (0x0002)
752 #define UNDNAME_NO_FUNCTION_RETURNS      (0x0004)
753 #define UNDNAME_NO_ALLOCATION_MODEL      (0x0008)
754 #define UNDNAME_NO_ALLOCATION_LANGUAGE   (0x0010)
755 #define UNDNAME_NO_MS_THISTYPE           (0x0020)
756 #define UNDNAME_NO_CV_THISTYPE           (0x0040)
757 #define UNDNAME_NO_THISTYPE              (0x0060)
758 #define UNDNAME_NO_ACCESS_SPECIFIERS     (0x0080)
759 #define UNDNAME_NO_THROW_SIGNATURES      (0x0100)
760 #define UNDNAME_NO_MEMBER_TYPE           (0x0200)
761 #define UNDNAME_NO_RETURN_UDT_MODEL      (0x0400)
762 #define UNDNAME_32_BIT_DECODE            (0x0800)
763 #define UNDNAME_NAME_ONLY                (0x1000)
764 #define UNDNAME_NO_ARGUMENTS             (0x2000)
765 #define UNDNAME_NO_SPECIAL_SYMS          (0x4000)
766
767 BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
768 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
769 BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
770 BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
771 BOOL WINAPI SymFromName(HANDLE, LPSTR, PSYMBOL_INFO);
772 BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
773 BOOL WINAPI SymGetSymFromName(HANDLE, PSTR, PIMAGEHLP_SYMBOL);
774 BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, LPSTR, PSYMBOL_INFO);
775 BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
776 BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
777 BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK,
778                            PVOID);
779 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
780 BOOL WINAPI SymEnumerateSymbols(HANDLE, DWORD, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
781 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
782 BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
783 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK64)(HANDLE, ULONG, ULONG64, ULONG64);
784 BOOL WINAPI SymRegisterCallback64(HANDLE, PSYMBOL_REGISTERED_CALLBACK64, ULONG64);
785 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
786 DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD);
787
788 /*************************
789  *      Source Files     *
790  *************************/
791 typedef BOOL (CALLBACK *PSYM_ENUMSOURCEFILES_CALLBACK)(PSOURCEFILE, PVOID);
792
793 BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, LPSTR, PSYM_ENUMSOURCEFILES_CALLBACK,
794                                PVOID);
795 BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
796 BOOL WINAPI SymGetLineFromAddr64(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
797 BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
798 BOOL WINAPI SymGetLinePrev64(HANDLE, PIMAGEHLP_LINE64);
799 BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
800 BOOL WINAPI SymGetLineNext64(HANDLE, PIMAGEHLP_LINE64);
801
802 typedef struct _SRCCODEINFO
803 {
804     DWORD       SizeOfStruct;
805     PVOID       Key;
806     DWORD64     ModBase;
807     char        Obj[MAX_PATH+1];
808     char        FileName[MAX_PATH+1];
809     DWORD       LineNumber;
810     DWORD64     Address;
811 } SRCCODEINFO, *PSRCCODEINFO;
812
813 typedef BOOL (CALLBACK* PSYM_ENUMLINES_CALLBACK)(PSRCCODEINFO, PVOID);
814 BOOL WINAPI SymEnumLines(HANDLE, ULONG64, PCSTR, PCSTR, PSYM_ENUMLINES_CALLBACK, PVOID);
815
816 /*************************
817  * File & image handling *
818  *************************/
819 BOOL WINAPI SymInitialize(HANDLE, PSTR, BOOL);
820 BOOL WINAPI SymCleanup(HANDLE);
821
822 HANDLE WINAPI FindDebugInfoFile(PSTR, PSTR, PSTR);
823 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
824 HANDLE WINAPI FindDebugInfoFileEx(PSTR, PSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
825 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR, PVOID);
826 BOOL WINAPI SymFindFileInPath(HANDLE, LPSTR, LPSTR, PVOID, DWORD, DWORD, DWORD,
827                               LPSTR, PFINDFILEINPATHCALLBACK, PVOID);
828 HANDLE WINAPI FindExecutableImage(PSTR, PSTR, PSTR);
829 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
830 HANDLE WINAPI FindExecutableImageEx(PSTR, PSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
831 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
832 PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
833                                          PIMAGE_SECTION_HEADER *);
834 PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
835 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
836 PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
837 BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
838 BOOL WINAPI SymSetSearchPath(HANDLE, PSTR);
839 DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
840 BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
841 BOOL WINAPI SearchTreeForFile(PSTR, PSTR, PSTR);
842 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR, PVOID);
843 BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, LPSTR, PENUMDIRTREE_CALLBACK, void*);
844 BOOL WINAPI SymMatchFileName(LPSTR, LPSTR, LPSTR*, LPSTR*);
845
846 /*************************
847  *   Context management  *
848  *************************/
849 BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
850
851
852 /*************************
853  *    Stack management   *
854  *************************/
855
856 typedef struct _KDHELP
857 {
858     DWORD       Thread;
859     DWORD       ThCallbackStack;
860     DWORD       NextCallback;
861     DWORD       FramePointer;
862     DWORD       KiCallUserMode;
863     DWORD       KeUserCallbackDispatcher;
864     DWORD       SystemRangeStart;
865 } KDHELP, *PKDHELP;
866
867 typedef struct _STACKFRAME
868 {
869     ADDRESS     AddrPC;
870     ADDRESS     AddrReturn;
871     ADDRESS     AddrFrame;
872     ADDRESS     AddrStack;
873     PVOID       FuncTableEntry;
874     DWORD       Params[4];
875     BOOL        Far;
876     BOOL        Virtual;
877     DWORD       Reserved[3];
878     KDHELP      KdHelp;
879     ADDRESS     AddrBStore;
880 } STACKFRAME, *LPSTACKFRAME;
881
882 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)
883     (HANDLE, DWORD, PVOID, DWORD, PDWORD);
884 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
885 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
886 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
887 BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID,
888                       PREAD_PROCESS_MEMORY_ROUTINE,
889                       PFUNCTION_TABLE_ACCESS_ROUTINE,
890                       PGET_MODULE_BASE_ROUTINE,
891                       PTRANSLATE_ADDRESS_ROUTINE);
892
893 PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
894
895 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK)(HANDLE, DWORD, PVOID);
896 typedef PVOID (CALLBACK *PSYMBOL_FUNCENTRY_CALLBACK64)(HANDLE, ULONG64, ULONG64);
897
898 BOOL WINAPI SymRegisterFunctionEntryCallback(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK, PVOID);
899 BOOL WINAPI SymRegisterFunctionEntryCallback64(HANDLE, PSYMBOL_FUNCENTRY_CALLBACK64, ULONG64);
900
901 /*************************
902  * Version, global stuff *
903  *************************/
904
905 typedef struct API_VERSION
906 {
907     USHORT  MajorVersion;
908     USHORT  MinorVersion;
909     USHORT  Revision;
910     USHORT  Reserved;
911 } API_VERSION, *LPAPI_VERSION;
912
913 LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
914 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
915
916 typedef struct _IMAGE_DEBUG_INFORMATION
917 {
918     LIST_ENTRY                  List;
919     DWORD                       ReservedSize;
920     PVOID                       ReservedMappedBase;
921     USHORT                      ReservedMachine;
922     USHORT                      ReservedCharacteristics;
923     DWORD                       ReservedCheckSum;
924     DWORD                       ImageBase;
925     DWORD                       SizeOfImage;
926     DWORD                       ReservedNumberOfSections;
927     PIMAGE_SECTION_HEADER       ReservedSections;
928     DWORD                       ReservedExportedNamesSize;
929     PSTR                        ReservedExportedNames;
930     DWORD                       ReservedNumberOfFunctionTableEntries;
931     PIMAGE_FUNCTION_ENTRY       ReservedFunctionTableEntries;
932     DWORD                       ReservedLowestFunctionStartingAddress;
933     DWORD                       ReservedHighestFunctionEndingAddress;
934     DWORD                       ReservedNumberOfFpoTableEntries;
935     PFPO_DATA                   ReservedFpoTableEntries;
936     DWORD                       SizeOfCoffSymbols;
937     PIMAGE_COFF_SYMBOLS_HEADER  CoffSymbols;
938     DWORD                       ReservedSizeOfCodeViewSymbols;
939     PVOID                       ReservedCodeViewSymbols;
940     PSTR                        ImageFilePath;
941     PSTR                        ImageFileName;
942     PSTR                        ReservedDebugFilePath;
943     DWORD                       ReservedTimeDateStamp;
944     BOOL                        ReservedRomImage;
945     PIMAGE_DEBUG_DIRECTORY      ReservedDebugDirectory;
946     DWORD                       ReservedNumberOfDebugDirectories;
947     DWORD                       ReservedOriginalFunctionTableBaseAddress;
948     DWORD                       Reserved[ 2 ];
949 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
950
951
952 PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PSTR, PSTR, DWORD);
953
954 BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
955
956 DWORD   WINAPI  SymGetOptions(void);
957 DWORD   WINAPI  SymSetOptions(DWORD);
958
959 BOOL WINAPI SymSetParentWindow(HWND hwnd);
960
961 /* Symbol server bits */
962 typedef BOOL     (WINAPI* PSYMBOLSERVERPROC)(LPCSTR, LPCSTR, PVOID, DWORD, DWORD, LPSTR);
963 typedef BOOL     (WINAPI* PSYMBOLSERVEROPENPROC)(void);
964 typedef BOOL     (WINAPI* PSYMBOLSERVERCLOSEPROC)(void);
965 typedef BOOL     (WINAPI* PSYMBOLSERVERSETOPTIONSPROC)(UINT_PTR, ULONG64);
966 typedef BOOL     (CALLBACK* PSYMBOLSERVERCALLBACKPROC)(UINT_PTR, ULONG64, ULONG64);
967 typedef UINT_PTR (WINAPI* PSYMBOLSERVERGETOPTIONSPROC)(void);
968 typedef BOOL     (WINAPI* PSYMBOLSERVERPINGPROC)(LPCSTR);
969
970 #define SSRVOPT_CALLBACK            0x0001
971 #define SSRVOPT_DWORD               0x0002
972 #define SSRVOPT_DWORDPTR            0x0004
973 #define SSRVOPT_GUIDPTR             0x0008
974 #define SSRVOPT_OLDGUIDPTR          0x0010
975 #define SSRVOPT_UNATTENDED          0x0020
976 #define SSRVOPT_NOCOPY              0x0040
977 #define SSRVOPT_PARENTWIN           0x0080
978 #define SSRVOPT_PARAMTYPE           0x0100
979 #define SSRVOPT_SECURE              0x0200
980 #define SSRVOPT_TRACE               0x0400
981 #define SSRVOPT_SETCONTEXT          0x0800
982 #define SSRVOPT_PROXY               0x1000
983 #define SSRVOPT_DOWNSTREAM_STORE    0x2000
984 #define SSRVOPT_RESET               ((ULONG_PTR)-1)
985
986 #define SSRVACTION_TRACE        1
987 #define SSRVACTION_QUERYCANCEL  2
988 #define SSRVACTION_EVENT        3
989
990 #ifdef __cplusplus
991 } /* extern "C" */
992 #endif /* defined(__cplusplus) */
993
994 #endif  /* __WINE_DBGHELP_H */