- Use FDI functions like native instead of advpack.ExtractFiles and
[wine.git] / include / dbghelp.h
blob110dad340680d81952a5a7755858066c28a9ae87
1 /*
2 * Declarations for DBGHELP
4 * Copyright (C) 2003 Eric Pouech
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.
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.
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
21 #ifndef __WINE_DBGHELP_H
22 #define __WINE_DBGHELP_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* defined(__cplusplus) */
28 typedef struct _LOADED_IMAGE
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;
44 /*************************
45 * IMAGEHLP equiv *
46 *************************/
48 typedef enum
50 AddrMode1616,
51 AddrMode1632,
52 AddrModeReal,
53 AddrModeFlat
54 } ADDRESS_MODE;
56 typedef struct _tagADDRESS
58 DWORD Offset;
59 WORD Segment;
60 ADDRESS_MODE Mode;
61 } ADDRESS, *LPADDRESS;
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
79 typedef enum
81 SymNone = 0,
82 SymCoff,
83 SymCv,
84 SymPdb,
85 SymExport,
86 SymDeferred,
87 SymSym,
88 SymDia,
89 NumSymTypes
90 } SYM_TYPE;
92 typedef struct _IMAGEHLP_SYMBOL
94 DWORD SizeOfStruct;
95 DWORD Address;
96 DWORD Size;
97 DWORD Flags;
98 DWORD MaxNameLength;
99 CHAR Name[1];
100 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
102 typedef struct _IMAGEHLP_MODULE
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;
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;
129 typedef struct _IMAGEHLP_LINE
131 DWORD SizeOfStruct;
132 PVOID Key;
133 DWORD LineNumber;
134 PCHAR FileName;
135 DWORD Address;
136 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
138 typedef struct _SOURCEFILE
140 DWORD ModBase;
141 PCHAR FileName;
142 } SOURCEFILE, *PSOURCEFILE;
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
155 typedef struct _IMAGEHLP_CBA_READ_MEMORY
157 DWORD addr;
158 PVOID buf;
159 DWORD bytes;
160 DWORD *bytesread;
161 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
163 enum {
164 sevInfo = 0,
165 sevProblem,
166 sevAttn,
167 sevFatal,
168 sevMax
171 typedef struct _IMAGEHLP_CBA_EVENT
173 DWORD severity;
174 DWORD code;
175 PCHAR desc;
176 PVOID object;
177 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
179 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
181 DWORD SizeOfStruct;
182 DWORD64 BaseOfImage;
183 DWORD CheckSum;
184 DWORD TimeDateStamp;
185 CHAR FileName[MAX_PATH];
186 BOOLEAN Reparse;
187 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
189 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
191 DWORD SizeOfStruct;
192 DWORD NumberOfDups;
193 PIMAGEHLP_SYMBOL Symbol;
194 DWORD SelectedSymbol;
195 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
197 #define SYMOPT_CASE_INSENSITIVE 0x00000001
198 #define SYMOPT_UNDNAME 0x00000002
199 #define SYMOPT_DEFERRED_LOADS 0x00000004
200 #define SYMOPT_NO_CPP 0x00000008
201 #define SYMOPT_LOAD_LINES 0x00000010
202 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
203 #define SYMOPT_LOAD_ANYTHING 0x00000040
204 #define SYMOPT_IGNORE_CVREC 0x00000080
205 #define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100
206 #define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200
207 #define SYMOPT_EXACT_SYMBOLS 0x00000400
208 #define SYMOPT_WILD_UNDERSCORE 0x00000800
209 #define SYMOPT_USE_DEFAULTS 0x00001000
210 #define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000
211 #define SYMOPT_PUBLICS_ONLY 0x00004000
212 #define SYMOPT_NO_PUBLICS 0x00008000
213 #define SYMOPT_AUTO_PUBLICS 0x00010000
214 #define SYMOPT_NO_IMAGE_SEARCH 0x00020000
215 #define SYMOPT_SECURE 0x00040000
216 #define SYMOPT_NO_PROMPTS 0x00080000
218 #define SYMOPT_DEBUG 0x80000000
220 typedef struct _IMAGEHLP_STACK_FRAME
222 ULONG InstructionOffset;
223 ULONG ReturnOffset;
224 ULONG FrameOffset;
225 ULONG StackOffset;
226 ULONG BackingStoreOffset;
227 ULONG FuncTableEntry;
228 ULONG Params[4];
229 ULONG Reserved[5];
230 BOOL Virtual;
231 ULONG Reserved2;
232 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
234 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
236 #define DBHHEADER_DEBUGDIRS 0x1
237 typedef struct _DBGHELP_MODLOAD_DATA
239 DWORD ssize;
240 DWORD ssig;
241 PVOID data;
242 DWORD size;
243 DWORD flags;
244 } MODLOAD_DATA, *PMODLOAD_DATA;
246 /*************************
247 * MiniDUMP *
248 *************************/
250 /* DebugHelp */
252 #define MINIDUMP_SIGNATURE 0x4D444D50 /* 'PMDM' */
253 #define MINIDUMP_VERSION (42899)
255 typedef DWORD RVA;
256 typedef ULONG64 RVA64;
258 typedef enum _MINIDUMP_TYPE
260 MiniDumpNormal = 0x0000,
261 MiniDumpWithDataSegs = 0x0001,
262 MiniDumpWithFullMemory = 0x0002,
263 MiniDumpWithHandleData = 0x0004,
264 MiniDumpFilterMemory = 0x0008,
265 MiniDumpScanMemory = 0x0010
266 } MINIDUMP_TYPE;
268 typedef enum _MINIDUMP_CALLBACK_TYPE
270 ModuleCallback,
271 ThreadCallback,
272 ThreadExCallback,
273 IncludeThreadCallback,
274 IncludeModuleCallback,
275 } MINIDUMP_CALLBACK_TYPE;
277 typedef struct _MINIDUMP_THREAD_CALLBACK
279 ULONG ThreadId;
280 HANDLE ThreadHandle;
281 CONTEXT Context;
282 ULONG SizeOfContext;
283 ULONGLONG StackBase;
284 ULONG64 StackEnd;
285 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
287 typedef struct _MINIDUMP_THREAD_EX_CALLBACK
289 ULONG ThreadId;
290 HANDLE ThreadHandle;
291 CONTEXT Context;
292 ULONG SizeOfContext;
293 ULONGLONG StackBase;
294 ULONGLONG StackEnd;
295 ULONGLONG BackingStoreBase;
296 ULONGLONG BackingStoreEnd;
297 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
299 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
301 ULONG ThreadId;
302 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
304 typedef enum _THREAD_WRITE_FLAGS
306 ThreadWriteThread = 0x0001,
307 ThreadWriteStack = 0x0002,
308 ThreadWriteContext = 0x0004,
309 ThreadWriteBackingStore = 0x0008,
310 ThreadWriteInstructionWindow = 0x0010
311 } THREAD_WRITE_FLAGS;
313 typedef struct _MINIDUMP_MODULE_CALLBACK
315 PWCHAR FullPath;
316 ULONGLONG BaseOfImage;
317 ULONG SizeOfImage;
318 ULONG CheckSum;
319 ULONG TimeDateStamp;
320 VS_FIXEDFILEINFO VersionInfo;
321 PVOID CvRecord;
322 ULONG SizeOfCvRecord;
323 PVOID MiscRecord;
324 ULONG SizeOfMiscRecord;
325 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
327 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK
329 ULONG64 BaseOfImage;
330 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
332 typedef enum _MODULE_WRITE_FLAGS
334 ModuleWriteModule = 0x0001,
335 ModuleWriteDataSeg = 0x0002,
336 ModuleWriteMiscRecord = 0x0004,
337 ModuleWriteCvRecord = 0x0008,
338 ModuleReferencedByMemory = 0x0010
339 } MODULE_WRITE_FLAGS;
341 typedef struct _MINIDUMP_CALLBACK_INPUT
343 ULONG ProcessId;
344 HANDLE ProcessHandle;
345 ULONG CallbackType;
346 union
348 MINIDUMP_THREAD_CALLBACK Thread;
349 MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
350 MINIDUMP_MODULE_CALLBACK Module;
351 MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
352 MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
353 } u;
354 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
356 typedef struct _MINIDUMP_CALLBACK_OUTPUT
358 union
360 ULONG ModuleWriteFlags;
361 ULONG ThreadWriteFlags;
362 } u;
363 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
365 typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,
366 const PMINIDUMP_CALLBACK_INPUT CallbackInput,
367 PMINIDUMP_CALLBACK_OUTPUT CallbackOutput);
369 typedef struct _MINIDUMP_CALLBACK_INFORMATION
371 MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
372 void* CallbackParam;
373 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
375 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR
377 ULONG DataSize;
378 RVA Rva;
379 } MINIDUMP_LOCATION_DESCRIPTOR;
381 typedef struct _MINIDUMP_DIRECTORY
383 ULONG StreamType;
384 MINIDUMP_LOCATION_DESCRIPTOR Location;
385 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
387 typedef struct _MINIDUMP_EXCEPTION
389 ULONG ExceptionCode;
390 ULONG ExceptionFlags;
391 ULONGLONG ExceptionRecord;
392 ULONGLONG ExceptionAddress;
393 ULONG NumberParameters;
394 ULONG __unusedAlignment;
395 ULONGLONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
396 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
398 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
400 DWORD ThreadId;
401 PEXCEPTION_POINTERS ExceptionPointers;
402 BOOL ClientPointers;
403 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
405 typedef struct MINIDUMP_EXCEPTION_STREAM
407 ULONG ThreadId;
408 ULONG __alignment;
409 MINIDUMP_EXCEPTION ExceptionRecord;
410 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
411 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
413 typedef struct _MINIDUMP_HEADER
415 DWORD Signature;
416 DWORD Version;
417 DWORD NumberOfStreams;
418 RVA StreamDirectoryRva;
419 DWORD CheckSum;
420 union
422 DWORD Reserved;
423 DWORD TimeDateStamp;
424 } u;
425 ULONGLONG Flags;
426 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
428 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR
430 ULONGLONG StartOfMemoryRange;
431 MINIDUMP_LOCATION_DESCRIPTOR Memory;
432 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
434 typedef struct _MINIDUMP_MODULE
436 ULONGLONG BaseOfImage;
437 ULONG SizeOfImage;
438 ULONG CheckSum;
439 ULONG TimeDateStamp;
440 RVA ModuleNameRva;
441 VS_FIXEDFILEINFO VersionInfo;
442 MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
443 MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
444 ULONGLONG Reserved0;
445 ULONGLONG Reserved1;
446 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
448 typedef struct _MINIDUMP_MODULE_LIST
450 ULONG NumberOfModules;
451 MINIDUMP_MODULE Modules[1]; /* FIXME: 0-sized array not supported */
452 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
454 typedef struct _MINIDUMP_USER_STREAM
456 ULONG Type;
457 ULONG BufferSize;
458 void* Buffer;
459 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
461 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
463 ULONG UserStreamCount;
464 PMINIDUMP_USER_STREAM UserStreamArray;
465 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
467 typedef enum _MINIDUMP_STREAM_TYPE
469 UnusedStream = 0,
470 ReservedStream0 = 1,
471 ReservedStream1 = 2,
472 ThreadListStream = 3,
473 ModuleListStream = 4,
474 MemoryListStream = 5,
475 ExceptionStream = 6,
476 SystemInfoStream = 7,
477 ThreadExListStream = 8,
478 Memory64ListStream = 9,
479 CommentStreamA = 10,
480 CommentStreamW = 11,
481 HandleDataStream = 12,
482 FunctionTableStream = 13,
484 LastReservedStream = 0xffff
485 } MINIDUMP_STREAM_TYPE;
487 typedef struct _MINIDUMP_SYSTEM_INFO
489 USHORT ProcessorArchitecture;
490 USHORT ProcessorLevel;
491 USHORT ProcessorRevision;
492 USHORT Reserved0;
494 ULONG MajorVersion;
495 ULONG MinorVersion;
496 ULONG BuildNumber;
497 ULONG PlatformId;
499 RVA CSDVersionRva;
500 ULONG Reserved1;
501 union _CPU_INFORMATION
503 struct
505 ULONG VendorId[3];
506 ULONG VersionInformation;
507 ULONG FeatureInformation;
508 ULONG AMDExtendedCpuFeatures;
509 } X86CpuInfo;
510 struct
512 ULONGLONG ProcessorFeatures[2];
513 } OtherCpuInfo;
514 } Cpu;
516 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
518 typedef struct _MINIDUMP_THREAD
520 ULONG ThreadId;
521 ULONG SuspendCount;
522 ULONG PriorityClass;
523 ULONG Priority;
524 ULONGLONG Teb;
525 MINIDUMP_MEMORY_DESCRIPTOR Stack;
526 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
527 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
529 typedef struct _MINIDUMP_THREAD_LIST
531 ULONG NumberOfThreads;
532 MINIDUMP_THREAD Threads[1]; /* FIXME: no support of 0 sized array */
533 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
535 BOOL WINAPI MiniDumpWriteDump(HANDLE,DWORD,HANDLE,MINIDUMP_TYPE,const PMINIDUMP_EXCEPTION_INFORMATION,
536 const PMINIDUMP_USER_STREAM_INFORMATION,const PMINIDUMP_CALLBACK_INFORMATION);
537 BOOL WINAPI MiniDumpReadDumpStream(PVOID,ULONG,PMINIDUMP_DIRECTORY*,PVOID*,ULONG*);
540 /*************************
541 * MODULE handling *
542 *************************/
543 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName, DWORD ModuleBase,
544 ULONG ModuleSize, PVOID UserContext);
545 extern BOOL WINAPI EnumerateLoadedModules(HANDLE hProcess,
546 PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,
547 PVOID UserContext);
548 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName, DWORD BaseOfDll,
549 PVOID UserContext);
550 extern BOOL WINAPI SymEnumerateModules(HANDLE hProcess,
551 PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
552 PVOID UserContext);
553 extern BOOL WINAPI SymGetModuleInfo(HANDLE hProcess, DWORD dwAddr,
554 PIMAGEHLP_MODULE ModuleInfo);
555 extern BOOL WINAPI SymGetModuleInfoW(HANDLE hProcess, DWORD dwAddr,
556 PIMAGEHLP_MODULEW ModuleInfo);
557 extern DWORD WINAPI SymGetModuleBase(HANDLE hProcess, DWORD dwAddr);
558 extern DWORD WINAPI SymLoadModule(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
559 PSTR ModuleName, DWORD BaseOfDll, DWORD SizeOfDll);
560 extern DWORD WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
561 PSTR ModuleName, DWORD BaseOfDll, DWORD DllSize,
562 PMODLOAD_DATA Data, DWORD Flags);
563 extern BOOL WINAPI SymUnloadModule(HANDLE hProcess, DWORD BaseOfDll);
565 /*************************
566 * Symbol Handling *
567 *************************/
569 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
570 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER /* 0x08 */
571 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL /* 0x10 */
572 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL /* 0x20 */
573 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER /* 0x40 */
574 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL /* 0x80 */
575 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT /* 0x100 */
576 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION /* 0x800 */
578 #define SYMFLAG_VALUEPRESENT 0x00000001
579 #define SYMFLAG_REGISTER 0x00000008
580 #define SYMFLAG_REGREL 0x00000010
581 #define SYMFLAG_FRAMEREL 0x00000020
582 #define SYMFLAG_PARAMETER 0x00000040
583 #define SYMFLAG_LOCAL 0x00000080
584 #define SYMFLAG_CONSTANT 0x00000100
585 #define SYMFLAG_EXPORT 0x00000200
586 #define SYMFLAG_FORWARDER 0x00000400
587 #define SYMFLAG_FUNCTION 0x00000800
588 #define SYMFLAG_VIRTUAL 0x00001000
589 #define SYMFLAG_THUNK 0x00002000
590 #define SYMFLAG_TLSREL 0x00004000
592 typedef struct _SYMBOL_INFO
594 ULONG SizeOfStruct;
595 ULONG TypeIndex;
596 ULONG Reserved[2];
597 ULONG info; /* sdk states info, while MSDN says it's Index... */
598 ULONG Size;
599 ULONG ModBase;
600 ULONG Flags;
601 ULONG Value;
602 ULONG Address;
603 ULONG Register;
604 ULONG Scope;
605 ULONG Tag;
606 ULONG NameLen;
607 ULONG MaxNameLen;
608 CHAR Name[1];
609 } SYMBOL_INFO, *PSYMBOL_INFO;
611 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
613 TI_GET_SYMTAG,
614 TI_GET_SYMNAME,
615 TI_GET_LENGTH,
616 TI_GET_TYPE,
617 TI_GET_TYPEID,
618 TI_GET_BASETYPE,
619 TI_GET_ARRAYINDEXTYPEID,
620 TI_FINDCHILDREN,
621 TI_GET_DATAKIND,
622 TI_GET_ADDRESSOFFSET,
623 TI_GET_OFFSET,
624 TI_GET_VALUE,
625 TI_GET_COUNT,
626 TI_GET_CHILDRENCOUNT,
627 TI_GET_BITPOSITION,
628 TI_GET_VIRTUALBASECLASS,
629 TI_GET_VIRTUALTABLESHAPEID,
630 TI_GET_VIRTUALBASEPOINTEROFFSET,
631 TI_GET_CLASSPARENTID,
632 TI_GET_NESTED,
633 TI_GET_SYMINDEX,
634 TI_GET_LEXICALPARENT,
635 TI_GET_ADDRESS,
636 TI_GET_THISADJUST,
637 TI_GET_UDTKIND,
638 TI_IS_EQUIV_TO,
639 TI_GET_CALLING_CONVENTION,
640 } IMAGEHLP_SYMBOL_TYPE_INFO;
642 typedef struct _TI_FINDCHILDREN_PARAMS
644 ULONG Count;
645 ULONG Start;
646 ULONG ChildId[1];
647 } TI_FINDCHILDREN_PARAMS;
649 #define UNDNAME_COMPLETE (0x0000)
650 #define UNDNAME_NO_LEADING_UNDERSCORES (0x0001)
651 #define UNDNAME_NO_MS_KEYWORDS (0x0002)
652 #define UNDNAME_NO_FUNCTION_RETURNS (0x0004)
653 #define UNDNAME_NO_ALLOCATION_MODEL (0x0008)
654 #define UNDNAME_NO_ALLOCATION_LANGUAGE (0x0010)
655 #define UNDNAME_NO_MS_THISTYPE (0x0020)
656 #define UNDNAME_NO_CV_THISTYPE (0x0040)
657 #define UNDNAME_NO_THISTYPE (0x0060)
658 #define UNDNAME_NO_ACCESS_SPECIFIERS (0x0080)
659 #define UNDNAME_NO_THROW_SIGNATURES (0x0100)
660 #define UNDNAME_NO_MEMBER_TYPE (0x0200)
661 #define UNDNAME_NO_RETURN_UDT_MODEL (0x0400)
662 #define UNDNAME_32_BIT_DECODE (0x0800)
663 #define UNDNAME_NAME_ONLY (0x1000)
664 #define UNDNAME_NO_ARGUMENTS (0x2000)
665 #define UNDNAME_NO_SPECIAL_SYMS (0x4000)
667 BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD ModBase, ULONG TypeId,
668 IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID);
669 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,
670 ULONG SymbolSize, PVOID UserContext);
671 BOOL WINAPI SymEnumTypes(HANDLE hProcess, DWORD BaseOfDll,
672 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
673 PVOID UserContext);
674 BOOL WINAPI SymFromAddr(HANDLE hProcess, DWORD addr, DWORD* displacement,
675 SYMBOL_INFO* sym_info);
676 BOOL WINAPI SymFromName(HANDLE hProcess, LPSTR Name, PSYMBOL_INFO Symbol);
677 BOOL WINAPI SymGetSymFromAddr(HANDLE,DWORD,PDWORD,PIMAGEHLP_SYMBOL);
678 BOOL WINAPI SymGetSymFromName(HANDLE,PSTR,PIMAGEHLP_SYMBOL);
679 BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, DWORD BaseOfDll, LPSTR Name,
680 PSYMBOL_INFO Symbol);
681 BOOL WINAPI SymGetSymNext(HANDLE,PIMAGEHLP_SYMBOL);
682 BOOL WINAPI SymGetSymPrev(HANDLE,PIMAGEHLP_SYMBOL);
683 BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG BaseOfDll, PCSTR Mask,
684 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
685 PVOID UserContext);
686 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(PSTR SymbolName, DWORD SymbolAddress,
687 ULONG SymbolSize, PVOID UserContext);
688 BOOL WINAPI SymEnumerateSymbols(HANDLE hProcess, DWORD BaseOfDll,
689 PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback,
690 PVOID UserContext);
691 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(HANDLE hProcess, ULONG ActionCode,
692 PVOID CallbackData, PVOID UserContext);
693 BOOL WINAPI SymRegisterCallback(HANDLE hProcess,
694 PSYMBOL_REGISTERED_CALLBACK CallbackFunction,
695 PVOID UserContext);
696 BOOL WINAPI SymUnDName(PIMAGEHLP_SYMBOL,PSTR,DWORD);
697 DWORD WINAPI UnDecorateSymbolName(LPCSTR DecoratedName, LPSTR UnDecoratedName,
698 DWORD UndecoratedLength, DWORD Flags);
700 /*************************
701 * Source Files *
702 *************************/
703 typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,
704 PVOID UserContext);
706 BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG ModBase, LPSTR Mask,
707 PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,
708 PVOID UserContext);
709 BOOL WINAPI SymGetLineFromAddr(HANDLE hProcess, DWORD dwAddr,
710 PDWORD pdwDisplacement, PIMAGEHLP_LINE Line);
711 BOOL WINAPI SymGetLinePrev(HANDLE hProcess, PIMAGEHLP_LINE Line);
712 BOOL WINAPI SymGetLineNext(HANDLE hProcess, PIMAGEHLP_LINE Line);
714 /*************************
715 * File & image handling *
716 *************************/
717 BOOL WINAPI SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess);
718 BOOL WINAPI SymCleanup(HANDLE hProcess);
720 HANDLE WINAPI FindDebugInfoFile(PSTR FileName, PSTR SymbolPath, PSTR DebugFilePath);
721 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle, PSTR FileName,
722 PVOID CallerData);
723 HANDLE WINAPI FindDebugInfoFileEx(PSTR FileName, PSTR SymbolPath, PSTR DebugFilePath,
724 PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData);
725 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename, PVOID context);
727 BOOL WINAPI SymFindFileInPath(HANDLE hProcess, LPSTR searchPath, LPSTR FileName,
728 PVOID id, DWORD two, DWORD three, DWORD flags,
729 LPSTR FilePath, PFINDFILEINPATHCALLBACK callback,
730 PVOID context);
731 HANDLE WINAPI FindExecutableImage(PSTR FileName, PSTR SymbolPath, PSTR ImageFilePath);
732 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle, PSTR FileName,
733 PVOID CallerData);
734 HANDLE WINAPI FindExecutableImageEx(PSTR FileName, PSTR SymbolPath, PSTR ImageFilePath,
735 PFIND_EXE_FILE_CALLBACK Callback, PVOID CallerData);
736 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID Base);
738 PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID Base, BOOLEAN MappedAsImage,
739 USHORT DirectoryEntry, PULONG Size,
740 PIMAGE_SECTION_HEADER *FoundHeader);
741 PVOID WINAPI ImageDirectoryEntryToData(PVOID Base, BOOLEAN MappedAsImage,
742 USHORT DirectoryEntry, PULONG Size);
743 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,
744 PVOID Base, ULONG Rva);
745 PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders, PVOID Base,
746 ULONG Rva, OUT PIMAGE_SECTION_HEADER *LastRvaSection);
747 BOOL WINAPI SymGetSearchPath(HANDLE,PSTR,DWORD);
748 BOOL WINAPI SymSetSearchPath(HANDLE,PSTR);
749 DWORD WINAPI GetTimestampForLoadedLibrary(HMODULE);
750 BOOL WINAPI MakeSureDirectoryPathExists(PCSTR);
751 BOOL WINAPI SearchTreeForFile(PSTR,PSTR,PSTR);
752 typedef BOOL (CALLBACK *PENUMDIRTREE_CALLBACK)(LPCSTR path, PVOID user);
753 BOOL WINAPI EnumDirTree(HANDLE hProcess, PCSTR root, PCSTR file,
754 LPSTR buffer, PENUMDIRTREE_CALLBACK cb, void* user);
755 BOOL WINAPI SymMatchFileName(LPSTR file, LPSTR match, LPSTR* filestop, LPSTR* matchstop);
757 /*************************
758 * Context management *
759 *************************/
760 BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
761 PIMAGEHLP_CONTEXT Context);
764 /*************************
765 * Stack management *
766 *************************/
768 typedef struct _KDHELP
770 DWORD Thread;
771 DWORD ThCallbackStack;
772 DWORD NextCallback;
773 DWORD FramePointer;
774 DWORD KiCallUserMode;
775 DWORD KeUserCallbackDispatcher;
776 DWORD SystemRangeStart;
777 } KDHELP, *PKDHELP;
779 typedef struct _STACKFRAME
781 ADDRESS AddrPC;
782 ADDRESS AddrReturn;
783 ADDRESS AddrFrame;
784 ADDRESS AddrStack;
785 PVOID FuncTableEntry;
786 DWORD Params[4];
787 BOOL Far;
788 BOOL Virtual;
789 DWORD Reserved[3];
790 KDHELP KdHelp;
791 } STACKFRAME, *LPSTACKFRAME;
793 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)
794 (HANDLE hProcess, LPCVOID lpBaseAddress, PVOID lpBuffer,
795 DWORD nSize, PDWORD lpNumberOfBytesRead);
797 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)
798 (HANDLE hProcess, DWORD AddrBase);
800 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)
801 (HANDLE hProcess, DWORD ReturnAddress);
803 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)
804 (HANDLE hProcess, HANDLE hThread, LPADDRESS lpaddr);
806 BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
807 LPSTACKFRAME StackFrame, PVOID ContextRecord,
808 PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
809 PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
810 PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
811 PTRANSLATE_ADDRESS_ROUTINE TranslateAddress);
813 PVOID WINAPI SymFunctionTableAccess(HANDLE hProcess, DWORD AddrBase);
815 /*************************
816 * Version, global stuff *
817 *************************/
819 typedef struct API_VERSION
821 USHORT MajorVersion;
822 USHORT MinorVersion;
823 USHORT Revision;
824 USHORT Reserved;
825 } API_VERSION, *LPAPI_VERSION;
827 LPAPI_VERSION WINAPI ImagehlpApiVersion(void);
828 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(LPAPI_VERSION AppVersion);
830 typedef struct _IMAGE_DEBUG_INFORMATION
832 LIST_ENTRY List;
833 DWORD ReservedSize;
834 PVOID ReservedMappedBase;
835 USHORT ReservedMachine;
836 USHORT ReservedCharacteristics;
837 DWORD ReservedCheckSum;
838 DWORD ImageBase;
839 DWORD SizeOfImage;
840 DWORD ReservedNumberOfSections;
841 PIMAGE_SECTION_HEADER ReservedSections;
842 DWORD ReservedExportedNamesSize;
843 PSTR ReservedExportedNames;
844 DWORD ReservedNumberOfFunctionTableEntries;
845 PIMAGE_FUNCTION_ENTRY ReservedFunctionTableEntries;
846 DWORD ReservedLowestFunctionStartingAddress;
847 DWORD ReservedHighestFunctionEndingAddress;
848 DWORD ReservedNumberOfFpoTableEntries;
849 PFPO_DATA ReservedFpoTableEntries;
850 DWORD SizeOfCoffSymbols;
851 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols;
852 DWORD ReservedSizeOfCodeViewSymbols;
853 PVOID ReservedCodeViewSymbols;
854 PSTR ImageFilePath;
855 PSTR ImageFileName;
856 PSTR ReservedDebugFilePath;
857 DWORD ReservedTimeDateStamp;
858 BOOL ReservedRomImage;
859 PIMAGE_DEBUG_DIRECTORY ReservedDebugDirectory;
860 DWORD ReservedNumberOfDebugDirectories;
861 DWORD ReservedOriginalFunctionTableBaseAddress;
862 DWORD Reserved[ 2 ];
863 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
866 PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(HANDLE FileHandle, PSTR FileName,
867 PSTR SymbolPath, DWORD ImageBase);
869 BOOL WINAPI UnmapDebugInformation(PIMAGE_DEBUG_INFORMATION DebugInfo);
871 DWORD WINAPI SymGetOptions(void);
872 DWORD WINAPI SymSetOptions(DWORD);
874 #ifdef __cplusplus
875 } /* extern "C" */
876 #endif /* defined(__cplusplus) */
878 #endif /* __WINE_DBGHELP_H */