Make sure sed uses the right locale.
[wine.git] / include / imagehlp.h
blob511abc17d2dcb5d4b9072fd8b79bd83078f75d40
1 /*
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
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* defined(__cplusplus) */
28 #define API_VERSION_NUMBER 7 /* 7 is the default */
30 /***********************************************************************
31 * Types
34 typedef PVOID DIGEST_HANDLE;
36 /***********************************************************************
37 * Enums/Defines
40 typedef enum _IMAGEHLP_STATUS_REASON {
41 BindOutOfMemory,
42 BindRvaToVaFailed,
43 BindNoRoomInImage,
44 BindImportModuleFailed,
45 BindImportProcedureFailed,
46 BindImportModule,
47 BindImportProcedure,
48 BindForwarder,
49 BindForwarderNOT,
50 BindImageModified,
51 BindExpandFileHeaders,
52 BindImageComplete,
53 BindMismatchedSymbols,
54 BindSymbolsNotUpdated
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
80 #define FRAME_FPO 0
81 #define FRAME_TRAP 1
82 #define FRAME_TSS 2
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 {
92 AddrMode1616,
93 AddrMode1632,
94 AddrModeReal,
95 AddrModeFlat
96 } ADDRESS_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
108 typedef enum {
109 SymNone,
110 SymCoff,
111 SymCv,
112 SymPdb,
113 SymExport,
114 SymDeferred,
115 SymSym /* .sym file */
116 } SYM_TYPE;
118 #define UNDNAME_COMPLETE 0x0000
119 #define UNDNAME_NO_LEADING_UNDERSCORES 0x0001
120 #define UNDNAME_NO_MS_KEYWORDS 0x0002
121 #define UNDNAME_NO_FUNCTION_RETURNS 0x0004
122 #define UNDNAME_NO_ALLOCATION_MODEL 0x0008
123 #define UNDNAME_NO_ALLOCATION_LANGUAGE 0x0010
124 #define UNDNAME_NO_MS_THISTYPE 0x0020
125 #define UNDNAME_NO_CV_THISTYPE 0x0040
126 #define UNDNAME_NO_THISTYPE 0x0060
127 #define UNDNAME_NO_ACCESS_SPECIFIERS 0x0080
128 #define UNDNAME_NO_THROW_SIGNATURES 0x0100
129 #define UNDNAME_NO_MEMBER_TYPE 0x0200
130 #define UNDNAME_NO_RETURN_UDT_MODEL 0x0400
131 #define UNDNAME_32_BIT_DECODE 0x0800
132 #define UNDNAME_NAME_ONLY 0x1000
133 #define UNDNAME_NO_ARGUMENTS 0x2000
134 #define UNDNAME_NO_SPECIAL_SYMS 0x4000
136 #define CBA_DEFERRED_SYMBOL_LOAD_START 0x00000001
137 #define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE 0x00000002
138 #define CBA_DEFERRED_SYMBOL_LOAD_FAILURE 0x00000003
139 #define CBA_SYMBOLS_UNLOADED 0x00000004
140 #define CBA_DUPLICATE_SYMBOL 0x00000005
142 /***********************************************************************
143 * Structures
146 typedef struct _LOADED_IMAGE {
147 LPSTR ModuleName;
148 HANDLE hFile;
149 PUCHAR MappedAddress;
150 PIMAGE_NT_HEADERS FileHeader;
151 PIMAGE_SECTION_HEADER LastRvaSection;
152 ULONG NumberOfSections;
153 PIMAGE_SECTION_HEADER Sections;
154 ULONG Characteristics;
155 BOOLEAN fSystemImage;
156 BOOLEAN fDOSImage;
157 LIST_ENTRY Links;
158 ULONG SizeOfImage;
159 } LOADED_IMAGE, *PLOADED_IMAGE;
161 typedef struct _WIN_CERTIFICATE {
162 DWORD dwLength;
163 WORD wRevision; /* WIN_CERT_REVISON_xxx */
164 WORD wCertificateType; /* WIN_CERT_TYPE_xxx */
165 BYTE bCertificate[ANYSIZE_ARRAY];
166 } WIN_CERTIFICATE, *PWIN_CERTIFICATE;
168 typedef struct _API_VERSION {
169 USHORT MajorVersion;
170 USHORT MinorVersion;
171 USHORT Revision;
172 USHORT Reserved;
173 } API_VERSION, *LPAPI_VERSION;
175 typedef struct _IMAGE_DEBUG_INFORMATION {
176 LIST_ENTRY List;
177 DWORD Size;
178 PVOID MappedBase;
179 USHORT Machine;
180 USHORT Characteristics;
181 DWORD CheckSum;
182 DWORD ImageBase;
183 DWORD SizeOfImage;
185 DWORD NumberOfSections;
186 PIMAGE_SECTION_HEADER Sections;
188 DWORD ExportedNamesSize;
189 LPSTR ExportedNames;
191 DWORD NumberOfFunctionTableEntries;
192 PIMAGE_FUNCTION_ENTRY FunctionTableEntries;
193 DWORD LowestFunctionStartingAddress;
194 DWORD HighestFunctionEndingAddress;
196 DWORD NumberOfFpoTableEntries;
197 PFPO_DATA FpoTableEntries;
199 DWORD SizeOfCoffSymbols;
200 PIMAGE_COFF_SYMBOLS_HEADER CoffSymbols;
202 DWORD SizeOfCodeViewSymbols;
203 PVOID CodeViewSymbols;
205 LPSTR ImageFilePath;
206 LPSTR ImageFileName;
207 LPSTR DebugFilePath;
209 DWORD TimeDateStamp;
211 BOOL RomImage;
212 PIMAGE_DEBUG_DIRECTORY DebugDirectory;
213 DWORD NumberOfDebugDirectories;
215 DWORD Reserved[3];
216 } IMAGE_DEBUG_INFORMATION, *PIMAGE_DEBUG_INFORMATION;
218 typedef struct _ADDRESS {
219 DWORD Offset;
220 WORD Segment;
221 ADDRESS_MODE Mode;
222 } ADDRESS, *PADDRESS;
224 typedef struct _KDHELP {
225 DWORD Thread;
226 DWORD ThCallbackStack;
227 DWORD NextCallback;
228 DWORD FramePointer;
229 DWORD KiCallUserMode;
230 DWORD KeUserCallbackDispatcher;
231 DWORD SystemRangeStart;
232 } KDHELP, *PKDHELP;
234 typedef struct _STACKFRAME {
235 ADDRESS AddrPC;
236 ADDRESS AddrReturn;
237 ADDRESS AddrFrame;
238 ADDRESS AddrStack;
239 PVOID FuncTableEntry;
240 DWORD Params[4];
241 BOOL Far;
242 BOOL Virtual;
243 DWORD Reserved[3];
244 KDHELP KdHelp;
245 } STACKFRAME, *LPSTACKFRAME;
247 typedef struct _IMAGEHLP_SYMBOL {
248 DWORD SizeOfStruct;
249 DWORD Address;
250 DWORD Size;
251 DWORD Flags;
252 DWORD MaxNameLength;
253 CHAR Name[ANYSIZE_ARRAY];
254 } IMAGEHLP_SYMBOL, *PIMAGEHLP_SYMBOL;
256 typedef struct _IMAGEHLP_MODULE {
257 DWORD SizeOfStruct;
258 DWORD BaseOfImage;
259 DWORD ImageSize;
260 DWORD TimeDateStamp;
261 DWORD CheckSum;
262 DWORD NumSyms;
263 SYM_TYPE SymType;
264 CHAR ModuleName[32];
265 CHAR ImageName[256];
266 CHAR LoadedImageName[256];
267 } IMAGEHLP_MODULE, *PIMAGEHLP_MODULE;
269 typedef struct _IMAGEHLP_LINE {
270 DWORD SizeOfStruct;
271 DWORD Key;
272 DWORD LineNumber;
273 PCHAR FileName;
274 DWORD Address;
275 } IMAGEHLP_LINE, *PIMAGEHLP_LINE;
277 typedef struct _IMAGEHLP_DEFERRED_SYMBOL_LOAD {
278 DWORD SizeOfStruct;
279 DWORD BaseOfImage;
280 DWORD CheckSum;
281 DWORD TimeDateStamp;
282 CHAR FileName[MAX_PATH];
283 BOOLEAN Reparse;
284 } IMAGEHLP_DEFERRED_SYMBOL_LOAD, *PIMAGEHLP_DEFERRED_SYMBOL_LOAD;
286 typedef struct _IMAGEHLP_DUPLICATE_SYMBOL {
287 DWORD SizeOfStruct;
288 DWORD NumberOfDups;
289 PIMAGEHLP_SYMBOL Symbol;
290 ULONG SelectedSymbol;
291 } IMAGEHLP_DUPLICATE_SYMBOL, *PIMAGEHLP_DUPLICATE_SYMBOL;
293 /***********************************************************************
294 * Callbacks
297 typedef BOOL (CALLBACK *PIMAGEHLP_STATUS_ROUTINE)(
298 IMAGEHLP_STATUS_REASON Reason, LPSTR ImageName, LPSTR DllName,
299 ULONG Va, ULONG Parameter
302 typedef BOOL (CALLBACK *PSYM_ENUMMODULES_CALLBACK)(
303 LPSTR ModuleName, ULONG BaseOfDll, PVOID UserContext
306 typedef BOOL (CALLBACK *PSYM_ENUMSYMBOLS_CALLBACK)(
307 LPSTR SymbolName, ULONG SymbolAddress, ULONG SymbolSize,
308 PVOID UserContext
311 typedef BOOL (CALLBACK *PENUMLOADED_MODULES_CALLBACK)(
312 LPSTR ModuleName, ULONG ModuleBase, ULONG ModuleSize,
313 PVOID UserContext
316 typedef BOOL (CALLBACK *PSYMBOL_REGISTERED_CALLBACK)(
317 HANDLE hProcess, ULONG ActionCode, PVOID CallbackData,
318 PVOID UserContext
321 typedef BOOL (CALLBACK *DIGEST_FUNCTION)(
322 DIGEST_HANDLE refdata, PBYTE pData, DWORD dwLength
325 typedef BOOL (CALLBACK *PREAD_PROCESS_MEMORY_ROUTINE)(
326 HANDLE hProcess, LPCVOID lpBaseAddress, PVOID lpBuffer,
327 DWORD nSize, PDWORD lpNumberOfBytesRead
330 typedef PVOID (CALLBACK *PFUNCTION_TABLE_ACCESS_ROUTINE)(
331 HANDLE hProcess, DWORD AddrBase
334 typedef DWORD (CALLBACK *PGET_MODULE_BASE_ROUTINE)(
335 HANDLE hProcess, DWORD ReturnAddress);
337 typedef DWORD (CALLBACK *PTRANSLATE_ADDRESS_ROUTINE)(
338 HANDLE hProcess, HANDLE hThread, PADDRESS lpaddr
341 /***********************************************************************
342 * Functions
345 BOOL WINAPI BindImage(
346 LPSTR ImageName, LPSTR DllPath, LPSTR SymbolPath
348 BOOL WINAPI BindImageEx(
349 DWORD Flags, LPSTR ImageName, LPSTR DllPath, LPSTR SymbolPath,
350 PIMAGEHLP_STATUS_ROUTINE StatusRoutine
352 PIMAGE_NT_HEADERS WINAPI CheckSumMappedFile(
353 LPVOID BaseAddress, DWORD FileLength,
354 LPDWORD HeaderSum, LPDWORD CheckSum
356 BOOL WINAPI EnumerateLoadedModules(
357 HANDLE hProcess,
358 PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,
359 PVOID UserContext
361 HANDLE WINAPI FindDebugInfoFile(
362 LPSTR FileName, LPSTR SymbolPath, LPSTR DebugFilePath
364 HANDLE WINAPI FindExecutableImage(
365 LPSTR FileName, LPSTR SymbolPath, LPSTR ImageFilePath
367 BOOL WINAPI GetImageConfigInformation(
368 PLOADED_IMAGE LoadedImage,
369 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
371 DWORD WINAPI GetImageUnusedHeaderBytes(
372 PLOADED_IMAGE LoadedImage,
373 LPDWORD SizeUnusedHeaderBytes
375 DWORD WINAPI GetTimestampForLoadedLibrary(
376 HMODULE Module
378 BOOL WINAPI ImageAddCertificate(
379 HANDLE FileHandle, PWIN_CERTIFICATE Certificate, PDWORD Index
381 PVOID WINAPI ImageDirectoryEntryToData(
382 PVOID Base, BOOLEAN MappedAsImage, USHORT DirectoryEntry, PULONG Size
384 BOOL WINAPI ImageEnumerateCertificates(
385 HANDLE FileHandle, WORD TypeFilter, PDWORD CertificateCount,
386 PDWORD Indices, DWORD IndexCount
388 BOOL WINAPI ImageGetCertificateData(
389 HANDLE FileHandle, DWORD CertificateIndex,
390 PWIN_CERTIFICATE Certificate, PDWORD RequiredLength
392 BOOL WINAPI ImageGetCertificateHeader(
393 HANDLE FileHandle, DWORD CertificateIndex,
394 PWIN_CERTIFICATE Certificateheader
396 BOOL WINAPI ImageGetDigestStream(
397 HANDLE FileHandle, DWORD DigestLevel,
398 DIGEST_FUNCTION DigestFunction, DIGEST_HANDLE DigestHandle
400 PLOADED_IMAGE WINAPI ImageLoad(
401 LPSTR DllName, LPSTR DllPath
403 PIMAGE_NT_HEADERS WINAPI ImageNtHeader(
404 PVOID Base
406 BOOL WINAPI ImageRemoveCertificate(
407 HANDLE FileHandle, DWORD Index
409 PIMAGE_SECTION_HEADER WINAPI ImageRvaToSection(
410 PIMAGE_NT_HEADERS NtHeaders, PVOID Base, ULONG Rva
412 PVOID WINAPI ImageRvaToVa(
413 PIMAGE_NT_HEADERS NtHeaders, PVOID Base, ULONG Rva,
414 PIMAGE_SECTION_HEADER *LastRvaSection
416 BOOL WINAPI ImageUnload(
417 PLOADED_IMAGE LoadedImage
419 LPAPI_VERSION WINAPI ImagehlpApiVersion(
420 void
422 LPAPI_VERSION WINAPI ImagehlpApiVersionEx(
423 LPAPI_VERSION AppVersion
425 BOOL WINAPI MakeSureDirectoryPathExists(
426 LPCSTR DirPath
428 BOOL WINAPI MapAndLoad(
429 LPSTR ImageName, LPSTR DllPath, PLOADED_IMAGE LoadedImage,
430 BOOL DotDll, BOOL ReadOnly
432 PIMAGE_DEBUG_INFORMATION WINAPI MapDebugInformation(
433 HANDLE FileHandle, LPSTR FileName,
434 LPSTR SymbolPath, DWORD ImageBase
436 DWORD WINAPI MapFileAndCheckSumA(
437 LPSTR Filename, LPDWORD HeaderSum, LPDWORD CheckSum
439 DWORD WINAPI MapFileAndCheckSumW(
440 LPWSTR Filename, LPDWORD HeaderSum, LPDWORD CheckSum
442 BOOL WINAPI ReBaseImage(
443 LPSTR CurrentImageName, LPSTR SymbolPath, BOOL fReBase,
444 BOOL fRebaseSysfileOk, BOOL fGoingDown, ULONG CheckImageSize,
445 ULONG *OldImageSize, ULONG *OldImageBase, ULONG *NewImageSize,
446 ULONG *NewImageBase, ULONG TimeStamp
448 BOOL WINAPI RemovePrivateCvSymbolic(
449 PCHAR DebugData, PCHAR *NewDebugData, ULONG *NewDebugSize
451 VOID WINAPI RemoveRelocations(
452 PCHAR ImageName
454 BOOL WINAPI SearchTreeForFile(
455 LPSTR RootPath, LPSTR InputPathName, LPSTR OutputPathBuffer
457 BOOL WINAPI SetImageConfigInformation(
458 PLOADED_IMAGE LoadedImage,
459 PIMAGE_LOAD_CONFIG_DIRECTORY ImageConfigInformation
461 BOOL WINAPI SplitSymbols(
462 LPSTR ImageName, LPSTR SymbolsPath,
463 LPSTR SymbolFilePath, DWORD Flags
465 BOOL WINAPI StackWalk(
466 DWORD MachineType, HANDLE hProcess, HANDLE hThread,
467 LPSTACKFRAME StackFrame, PVOID ContextRecord,
468 PREAD_PROCESS_MEMORY_ROUTINE ReadMemoryRoutine,
469 PFUNCTION_TABLE_ACCESS_ROUTINE FunctionTableAccessRoutine,
470 PGET_MODULE_BASE_ROUTINE GetModuleBaseRoutine,
471 PTRANSLATE_ADDRESS_ROUTINE TranslateAddress
473 BOOL WINAPI SymCleanup(
474 HANDLE hProcess
476 BOOL WINAPI SymEnumerateModules(
477 HANDLE hProcess, PSYM_ENUMMODULES_CALLBACK EnumModulesCallback,
478 PVOID UserContext
480 BOOL WINAPI SymEnumerateSymbols(
481 HANDLE hProcess, DWORD BaseOfDll,
482 PSYM_ENUMSYMBOLS_CALLBACK EnumSymbolsCallback, PVOID UserContext
484 PVOID WINAPI SymFunctionTableAccess(
485 HANDLE hProcess, DWORD AddrBase
487 DWORD WINAPI SymGetModuleBase(
488 HANDLE hProcess, DWORD dwAddr
490 BOOL WINAPI SymGetModuleInfo(
491 HANDLE hProcess, DWORD dwAddr,
492 PIMAGEHLP_MODULE ModuleInfo
494 DWORD WINAPI SymGetOptions(
495 void
497 BOOL WINAPI SymGetSearchPath(
498 HANDLE hProcess, LPSTR szSearchPath, DWORD SearchPathLength
500 BOOL WINAPI SymGetSymFromAddr(
501 HANDLE hProcess, DWORD dwAddr,
502 PDWORD pdwDisplacement, PIMAGEHLP_SYMBOL Symbol
504 BOOL WINAPI SymGetSymFromName(
505 HANDLE hProcess, LPSTR Name, PIMAGEHLP_SYMBOL Symbol
507 BOOL WINAPI SymGetSymNext(
508 HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol
510 BOOL WINAPI SymGetSymPrev(
511 HANDLE hProcess, PIMAGEHLP_SYMBOL Symbol
513 BOOL WINAPI SymInitialize(
514 HANDLE hProcess, LPSTR UserSearchPath, BOOL fInvadeProcess
516 BOOL WINAPI SymLoadModule(
517 HANDLE hProcess, HANDLE hFile, LPSTR ImageName, LPSTR ModuleName,
518 DWORD BaseOfDll, DWORD SizeOfDll
520 BOOL WINAPI SymRegisterCallback(
521 HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK CallbackFunction,
522 PVOID UserContext
524 DWORD WINAPI SymSetOptions(
525 DWORD SymOptions
527 BOOL WINAPI SymSetSearchPath(
528 HANDLE hProcess, LPSTR szSearchPath
530 BOOL WINAPI SymUnDName(
531 PIMAGEHLP_SYMBOL sym, LPSTR UnDecName, DWORD UnDecNameLength
533 BOOL WINAPI SymUnloadModule(
534 HANDLE hProcess, DWORD BaseOfDll
536 BOOL WINAPI TouchFileTimes(
537 HANDLE FileHandle, LPSYSTEMTIME lpSystemTime
539 DWORD WINAPI UnDecorateSymbolName(
540 LPCSTR DecoratedName, LPSTR UnDecoratedName,
541 DWORD UndecoratedLength, DWORD Flags
543 BOOL WINAPI UnMapAndLoad(
544 PLOADED_IMAGE LoadedImage
546 BOOL WINAPI UnmapDebugInformation(
547 PIMAGE_DEBUG_INFORMATION DebugInfo
549 BOOL WINAPI UpdateDebugInfoFile(
550 LPSTR ImageFileName, LPSTR SymbolPath,
551 LPSTR DebugFilePath, PIMAGE_NT_HEADERS NtHeaders
553 BOOL WINAPI UpdateDebugInfoFileEx(
554 LPSTR ImageFileName, LPSTR SymbolPath, LPSTR DebugFilePath,
555 PIMAGE_NT_HEADERS NtHeaders, DWORD OldChecksum
558 #ifdef __cplusplus
559 } /* extern "C" */
560 #endif /* defined(__cplusplus) */
562 #endif /* __WINE_IMAGEHLP_H */