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