Syntax fix in configure.ac.
[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 0x4D444D50 /* 'PMDM' */
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 } MINIDUMP_TYPE;
268
269 typedef enum _MINIDUMP_CALLBACK_TYPE
270 {
271     ModuleCallback,
272     ThreadCallback,
273     ThreadExCallback,
274     IncludeThreadCallback,
275     IncludeModuleCallback,
276 } MINIDUMP_CALLBACK_TYPE;
277
278 typedef struct _MINIDUMP_THREAD_CALLBACK
279 {
280     ULONG                       ThreadId;
281     HANDLE                      ThreadHandle;
282     CONTEXT                     Context;
283     ULONG                       SizeOfContext;
284     ULONGLONG                   StackBase;
285     ULONG64                     StackEnd;
286 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
287
288 typedef struct _MINIDUMP_THREAD_EX_CALLBACK 
289 {
290     ULONG                       ThreadId;
291     HANDLE                      ThreadHandle;
292     CONTEXT                     Context;
293     ULONG                       SizeOfContext;
294     ULONGLONG                   StackBase;
295     ULONGLONG                   StackEnd;
296     ULONGLONG                   BackingStoreBase;
297     ULONGLONG                   BackingStoreEnd;
298 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
299
300 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
301 {
302     ULONG ThreadId;
303 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
304
305 typedef enum _THREAD_WRITE_FLAGS 
306 {
307     ThreadWriteThread            = 0x0001,
308     ThreadWriteStack             = 0x0002,
309     ThreadWriteContext           = 0x0004,
310     ThreadWriteBackingStore      = 0x0008,
311     ThreadWriteInstructionWindow = 0x0010
312 } THREAD_WRITE_FLAGS;
313
314 typedef struct _MINIDUMP_MODULE_CALLBACK 
315 {
316     PWCHAR                      FullPath;
317     ULONGLONG                   BaseOfImage;
318     ULONG                       SizeOfImage;
319     ULONG                       CheckSum;
320     ULONG                       TimeDateStamp;
321     VS_FIXEDFILEINFO            VersionInfo;
322     PVOID                       CvRecord;
323     ULONG                       SizeOfCvRecord;
324     PVOID                       MiscRecord;
325     ULONG                       SizeOfMiscRecord;
326 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
327
328 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK 
329 {
330     ULONG64 BaseOfImage;
331 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
332
333 typedef enum _MODULE_WRITE_FLAGS 
334 {
335     ModuleWriteModule        = 0x0001,
336     ModuleWriteDataSeg       = 0x0002,
337     ModuleWriteMiscRecord    = 0x0004,
338     ModuleWriteCvRecord      = 0x0008,
339     ModuleReferencedByMemory = 0x0010
340 } MODULE_WRITE_FLAGS;
341
342 typedef struct _MINIDUMP_CALLBACK_INPUT 
343 {
344     ULONG                       ProcessId;
345     HANDLE                      ProcessHandle;
346     ULONG                       CallbackType;
347     union 
348     {
349         MINIDUMP_THREAD_CALLBACK        Thread;
350         MINIDUMP_THREAD_EX_CALLBACK     ThreadEx;
351         MINIDUMP_MODULE_CALLBACK        Module;
352         MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
353         MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
354     } u;
355 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
356
357 typedef struct _MINIDUMP_CALLBACK_OUTPUT
358 {
359     union 
360     {
361         ULONG                           ModuleWriteFlags;
362         ULONG                           ThreadWriteFlags;
363     } u;
364 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
365
366 typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,
367                                                  const PMINIDUMP_CALLBACK_INPUT CallbackInput,
368                                                  PMINIDUMP_CALLBACK_OUTPUT CallbackOutput);
369
370 typedef struct _MINIDUMP_CALLBACK_INFORMATION 
371 {
372     MINIDUMP_CALLBACK_ROUTINE   CallbackRoutine;
373     void*                       CallbackParam;
374 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
375
376 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR 
377 {
378     ULONG                       DataSize;
379     RVA                         Rva;
380 } MINIDUMP_LOCATION_DESCRIPTOR;
381
382 typedef struct _MINIDUMP_DIRECTORY 
383 {
384     ULONG                       StreamType;
385     MINIDUMP_LOCATION_DESCRIPTOR Location;
386 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
387
388 typedef struct _MINIDUMP_EXCEPTION
389 {
390     ULONG                       ExceptionCode;
391     ULONG                       ExceptionFlags;
392     ULONGLONG                   ExceptionRecord;
393     ULONGLONG                   ExceptionAddress;
394     ULONG                       NumberParameters;
395     ULONG                        __unusedAlignment;
396     ULONGLONG                   ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
397 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
398
399 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
400 {
401     DWORD                       ThreadId;
402     PEXCEPTION_POINTERS         ExceptionPointers;
403     BOOL                        ClientPointers;
404 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
405
406 typedef struct MINIDUMP_EXCEPTION_STREAM 
407 {
408     ULONG                       ThreadId;
409     ULONG                       __alignment;
410     MINIDUMP_EXCEPTION          ExceptionRecord;
411     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
412 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
413
414 typedef struct _MINIDUMP_HEADER 
415 {
416     DWORD                       Signature;
417     DWORD                       Version;
418     DWORD                       NumberOfStreams;
419     RVA                         StreamDirectoryRva;
420     DWORD                       CheckSum;
421     union 
422     {
423         DWORD                           Reserved;
424         DWORD                           TimeDateStamp;
425     } u;
426     ULONGLONG                   Flags;
427 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
428
429 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR 
430 {
431     ULONGLONG                   StartOfMemoryRange;
432     MINIDUMP_LOCATION_DESCRIPTOR Memory;
433 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
434
435 typedef struct _MINIDUMP_MODULE
436 {
437     ULONGLONG                   BaseOfImage;
438     ULONG                       SizeOfImage;
439     ULONG                       CheckSum;
440     ULONG                       TimeDateStamp;
441     RVA                         ModuleNameRva;
442     VS_FIXEDFILEINFO            VersionInfo;
443     MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
444     MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
445     ULONGLONG                   Reserved0;
446     ULONGLONG                   Reserved1;
447 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
448
449 typedef struct _MINIDUMP_MODULE_LIST 
450 {
451     ULONG                       NumberOfModules;
452     MINIDUMP_MODULE             Modules[1]; /* FIXME: 0-sized array not supported */
453 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
454
455 typedef struct _MINIDUMP_USER_STREAM
456 {
457     ULONG                       Type;
458     ULONG                       BufferSize;
459     void*                       Buffer;
460 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
461
462 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
463 {
464     ULONG                       UserStreamCount;
465     PMINIDUMP_USER_STREAM       UserStreamArray;
466 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
467
468 typedef enum _MINIDUMP_STREAM_TYPE
469 {
470     UnusedStream                = 0,
471     ReservedStream0             = 1,
472     ReservedStream1             = 2,
473     ThreadListStream            = 3,
474     ModuleListStream            = 4,
475     MemoryListStream            = 5,
476     ExceptionStream             = 6,
477     SystemInfoStream            = 7,
478     ThreadExListStream          = 8,
479     Memory64ListStream          = 9,
480     CommentStreamA              = 10,
481     CommentStreamW              = 11,
482     HandleDataStream            = 12,
483     FunctionTableStream         = 13,
484
485     LastReservedStream          = 0xffff
486 } MINIDUMP_STREAM_TYPE;
487
488 typedef struct _MINIDUMP_SYSTEM_INFO
489 {
490     USHORT                      ProcessorArchitecture;
491     USHORT                      ProcessorLevel;
492     USHORT                      ProcessorRevision;
493     USHORT                      Reserved0;
494
495     ULONG                       MajorVersion;
496     ULONG                       MinorVersion;
497     ULONG                       BuildNumber;
498     ULONG                       PlatformId;
499
500     RVA                         CSDVersionRva;
501     ULONG                       Reserved1;
502     union _CPU_INFORMATION 
503     {
504         struct 
505         {
506             ULONG                       VendorId[3];
507             ULONG                       VersionInformation;
508             ULONG                       FeatureInformation;
509             ULONG                       AMDExtendedCpuFeatures;
510         } X86CpuInfo;
511         struct 
512         {
513             ULONGLONG                   ProcessorFeatures[2];
514         } OtherCpuInfo;
515     } Cpu;
516
517 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
518
519 typedef struct _MINIDUMP_THREAD
520 {
521     ULONG                       ThreadId;
522     ULONG                       SuspendCount;
523     ULONG                       PriorityClass;
524     ULONG                       Priority;
525     ULONGLONG                   Teb;
526     MINIDUMP_MEMORY_DESCRIPTOR  Stack;
527     MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
528 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
529
530 typedef struct _MINIDUMP_THREAD_LIST
531 {
532     ULONG                       NumberOfThreads;
533     MINIDUMP_THREAD             Threads[1]; /* FIXME: no support of 0 sized array */
534 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
535
536 BOOL WINAPI MiniDumpWriteDump(HANDLE,DWORD,HANDLE,MINIDUMP_TYPE,const PMINIDUMP_EXCEPTION_INFORMATION,
537                               const PMINIDUMP_USER_STREAM_INFORMATION,const PMINIDUMP_CALLBACK_INFORMATION);
538 BOOL WINAPI MiniDumpReadDumpStream(PVOID,ULONG,PMINIDUMP_DIRECTORY*,PVOID*,ULONG*);
539
540
541 /*************************
542  *    MODULE handling    *
543  *************************/
544 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
545 BOOL   WINAPI EnumerateLoadedModules(HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
546 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR, DWORD, PVOID);
547 BOOL    WINAPI SymEnumerateModules(HANDLE, PSYM_ENUMMODULES_CALLBACK, PVOID);
548 BOOL    WINAPI SymGetModuleInfo(HANDLE, DWORD, PIMAGEHLP_MODULE);
549 BOOL    WINAPI SymGetModuleInfoW(HANDLE, DWORD, PIMAGEHLP_MODULEW);
550 DWORD   WINAPI SymGetModuleBase(HANDLE, DWORD);
551 DWORD   WINAPI SymLoadModule(HANDLE, HANDLE, PSTR, PSTR, DWORD, DWORD);
552 DWORD64 WINAPI SymLoadModuleEx(HANDLE, HANDLE, PSTR, PSTR, DWORD64, DWORD,
553                                PMODLOAD_DATA, DWORD);
554 BOOL    WINAPI SymUnloadModule(HANDLE, DWORD);
555
556 /*************************
557  *    Symbol Handling    *
558  *************************/
559
560 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT          1
561 #define IMAGEHLP_SYMBOL_INFO_REGISTER              SYMF_REGISTER        /*  0x08 */
562 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE           SYMF_REGREL          /*  0x10 */
563 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE         SYMF_FRAMEREL        /*  0x20 */
564 #define IMAGEHLP_SYMBOL_INFO_PARAMETER             SYMF_PARAMETER       /*  0x40 */
565 #define IMAGEHLP_SYMBOL_INFO_LOCAL                 SYMF_LOCAL           /*  0x80 */
566 #define IMAGEHLP_SYMBOL_INFO_CONSTANT              SYMF_CONSTANT        /* 0x100 */
567 #define IMAGEHLP_SYMBOL_FUNCTION                   SYMF_FUNCTION        /* 0x800 */
568
569 #define SYMFLAG_VALUEPRESENT     0x00000001
570 #define SYMFLAG_REGISTER         0x00000008
571 #define SYMFLAG_REGREL           0x00000010
572 #define SYMFLAG_FRAMEREL         0x00000020
573 #define SYMFLAG_PARAMETER        0x00000040
574 #define SYMFLAG_LOCAL            0x00000080
575 #define SYMFLAG_CONSTANT         0x00000100
576 #define SYMFLAG_EXPORT           0x00000200
577 #define SYMFLAG_FORWARDER        0x00000400
578 #define SYMFLAG_FUNCTION         0x00000800
579 #define SYMFLAG_VIRTUAL          0x00001000
580 #define SYMFLAG_THUNK            0x00002000
581 #define SYMFLAG_TLSREL           0x00004000
582
583 typedef struct _SYMBOL_INFO
584 {
585     ULONG       SizeOfStruct;
586     ULONG       TypeIndex;
587     ULONG64     Reserved[2];
588     ULONG       info;   /* sdk states info, while MSDN says it's Index... */
589     ULONG       Size;
590     ULONG64     ModBase;
591     ULONG       Flags;
592     ULONG64     Value;
593     ULONG64     Address;
594     ULONG       Register;
595     ULONG       Scope;
596     ULONG       Tag;
597     ULONG       NameLen;
598     ULONG       MaxNameLen;
599     CHAR        Name[1];
600 } SYMBOL_INFO, *PSYMBOL_INFO;
601
602 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO 
603 {
604     TI_GET_SYMTAG,
605     TI_GET_SYMNAME,
606     TI_GET_LENGTH,
607     TI_GET_TYPE,
608     TI_GET_TYPEID,
609     TI_GET_BASETYPE,
610     TI_GET_ARRAYINDEXTYPEID,
611     TI_FINDCHILDREN,
612     TI_GET_DATAKIND,
613     TI_GET_ADDRESSOFFSET,
614     TI_GET_OFFSET,
615     TI_GET_VALUE,
616     TI_GET_COUNT,
617     TI_GET_CHILDRENCOUNT,
618     TI_GET_BITPOSITION,
619     TI_GET_VIRTUALBASECLASS,
620     TI_GET_VIRTUALTABLESHAPEID,
621     TI_GET_VIRTUALBASEPOINTEROFFSET,
622     TI_GET_CLASSPARENTID,
623     TI_GET_NESTED,
624     TI_GET_SYMINDEX,
625     TI_GET_LEXICALPARENT,
626     TI_GET_ADDRESS,
627     TI_GET_THISADJUST,
628     TI_GET_UDTKIND,
629     TI_IS_EQUIV_TO,
630     TI_GET_CALLING_CONVENTION,
631 } IMAGEHLP_SYMBOL_TYPE_INFO;
632
633 typedef struct _TI_FINDCHILDREN_PARAMS 
634 {
635     ULONG Count;
636     ULONG Start;
637     ULONG ChildId[1];
638 } TI_FINDCHILDREN_PARAMS;
639
640 #define UNDNAME_COMPLETE                 (0x0000)
641 #define UNDNAME_NO_LEADING_UNDERSCORES   (0x0001)
642 #define UNDNAME_NO_MS_KEYWORDS           (0x0002)
643 #define UNDNAME_NO_FUNCTION_RETURNS      (0x0004)
644 #define UNDNAME_NO_ALLOCATION_MODEL      (0x0008)
645 #define UNDNAME_NO_ALLOCATION_LANGUAGE   (0x0010)
646 #define UNDNAME_NO_MS_THISTYPE           (0x0020)
647 #define UNDNAME_NO_CV_THISTYPE           (0x0040)
648 #define UNDNAME_NO_THISTYPE              (0x0060)
649 #define UNDNAME_NO_ACCESS_SPECIFIERS     (0x0080)
650 #define UNDNAME_NO_THROW_SIGNATURES      (0x0100)
651 #define UNDNAME_NO_MEMBER_TYPE           (0x0200)
652 #define UNDNAME_NO_RETURN_UDT_MODEL      (0x0400)
653 #define UNDNAME_32_BIT_DECODE            (0x0800)
654 #define UNDNAME_NAME_ONLY                (0x1000)
655 #define UNDNAME_NO_ARGUMENTS             (0x2000)
656 #define UNDNAME_NO_SPECIAL_SYMS          (0x4000)
657
658 BOOL WINAPI SymGetTypeInfo(HANDLE, DWORD64, ULONG, IMAGEHLP_SYMBOL_TYPE_INFO, PVOID);
659 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO, ULONG, PVOID);
660 BOOL WINAPI SymEnumTypes(HANDLE, ULONG64, PSYM_ENUMERATESYMBOLS_CALLBACK, PVOID);
661 BOOL WINAPI SymFromAddr(HANDLE, DWORD64, DWORD64*, SYMBOL_INFO*);
662 BOOL WINAPI SymFromName(HANDLE, LPSTR, PSYMBOL_INFO);
663 BOOL WINAPI SymGetSymFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
664 BOOL WINAPI SymGetSymFromName(HANDLE, PSTR, PIMAGEHLP_SYMBOL);
665 BOOL WINAPI SymGetTypeFromName(HANDLE, ULONG64, LPSTR, PSYMBOL_INFO);
666 BOOL WINAPI SymGetSymNext(HANDLE, PIMAGEHLP_SYMBOL);
667 BOOL WINAPI SymGetSymPrev(HANDLE, PIMAGEHLP_SYMBOL);
668 BOOL WINAPI SymEnumSymbols(HANDLE, ULONG64, PCSTR, PSYM_ENUMERATESYMBOLS_CALLBACK,
669                            PVOID);
670 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR, DWORD, ULONG, PVOID);
671 BOOL WINAPI SymEnumerateSymbols(HANDLE, DWORD, PSYM_ENUMSYMBOLS_CALLBACK, PVOID);
672 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE, ULONG, PVOID, PVOID);
673 BOOL WINAPI SymRegisterCallback(HANDLE, PSYMBOL_REGISTERED_CALLBACK, PVOID);
674 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL, PSTR, DWORD);
675 DWORD WINAPI UnDecorateSymbolName(LPCSTR, LPSTR, DWORD, DWORD);
676
677 /*************************
678  *      Source Files     *
679  *************************/
680 typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE, PVOID);
681
682 BOOL WINAPI SymEnumSourceFiles(HANDLE, ULONG64, LPSTR, PSYM_ENUMSOURCFILES_CALLBACK,
683                                PVOID);
684 BOOL WINAPI SymGetLineFromAddr(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
685 BOOL WINAPI SymGetLinePrev(HANDLE, PIMAGEHLP_LINE);
686 BOOL WINAPI SymGetLineNext(HANDLE, PIMAGEHLP_LINE);
687
688 /*************************
689  * File & image handling *
690  *************************/
691 BOOL WINAPI SymInitialize(HANDLE, PSTR, BOOL);
692 BOOL WINAPI SymCleanup(HANDLE);
693
694 HANDLE WINAPI FindDebugInfoFile(PSTR, PSTR, PSTR);
695 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
696 HANDLE WINAPI FindDebugInfoFileEx(PSTR, PSTR, PSTR, PFIND_DEBUG_FILE_CALLBACK, PVOID);
697 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR, PVOID);
698 BOOL WINAPI SymFindFileInPath(HANDLE, LPSTR, LPSTR, PVOID, DWORD, DWORD, DWORD,
699                               LPSTR, PFINDFILEINPATHCALLBACK, PVOID);
700 HANDLE WINAPI FindExecutableImage(PSTR, PSTR, PSTR);
701 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE, PSTR, PVOID);
702 HANDLE WINAPI FindExecutableImageEx(PSTR, PSTR, PSTR, PFIND_EXE_FILE_CALLBACK, PVOID);
703 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID);
704 PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID, BOOLEAN, USHORT, PULONG,
705                                          PIMAGE_SECTION_HEADER *);
706 PVOID WINAPI ImageDirectoryEntryToData(PVOID, BOOLEAN, USHORT, PULONG);
707 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS, PVOID, ULONG);
708 PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS, PVOID, ULONG, PIMAGE_SECTION_HEADER*);
709 BOOL WINAPI SymGetSearchPath(HANDLE, PSTR, DWORD);
710 BOOL WINAPI SymSetSearchPath(HANDLE, PSTR);
711 DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
712 BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
713 BOOL WINAPI SearchTreeForFile(PSTR, PSTR, PSTR);
714 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR, PVOID);
715 BOOL WINAPI EnumDirTree(HANDLE, PCSTR, PCSTR, LPSTR, PENUMDIRTREE_CALLBACK, void*);
716 BOOL WINAPI SymMatchFileName(LPSTR, LPSTR, LPSTR*, LPSTR*);
717
718 /*************************
719  *   Context management  *
720  *************************/
721 BOOL WINAPI SymSetContext(HANDLE, PIMAGEHLP_STACK_FRAME, PIMAGEHLP_CONTEXT);
722
723
724 /*************************
725  *    Stack management   *
726  *************************/
727
728 typedef struct _KDHELP
729 {
730     DWORD       Thread;
731     DWORD       ThCallbackStack;
732     DWORD       NextCallback;
733     DWORD       FramePointer;
734     DWORD       KiCallUserMode;
735     DWORD       KeUserCallbackDispatcher;
736     DWORD       SystemRangeStart;
737 } KDHELP, *PKDHELP;
738
739 typedef struct _STACKFRAME
740 {
741     ADDRESS     AddrPC;
742     ADDRESS     AddrReturn;
743     ADDRESS     AddrFrame;
744     ADDRESS     AddrStack;
745     PVOID       FuncTableEntry;
746     DWORD       Params[4];
747     BOOL        Far;
748     BOOL        Virtual;
749     DWORD       Reserved[3];
750     KDHELP      KdHelp;
751     ADDRESS     AddrBStore;
752 } STACKFRAME, *LPSTACKFRAME;
753
754 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)
755     (HANDLE, LPCVOID, PVOID, DWORD, PDWORD);
756 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(HANDLE, DWORD);
757 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(HANDLE, DWORD);
758 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(HANDLE, HANDLE, LPADDRESS);
759 BOOL WINAPI StackWalk(DWORD, HANDLE, HANDLE, LPSTACKFRAME, PVOID,
760                       PREAD_PROCESS_MEMORY_ROUTINE,
761                       PFUNCTION_TABLE_ACCESS_ROUTINE,
762                       PGET_MODULE_BASE_ROUTINE,
763                       PTRANSLATE_ADDRESS_ROUTINE);
764
765 PVOID WINAPI SymFunctionTableAccess(HANDLE, DWORD);
766
767 /*************************
768  * Version, global stuff *
769  *************************/
770
771 typedef struct API_VERSION
772 {
773     USHORT  MajorVersion;
774     USHORT  MinorVersion;
775     USHORT  Revision;
776     USHORT  Reserved;
777 } API_VERSION, *LPAPI_VERSION;
778
779 LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
780 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION);
781
782 typedef struct _IMAGE_DEBUG_INFORMATION
783 {
784     LIST_ENTRY                  List;
785     DWORD                       ReservedSize;
786     PVOID                       ReservedMappedBase;
787     USHORT                      ReservedMachine;
788     USHORT                      ReservedCharacteristics;
789     DWORD                       ReservedCheckSum;
790     DWORD                       ImageBase;
791     DWORD                       SizeOfImage;
792     DWORD                       ReservedNumberOfSections;
793     PIMAGE_SECTION_HEADER       ReservedSections;
794     DWORD                       ReservedExportedNamesSize;
795     PSTR                        ReservedExportedNames;
796     DWORD                       ReservedNumberOfFunctionTableEntries;
797     PIMAGE_FUNCTION_ENTRY       ReservedFunctionTableEntries;
798     DWORD                       ReservedLowestFunctionStartingAddress;
799     DWORD                       ReservedHighestFunctionEndingAddress;
800     DWORD                       ReservedNumberOfFpoTableEntries;
801     PFPO_DATA                   ReservedFpoTableEntries;
802     DWORD                       SizeOfCoffSymbols;
803     PIMAGE_COFF_SYMBOLS_HEADER  CoffSymbols;
804     DWORD                       ReservedSizeOfCodeViewSymbols;
805     PVOID                       ReservedCodeViewSymbols;
806     PSTR                        ImageFilePath;
807     PSTR                        ImageFileName;
808     PSTR                        ReservedDebugFilePath;
809     DWORD                       ReservedTimeDateStamp;
810     BOOL                        ReservedRomImage;
811     PIMAGE_DEBUG_DIRECTORY      ReservedDebugDirectory;
812     DWORD                       ReservedNumberOfDebugDirectories;
813     DWORD                       ReservedOriginalFunctionTableBaseAddress;
814     DWORD                       Reserved[ 2 ];
815 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
816
817
818 PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE, PSTR, PSTR, DWORD);
819
820 BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION);
821
822 DWORD   WINAPI  SymGetOptions(void);
823 DWORD   WINAPI  SymSetOptions(DWORD);
824
825 #ifdef __cplusplus
826 } /* extern "C" */
827 #endif /* defined(__cplusplus) */
828
829 #endif  /* __WINE_DBGHELP_H */