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
26 #endif /* defined(__cplusplus) */
28 typedef struct _LOADED_IMAGE
33 PIMAGE_NT_HEADERS FileHeader;
34 PIMAGE_SECTION_HEADER LastRvaSection;
35 ULONG NumberOfSections;
36 PIMAGE_SECTION_HEADER Sections;
37 ULONG Characteristics;
42 } LOADED_IMAGE, *PLOADED_IMAGE;
44 /*************************
46 *************************/
56 typedef struct _tagADDRESS
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
89 typedef struct _IMAGEHLP_SYMBOL
97 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
99 typedef struct _IMAGEHLP_MODULE
110 CHAR LoadedImageName[256];
111 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
113 typedef struct _IMAGEHLP_MODULEW {
121 WCHAR ModuleName[32];
122 WCHAR ImageName[256];
123 WCHAR LoadedImageName[256];
124 } IMAGEHLP_MODULEW, *PIMAGEHLP_MODULEW;
126 typedef struct _IMAGEHLP_LINE
133 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
135 typedef struct _SOURCEFILE
139 } SOURCEFILE, *PSOURCEFILE;
141 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
142 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
143 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
144 #define CBA_SYMBOLS_UNLOADED 0x00000004
145 #define CBA_DUPLICATE_SYMBOL 0x00000005
146 #define CBA_READ_MEMORY 0x00000006
147 #define CBA_DEFERRED_SYMBOL_LOAD_CANCEL 0x00000007
148 #define CBA_SET_OPTIONS 0x00000008
149 #define CBA_EVENT 0x00000010
150 #define CBA_DEBUG_INFO 0x10000000
152 typedef struct _IMAGEHLP_CBA_READ_MEMORY
158 } IMAGEHLP_CBA_READ_MEMORY, *PIMAGEHLP_CBA_READ_MEMORY;
168 typedef struct _IMAGEHLP_CBA_EVENT
174 } IMAGEHLP_CBA_EVENT, *PIMAGEHLP_CBA_EVENT;
176 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
182 CHAR FileName[MAX_PATH];
184 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
186 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
190 PIMAGEHLP_SYMBOL Symbol;
191 DWORD SelectedSymbol;
192 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
194 #define SYMOPT_CASE_INSENSITIVE 0x00000001
195 #define SYMOPT_UNDNAME 0x00000002
196 #define SYMOPT_DEFERRED_LOADS 0x00000004
197 #define SYMOPT_NO_CPP 0x00000008
198 #define SYMOPT_LOAD_LINES 0x00000010
199 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
200 #define SYMOPT_LOAD_ANYTHING 0x00000040
201 #define SYMOPT_IGNORE_CVREC 0x00000080
202 #define SYMOPT_NO_UNQUALIFIED_LOADS 0x00000100
203 #define SYMOPT_FAIL_CRITICAL_ERRORS 0x00000200
204 #define SYMOPT_EXACT_SYMBOLS 0x00000400
205 #define SYMOPT_WILD_UNDERSCORE 0x00000800
206 #define SYMOPT_USE_DEFAULTS 0x00001000
207 #define SYMOPT_INCLUDE_32BIT_MODULES 0x00002000
209 #define SYMOPT_DEBUG 0x80000000
211 typedef struct _IMAGEHLP_STACK_FRAME
213 ULONG InstructionOffset;
217 ULONG BackingStoreOffset;
218 ULONG FuncTableEntry;
223 } IMAGEHLP_STACK_FRAME, *PIMAGEHLP_STACK_FRAME;
225 typedef VOID IMAGEHLP_CONTEXT, *PIMAGEHLP_CONTEXT;
227 #define DBHHEADER_DEBUGDIRS 0x1
228 typedef struct _DBGHELP_MODLOAD_DATA
235 } MODLOAD_DATA, *PMODLOAD_DATA;
237 /*************************
239 *************************/
243 #define MINIDUMP_SIGNATURE 0x4D444D50 /* 'PMDM' */
244 #define MINIDUMP_VERSION (42899)
247 typedef ULONG64 RVA64;
249 typedef enum _MINIDUMP_TYPE
251 MiniDumpNormal = 0x0000,
252 MiniDumpWithDataSegs = 0x0001,
253 MiniDumpWithFullMemory = 0x0002,
254 MiniDumpWithHandleData = 0x0004,
255 MiniDumpFilterMemory = 0x0008,
256 MiniDumpScanMemory = 0x0010
259 typedef enum _MINIDUMP_CALLBACK_TYPE
264 IncludeThreadCallback,
265 IncludeModuleCallback,
266 } MINIDUMP_CALLBACK_TYPE;
268 typedef struct _MINIDUMP_THREAD_CALLBACK
276 } MINIDUMP_THREAD_CALLBACK, *PMINIDUMP_THREAD_CALLBACK;
278 typedef struct _MINIDUMP_THREAD_EX_CALLBACK
286 ULONGLONG BackingStoreBase;
287 ULONGLONG BackingStoreEnd;
288 } MINIDUMP_THREAD_EX_CALLBACK, *PMINIDUMP_THREAD_EX_CALLBACK;
290 typedef struct _MINIDUMP_INCLUDE_THREAD_CALLBACK
293 } MINIDUMP_INCLUDE_THREAD_CALLBACK, *PMINIDUMP_INCLUDE_THREAD_CALLBACK;
295 typedef enum _THREAD_WRITE_FLAGS
297 ThreadWriteThread = 0x0001,
298 ThreadWriteStack = 0x0002,
299 ThreadWriteContext = 0x0004,
300 ThreadWriteBackingStore = 0x0008,
301 ThreadWriteInstructionWindow = 0x0010
302 } THREAD_WRITE_FLAGS;
304 typedef struct _MINIDUMP_MODULE_CALLBACK
307 ULONGLONG BaseOfImage;
311 VS_FIXEDFILEINFO VersionInfo;
313 ULONG SizeOfCvRecord;
315 ULONG SizeOfMiscRecord;
316 } MINIDUMP_MODULE_CALLBACK, *PMINIDUMP_MODULE_CALLBACK;
318 typedef struct _MINIDUMP_INCLUDE_MODULE_CALLBACK
321 } MINIDUMP_INCLUDE_MODULE_CALLBACK, *PMINIDUMP_INCLUDE_MODULE_CALLBACK;
323 typedef enum _MODULE_WRITE_FLAGS
325 ModuleWriteModule = 0x0001,
326 ModuleWriteDataSeg = 0x0002,
327 ModuleWriteMiscRecord = 0x0004,
328 ModuleWriteCvRecord = 0x0008,
329 ModuleReferencedByMemory = 0x0010
330 } MODULE_WRITE_FLAGS;
332 typedef struct _MINIDUMP_CALLBACK_INPUT
335 HANDLE ProcessHandle;
339 MINIDUMP_THREAD_CALLBACK Thread;
340 MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
341 MINIDUMP_MODULE_CALLBACK Module;
342 MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
343 MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
345 } MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
347 typedef struct _MINIDUMP_CALLBACK_OUTPUT
351 ULONG ModuleWriteFlags;
352 ULONG ThreadWriteFlags;
354 } MINIDUMP_CALLBACK_OUTPUT, *PMINIDUMP_CALLBACK_OUTPUT;
356 typedef BOOL (WINAPI* MINIDUMP_CALLBACK_ROUTINE)(PVOID CallbackParam,
357 const PMINIDUMP_CALLBACK_INPUT CallbackInput,
358 PMINIDUMP_CALLBACK_OUTPUT CallbackOutput);
360 typedef struct _MINIDUMP_CALLBACK_INFORMATION
362 MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;
364 } MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;
366 typedef struct _MINIDUMP_LOCATION_DESCRIPTOR
370 } MINIDUMP_LOCATION_DESCRIPTOR;
372 typedef struct _MINIDUMP_DIRECTORY
375 MINIDUMP_LOCATION_DESCRIPTOR Location;
376 } MINIDUMP_DIRECTORY, *PMINIDUMP_DIRECTORY;
378 typedef struct _MINIDUMP_EXCEPTION
381 ULONG ExceptionFlags;
382 ULONGLONG ExceptionRecord;
383 ULONGLONG ExceptionAddress;
384 ULONG NumberParameters;
385 ULONG __unusedAlignment;
386 ULONGLONG ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
387 } MINIDUMP_EXCEPTION, *PMINIDUMP_EXCEPTION;
389 typedef struct _MINIDUMP_EXCEPTION_INFORMATION
392 PEXCEPTION_POINTERS ExceptionPointers;
394 } MINIDUMP_EXCEPTION_INFORMATION, *PMINIDUMP_EXCEPTION_INFORMATION;
396 typedef struct MINIDUMP_EXCEPTION_STREAM
400 MINIDUMP_EXCEPTION ExceptionRecord;
401 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
402 } MINIDUMP_EXCEPTION_STREAM, *PMINIDUMP_EXCEPTION_STREAM;
404 typedef struct _MINIDUMP_HEADER
408 DWORD NumberOfStreams;
409 RVA StreamDirectoryRva;
417 } MINIDUMP_HEADER, *PMINIDUMP_HEADER;
419 typedef struct _MINIDUMP_MEMORY_DESCRIPTOR
421 ULONGLONG StartOfMemoryRange;
422 MINIDUMP_LOCATION_DESCRIPTOR Memory;
423 } MINIDUMP_MEMORY_DESCRIPTOR, *PMINIDUMP_MEMORY_DESCRIPTOR;
425 typedef struct _MINIDUMP_MODULE
427 ULONGLONG BaseOfImage;
432 VS_FIXEDFILEINFO VersionInfo;
433 MINIDUMP_LOCATION_DESCRIPTOR CvRecord;
434 MINIDUMP_LOCATION_DESCRIPTOR MiscRecord;
437 } MINIDUMP_MODULE, *PMINIDUMP_MODULE;
439 typedef struct _MINIDUMP_MODULE_LIST
441 ULONG NumberOfModules;
442 MINIDUMP_MODULE Modules[1]; /* FIXME: 0-sized array not supported */
443 } MINIDUMP_MODULE_LIST, *PMINIDUMP_MODULE_LIST;
445 typedef struct _MINIDUMP_USER_STREAM
450 } MINIDUMP_USER_STREAM, *PMINIDUMP_USER_STREAM;
452 typedef struct _MINIDUMP_USER_STREAM_INFORMATION
454 ULONG UserStreamCount;
455 PMINIDUMP_USER_STREAM UserStreamArray;
456 } MINIDUMP_USER_STREAM_INFORMATION, *PMINIDUMP_USER_STREAM_INFORMATION;
458 typedef enum _MINIDUMP_STREAM_TYPE
463 ThreadListStream = 3,
464 ModuleListStream = 4,
465 MemoryListStream = 5,
467 SystemInfoStream = 7,
468 ThreadExListStream = 8,
469 Memory64ListStream = 9,
472 HandleDataStream = 12,
473 FunctionTableStream = 13,
475 LastReservedStream = 0xffff
476 } MINIDUMP_STREAM_TYPE;
478 typedef struct _MINIDUMP_SYSTEM_INFO
480 USHORT ProcessorArchitecture;
481 USHORT ProcessorLevel;
482 USHORT ProcessorRevision;
492 union _CPU_INFORMATION
497 ULONG VersionInformation;
498 ULONG FeatureInformation;
499 ULONG AMDExtendedCpuFeatures;
503 ULONGLONG ProcessorFeatures[2];
507 } MINIDUMP_SYSTEM_INFO, *PMINIDUMP_SYSTEM_INFO;
509 typedef struct _MINIDUMP_THREAD
516 MINIDUMP_MEMORY_DESCRIPTOR Stack;
517 MINIDUMP_LOCATION_DESCRIPTOR ThreadContext;
518 } MINIDUMP_THREAD, *PMINIDUMP_THREAD;
520 typedef struct _MINIDUMP_THREAD_LIST
522 ULONG NumberOfThreads;
523 MINIDUMP_THREAD Threads[1]; /* FIXME: no support of 0 sized array */
524 } MINIDUMP_THREAD_LIST, *PMINIDUMP_THREAD_LIST;
527 /*************************
529 *************************/
530 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(PSTR ModuleName, DWORD ModuleBase,
531 ULONG ModuleSize, PVOID UserContext);
532 extern BOOL WINAPI EnumerateLoadedModules(HANDLE hProcess,
533 PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,
535 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(PSTR ModuleName, DWORD BaseOfDll,
537 extern BOOL WINAPI SymEnumerateModules(HANDLE hProcess,
538 PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
540 extern BOOL WINAPI SymGetModuleInfo(HANDLE hProcess, DWORD dwAddr,
541 PIMAGEHLP_MODULE ModuleInfo);
542 extern BOOL WINAPI SymGetModuleInfoW(HANDLE hProcess, DWORD dwAddr,
543 PIMAGEHLP_MODULEW ModuleInfo);
544 extern DWORD WINAPI SymGetModuleBase(HANDLE hProcess, DWORD dwAddr);
545 extern DWORD WINAPI SymLoadModule(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
546 PSTR ModuleName, DWORD BaseOfDll, DWORD SizeOfDll);
547 extern DWORD WINAPI SymLoadModuleEx(HANDLE hProcess, HANDLE hFile, PSTR ImageName,
548 PSTR ModuleName, DWORD BaseOfDll, DWORD DllSize,
549 PMODLOAD_DATA Data, DWORD Flags);
550 extern BOOL WINAPI SymUnloadModule(HANDLE hProcess, DWORD BaseOfDll);
552 /*************************
554 *************************/
556 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
557 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER /* 0x08 */
558 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL /* 0x10 */
559 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL /* 0x20 */
560 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER /* 0x40 */
561 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL /* 0x80 */
562 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT /* 0x100 */
563 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION /* 0x800 */
565 typedef struct _SYMBOL_INFO
582 } SYMBOL_INFO, *PSYMBOL_INFO;
584 typedef enum _IMAGEHLP_SYMBOL_TYPE_INFO
592 TI_GET_ARRAYINDEXTYPEID,
595 TI_GET_ADDRESSOFFSET,
599 TI_GET_CHILDRENCOUNT,
601 TI_GET_VIRTUALBASECLASS,
602 TI_GET_VIRTUALTABLESHAPEID,
603 TI_GET_VIRTUALBASEPOINTEROFFSET,
604 TI_GET_CLASSPARENTID,
607 TI_GET_LEXICALPARENT,
610 } IMAGEHLP_SYMBOL_TYPE_INFO;
612 typedef struct _TI_FINDCHILDREN_PARAMS
617 } TI_FINDCHILDREN_PARAMS;
619 BOOL WINAPI SymGetTypeInfo(HANDLE hProcess, DWORD ModBase, ULONG TypeId,
620 IMAGEHLP_SYMBOL_TYPE_INFO GetType, PVOID);
621 typedef BOOL (CALLBACK *PSYM_ENUMERATESYMBOLS_CALLBACK)(PSYMBOL_INFO pSymInfo,
622 ULONG SymbolSize, PVOID UserContext);
623 BOOL WINAPI SymEnumTypes(HANDLE hProcess, DWORD BaseOfDll,
624 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
626 BOOL WINAPI SymGetTypeFromName(HANDLE hProcess, DWORD BaseOfDll, LPSTR Name,
627 PSYMBOL_INFO Symbol);
628 BOOL WINAPI SymEnumSymbols(HANDLE hProcess, ULONG BaseOfDll, PCSTR Mask,
629 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback,
632 /*************************
634 *************************/
635 typedef BOOL (CALLBACK *PSYM_ENUMSOURCFILES_CALLBACK)(PSOURCEFILE pSourceFile,
638 BOOL WINAPI SymEnumSourceFiles(HANDLE hProcess, ULONG ModBase, LPSTR Mask,
639 PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles,
642 /*************************
643 * File & image handling *
644 *************************/
645 BOOL WINAPI SymInitialize(HANDLE hProcess, PSTR UserSearchPath, BOOL fInvadeProcess);
646 BOOL WINAPI SymCleanup(HANDLE hProcess);
648 HANDLE WINAPI FindDebugInfoFile(PSTR FileName, PSTR SymbolPath, PSTR DebugFilePath);
649 typedef BOOL (CALLBACK *PFIND_DEBUG_FILE_CALLBACK)(HANDLE FileHandle, PSTR FileName,
651 HANDLE WINAPI FindDebugInfoFileEx(PSTR FileName, PSTR SymbolPath, PSTR DebugFilePath,
652 PFIND_DEBUG_FILE_CALLBACK Callback, PVOID CallerData);
653 typedef BOOL (CALLBACK *PFINDFILEINPATHCALLBACK)(PSTR filename, PVOID context);
655 BOOL WINAPI SymFindFileInPath(HANDLE hProcess, LPSTR searchPath, LPSTR FileName,
656 PVOID id, DWORD two, DWORD three, DWORD flags,
657 LPSTR FilePath, PFINDFILEINPATHCALLBACK callback,
659 HANDLE WINAPI FindExecutableImage(PSTR FileName, PSTR SymbolPath, PSTR ImageFilePath);
660 typedef BOOL (CALLBACK *PFIND_EXE_FILE_CALLBACK)(HANDLE FileHandle, PSTR FileName,
662 HANDLE WINAPI FindExecutableImageEx(PSTR FileName, PSTR SymbolPath, PSTR ImageFilePath,
663 PFIND_EXE_FILE_CALLBACK Callback, PVOID CallerData);
664 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(PVOID Base);
666 PVOID WINAPI ImageDirectoryEntryToDataEx(PVOID Base, BOOLEAN MappedAsImage,
667 USHORT DirectoryEntry, PULONG Size,
668 PIMAGE_SECTION_HEADER *FoundHeader);
669 PVOID WINAPI ImageDirectoryEntryToData(PVOID Base, BOOLEAN MappedAsImage,
670 USHORT DirectoryEntry, PULONG Size);
671 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(PIMAGE_NT_HEADERS NtHeaders,
672 PVOID Base, ULONG Rva);
673 PVOID WINAPI ImageRvaToVa(PIMAGE_NT_HEADERS NtHeaders, PVOID Base,
674 ULONG Rva, OUT PIMAGE_SECTION_HEADER *LastRvaSection);
676 /*************************
677 * Context management *
678 *************************/
679 BOOL WINAPI SymSetContext(HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame,
680 PIMAGEHLP_CONTEXT Context);
685 #endif /* defined(__cplusplus) */
687 #endif /* __WINE_DBGHELP_H */