1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
|
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
//! DbgHelp include file
use shared::basetsd::{DWORD64, PDWORD64, ULONG64};
use shared::guiddef::GUID;
use shared::minwindef::{
BOOL, DWORD, HMODULE, LPDWORD, MAX_PATH, PDWORD, PUCHAR, PULONG, UCHAR, ULONG, USHORT, WORD,
};
use um::winnt::{
BOOLEAN, CHAR, HANDLE, LIST_ENTRY, PCSTR, PCWSTR, PIMAGE_NT_HEADERS, PIMAGE_SECTION_HEADER,
PSTR, PVOID, PWSTR, WCHAR,
};
#[cfg(target_pointer_width = "32")]
use um::winnt::{
PFPO_DATA, PIMAGE_COFF_SYMBOLS_HEADER, PIMAGE_DEBUG_DIRECTORY, PIMAGE_FUNCTION_ENTRY,
PIMAGE_NT_HEADERS32,
};
#[cfg(target_pointer_width = "64")]
use um::winnt::PIMAGE_NT_HEADERS64;
use vc::vcruntime::size_t;
#[cfg(target_pointer_width = "64")]
STRUCT!{struct LOADED_IMAGE {
ModuleName: PSTR,
hFile: HANDLE,
MappedAddress: PUCHAR,
FileHeader: PIMAGE_NT_HEADERS64,
LastRvaSection: PIMAGE_SECTION_HEADER,
NumberOfSections: ULONG,
Sections: PIMAGE_SECTION_HEADER,
Characteristics: ULONG,
fSystemImage: BOOLEAN,
fDOSImage: BOOLEAN,
fReadOnly: BOOLEAN,
Version: UCHAR,
Links: LIST_ENTRY,
SizeOfImage: ULONG,
}}
#[cfg(target_pointer_width = "32")]
STRUCT!{struct LOADED_IMAGE {
ModuleName: PSTR,
hFile: HANDLE,
MappedAddress: PUCHAR,
FileHeader: PIMAGE_NT_HEADERS32,
LastRvaSection: PIMAGE_SECTION_HEADER,
NumberOfSections: ULONG,
Sections: PIMAGE_SECTION_HEADER,
Characteristics: ULONG,
fSystemImage: BOOLEAN,
fDOSImage: BOOLEAN,
fReadOnly: BOOLEAN,
Version: UCHAR,
Links: LIST_ENTRY,
SizeOfImage: ULONG,
}}
pub const MAX_SYM_NAME: usize = 2000;
pub const ERROR_IMAGE_NOT_STRIPPED: DWORD = 0x8800;
pub const ERROR_NO_DBG_POINTER: DWORD = 0x8801;
pub const ERROR_NO_PDB_POINTER: DWORD = 0x8802;
FN!{stdcall PFIND_DEBUG_FILE_CALLBACK(
FileHandle: HANDLE,
FileName: PCSTR,
CallerData: PVOID,
) -> BOOL}
FN!{stdcall PFIND_DEBUG_FILE_CALLBACKW(
FileHandle: HANDLE,
FileName: PCWSTR,
CallerData: PVOID,
) -> BOOL}
FN!{stdcall PFINDFILEINPATHCALLBACK(
filename: PCSTR,
context: PVOID,
) -> BOOL}
FN!{stdcall PFINDFILEINPATHCALLBACKW(
filename: PCWSTR,
context: PVOID,
) -> BOOL}
FN!{stdcall PFIND_EXE_FILE_CALLBACK(
FileHandle: HANDLE,
FileName: PCSTR,
CallerData: PVOID,
) -> BOOL}
FN!{stdcall PFIND_EXE_FILE_CALLBACKW(
FileHandle: HANDLE,
FileName: PCWSTR,
CallerData: PVOID,
) -> BOOL}
FN!{stdcall PSYM_ENUMERATESYMBOLS_CALLBACKW(
pSymInfo: PSYMBOL_INFOW,
SymbolSize: ULONG,
CallerData: PVOID,
) -> BOOL}
#[cfg(target_pointer_width = "32")]
STRUCT!{struct IMAGE_DEBUG_INFORMATION {
List: LIST_ENTRY,
ReservedSize: DWORD,
ReservedMappedBase: PVOID,
ReservedMachine: USHORT,
ReservedCharacteristics: USHORT,
ReservedCheckSum: DWORD,
ImageBase: DWORD,
SizeOfImage: DWORD,
ReservedNumberOfSections: DWORD,
ReservedSections: PIMAGE_SECTION_HEADER,
ReservedExportedNamesSize: DWORD,
ReservedExportedNames: PSTR,
ReservedNumberOfFunctionTableEntries: DWORD,
ReservedFunctionTableEntries: PIMAGE_FUNCTION_ENTRY,
ReservedLowestFunctionStartingAddress: DWORD,
ReservedHighestFunctionEndingAddress: DWORD,
ReservedNumberOfFpoTableEntries: DWORD,
ReservedFpoTableEntries: PFPO_DATA,
SizeOfCoffSymbols: DWORD,
CoffSymbols: PIMAGE_COFF_SYMBOLS_HEADER,
ReservedSizeOfCodeViewSymbols: DWORD,
ReservedCodeViewSymbols: PVOID,
ImageFilePath: PSTR,
ImageFileName: PSTR,
ReservedDebugFilePath: PSTR,
ReservedTimeDateStamp: DWORD,
ReservedRomImage: BOOL,
ReservedDebugDirectory: PIMAGE_DEBUG_DIRECTORY,
ReservedNumberOfDebugDirectories: DWORD,
ReservedOriginalFunctionTableBaseAddress: DWORD,
Reserved: [DWORD; 2],
}}
#[cfg(target_pointer_width = "32")]
pub type PIMAGE_DEBUG_INFORMATION = *mut IMAGE_DEBUG_INFORMATION;
FN!{stdcall PENUMDIRTREE_CALLBACK(
FilePath: PCSTR,
CallerData: PVOID,
) -> BOOL}
FN!{stdcall PENUMDIRTREE_CALLBACKW(
FilePath: PCWSTR,
CallerData: PVOID,
) -> BOOL}
pub const UNDNAME_COMPLETE: DWORD = 0x0000;
pub const UNDNAME_NO_LEADING_UNDERSCORES: DWORD = 0x0001;
pub const UNDNAME_NO_MS_KEYWORDS: DWORD = 0x0002;
pub const UNDNAME_NO_FUNCTION_RETURNS: DWORD = 0x0004;
pub const UNDNAME_NO_ALLOCATION_MODEL: DWORD = 0x0008;
pub const UNDNAME_NO_ALLOCATION_LANGUAGE: DWORD = 0x0010;
pub const UNDNAME_NO_MS_THISTYPE: DWORD = 0x0020;
pub const UNDNAME_NO_CV_THISTYPE: DWORD = 0x0040;
pub const UNDNAME_NO_THISTYPE: DWORD = 0x0060;
pub const UNDNAME_NO_ACCESS_SPECIFIERS: DWORD = 0x0080;
pub const UNDNAME_NO_THROW_SIGNATURES: DWORD = 0x0100;
pub const UNDNAME_NO_MEMBER_TYPE: DWORD = 0x0200;
pub const UNDNAME_NO_RETURN_UDT_MODEL: DWORD = 0x0400;
pub const UNDNAME_32_BIT_DECODE: DWORD = 0x0800;
pub const UNDNAME_NAME_ONLY: DWORD = 0x1000;
pub const UNDNAME_NO_ARGUMENTS: DWORD = 0x2000;
pub const UNDNAME_NO_SPECIAL_SYMS: DWORD = 0x4000;
pub const DBHHEADER_DEBUGDIRS: DWORD = 0x1;
pub const DBHHEADER_CVMISC: DWORD = 0x2;
pub const DBHHEADER_PDBGUID: DWORD = 0x3;
STRUCT!{struct MODLOAD_DATA {
ssize: DWORD,
ssig: DWORD,
data: PVOID,
size: DWORD,
flags: DWORD,
}}
pub type PMODLOAD_DATA = *mut MODLOAD_DATA;
STRUCT!{struct MODLOAD_CVMISC {
oCV: DWORD,
cCV: size_t,
oMisc: DWORD,
cMisc: size_t,
dtImage: DWORD,
cImage: DWORD,
}}
pub type PMODLOAD_CVMISC = *mut MODLOAD_CVMISC;
STRUCT!{struct MODLOAD_PDBGUID_PDBAGE {
PdbGuid: GUID,
PdbAge: DWORD,
}}
pub type PMODLOAD_PDBGUID_PDBAGE = *mut MODLOAD_PDBGUID_PDBAGE;
ENUM!{enum ADDRESS_MODE {
AddrMode1616,
AddrMode1632,
AddrModeReal,
AddrModeFlat,
}}
STRUCT!{struct ADDRESS64 {
Offset: DWORD64,
Segment: WORD,
Mode: ADDRESS_MODE,
}}
pub type LPADDRESS64 = *mut ADDRESS64;
#[cfg(target_pointer_width = "64")]
pub type ADDRESS = ADDRESS64;
#[cfg(target_pointer_width = "64")]
pub type LPADDRESS = LPADDRESS64;
#[cfg(target_pointer_width = "32")]
STRUCT!{struct ADDRESS {
Offset: DWORD,
Segment: WORD,
Mode: ADDRESS_MODE,
}}
#[cfg(target_pointer_width = "32")]
pub type LPADDRESS = *mut ADDRESS;
STRUCT!{struct KDHELP64 {
Thread: DWORD64,
ThCallbackStack: DWORD,
ThCallbackBStore: DWORD,
NextCallback: DWORD,
FramePointer: DWORD,
KiCallUserMode: DWORD64,
KeUserCallbackDispatcher: DWORD64,
SystemRangeStart: DWORD64,
KiUserExceptionDispatcher: DWORD64,
StackBase: DWORD64,
StackLimit: DWORD64,
BuildVersion: DWORD,
Reserved0: DWORD,
Reserved1: [DWORD64; 4],
}}
pub type PKDHELP64 = *mut KDHELP64;
#[cfg(target_pointer_width = "64")]
pub type KDHELP = KDHELP64;
#[cfg(target_pointer_width = "64")]
pub type PKDHELP = PKDHELP64;
#[cfg(target_pointer_width = "32")]
STRUCT!{struct KDHELP {
Thread: DWORD,
ThCallbackStack: DWORD,
NextCallback: DWORD,
FramePointer: DWORD,
KiCallUserMode: DWORD,
KeUserCallbackDispatcher: DWORD,
SystemRangeStart: DWORD,
ThCallbackBStore: DWORD,
KiUserExceptionDispatcher: DWORD,
StackBase: DWORD,
StackLimit: DWORD,
Reserved: [DWORD; 5],
}}
#[cfg(target_pointer_width = "32")]
pub type PKDHELP = *mut KDHELP;
STRUCT!{struct STACKFRAME64 {
AddrPC: ADDRESS64,
AddrReturn: ADDRESS64,
AddrFrame: ADDRESS64,
AddrStack: ADDRESS64,
AddrBStore: ADDRESS64,
FuncTableEntry: PVOID,
Params: [DWORD64; 4],
Far: BOOL,
Virtual: BOOL,
Reserved: [DWORD64; 3],
KdHelp: KDHELP64,
}}
pub type LPSTACKFRAME64 = *mut STACKFRAME64;
pub const INLINE_FRAME_CONTEXT_INIT: DWORD = 0;
pub const INLINE_FRAME_CONTEXT_IGNORE: DWORD = 0xFFFFFFFF;
STRUCT!{struct STACKFRAME_EX {
AddrPC: ADDRESS64,
AddrReturn: ADDRESS64,
AddrFrame: ADDRESS64,
AddrStack: ADDRESS64,
AddrBStore: ADDRESS64,
FuncTableEntry: PVOID,
Params: [DWORD64; 4],
Far: BOOL,
Virtual: BOOL,
Reserved: [DWORD64; 3],
KdHelp: KDHELP64,
StackFrameSize: DWORD,
InlineFrameContext: DWORD,
}}
pub type LPSTACKFRAME_EX = *mut STACKFRAME_EX;
#[cfg(target_pointer_width = "64")]
pub type STACKFRAME = STACKFRAME64;
#[cfg(target_pointer_width = "64")]
pub type LPSTACKFRAME = LPSTACKFRAME64;
#[cfg(target_pointer_width = "32")]
STRUCT!{struct STACKFRAME {
AddrPC: ADDRESS,
AddrReturn: ADDRESS,
AddrFrame: ADDRESS,
AddrStack: ADDRESS,
FuncTableEntry: PVOID,
Params: [DWORD; 4],
Far: BOOL,
Virtual: BOOL,
Reserved: [DWORD; 3],
KdHelp: KDHELP,
AddrBStore: ADDRESS,
}}
#[cfg(target_pointer_width = "32")]
pub type LPSTACKFRAME = *mut STACKFRAME;
FN!{stdcall PREAD_PROCESS_MEMORY_ROUTINE64(
hProcess: HANDLE,
qwBaseAddress: DWORD64,
lpBuffer: PVOID,
nSize: DWORD,
lpNumberOfBytesRead: LPDWORD,
) -> BOOL}
FN!{stdcall PFUNCTION_TABLE_ACCESS_ROUTINE64(
ahProcess: HANDLE,
AddrBase: DWORD64,
) -> PVOID}
FN!{stdcall PGET_MODULE_BASE_ROUTINE64(
hProcess: HANDLE,
Address: DWORD64,
) -> DWORD64}
FN!{stdcall PTRANSLATE_ADDRESS_ROUTINE64(
hProcess: HANDLE,
hThread: HANDLE,
lpaddr: LPADDRESS64,
) -> DWORD64}
pub const SYM_STKWALK_DEFAULT: DWORD = 0x00000000;
pub const SYM_STKWALK_FORCE_FRAMEPTR: DWORD = 0x00000001;
#[cfg(target_pointer_width = "64")]
pub type PREAD_PROCESS_MEMORY_ROUTINE = PREAD_PROCESS_MEMORY_ROUTINE64;
#[cfg(target_pointer_width = "64")]
pub type PFUNCTION_TABLE_ACCESS_ROUTINE = PFUNCTION_TABLE_ACCESS_ROUTINE64;
#[cfg(target_pointer_width = "64")]
pub type PGET_MODULE_BASE_ROUTINE = PGET_MODULE_BASE_ROUTINE64;
#[cfg(target_pointer_width = "64")]
pub type PTRANSLATE_ADDRESS_ROUTINE = PTRANSLATE_ADDRESS_ROUTINE64;
#[cfg(target_pointer_width = "32")]
FN!{stdcall PREAD_PROCESS_MEMORY_ROUTINE(
hProcess: HANDLE,
qwBaseAddress: DWORD,
lpBuffer: PVOID,
nSize: DWORD,
lpNumberOfBytesRead: PDWORD,
) -> BOOL}
#[cfg(target_pointer_width = "32")]
FN!{stdcall PFUNCTION_TABLE_ACCESS_ROUTINE(
ahProcess: HANDLE,
AddrBase: DWORD,
) -> PVOID}
#[cfg(target_pointer_width = "32")]
FN!{stdcall PGET_MODULE_BASE_ROUTINE(
hProcess: HANDLE,
Address: DWORD,
) -> DWORD}
#[cfg(target_pointer_width = "32")]
FN!{stdcall PTRANSLATE_ADDRESS_ROUTINE(
hProcess: HANDLE,
hThread: HANDLE,
lpaddr: LPADDRESS,
) -> DWORD}
pub const API_VERSION_NUMBER: USHORT = 12;
STRUCT!{struct API_VERSION {
MajorVersion: USHORT,
MinorVersion: USHORT,
Revision: USHORT,
Reserved: USHORT,
}}
pub type LPAPI_VERSION = *mut API_VERSION;
STRUCT!{struct SYMBOL_INFOW {
SizeOfStruct: ULONG,
TypeIndex: ULONG,
Reserved: [ULONG64; 2],
Index: ULONG,
Size: ULONG,
ModBase: ULONG64,
Flags: ULONG,
Value: ULONG64,
Address: ULONG64,
Register: ULONG,
Scope: ULONG,
Tag: ULONG,
NameLen: ULONG,
MaxNameLen: ULONG,
Name: [WCHAR; 1],
}}
pub type PSYMBOL_INFOW = *mut SYMBOL_INFOW;
ENUM!{enum SYM_TYPE {
SymNone = 0,
SymCoff,
SymCv,
SymPdb,
SymExport,
SymDeferred,
SymSym,
SymDia,
SymVirtual,
NumSymTypes,
}}
STRUCT!{struct IMAGEHLP_SYMBOL64 {
SizeOfStruct: DWORD,
Address: DWORD64,
Size: DWORD,
Flags: DWORD,
MaxNameLength: DWORD,
Name: [CHAR; 1],
}}
pub type PIMAGEHLP_SYMBOL64 = *mut IMAGEHLP_SYMBOL64;
STRUCT!{struct IMAGEHLP_MODULEW64 {
SizeOfStruct: DWORD,
BaseOfImage: DWORD64,
ImageSize: DWORD,
TimeDateStamp: DWORD,
CheckSum: DWORD,
NumSyms: DWORD,
SymType: SYM_TYPE,
ModuleName: [WCHAR; 32],
ImageName: [WCHAR; 256],
LoadedImageName: [WCHAR; 256],
LoadedPdbName: [WCHAR; 256],
CVSig: DWORD,
CVData: [WCHAR; MAX_PATH * 3],
PdbSig: DWORD,
PdbSig70: GUID,
PdbAge: DWORD,
PdbUnmatched: BOOL,
DbgUnmatched: BOOL,
LineNumbers: BOOL,
GlobalSymbols: BOOL,
TypeInfo: BOOL,
SourceIndexed: BOOL,
Publics: BOOL,
MachineType: DWORD,
Reserved: DWORD,
}}
pub type PIMAGEHLP_MODULEW64 = *mut IMAGEHLP_MODULEW64;
STRUCT!{struct IMAGEHLP_LINEW64 {
SizeOfStruct: DWORD,
Key: PVOID,
LineNumber: DWORD,
FileName: PWSTR,
Address: DWORD64,
}}
pub type PIMAGEHLP_LINEW64 = *mut IMAGEHLP_LINEW64;
extern "system" {
pub fn EnumDirTree(
hProcess: HANDLE,
RootPath: PCSTR,
InputPathName: PCSTR,
OutputPathBuffer: PSTR,
cb: PENUMDIRTREE_CALLBACK,
data: PVOID,
) -> BOOL;
pub fn EnumDirTreeW(
hProcess: HANDLE,
RootPath: PCWSTR,
InputPathName: PCWSTR,
OutputPathBuffer: PWSTR,
cb: PENUMDIRTREE_CALLBACKW,
data: PVOID,
) -> BOOL;
pub fn ImagehlpApiVersion() -> LPAPI_VERSION;
pub fn ImagehlpApiVersionEx(
AppVersion: LPAPI_VERSION,
) -> LPAPI_VERSION;
pub fn MakeSureDirectoryPathExists(
DirPath: PCSTR,
) -> BOOL;
pub fn SearchTreeForFile(
RootPath: PCSTR,
InputPathName: PCSTR,
OutputPathBuffer: PSTR,
) -> BOOL;
pub fn SearchTreeForFileW(
RootPath: PCWSTR,
InputPathName: PCWSTR,
OutputPathBuffer: PWSTR,
) -> BOOL;
pub fn FindDebugInfoFile(
FileName: PCSTR,
SymbolPath: PCSTR,
DebugFilePath: PSTR,
) -> HANDLE;
pub fn FindDebugInfoFileEx(
FileName: PCSTR,
SymbolPath: PCSTR,
DebugFilePath: PSTR,
Callback: PFIND_DEBUG_FILE_CALLBACK,
CallerData: PVOID,
) -> HANDLE;
pub fn FindDebugInfoFileExW(
FileName: PCWSTR,
SymbolPath: PCWSTR,
DebugFilePath: PWSTR,
Callback: PFIND_DEBUG_FILE_CALLBACKW,
CallerData: PVOID,
) -> HANDLE;
pub fn FindExecutableImage(
FileName: PCSTR,
SymbolPath: PCSTR,
ImageFilePath: PSTR,
) -> HANDLE;
pub fn FindExecutableImageEx(
FileName: PCSTR,
SymbolPath: PCSTR,
ImageFilePath: PSTR,
Callback: PFIND_EXE_FILE_CALLBACK,
CallerData: PVOID,
) -> HANDLE;
pub fn FindExecutableImageExW(
FileName: PCWSTR,
SymbolPath: PCWSTR,
ImageFilePath: PWSTR,
Callback: PFIND_EXE_FILE_CALLBACKW,
CallerData: PVOID,
) -> HANDLE;
pub fn StackWalk(
MachineType: DWORD,
hProcess: HANDLE,
hThread: HANDLE,
StackFrame: LPSTACKFRAME,
ContextRecord: PVOID,
ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE,
FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE,
GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE,
TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE,
) -> BOOL;
pub fn StackWalkEx(
MachineType: DWORD,
hProcess: HANDLE,
hThread: HANDLE,
StackFrame: LPSTACKFRAME_EX,
ContextRecord: PVOID,
ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE64,
FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE64,
GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE64,
TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE64,
Flags: DWORD,
) -> BOOL;
pub fn StackWalk64(
MachineType: DWORD,
hProcess: HANDLE,
hThread: HANDLE,
StackFrame: LPSTACKFRAME64,
ContextRecord: PVOID,
ReadMemoryRoutine: PREAD_PROCESS_MEMORY_ROUTINE64,
FunctionTableAccessRoutine: PFUNCTION_TABLE_ACCESS_ROUTINE64,
GetModuleBaseRoutine: PGET_MODULE_BASE_ROUTINE64,
TranslateAddress: PTRANSLATE_ADDRESS_ROUTINE64,
) -> BOOL;
pub fn UnDecorateSymbolName(
name: PCSTR,
outputString: PSTR,
maxStringLength: DWORD,
flags: DWORD,
) -> DWORD;
pub fn UnDecorateSymbolNameW(
name: PCWSTR,
outputString: PWSTR,
maxStringLength: DWORD,
flags: DWORD,
) -> DWORD;
pub fn GetTimestampForLoadedLibrary(
Module: HMODULE,
) -> DWORD;
pub fn ImageDirectoryEntryToData(
Base: PVOID,
MappedAsImage: BOOLEAN,
DirectoryEntry: USHORT,
Size: PULONG,
) -> PVOID;
pub fn ImageDirectoryEntryToDataEx(
Base: PVOID,
MappedAsImage: BOOLEAN,
DirectoryEntry: USHORT,
Size: PULONG,
FoundHeader: *mut PIMAGE_SECTION_HEADER,
) -> PVOID;
pub fn ImageNtHeader(
Base: PVOID,
) -> PIMAGE_NT_HEADERS;
pub fn ImageRvaToSection(
NtHeaders: PIMAGE_NT_HEADERS,
Base: PVOID,
Rva: ULONG,
) -> PIMAGE_SECTION_HEADER;
pub fn ImageRvaToVa(
NtHeaders: PIMAGE_NT_HEADERS,
Base: PVOID,
Rva: ULONG,
LastRvaSection: *mut PIMAGE_SECTION_HEADER,
) -> PVOID;
}
pub const SYMOPT_CASE_INSENSITIVE: DWORD = 0x00000001;
pub const SYMOPT_UNDNAME: DWORD = 0x00000002;
pub const SYMOPT_DEFERRED_LOADS: DWORD = 0x00000004;
pub const SYMOPT_NO_CPP: DWORD = 0x00000008;
pub const SYMOPT_LOAD_LINES: DWORD = 0x00000010;
pub const SYMOPT_OMAP_FIND_NEAREST: DWORD = 0x00000020;
pub const SYMOPT_LOAD_ANYTHING: DWORD = 0x00000040;
pub const SYMOPT_IGNORE_CVREC: DWORD = 0x00000080;
pub const SYMOPT_NO_UNQUALIFIED_LOADS: DWORD = 0x00000100;
pub const SYMOPT_FAIL_CRITICAL_ERRORS: DWORD = 0x00000200;
pub const SYMOPT_EXACT_SYMBOLS: DWORD = 0x00000400;
pub const SYMOPT_ALLOW_ABSOLUTE_SYMBOLS: DWORD = 0x00000800;
pub const SYMOPT_IGNORE_NT_SYMPATH: DWORD = 0x00001000;
pub const SYMOPT_INCLUDE_32BIT_MODULES: DWORD = 0x00002000;
pub const SYMOPT_PUBLICS_ONLY: DWORD = 0x00004000;
pub const SYMOPT_NO_PUBLICS: DWORD = 0x00008000;
pub const SYMOPT_AUTO_PUBLICS: DWORD = 0x00010000;
pub const SYMOPT_NO_IMAGE_SEARCH: DWORD = 0x00020000;
pub const SYMOPT_SECURE: DWORD = 0x00040000;
pub const SYMOPT_NO_PROMPTS: DWORD = 0x00080000;
pub const SYMOPT_OVERWRITE: DWORD = 0x00100000;
pub const SYMOPT_IGNORE_IMAGEDIR: DWORD = 0x00200000;
pub const SYMOPT_FLAT_DIRECTORY: DWORD = 0x00400000;
pub const SYMOPT_FAVOR_COMPRESSED: DWORD = 0x00800000;
pub const SYMOPT_ALLOW_ZERO_ADDRESS: DWORD = 0x01000000;
pub const SYMOPT_DISABLE_SYMSRV_AUTODETECT: DWORD = 0x02000000;
pub const SYMOPT_READONLY_CACHE: DWORD = 0x04000000;
pub const SYMOPT_SYMPATH_LAST: DWORD = 0x08000000;
pub const SYMOPT_DISABLE_FAST_SYMBOLS: DWORD = 0x10000000;
pub const SYMOPT_DISABLE_SYMSRV_TIMEOUT: DWORD = 0x20000000;
pub const SYMOPT_DISABLE_SRVSTAR_ON_STARTUP: DWORD = 0x40000000;
pub const SYMOPT_DEBUG: DWORD = 0x80000000;
extern "system" {
pub fn SymSetOptions(
SymOptions: DWORD,
) -> DWORD;
pub fn SymGetOptions() -> DWORD;
pub fn SymCleanup(
hProcess: HANDLE,
) -> BOOL;
pub fn SymEnumSymbolsW(
hProcess: HANDLE,
BaseOfDll: ULONG64,
Mask: PCWSTR,
EnumSymbolsCallback: PSYM_ENUMERATESYMBOLS_CALLBACKW,
CallerData: PVOID,
) -> BOOL;
pub fn SymFindDebugInfoFile(
hProcess: HANDLE,
FileName: PCSTR,
DebugFilePath: PSTR,
Callback: PFIND_DEBUG_FILE_CALLBACK,
CallerData: PVOID,
) -> HANDLE;
pub fn SymFindDebugInfoFileW(
hProcess: HANDLE,
FileName: PCWSTR,
DebugFilePath: PWSTR,
Callback: PFIND_DEBUG_FILE_CALLBACKW,
CallerData: PVOID,
) -> HANDLE;
pub fn SymFindExecutableImage(
hProcess: HANDLE,
FileName: PCSTR,
ImageFilePath: PSTR,
Callback: PFIND_EXE_FILE_CALLBACK,
CallerData: PVOID,
) -> HANDLE;
pub fn SymFindExecutableImageW(
hProcess: HANDLE,
FileName: PCWSTR,
ImageFilePath: PWSTR,
Callback: PFIND_EXE_FILE_CALLBACKW,
CallerData: PVOID,
) -> HANDLE;
pub fn SymFindFileInPath(
hprocess: HANDLE,
SearchPath: PCSTR,
FileName: PCSTR,
id: PVOID,
two: DWORD,
three: DWORD,
flags: DWORD,
FoundFile: PSTR,
callback: PFINDFILEINPATHCALLBACK,
context: PVOID,
) -> BOOL;
pub fn SymFindFileInPathW(
hprocess: HANDLE,
SearchPath: PCWSTR,
FileName: PCWSTR,
id: PVOID,
two: DWORD,
three: DWORD,
flags: DWORD,
FoundFile: PWSTR,
callback: PFINDFILEINPATHCALLBACKW,
context: PVOID,
) -> BOOL;
pub fn SymFromAddrW(
hProcess: HANDLE,
Address: DWORD64,
Displacement: PDWORD64,
Symbol: PSYMBOL_INFOW,
) -> BOOL;
pub fn SymFromNameW(
hProcess: HANDLE,
Name: PCWSTR,
Symbol: PSYMBOL_INFOW,
) -> BOOL;
pub fn SymFunctionTableAccess64(
hProcess: HANDLE,
AddrBase: DWORD64,
) -> PVOID;
pub fn SymGetLineFromAddrW64(
hProcess: HANDLE,
dwAddr: DWORD64,
pdwDisplacement: PDWORD,
Line: PIMAGEHLP_LINEW64,
) -> BOOL;
pub fn SymGetModuleInfoW64(
hProcess: HANDLE,
qwAddr: DWORD64,
ModuleInfo: PIMAGEHLP_MODULEW64,
) -> BOOL;
pub fn SymGetModuleBase64(
hProcess: HANDLE,
AddrBase: DWORD64,
) -> DWORD64;
pub fn SymGetSymFromAddr64(
hProcess: HANDLE,
Address: DWORD64,
Displacement: PDWORD64,
Symbol: PIMAGEHLP_SYMBOL64,
) -> BOOL;
pub fn SymInitializeW(
hProcess: HANDLE,
UserSearchPath: PCWSTR,
fInvadeProcess: BOOL,
) -> BOOL;
pub fn SymLoadModuleExW(
hProcess: HANDLE,
hFile: HANDLE,
ImageName: PCWSTR,
ModuleName: PCWSTR,
BaseOfDll: DWORD64,
SizeOfDll: DWORD,
Data: PMODLOAD_DATA,
Flags: DWORD,
) -> DWORD64;
pub fn SymUnloadModule(
hProcess: HANDLE,
BaseOfDll: DWORD,
) -> BOOL;
pub fn SymUnloadModule64(
hProcess: HANDLE,
BaseOfDll: DWORD64,
) -> BOOL;
#[cfg(target_pointer_width = "32")]
pub fn MapDebugInformation(
FileHandle: HANDLE,
FileName: PCSTR,
SymbolPath: PCSTR,
ImageBase: ULONG,
) -> PIMAGE_DEBUG_INFORMATION;
#[cfg(target_pointer_width = "32")]
pub fn UnmapDebugInformation(
DebugInfo: PIMAGE_DEBUG_INFORMATION,
) -> BOOL;
}
|