2 * Declarations for IMAGEHLP
4 * Copyright (C) 1998 Patrik Stridvall
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_IMAGEHLP_H
22 #define __WINE_IMAGEHLP_H
26 #endif /* defined(__cplusplus) */
28 #define API_VERSION_NUMBER 7 /* 7 is the default */
30 /***********************************************************************
34 typedef PVOID DIGEST_HANDLE
;
36 /***********************************************************************
40 typedef enum _IMAGEHLP_STATUS_REASON
{
44 BindImportModuleFailed
,
45 BindImportProcedureFailed
,
51 BindExpandFileHeaders
,
53 BindMismatchedSymbols
,
55 } IMAGEHLP_STATUS_REASON
;
57 #define BIND_NO_BOUND_IMPORTS 0x00000001
58 #define BIND_NO_UPDATE 0x00000002
59 #define BIND_ALL_IMAGES 0x00000004
60 #define BIND_CACHE_IMPORT_DLLS 0x00000008
62 #define CERT_PE_IMAGE_DIGEST_DEBUG_INFO 0x01
63 #define CERT_PE_IMAGE_DIGEST_RESOURCES 0x02
64 #define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO 0x04
65 #define CERT_PE_IMAGE_DIGEST_NON_PE_INFO 0x08
67 #define CERT_SECTION_TYPE_ANY 0xFF
69 #define WIN_CERT_REVISION_1_0 0x0100
70 #define WIN_CERT_REVISION_2_0 0x0200
72 #define WIN_CERT_TYPE_X509 0x0001 /* X.509 Certificate */
73 #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 /* PKCS SignedData */
74 #define WIN_CERT_TYPE_RESERVED_1 0x0003 /* Reserved */
76 #define SPLITSYM_REMOVE_PRIVATE 0x00000001
77 #define SPLITSYM_EXTRACT_ALL 0x00000002
78 #define SPLITSYM_SYMBOLPATH_IS_SRC 0x00000004
83 #define FRAME_NONFPO 3
85 #define CHECKSUM_SUCCESS 0
86 #define CHECKSUM_OPEN_FAILURE 1
87 #define CHECKSUM_MAP_FAILURE 2
88 #define CHECKSUM_MAPVIEW_FAILURE 3
89 #define CHECKSUM_UNICODE_FAILURE 4
91 typedef enum _ADRESS_MODE
{
98 #define SYMOPT_CASE_INSENSITIVE 0x00000001
99 #define SYMOPT_UNDNAME 0x00000002
100 #define SYMOPT_DEFERRED_LOADS 0x00000004
101 #define SYMOPT_NO_CPP 0x00000008
102 #define SYMOPT_LOAD_LINES 0x00000010
103 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
105 #define SYMF_OMAP_GENERATED 0x00000001
106 #define SYMF_OMAP_MODIFIED 0x00000002
107 /* 0x00000004 has been obsoleted */
108 #define SYMF_REGISTER 0x00000008
109 #define SYMF_REGREL 0x00000010
110 #define SYMF_FRAMEREL 0x00000020
111 #define SYMF_PARAMETER 0x00000040
112 #define SYMF_LOCAL 0x00000080
113 #define SYMF_CONSTANT 0x00000100
114 #define SYMF_EXPORT 0x00000200
115 #define SYMF_FORWARDER 0x00000400
116 #define SYMF_FUNCTION 0x00000800
131 #define UNDNAME_COMPLETE 0x0000
132 #define UNDNAME_NO_LEADING_UNDERSCORES 0x0001
133 #define UNDNAME_NO_MS_KEYWORDS 0x0002
134 #define UNDNAME_NO_FUNCTION_RETURNS 0x0004
135 #define UNDNAME_NO_ALLOCATION_MODEL 0x0008
136 #define UNDNAME_NO_ALLOCATION_LANGUAGE 0x0010
137 #define UNDNAME_NO_MS_THISTYPE 0x0020
138 #define UNDNAME_NO_CV_THISTYPE 0x0040
139 #define UNDNAME_NO_THISTYPE 0x0060
140 #define UNDNAME_NO_ACCESS_SPECIFIERS 0x0080
141 #define UNDNAME_NO_THROW_SIGNATURES 0x0100
142 #define UNDNAME_NO_MEMBER_TYPE 0x0200
143 #define UNDNAME_NO_RETURN_UDT_MODEL 0x0400
144 #define UNDNAME_32_BIT_DECODE 0x0800
145 #define UNDNAME_NAME_ONLY 0x1000
146 #define UNDNAME_NO_ARGUMENTS 0x2000
147 #define UNDNAME_NO_SPECIAL_SYMS 0x4000
149 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
150 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
151 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
152 #define CBA_SYMBOLS_UNLOADED 0x00000004
153 #define CBA_DUPLICATE_SYMBOL 0x00000005
155 /***********************************************************************
159 typedef struct _LOADED_IMAGE
{
162 PUCHAR MappedAddress
;
163 PIMAGE_NT_HEADERS FileHeader
;
164 PIMAGE_SECTION_HEADER LastRvaSection
;
165 ULONG NumberOfSections
;
166 PIMAGE_SECTION_HEADER Sections
;
167 ULONG Characteristics
;
168 BOOLEAN fSystemImage
;
172 } LOADED_IMAGE
, *PLOADED_IMAGE
;
174 typedef struct _WIN_CERTIFICATE
{
176 WORD wRevision
; /* WIN_CERT_REVISON_xxx */
177 WORD wCertificateType
; /* WIN_CERT_TYPE_xxx */
178 BYTE bCertificate
[ANYSIZE_ARRAY
];
179 } WIN_CERTIFICATE
, *PWIN_CERTIFICATE
;
181 typedef struct _API_VERSION
{
186 } API_VERSION
, *LPAPI_VERSION
;
188 typedef struct _IMAGE_DEBUG_INFORMATION
{
193 USHORT Characteristics
;
198 DWORD NumberOfSections
;
199 PIMAGE_SECTION_HEADER Sections
;
201 DWORD ExportedNamesSize
;
204 DWORD NumberOfFunctionTableEntries
;
205 PIMAGE_FUNCTION_ENTRY FunctionTableEntries
;
206 DWORD LowestFunctionStartingAddress
;
207 DWORD HighestFunctionEndingAddress
;
209 DWORD NumberOfFpoTableEntries
;
210 PFPO_DATA FpoTableEntries
;
212 DWORD SizeOfCoffSymbols
;
213 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols
;
215 DWORD SizeOfCodeViewSymbols
;
216 PVOID CodeViewSymbols
;
225 PIMAGE_DEBUG_DIRECTORY DebugDirectory
;
226 DWORD NumberOfDebugDirectories
;
229 } IMAGE_DEBUG_INFORMATION
, *PIMAGE_DEBUG_INFORMATION
;
231 typedef struct _ADDRESS
{
235 } ADDRESS
, *PADDRESS
;
237 typedef struct _KDHELP
{
239 DWORD ThCallbackStack
;
242 DWORD KiCallUserMode
;
243 DWORD KeUserCallbackDispatcher
;
244 DWORD SystemRangeStart
;
247 typedef struct _STACKFRAME
{
252 PVOID FuncTableEntry
;
258 } STACKFRAME
, *LPSTACKFRAME
;
260 typedef struct _SOURCEFILE
{
263 } SOURCEFILE
, *PSOURCEFILE
;
265 typedef struct _IMAGEHLP_STACK_FRAME
267 DWORD InstructionOffset
;
271 DWORD BackingStoreOffset
;
272 DWORD FuncTableEntry
;
277 } IMAGEHLP_STACK_FRAME
, *PIMAGEHLP_STACK_FRAME
;
279 typedef VOID IMAGEHLP_CONTEXT
, *PIMAGEHLP_CONTEXT
;
281 typedef struct _IMAGEHLP_SYMBOL
{
287 CHAR Name
[ANYSIZE_ARRAY
];
288 } IMAGEHLP_SYMBOL
, *PIMAGEHLP_SYMBOL
;
290 typedef struct _IMAGEHLP_MODULE
{
300 CHAR LoadedImageName
[256];
301 } IMAGEHLP_MODULE
, *PIMAGEHLP_MODULE
;
303 typedef struct _IMAGEHLP_LINE
{
309 } IMAGEHLP_LINE
, *PIMAGEHLP_LINE
;
311 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
{
316 CHAR FileName
[MAX_PATH
];
318 } IMAGEHLP_DEFERRED_SYMBOL_LOAD
, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD
;
320 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
{
323 PIMAGEHLP_SYMBOL Symbol
;
324 ULONG SelectedSymbol
;
325 } IMAGEHLP_DUPLICATE_SYMBOL
, *PIMAGEHLP_DUPLICATE_SYMBOL
;
327 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
328 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER
329 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL
330 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL
331 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER
332 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL
333 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT
334 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION
336 typedef struct _SYMBOL_INFO
{
352 } SYMBOL_INFO
, *PSYMBOL_INFO
;
354 /***********************************************************************
358 typedef BOOL (CALLBACK
*PIMAGEHLP_STATUS_ROUTINE
)(
359 IMAGEHLP_STATUS_REASON Reason
, LPSTR ImageName
, LPSTR DllName
,
360 ULONG Va
, ULONG Parameter
363 typedef BOOL (CALLBACK
*PSYM_ENUMERATESYMBOLS_CALLBACK
)(
364 PSYMBOL_INFO pSymInfo
, DWORD SymbolSize
, PVOID UserContext
367 typedef BOOL (CALLBACK
*PSYM_ENUMSOURCFILES_CALLBACK
)(
368 PSOURCEFILE pSourceFile
, PVOID UserContext
371 typedef BOOL (CALLBACK
*PSYM_ENUMMODULES_CALLBACK
)(
372 LPSTR ModuleName
, ULONG BaseOfDll
, PVOID UserContext
375 typedef BOOL (CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK
)(
376 LPSTR SymbolName
, ULONG SymbolAddress
, ULONG SymbolSize
,
380 typedef BOOL (CALLBACK
*PENUMLOADED_MODULES_CALLBACK
)(
381 LPSTR ModuleName
, ULONG ModuleBase
, ULONG ModuleSize
,
385 typedef BOOL (CALLBACK
*PSYMBOL_REGISTERED_CALLBACK
)(
386 HANDLE hProcess
, ULONG ActionCode
, PVOID CallbackData
,
390 typedef BOOL (CALLBACK
*DIGEST_FUNCTION
)(
391 DIGEST_HANDLE refdata
, PBYTE pData
, DWORD dwLength
394 typedef BOOL (CALLBACK
*PREAD_PROCESS_MEMORY_ROUTINE
)(
395 HANDLE hProcess
, LPCVOID lpBaseAddress
, PVOID lpBuffer
,
396 DWORD nSize
, PDWORD lpNumberOfBytesRead
399 typedef PVOID (CALLBACK
*PFUNCTION_TABLE_ACCESS_ROUTINE
)(
400 HANDLE hProcess
, DWORD AddrBase
403 typedef DWORD (CALLBACK
*PGET_MODULE_BASE_ROUTINE
)(
404 HANDLE hProcess
, DWORD ReturnAddress
);
406 typedef DWORD (CALLBACK
*PTRANSLATE_ADDRESS_ROUTINE
)(
407 HANDLE hProcess
, HANDLE hThread
, PADDRESS lpaddr
410 /***********************************************************************
414 BOOL WINAPI
BindImage(
415 LPSTR ImageName
, LPSTR DllPath
, LPSTR SymbolPath
417 BOOL WINAPI
BindImageEx(
418 DWORD Flags
, LPSTR ImageName
, LPSTR DllPath
, LPSTR SymbolPath
,
419 PIMAGEHLP_STATUS_ROUTINE StatusRoutine
421 PIMAGE_NT_HEADERS WINAPI
CheckSumMappedFile(
422 LPVOID BaseAddress
, DWORD FileLength
,
423 LPDWORD HeaderSum
, LPDWORD CheckSum
425 BOOL WINAPI
EnumerateLoadedModules(
427 PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback
,
430 HANDLE WINAPI
FindDebugInfoFile(
431 LPSTR FileName
, LPSTR SymbolPath
, LPSTR DebugFilePath
433 HANDLE WINAPI
FindExecutableImage(
434 LPSTR FileName
, LPSTR SymbolPath
, LPSTR ImageFilePath
436 BOOL WINAPI
GetImageConfigInformation(
437 PLOADED_IMAGE LoadedImage
,
438 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
440 DWORD WINAPI
GetImageUnusedHeaderBytes(
441 PLOADED_IMAGE LoadedImage
,
442 LPDWORD SizeUnusedHeaderBytes
444 DWORD WINAPI
GetTimestampForLoadedLibrary(
447 BOOL WINAPI
ImageAddCertificate(
448 HANDLE FileHandle
, PWIN_CERTIFICATE Certificate
, PDWORD Index
450 PVOID WINAPI
ImageDirectoryEntryToData(
451 PVOID Base
, BOOLEAN MappedAsImage
, USHORT DirectoryEntry
, PULONG Size
453 BOOL WINAPI
ImageEnumerateCertificates(
454 HANDLE FileHandle
, WORD TypeFilter
, PDWORD CertificateCount
,
455 PDWORD Indices
, DWORD IndexCount
457 BOOL WINAPI
ImageGetCertificateData(
458 HANDLE FileHandle
, DWORD CertificateIndex
,
459 PWIN_CERTIFICATE Certificate
, PDWORD RequiredLength
461 BOOL WINAPI
ImageGetCertificateHeader(
462 HANDLE FileHandle
, DWORD CertificateIndex
,
463 PWIN_CERTIFICATE Certificateheader
465 BOOL WINAPI
ImageGetDigestStream(
466 HANDLE FileHandle
, DWORD DigestLevel
,
467 DIGEST_FUNCTION DigestFunction
, DIGEST_HANDLE DigestHandle
469 PLOADED_IMAGE WINAPI
ImageLoad(
470 LPSTR DllName
, LPSTR DllPath
472 PIMAGE_NT_HEADERS WINAPI
ImageNtHeader(
475 BOOL WINAPI
ImageRemoveCertificate(
476 HANDLE FileHandle
, DWORD Index
478 PIMAGE_SECTION_HEADER WINAPI
ImageRvaToSection(
479 PIMAGE_NT_HEADERS NtHeaders
, PVOID Base
, ULONG Rva
481 PVOID WINAPI
ImageRvaToVa(
482 PIMAGE_NT_HEADERS NtHeaders
, PVOID Base
, ULONG Rva
,
483 PIMAGE_SECTION_HEADER
*LastRvaSection
485 BOOL WINAPI
ImageUnload(
486 PLOADED_IMAGE LoadedImage
488 LPAPI_VERSION WINAPI
ImagehlpApiVersion(
491 LPAPI_VERSION WINAPI
ImagehlpApiVersionEx(
492 LPAPI_VERSION AppVersion
494 BOOL WINAPI
MakeSureDirectoryPathExists(
497 BOOL WINAPI
MapAndLoad(
498 LPSTR ImageName
, LPSTR DllPath
, PLOADED_IMAGE LoadedImage
,
499 BOOL DotDll
, BOOL ReadOnly
501 PIMAGE_DEBUG_INFORMATION WINAPI
MapDebugInformation(
502 HANDLE FileHandle
, LPSTR FileName
,
503 LPSTR SymbolPath
, DWORD ImageBase
505 DWORD WINAPI
MapFileAndCheckSumA(
506 LPSTR Filename
, LPDWORD HeaderSum
, LPDWORD CheckSum
508 DWORD WINAPI
MapFileAndCheckSumW(
509 LPWSTR Filename
, LPDWORD HeaderSum
, LPDWORD CheckSum
511 BOOL WINAPI
ReBaseImage(
512 LPSTR CurrentImageName
, LPSTR SymbolPath
, BOOL fReBase
,
513 BOOL fRebaseSysfileOk
, BOOL fGoingDown
, ULONG CheckImageSize
,
514 ULONG
*OldImageSize
, ULONG
*OldImageBase
, ULONG
*NewImageSize
,
515 ULONG
*NewImageBase
, ULONG TimeStamp
517 BOOL WINAPI
RemovePrivateCvSymbolic(
518 PCHAR DebugData
, PCHAR
*NewDebugData
, ULONG
*NewDebugSize
520 VOID WINAPI
RemoveRelocations(
523 BOOL WINAPI
SearchTreeForFile(
524 LPSTR RootPath
, LPSTR InputPathName
, LPSTR OutputPathBuffer
526 BOOL WINAPI
SetImageConfigInformation(
527 PLOADED_IMAGE LoadedImage
,
528 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
530 BOOL WINAPI
SplitSymbols(
531 LPSTR ImageName
, LPSTR SymbolsPath
,
532 LPSTR SymbolFilePath
, DWORD Flags
534 BOOL WINAPI
StackWalk(
535 DWORD MachineType
, HANDLE hProcess
, HANDLE hThread
,
536 LPSTACKFRAME StackFrame
, PVOID ContextRecord
,
537 PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine
,
538 PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine
,
539 PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine
,
540 PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
542 BOOL WINAPI
SymCleanup(
545 BOOL WINAPI
SymEnumerateModules(
546 HANDLE hProcess
, PSYM_ENUMMODULES_CALLBACK EnumModulesCallback
,
549 BOOL WINAPI
SymEnumerateSymbols(
550 HANDLE hProcess
, DWORD BaseOfDll
,
551 PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback
, PVOID UserContext
553 BOOL WINAPI
SymEnumSourceFiles(
554 HANDLE hProcess
, DWORD ModBase
, LPSTR Mask
,
555 PSYM_ENUMSOURCFILES_CALLBACK cbSrcFiles
, PVOID UserContext
557 BOOL WINAPI
SymEnumSymbols(
558 HANDLE hProcess
, DWORD BaseOfDll
, PCSTR Mask
,
559 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
, PVOID UserContext
561 PVOID WINAPI
SymFunctionTableAccess(
562 HANDLE hProcess
, DWORD AddrBase
564 DWORD WINAPI
SymGetModuleBase(
565 HANDLE hProcess
, DWORD dwAddr
567 BOOL WINAPI
SymGetModuleInfo(
568 HANDLE hProcess
, DWORD dwAddr
,
569 PIMAGEHLP_MODULE ModuleInfo
571 DWORD WINAPI
SymGetOptions(
574 BOOL WINAPI
SymGetSearchPath(
575 HANDLE hProcess
, LPSTR szSearchPath
, DWORD SearchPathLength
577 BOOL WINAPI
SymGetSymFromAddr(
578 HANDLE hProcess
, DWORD dwAddr
,
579 PDWORD pdwDisplacement
, PIMAGEHLP_SYMBOL Symbol
581 BOOL WINAPI
SymGetSymFromName(
582 HANDLE hProcess
, LPSTR Name
, PIMAGEHLP_SYMBOL Symbol
584 BOOL WINAPI
SymGetSymNext(
585 HANDLE hProcess
, PIMAGEHLP_SYMBOL Symbol
587 BOOL WINAPI
SymGetSymPrev(
588 HANDLE hProcess
, PIMAGEHLP_SYMBOL Symbol
590 BOOL WINAPI
SymInitialize(
591 HANDLE hProcess
, LPSTR UserSearchPath
, BOOL fInvadeProcess
593 DWORD WINAPI
SymLoadModule(
594 HANDLE hProcess
, HANDLE hFile
, LPSTR ImageName
, LPSTR ModuleName
,
595 DWORD BaseOfDll
, DWORD SizeOfDll
597 BOOL WINAPI
SymRegisterCallback(
598 HANDLE hProcess
, PSYMBOL_REGISTERED_CALLBACK CallbackFunction
,
601 DWORD WINAPI
SymSetContext(
602 HANDLE hProcess
, PIMAGEHLP_STACK_FRAME StackFrame
,
603 PIMAGEHLP_CONTEXT Context
605 DWORD WINAPI
SymSetOptions(
608 BOOL WINAPI
SymSetSearchPath(
609 HANDLE hProcess
, LPSTR szSearchPath
611 BOOL WINAPI
SymUnDName(
612 PIMAGEHLP_SYMBOL sym
, LPSTR UnDecName
, DWORD UnDecNameLength
614 BOOL WINAPI
SymUnloadModule(
615 HANDLE hProcess
, DWORD BaseOfDll
617 BOOL WINAPI
TouchFileTimes(
618 HANDLE FileHandle
, LPSYSTEMTIME lpSystemTime
620 DWORD WINAPI
UnDecorateSymbolName(
621 LPCSTR DecoratedName
, LPSTR UnDecoratedName
,
622 DWORD UndecoratedLength
, DWORD Flags
624 BOOL WINAPI
UnMapAndLoad(
625 PLOADED_IMAGE LoadedImage
627 BOOL WINAPI
UnmapDebugInformation(
628 PIMAGE_DEBUG_INFORMATION DebugInfo
630 BOOL WINAPI
UpdateDebugInfoFile(
631 LPSTR ImageFileName
, LPSTR SymbolPath
,
632 LPSTR DebugFilePath
, PIMAGE_NT_HEADERS NtHeaders
634 BOOL WINAPI
UpdateDebugInfoFileEx(
635 LPSTR ImageFileName
, LPSTR SymbolPath
, LPSTR DebugFilePath
,
636 PIMAGE_NT_HEADERS NtHeaders
, DWORD OldChecksum
641 #endif /* defined(__cplusplus) */
643 #endif /* __WINE_IMAGEHLP_H */