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
28 #endif /* defined(__cplusplus) */
30 #define API_VERSION_NUMBER 7 /* 7 is the default */
32 /***********************************************************************
36 typedef PVOID DIGEST_HANDLE
;
38 /***********************************************************************
42 typedef enum _IMAGEHLP_STATUS_REASON
{
46 BindImportModuleFailed
,
47 BindImportProcedureFailed
,
53 BindExpandFileHeaders
,
55 BindMismatchedSymbols
,
57 } IMAGEHLP_STATUS_REASON
;
59 #define BIND_NO_BOUND_IMPORTS 0x00000001
60 #define BIND_NO_UPDATE 0x00000002
61 #define BIND_ALL_IMAGES 0x00000004
62 #define BIND_CACHE_IMPORT_DLLS 0x00000008
64 #define CERT_PE_IMAGE_DIGEST_DEBUG_INFO 0x01
65 #define CERT_PE_IMAGE_DIGEST_RESOURCES 0x02
66 #define CERT_PE_IMAGE_DIGEST_ALL_IMPORT_INFO 0x04
67 #define CERT_PE_IMAGE_DIGEST_NON_PE_INFO 0x08
69 #define CERT_SECTION_TYPE_ANY 0xFF
71 #define WIN_CERT_REVISION_1_0 0x0100
72 #define WIN_CERT_REVISION_2_0 0x0200
74 #define WIN_CERT_TYPE_X509 0x0001 /* X.509 Certificate */
75 #define WIN_CERT_TYPE_PKCS_SIGNED_DATA 0x0002 /* PKCS SignedData */
76 #define WIN_CERT_TYPE_RESERVED_1 0x0003 /* Reserved */
78 #define SPLITSYM_REMOVE_PRIVATE 0x00000001
79 #define SPLITSYM_EXTRACT_ALL 0x00000002
80 #define SPLITSYM_SYMBOLPATH_IS_SRC 0x00000004
85 #define FRAME_NONFPO 3
87 #define CHECKSUM_SUCCESS 0
88 #define CHECKSUM_OPEN_FAILURE 1
89 #define CHECKSUM_MAP_FAILURE 2
90 #define CHECKSUM_MAPVIEW_FAILURE 3
91 #define CHECKSUM_UNICODE_FAILURE 4
93 typedef enum _ADRESS_MODE
{
100 #define SYMOPT_CASE_INSENSITIVE 0x00000001
101 #define SYMOPT_UNDNAME 0x00000002
102 #define SYMOPT_DEFERRED_LOADS 0x00000004
103 #define SYMOPT_NO_CPP 0x00000008
104 #define SYMOPT_LOAD_LINES 0x00000010
105 #define SYMOPT_OMAP_FIND_NEAREST 0x00000020
107 #define SYMF_OMAP_GENERATED 0x00000001
108 #define SYMF_OMAP_MODIFIED 0x00000002
109 /* 0x00000004 has been obsoleted */
110 #define SYMF_REGISTER 0x00000008
111 #define SYMF_REGREL 0x00000010
112 #define SYMF_FRAMEREL 0x00000020
113 #define SYMF_PARAMETER 0x00000040
114 #define SYMF_LOCAL 0x00000080
115 #define SYMF_CONSTANT 0x00000100
116 #define SYMF_EXPORT 0x00000200
117 #define SYMF_FORWARDER 0x00000400
118 #define SYMF_FUNCTION 0x00000800
133 #define UNDNAME_COMPLETE 0x0000
134 #define UNDNAME_NO_LEADING_UNDERSCORES 0x0001
135 #define UNDNAME_NO_MS_KEYWORDS 0x0002
136 #define UNDNAME_NO_FUNCTION_RETURNS 0x0004
137 #define UNDNAME_NO_ALLOCATION_MODEL 0x0008
138 #define UNDNAME_NO_ALLOCATION_LANGUAGE 0x0010
139 #define UNDNAME_NO_MS_THISTYPE 0x0020
140 #define UNDNAME_NO_CV_THISTYPE 0x0040
141 #define UNDNAME_NO_THISTYPE 0x0060
142 #define UNDNAME_NO_ACCESS_SPECIFIERS 0x0080
143 #define UNDNAME_NO_THROW_SIGNATURES 0x0100
144 #define UNDNAME_NO_MEMBER_TYPE 0x0200
145 #define UNDNAME_NO_RETURN_UDT_MODEL 0x0400
146 #define UNDNAME_32_BIT_DECODE 0x0800
147 #define UNDNAME_NAME_ONLY 0x1000
148 #define UNDNAME_NO_ARGUMENTS 0x2000
149 #define UNDNAME_NO_SPECIAL_SYMS 0x4000
151 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
152 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
153 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
154 #define CBA_SYMBOLS_UNLOADED 0x00000004
155 #define CBA_DUPLICATE_SYMBOL 0x00000005
157 /***********************************************************************
161 typedef struct _LOADED_IMAGE
{
164 PUCHAR MappedAddress
;
165 PIMAGE_NT_HEADERS FileHeader
;
166 PIMAGE_SECTION_HEADER LastRvaSection
;
167 ULONG NumberOfSections
;
168 PIMAGE_SECTION_HEADER Sections
;
169 ULONG Characteristics
;
170 BOOLEAN fSystemImage
;
174 } LOADED_IMAGE
, *PLOADED_IMAGE
;
176 typedef struct _WIN_CERTIFICATE
{
178 WORD wRevision
; /* WIN_CERT_REVISON_xxx */
179 WORD wCertificateType
; /* WIN_CERT_TYPE_xxx */
180 BYTE bCertificate
[ANYSIZE_ARRAY
];
181 } WIN_CERTIFICATE
, *PWIN_CERTIFICATE
;
183 typedef struct _API_VERSION
{
188 } API_VERSION
, *LPAPI_VERSION
;
190 typedef struct _IMAGE_DEBUG_INFORMATION
{
195 USHORT Characteristics
;
200 DWORD NumberOfSections
;
201 PIMAGE_SECTION_HEADER Sections
;
203 DWORD ExportedNamesSize
;
206 DWORD NumberOfFunctionTableEntries
;
207 PIMAGE_FUNCTION_ENTRY FunctionTableEntries
;
208 DWORD LowestFunctionStartingAddress
;
209 DWORD HighestFunctionEndingAddress
;
211 DWORD NumberOfFpoTableEntries
;
212 PFPO_DATA FpoTableEntries
;
214 DWORD SizeOfCoffSymbols
;
215 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols
;
217 DWORD SizeOfCodeViewSymbols
;
218 PVOID CodeViewSymbols
;
227 PIMAGE_DEBUG_DIRECTORY DebugDirectory
;
228 DWORD NumberOfDebugDirectories
;
231 } IMAGE_DEBUG_INFORMATION
, *PIMAGE_DEBUG_INFORMATION
;
233 typedef struct _ADDRESS
{
237 } ADDRESS
, *PADDRESS
;
239 typedef struct _KDHELP
{
241 DWORD ThCallbackStack
;
244 DWORD KiCallUserMode
;
245 DWORD KeUserCallbackDispatcher
;
246 DWORD SystemRangeStart
;
249 typedef struct _STACKFRAME
{
254 PVOID FuncTableEntry
;
260 } STACKFRAME
, *LPSTACKFRAME
;
262 typedef struct _SOURCEFILE
{
265 } SOURCEFILE
, *PSOURCEFILE
;
267 typedef struct _IMAGEHLP_STACK_FRAME
269 DWORD InstructionOffset
;
273 DWORD BackingStoreOffset
;
274 DWORD FuncTableEntry
;
279 } IMAGEHLP_STACK_FRAME
, *PIMAGEHLP_STACK_FRAME
;
281 typedef VOID IMAGEHLP_CONTEXT
, *PIMAGEHLP_CONTEXT
;
283 typedef struct _IMAGEHLP_SYMBOL
{
289 CHAR Name
[ANYSIZE_ARRAY
];
290 } IMAGEHLP_SYMBOL
, *PIMAGEHLP_SYMBOL
;
292 typedef struct _IMAGEHLP_MODULE
{
302 CHAR LoadedImageName
[256];
303 } IMAGEHLP_MODULE
, *PIMAGEHLP_MODULE
;
305 typedef struct _IMAGEHLP_LINE
{
311 } IMAGEHLP_LINE
, *PIMAGEHLP_LINE
;
313 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD
{
318 CHAR FileName
[MAX_PATH
];
320 } IMAGEHLP_DEFERRED_SYMBOL_LOAD
, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD
;
322 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL
{
325 PIMAGEHLP_SYMBOL Symbol
;
326 ULONG SelectedSymbol
;
327 } IMAGEHLP_DUPLICATE_SYMBOL
, *PIMAGEHLP_DUPLICATE_SYMBOL
;
329 #define IMAGEHLP_SYMBOL_INFO_VALUEPRESENT 1
330 #define IMAGEHLP_SYMBOL_INFO_REGISTER SYMF_REGISTER
331 #define IMAGEHLP_SYMBOL_INFO_REGRELATIVE SYMF_REGREL
332 #define IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE SYMF_FRAMEREL
333 #define IMAGEHLP_SYMBOL_INFO_PARAMETER SYMF_PARAMETER
334 #define IMAGEHLP_SYMBOL_INFO_LOCAL SYMF_LOCAL
335 #define IMAGEHLP_SYMBOL_INFO_CONSTANT SYMF_CONSTANT
336 #define IMAGEHLP_SYMBOL_FUNCTION SYMF_FUNCTION
338 typedef struct _SYMBOL_INFO
{
354 } SYMBOL_INFO
, *PSYMBOL_INFO
;
356 /***********************************************************************
360 typedef BOOL (CALLBACK
*PIMAGEHLP_STATUS_ROUTINE
)(
361 IMAGEHLP_STATUS_REASON Reason
, LPSTR ImageName
, LPSTR DllName
,
362 ULONG Va
, ULONG Parameter
365 typedef BOOL (CALLBACK
*PSYM_ENUMERATESYMBOLS_CALLBACK
)(
366 PSYMBOL_INFO pSymInfo
, DWORD SymbolSize
, PVOID UserContext
369 typedef BOOL (CALLBACK
*PSYM_ENUMSOURCEFILES_CALLBACK
)(
370 PSOURCEFILE pSourceFile
, PVOID UserContext
373 typedef BOOL (CALLBACK
*PSYM_ENUMMODULES_CALLBACK
)(
374 LPSTR ModuleName
, ULONG BaseOfDll
, PVOID UserContext
377 typedef BOOL (CALLBACK
*PSYM_ENUMSYMBOLS_CALLBACK
)(
378 LPSTR SymbolName
, ULONG SymbolAddress
, ULONG SymbolSize
,
382 typedef BOOL (CALLBACK
*PENUMLOADED_MODULES_CALLBACK
)(
383 LPSTR ModuleName
, ULONG ModuleBase
, ULONG ModuleSize
,
387 typedef BOOL (CALLBACK
*PSYMBOL_REGISTERED_CALLBACK
)(
388 HANDLE hProcess
, ULONG ActionCode
, PVOID CallbackData
,
392 typedef BOOL (CALLBACK
*DIGEST_FUNCTION
)(
393 DIGEST_HANDLE refdata
, PBYTE pData
, DWORD dwLength
396 typedef BOOL (CALLBACK
*PREAD_PROCESS_MEMORY_ROUTINE
)(
397 HANDLE hProcess
, LPCVOID lpBaseAddress
, PVOID lpBuffer
,
398 DWORD nSize
, PDWORD lpNumberOfBytesRead
401 typedef PVOID (CALLBACK
*PFUNCTION_TABLE_ACCESS_ROUTINE
)(
402 HANDLE hProcess
, DWORD AddrBase
405 typedef DWORD (CALLBACK
*PGET_MODULE_BASE_ROUTINE
)(
406 HANDLE hProcess
, DWORD ReturnAddress
);
408 typedef DWORD (CALLBACK
*PTRANSLATE_ADDRESS_ROUTINE
)(
409 HANDLE hProcess
, HANDLE hThread
, PADDRESS lpaddr
412 /***********************************************************************
416 BOOL WINAPI
BindImage(
417 LPSTR ImageName
, LPSTR DllPath
, LPSTR SymbolPath
419 BOOL WINAPI
BindImageEx(
420 DWORD Flags
, LPSTR ImageName
, LPSTR DllPath
, LPSTR SymbolPath
,
421 PIMAGEHLP_STATUS_ROUTINE StatusRoutine
423 PIMAGE_NT_HEADERS WINAPI
CheckSumMappedFile(
424 LPVOID BaseAddress
, DWORD FileLength
,
425 LPDWORD HeaderSum
, LPDWORD CheckSum
427 BOOL WINAPI
EnumerateLoadedModules(
429 PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback
,
432 HANDLE WINAPI
FindDebugInfoFile(
433 LPSTR FileName
, LPSTR SymbolPath
, LPSTR DebugFilePath
435 HANDLE WINAPI
FindExecutableImage(
436 LPSTR FileName
, LPSTR SymbolPath
, LPSTR ImageFilePath
438 BOOL WINAPI
GetImageConfigInformation(
439 PLOADED_IMAGE LoadedImage
,
440 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
442 DWORD WINAPI
GetImageUnusedHeaderBytes(
443 PLOADED_IMAGE LoadedImage
,
444 LPDWORD SizeUnusedHeaderBytes
446 DWORD WINAPI
GetTimestampForLoadedLibrary(
449 BOOL WINAPI
ImageAddCertificate(
450 HANDLE FileHandle
, PWIN_CERTIFICATE Certificate
, PDWORD Index
452 PVOID WINAPI
ImageDirectoryEntryToData(
453 PVOID Base
, BOOLEAN MappedAsImage
, USHORT DirectoryEntry
, PULONG Size
455 BOOL WINAPI
ImageEnumerateCertificates(
456 HANDLE FileHandle
, WORD TypeFilter
, PDWORD CertificateCount
,
457 PDWORD Indices
, DWORD IndexCount
459 BOOL WINAPI
ImageGetCertificateData(
460 HANDLE FileHandle
, DWORD CertificateIndex
,
461 PWIN_CERTIFICATE Certificate
, PDWORD RequiredLength
463 BOOL WINAPI
ImageGetCertificateHeader(
464 HANDLE FileHandle
, DWORD CertificateIndex
,
465 PWIN_CERTIFICATE Certificateheader
467 BOOL WINAPI
ImageGetDigestStream(
468 HANDLE FileHandle
, DWORD DigestLevel
,
469 DIGEST_FUNCTION DigestFunction
, DIGEST_HANDLE DigestHandle
471 PLOADED_IMAGE WINAPI
ImageLoad(
472 LPSTR DllName
, LPSTR DllPath
474 PIMAGE_NT_HEADERS WINAPI
ImageNtHeader(
477 BOOL WINAPI
ImageRemoveCertificate(
478 HANDLE FileHandle
, DWORD Index
480 PIMAGE_SECTION_HEADER WINAPI
ImageRvaToSection(
481 PIMAGE_NT_HEADERS NtHeaders
, PVOID Base
, ULONG Rva
483 PVOID WINAPI
ImageRvaToVa(
484 PIMAGE_NT_HEADERS NtHeaders
, PVOID Base
, ULONG Rva
,
485 PIMAGE_SECTION_HEADER
*LastRvaSection
487 BOOL WINAPI
ImageUnload(
488 PLOADED_IMAGE LoadedImage
490 LPAPI_VERSION WINAPI
ImagehlpApiVersion(
493 LPAPI_VERSION WINAPI
ImagehlpApiVersionEx(
494 LPAPI_VERSION AppVersion
496 BOOL WINAPI
MakeSureDirectoryPathExists(
499 BOOL WINAPI
MapAndLoad(
500 LPSTR ImageName
, LPSTR DllPath
, PLOADED_IMAGE LoadedImage
,
501 BOOL DotDll
, BOOL ReadOnly
503 PIMAGE_DEBUG_INFORMATION WINAPI
MapDebugInformation(
504 HANDLE FileHandle
, LPSTR FileName
,
505 LPSTR SymbolPath
, DWORD ImageBase
507 DWORD WINAPI
MapFileAndCheckSumA(
508 LPSTR Filename
, LPDWORD HeaderSum
, LPDWORD CheckSum
510 DWORD WINAPI
MapFileAndCheckSumW(
511 LPWSTR Filename
, LPDWORD HeaderSum
, LPDWORD CheckSum
513 BOOL WINAPI
ReBaseImage(
514 LPSTR CurrentImageName
, LPSTR SymbolPath
, BOOL fReBase
,
515 BOOL fRebaseSysfileOk
, BOOL fGoingDown
, ULONG CheckImageSize
,
516 ULONG
*OldImageSize
, ULONG
*OldImageBase
, ULONG
*NewImageSize
,
517 ULONG
*NewImageBase
, ULONG TimeStamp
519 BOOL WINAPI
RemovePrivateCvSymbolic(
520 PCHAR DebugData
, PCHAR
*NewDebugData
, ULONG
*NewDebugSize
522 VOID WINAPI
RemoveRelocations(
525 BOOL WINAPI
SearchTreeForFile(
526 LPSTR RootPath
, LPSTR InputPathName
, LPSTR OutputPathBuffer
528 BOOL WINAPI
SetImageConfigInformation(
529 PLOADED_IMAGE LoadedImage
,
530 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
532 BOOL WINAPI
SplitSymbols(
533 LPSTR ImageName
, LPSTR SymbolsPath
,
534 LPSTR SymbolFilePath
, DWORD Flags
536 BOOL WINAPI
StackWalk(
537 DWORD MachineType
, HANDLE hProcess
, HANDLE hThread
,
538 LPSTACKFRAME StackFrame
, PVOID ContextRecord
,
539 PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine
,
540 PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine
,
541 PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine
,
542 PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
544 BOOL WINAPI
SymCleanup(
547 BOOL WINAPI
SymEnumerateModules(
548 HANDLE hProcess
, PSYM_ENUMMODULES_CALLBACK EnumModulesCallback
,
551 BOOL WINAPI
SymEnumerateSymbols(
552 HANDLE hProcess
, DWORD BaseOfDll
,
553 PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback
, PVOID UserContext
555 BOOL WINAPI
SymEnumSourceFiles(
556 HANDLE hProcess
, DWORD ModBase
, LPSTR Mask
,
557 PSYM_ENUMSOURCEFILES_CALLBACK cbSrcFiles
, PVOID UserContext
559 BOOL WINAPI
SymEnumSymbols(
560 HANDLE hProcess
, DWORD BaseOfDll
, PCSTR Mask
,
561 PSYM_ENUMERATESYMBOLS_CALLBACK EnumSymbolsCallback
, PVOID UserContext
563 PVOID WINAPI
SymFunctionTableAccess(
564 HANDLE hProcess
, DWORD AddrBase
566 DWORD WINAPI
SymGetModuleBase(
567 HANDLE hProcess
, DWORD dwAddr
569 BOOL WINAPI
SymGetModuleInfo(
570 HANDLE hProcess
, DWORD dwAddr
,
571 PIMAGEHLP_MODULE ModuleInfo
573 DWORD WINAPI
SymGetOptions(
576 BOOL WINAPI
SymGetSearchPath(
577 HANDLE hProcess
, LPSTR szSearchPath
, DWORD SearchPathLength
579 BOOL WINAPI
SymGetSymFromAddr(
580 HANDLE hProcess
, DWORD dwAddr
,
581 PDWORD pdwDisplacement
, PIMAGEHLP_SYMBOL Symbol
583 BOOL WINAPI
SymGetSymFromName(
584 HANDLE hProcess
, LPSTR Name
, PIMAGEHLP_SYMBOL Symbol
586 BOOL WINAPI
SymGetSymNext(
587 HANDLE hProcess
, PIMAGEHLP_SYMBOL Symbol
589 BOOL WINAPI
SymGetSymPrev(
590 HANDLE hProcess
, PIMAGEHLP_SYMBOL Symbol
592 BOOL WINAPI
SymInitialize(
593 HANDLE hProcess
, LPSTR UserSearchPath
, BOOL fInvadeProcess
595 DWORD WINAPI
SymLoadModule(
596 HANDLE hProcess
, HANDLE hFile
, LPSTR ImageName
, LPSTR ModuleName
,
597 DWORD BaseOfDll
, DWORD SizeOfDll
599 BOOL WINAPI
SymRegisterCallback(
600 HANDLE hProcess
, PSYMBOL_REGISTERED_CALLBACK CallbackFunction
,
603 DWORD WINAPI
SymSetContext(
604 HANDLE hProcess
, PIMAGEHLP_STACK_FRAME StackFrame
,
605 PIMAGEHLP_CONTEXT Context
607 DWORD WINAPI
SymSetOptions(
610 BOOL WINAPI
SymSetSearchPath(
611 HANDLE hProcess
, LPSTR szSearchPath
613 BOOL WINAPI
SymUnDName(
614 PIMAGEHLP_SYMBOL sym
, LPSTR UnDecName
, DWORD UnDecNameLength
616 BOOL WINAPI
SymUnloadModule(
617 HANDLE hProcess
, DWORD BaseOfDll
619 BOOL WINAPI
TouchFileTimes(
620 HANDLE FileHandle
, LPSYSTEMTIME lpSystemTime
622 DWORD WINAPI
UnDecorateSymbolName(
623 LPCSTR DecoratedName
, LPSTR UnDecoratedName
,
624 DWORD UndecoratedLength
, DWORD Flags
626 BOOL WINAPI
UnMapAndLoad(
627 PLOADED_IMAGE LoadedImage
629 BOOL WINAPI
UnmapDebugInformation(
630 PIMAGE_DEBUG_INFORMATION DebugInfo
632 BOOL WINAPI
UpdateDebugInfoFile(
633 LPSTR ImageFileName
, LPSTR SymbolPath
,
634 LPSTR DebugFilePath
, PIMAGE_NT_HEADERS NtHeaders
636 BOOL WINAPI
UpdateDebugInfoFileEx(
637 LPSTR ImageFileName
, LPSTR SymbolPath
, LPSTR DebugFilePath
,
638 PIMAGE_NT_HEADERS NtHeaders
, DWORD OldChecksum
643 #endif /* defined(__cplusplus) */
645 #endif /* __WINE_IMAGEHLP_H */