-
Notifications
You must be signed in to change notification settings - Fork 260
/
Copy pathwindows_sys.rs
668 lines (665 loc) · 21.8 KB
/
windows_sys.rs
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
// Bindings generated by `windows-bindgen` 0.58.0
#![allow(
non_snake_case,
non_upper_case_globals,
non_camel_case_types,
dead_code,
clippy::all
)]
windows_targets::link!("dbghelp.dll" "system" fn EnumerateLoadedModulesW64(hprocess : HANDLE, enumloadedmodulescallback : PENUMLOADED_MODULES_CALLBACKW64, usercontext : *const core::ffi::c_void) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn StackWalk64(machinetype : u32, hprocess : HANDLE, hthread : HANDLE, stackframe : *mut STACKFRAME64, contextrecord : *mut core::ffi::c_void, readmemoryroutine : PREAD_PROCESS_MEMORY_ROUTINE64, functiontableaccessroutine : PFUNCTION_TABLE_ACCESS_ROUTINE64, getmodulebaseroutine : PGET_MODULE_BASE_ROUTINE64, translateaddress : PTRANSLATE_ADDRESS_ROUTINE64) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn StackWalkEx(machinetype : u32, hprocess : HANDLE, hthread : HANDLE, stackframe : *mut STACKFRAME_EX, contextrecord : *mut core::ffi::c_void, readmemoryroutine : PREAD_PROCESS_MEMORY_ROUTINE64, functiontableaccessroutine : PFUNCTION_TABLE_ACCESS_ROUTINE64, getmodulebaseroutine : PGET_MODULE_BASE_ROUTINE64, translateaddress : PTRANSLATE_ADDRESS_ROUTINE64, flags : u32) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymAddrIncludeInlineTrace(hprocess : HANDLE, address : u64) -> u32);
windows_targets::link!("dbghelp.dll" "system" fn SymFromAddrW(hprocess : HANDLE, address : u64, displacement : *mut u64, symbol : *mut SYMBOL_INFOW) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymFromInlineContextW(hprocess : HANDLE, address : u64, inlinecontext : u32, displacement : *mut u64, symbol : *mut SYMBOL_INFOW) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymFunctionTableAccess64(hprocess : HANDLE, addrbase : u64) -> *mut core::ffi::c_void);
windows_targets::link!("dbghelp.dll" "system" fn SymGetLineFromAddrW64(hprocess : HANDLE, dwaddr : u64, pdwdisplacement : *mut u32, line : *mut IMAGEHLP_LINEW64) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymGetLineFromInlineContextW(hprocess : HANDLE, dwaddr : u64, inlinecontext : u32, qwmodulebaseaddress : u64, pdwdisplacement : *mut u32, line : *mut IMAGEHLP_LINEW64) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymGetModuleBase64(hprocess : HANDLE, qwaddr : u64) -> u64);
windows_targets::link!("dbghelp.dll" "system" fn SymGetOptions() -> u32);
windows_targets::link!("dbghelp.dll" "system" fn SymGetSearchPathW(hprocess : HANDLE, searchpatha : PWSTR, searchpathlength : u32) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymInitializeW(hprocess : HANDLE, usersearchpath : PCWSTR, finvadeprocess : BOOL) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymQueryInlineTrace(hprocess : HANDLE, startaddress : u64, startcontext : u32, startretaddress : u64, curaddress : u64, curcontext : *mut u32, curframeindex : *mut u32) -> BOOL);
windows_targets::link!("dbghelp.dll" "system" fn SymSetOptions(symoptions : u32) -> u32);
windows_targets::link!("dbghelp.dll" "system" fn SymSetSearchPathW(hprocess : HANDLE, searchpatha : PCWSTR) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn CloseHandle(hobject : HANDLE) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn CreateFileMappingA(hfile : HANDLE, lpfilemappingattributes : *const SECURITY_ATTRIBUTES, flprotect : PAGE_PROTECTION_FLAGS, dwmaximumsizehigh : u32, dwmaximumsizelow : u32, lpname : PCSTR) -> HANDLE);
windows_targets::link!("kernel32.dll" "system" fn CreateMutexA(lpmutexattributes : *const SECURITY_ATTRIBUTES, binitialowner : BOOL, lpname : PCSTR) -> HANDLE);
windows_targets::link!("kernel32.dll" "system" fn CreateToolhelp32Snapshot(dwflags : CREATE_TOOLHELP_SNAPSHOT_FLAGS, th32processid : u32) -> HANDLE);
windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcess() -> HANDLE);
windows_targets::link!("kernel32.dll" "system" fn GetCurrentProcessId() -> u32);
windows_targets::link!("kernel32.dll" "system" fn GetCurrentThread() -> HANDLE);
windows_targets::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC);
windows_targets::link!("kernel32.dll" "system" fn LoadLibraryA(lplibfilename : PCSTR) -> HMODULE);
windows_targets::link!("kernel32.dll" "system" fn MapViewOfFile(hfilemappingobject : HANDLE, dwdesiredaccess : FILE_MAP, dwfileoffsethigh : u32, dwfileoffsetlow : u32, dwnumberofbytestomap : usize) -> MEMORY_MAPPED_VIEW_ADDRESS);
windows_targets::link!("kernel32.dll" "system" fn Module32FirstW(hsnapshot : HANDLE, lpme : *mut MODULEENTRY32W) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn Module32NextW(hsnapshot : HANDLE, lpme : *mut MODULEENTRY32W) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn ReleaseMutex(hmutex : HANDLE) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn RtlCaptureContext(contextrecord : *mut CONTEXT));
#[cfg(target_arch = "aarch64")]
windows_targets::link!("kernel32.dll" "system" fn RtlLookupFunctionEntry(controlpc : usize, imagebase : *mut usize, historytable : *mut UNWIND_HISTORY_TABLE) -> *mut IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY);
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
windows_targets::link!("kernel32.dll" "system" fn RtlLookupFunctionEntry(controlpc : u64, imagebase : *mut u64, historytable : *mut UNWIND_HISTORY_TABLE) -> *mut IMAGE_RUNTIME_FUNCTION_ENTRY);
#[cfg(target_arch = "aarch64")]
windows_targets::link!("kernel32.dll" "system" fn RtlVirtualUnwind(handlertype : RTL_VIRTUAL_UNWIND_HANDLER_TYPE, imagebase : usize, controlpc : usize, functionentry : *const IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, contextrecord : *mut CONTEXT, handlerdata : *mut *mut core::ffi::c_void, establisherframe : *mut usize, contextpointers : *mut KNONVOLATILE_CONTEXT_POINTERS) -> EXCEPTION_ROUTINE);
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
windows_targets::link!("kernel32.dll" "system" fn RtlVirtualUnwind(handlertype : RTL_VIRTUAL_UNWIND_HANDLER_TYPE, imagebase : u64, controlpc : u64, functionentry : *const IMAGE_RUNTIME_FUNCTION_ENTRY, contextrecord : *mut CONTEXT, handlerdata : *mut *mut core::ffi::c_void, establisherframe : *mut u64, contextpointers : *mut KNONVOLATILE_CONTEXT_POINTERS) -> EXCEPTION_ROUTINE);
windows_targets::link!("kernel32.dll" "system" fn UnmapViewOfFile(lpbaseaddress : MEMORY_MAPPED_VIEW_ADDRESS) -> BOOL);
windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObjectEx(hhandle : HANDLE, dwmilliseconds : u32, balertable : BOOL) -> WAIT_EVENT);
windows_targets::link!("kernel32.dll" "system" fn WideCharToMultiByte(codepage : u32, dwflags : u32, lpwidecharstr : PCWSTR, cchwidechar : i32, lpmultibytestr : PSTR, cbmultibyte : i32, lpdefaultchar : PCSTR, lpuseddefaultchar : *mut BOOL) -> i32);
windows_targets::link!("kernel32.dll" "system" fn lstrlenW(lpstring : PCWSTR) -> i32);
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ADDRESS64 {
pub Offset: u64,
pub Segment: u16,
pub Mode: ADDRESS_MODE,
}
pub type ADDRESS_MODE = i32;
#[repr(C)]
#[derive(Clone, Copy)]
pub union ARM64_NT_NEON128 {
pub Anonymous: ARM64_NT_NEON128_0,
pub D: [f64; 2],
pub S: [f32; 4],
pub H: [u16; 8],
pub B: [u8; 16],
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct ARM64_NT_NEON128_0 {
pub Low: u64,
pub High: i64,
}
pub const AddrModeFlat: ADDRESS_MODE = 3i32;
pub type BOOL = i32;
#[repr(C)]
#[cfg(target_arch = "aarch64")]
#[derive(Clone, Copy)]
pub struct CONTEXT {
pub ContextFlags: CONTEXT_FLAGS,
pub Cpsr: u32,
pub Anonymous: CONTEXT_0,
pub Sp: u64,
pub Pc: u64,
pub V: [ARM64_NT_NEON128; 32],
pub Fpcr: u32,
pub Fpsr: u32,
pub Bcr: [u32; 8],
pub Bvr: [u64; 8],
pub Wcr: [u32; 2],
pub Wvr: [u64; 2],
}
#[repr(C)]
#[cfg(target_arch = "aarch64")]
#[derive(Clone, Copy)]
pub union CONTEXT_0 {
pub Anonymous: CONTEXT_0_0,
pub X: [u64; 31],
}
#[repr(C)]
#[cfg(target_arch = "aarch64")]
#[derive(Clone, Copy)]
pub struct CONTEXT_0_0 {
pub X0: u64,
pub X1: u64,
pub X2: u64,
pub X3: u64,
pub X4: u64,
pub X5: u64,
pub X6: u64,
pub X7: u64,
pub X8: u64,
pub X9: u64,
pub X10: u64,
pub X11: u64,
pub X12: u64,
pub X13: u64,
pub X14: u64,
pub X15: u64,
pub X16: u64,
pub X17: u64,
pub X18: u64,
pub X19: u64,
pub X20: u64,
pub X21: u64,
pub X22: u64,
pub X23: u64,
pub X24: u64,
pub X25: u64,
pub X26: u64,
pub X27: u64,
pub X28: u64,
pub Fp: u64,
pub Lr: u64,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub struct CONTEXT {
pub P1Home: u64,
pub P2Home: u64,
pub P3Home: u64,
pub P4Home: u64,
pub P5Home: u64,
pub P6Home: u64,
pub ContextFlags: CONTEXT_FLAGS,
pub MxCsr: u32,
pub SegCs: u16,
pub SegDs: u16,
pub SegEs: u16,
pub SegFs: u16,
pub SegGs: u16,
pub SegSs: u16,
pub EFlags: u32,
pub Dr0: u64,
pub Dr1: u64,
pub Dr2: u64,
pub Dr3: u64,
pub Dr6: u64,
pub Dr7: u64,
pub Rax: u64,
pub Rcx: u64,
pub Rdx: u64,
pub Rbx: u64,
pub Rsp: u64,
pub Rbp: u64,
pub Rsi: u64,
pub Rdi: u64,
pub R8: u64,
pub R9: u64,
pub R10: u64,
pub R11: u64,
pub R12: u64,
pub R13: u64,
pub R14: u64,
pub R15: u64,
pub Rip: u64,
pub Anonymous: CONTEXT_0,
pub VectorRegister: [M128A; 26],
pub VectorControl: u64,
pub DebugControl: u64,
pub LastBranchToRip: u64,
pub LastBranchFromRip: u64,
pub LastExceptionToRip: u64,
pub LastExceptionFromRip: u64,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub union CONTEXT_0 {
pub FltSave: XSAVE_FORMAT,
pub Anonymous: CONTEXT_0_0,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub struct CONTEXT_0_0 {
pub Header: [M128A; 2],
pub Legacy: [M128A; 8],
pub Xmm0: M128A,
pub Xmm1: M128A,
pub Xmm2: M128A,
pub Xmm3: M128A,
pub Xmm4: M128A,
pub Xmm5: M128A,
pub Xmm6: M128A,
pub Xmm7: M128A,
pub Xmm8: M128A,
pub Xmm9: M128A,
pub Xmm10: M128A,
pub Xmm11: M128A,
pub Xmm12: M128A,
pub Xmm13: M128A,
pub Xmm14: M128A,
pub Xmm15: M128A,
}
#[repr(C)]
#[cfg(target_arch = "x86")]
#[derive(Clone, Copy)]
pub struct CONTEXT {
pub ContextFlags: CONTEXT_FLAGS,
pub Dr0: u32,
pub Dr1: u32,
pub Dr2: u32,
pub Dr3: u32,
pub Dr6: u32,
pub Dr7: u32,
pub FloatSave: FLOATING_SAVE_AREA,
pub SegGs: u32,
pub SegFs: u32,
pub SegEs: u32,
pub SegDs: u32,
pub Edi: u32,
pub Esi: u32,
pub Ebx: u32,
pub Edx: u32,
pub Ecx: u32,
pub Eax: u32,
pub Ebp: u32,
pub Eip: u32,
pub SegCs: u32,
pub EFlags: u32,
pub Esp: u32,
pub SegSs: u32,
pub ExtendedRegisters: [u8; 512],
}
pub type CONTEXT_FLAGS = u32;
pub const CP_UTF8: u32 = 65001u32;
pub type CREATE_TOOLHELP_SNAPSHOT_FLAGS = u32;
pub type EXCEPTION_DISPOSITION = i32;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct EXCEPTION_RECORD {
pub ExceptionCode: NTSTATUS,
pub ExceptionFlags: u32,
pub ExceptionRecord: *mut EXCEPTION_RECORD,
pub ExceptionAddress: *mut core::ffi::c_void,
pub NumberParameters: u32,
pub ExceptionInformation: [usize; 15],
}
pub type EXCEPTION_ROUTINE = Option<
unsafe extern "system" fn(
exceptionrecord: *mut EXCEPTION_RECORD,
establisherframe: *const core::ffi::c_void,
contextrecord: *mut CONTEXT,
dispatchercontext: *const core::ffi::c_void,
) -> EXCEPTION_DISPOSITION,
>;
pub const FALSE: BOOL = 0i32;
pub type FARPROC = Option<unsafe extern "system" fn() -> isize>;
pub type FILE_MAP = u32;
pub const FILE_MAP_READ: FILE_MAP = 4u32;
#[repr(C)]
#[cfg(any(
target_arch = "aarch64",
target_arch = "arm64ec",
target_arch = "x86_64"
))]
#[derive(Clone, Copy)]
pub struct FLOATING_SAVE_AREA {
pub ControlWord: u32,
pub StatusWord: u32,
pub TagWord: u32,
pub ErrorOffset: u32,
pub ErrorSelector: u32,
pub DataOffset: u32,
pub DataSelector: u32,
pub RegisterArea: [u8; 80],
pub Cr0NpxState: u32,
}
#[repr(C)]
#[cfg(target_arch = "x86")]
#[derive(Clone, Copy)]
pub struct FLOATING_SAVE_AREA {
pub ControlWord: u32,
pub StatusWord: u32,
pub TagWord: u32,
pub ErrorOffset: u32,
pub ErrorSelector: u32,
pub DataOffset: u32,
pub DataSelector: u32,
pub RegisterArea: [u8; 80],
pub Spare0: u32,
}
pub type HANDLE = *mut core::ffi::c_void;
pub type HINSTANCE = *mut core::ffi::c_void;
pub type HMODULE = *mut core::ffi::c_void;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct IMAGEHLP_LINEW64 {
pub SizeOfStruct: u32,
pub Key: *mut core::ffi::c_void,
pub LineNumber: u32,
pub FileName: PWSTR,
pub Address: u64,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY {
pub BeginAddress: u32,
pub Anonymous: IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY_0,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY_0 {
pub UnwindData: u32,
pub Anonymous: IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY_0_0,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY_0_0 {
pub _bitfield: u32,
}
pub type IMAGE_FILE_MACHINE = u16;
pub const IMAGE_FILE_MACHINE_I386: IMAGE_FILE_MACHINE = 332u16;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct IMAGE_RUNTIME_FUNCTION_ENTRY {
pub BeginAddress: u32,
pub EndAddress: u32,
pub Anonymous: IMAGE_RUNTIME_FUNCTION_ENTRY_0,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub union IMAGE_RUNTIME_FUNCTION_ENTRY_0 {
pub UnwindInfoAddress: u32,
pub UnwindData: u32,
}
pub const INFINITE: u32 = 4294967295u32;
pub const INVALID_HANDLE_VALUE: HANDLE = -1i32 as _;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct KDHELP64 {
pub Thread: u64,
pub ThCallbackStack: u32,
pub ThCallbackBStore: u32,
pub NextCallback: u32,
pub FramePointer: u32,
pub KiCallUserMode: u64,
pub KeUserCallbackDispatcher: u64,
pub SystemRangeStart: u64,
pub KiUserExceptionDispatcher: u64,
pub StackBase: u64,
pub StackLimit: u64,
pub BuildVersion: u32,
pub RetpolineStubFunctionTableSize: u32,
pub RetpolineStubFunctionTable: u64,
pub RetpolineStubOffset: u32,
pub RetpolineStubSize: u32,
pub Reserved0: [u64; 2],
}
#[repr(C)]
#[cfg(target_arch = "aarch64")]
#[derive(Clone, Copy)]
pub struct KNONVOLATILE_CONTEXT_POINTERS {
pub X19: *mut u64,
pub X20: *mut u64,
pub X21: *mut u64,
pub X22: *mut u64,
pub X23: *mut u64,
pub X24: *mut u64,
pub X25: *mut u64,
pub X26: *mut u64,
pub X27: *mut u64,
pub X28: *mut u64,
pub Fp: *mut u64,
pub Lr: *mut u64,
pub D8: *mut u64,
pub D9: *mut u64,
pub D10: *mut u64,
pub D11: *mut u64,
pub D12: *mut u64,
pub D13: *mut u64,
pub D14: *mut u64,
pub D15: *mut u64,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub struct KNONVOLATILE_CONTEXT_POINTERS {
pub Anonymous1: KNONVOLATILE_CONTEXT_POINTERS_0,
pub Anonymous2: KNONVOLATILE_CONTEXT_POINTERS_1,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub union KNONVOLATILE_CONTEXT_POINTERS_0 {
pub FloatingContext: [*mut M128A; 16],
pub Anonymous: KNONVOLATILE_CONTEXT_POINTERS_0_0,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub struct KNONVOLATILE_CONTEXT_POINTERS_0_0 {
pub Xmm0: *mut M128A,
pub Xmm1: *mut M128A,
pub Xmm2: *mut M128A,
pub Xmm3: *mut M128A,
pub Xmm4: *mut M128A,
pub Xmm5: *mut M128A,
pub Xmm6: *mut M128A,
pub Xmm7: *mut M128A,
pub Xmm8: *mut M128A,
pub Xmm9: *mut M128A,
pub Xmm10: *mut M128A,
pub Xmm11: *mut M128A,
pub Xmm12: *mut M128A,
pub Xmm13: *mut M128A,
pub Xmm14: *mut M128A,
pub Xmm15: *mut M128A,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub union KNONVOLATILE_CONTEXT_POINTERS_1 {
pub IntegerContext: [*mut u64; 16],
pub Anonymous: KNONVOLATILE_CONTEXT_POINTERS_1_0,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub struct KNONVOLATILE_CONTEXT_POINTERS_1_0 {
pub Rax: *mut u64,
pub Rcx: *mut u64,
pub Rdx: *mut u64,
pub Rbx: *mut u64,
pub Rsp: *mut u64,
pub Rbp: *mut u64,
pub Rsi: *mut u64,
pub Rdi: *mut u64,
pub R8: *mut u64,
pub R9: *mut u64,
pub R10: *mut u64,
pub R11: *mut u64,
pub R12: *mut u64,
pub R13: *mut u64,
pub R14: *mut u64,
pub R15: *mut u64,
}
#[repr(C)]
#[cfg(target_arch = "x86")]
#[derive(Clone, Copy)]
pub struct KNONVOLATILE_CONTEXT_POINTERS {
pub Dummy: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct M128A {
pub Low: u64,
pub High: i64,
}
pub const MAX_SYM_NAME: u32 = 2000u32;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct MEMORY_MAPPED_VIEW_ADDRESS {
pub Value: *mut core::ffi::c_void,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct MODULEENTRY32W {
pub dwSize: u32,
pub th32ModuleID: u32,
pub th32ProcessID: u32,
pub GlblcntUsage: u32,
pub ProccntUsage: u32,
pub modBaseAddr: *mut u8,
pub modBaseSize: u32,
pub hModule: HMODULE,
pub szModule: [u16; 256],
pub szExePath: [u16; 260],
}
pub type NTSTATUS = i32;
pub type PAGE_PROTECTION_FLAGS = u32;
pub const PAGE_READONLY: PAGE_PROTECTION_FLAGS = 2u32;
pub type PCSTR = *const u8;
pub type PCWSTR = *const u16;
pub type PENUMLOADED_MODULES_CALLBACKW64 = Option<
unsafe extern "system" fn(
modulename: PCWSTR,
modulebase: u64,
modulesize: u32,
usercontext: *const core::ffi::c_void,
) -> BOOL,
>;
pub type PFUNCTION_TABLE_ACCESS_ROUTINE64 =
Option<unsafe extern "system" fn(ahprocess: HANDLE, addrbase: u64) -> *mut core::ffi::c_void>;
pub type PGET_MODULE_BASE_ROUTINE64 =
Option<unsafe extern "system" fn(hprocess: HANDLE, address: u64) -> u64>;
pub type PREAD_PROCESS_MEMORY_ROUTINE64 = Option<
unsafe extern "system" fn(
hprocess: HANDLE,
qwbaseaddress: u64,
lpbuffer: *mut core::ffi::c_void,
nsize: u32,
lpnumberofbytesread: *mut u32,
) -> BOOL,
>;
pub type PSTR = *mut u8;
pub type PTRANSLATE_ADDRESS_ROUTINE64 = Option<
unsafe extern "system" fn(hprocess: HANDLE, hthread: HANDLE, lpaddr: *const ADDRESS64) -> u64,
>;
pub type PWSTR = *mut u16;
pub type RTL_VIRTUAL_UNWIND_HANDLER_TYPE = u32;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct SECURITY_ATTRIBUTES {
pub nLength: u32,
pub lpSecurityDescriptor: *mut core::ffi::c_void,
pub bInheritHandle: BOOL,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct STACKFRAME64 {
pub AddrPC: ADDRESS64,
pub AddrReturn: ADDRESS64,
pub AddrFrame: ADDRESS64,
pub AddrStack: ADDRESS64,
pub AddrBStore: ADDRESS64,
pub FuncTableEntry: *mut core::ffi::c_void,
pub Params: [u64; 4],
pub Far: BOOL,
pub Virtual: BOOL,
pub Reserved: [u64; 3],
pub KdHelp: KDHELP64,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct STACKFRAME_EX {
pub AddrPC: ADDRESS64,
pub AddrReturn: ADDRESS64,
pub AddrFrame: ADDRESS64,
pub AddrStack: ADDRESS64,
pub AddrBStore: ADDRESS64,
pub FuncTableEntry: *mut core::ffi::c_void,
pub Params: [u64; 4],
pub Far: BOOL,
pub Virtual: BOOL,
pub Reserved: [u64; 3],
pub KdHelp: KDHELP64,
pub StackFrameSize: u32,
pub InlineFrameContext: u32,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct SYMBOL_INFOW {
pub SizeOfStruct: u32,
pub TypeIndex: u32,
pub Reserved: [u64; 2],
pub Index: u32,
pub Size: u32,
pub ModBase: u64,
pub Flags: SYMBOL_INFO_FLAGS,
pub Value: u64,
pub Address: u64,
pub Register: u32,
pub Scope: u32,
pub Tag: u32,
pub NameLen: u32,
pub MaxNameLen: u32,
pub Name: [u16; 1],
}
pub type SYMBOL_INFO_FLAGS = u32;
pub const SYMOPT_DEFERRED_LOADS: u32 = 4u32;
pub const TH32CS_SNAPMODULE: CREATE_TOOLHELP_SNAPSHOT_FLAGS = 8u32;
pub const TRUE: BOOL = 1i32;
#[repr(C)]
#[cfg(any(
target_arch = "aarch64",
target_arch = "arm64ec",
target_arch = "x86_64"
))]
#[derive(Clone, Copy)]
pub struct UNWIND_HISTORY_TABLE {
pub Count: u32,
pub LocalHint: u8,
pub GlobalHint: u8,
pub Search: u8,
pub Once: u8,
pub LowAddress: usize,
pub HighAddress: usize,
pub Entry: [UNWIND_HISTORY_TABLE_ENTRY; 12],
}
#[repr(C)]
#[cfg(target_arch = "aarch64")]
#[derive(Clone, Copy)]
pub struct UNWIND_HISTORY_TABLE_ENTRY {
pub ImageBase: usize,
pub FunctionEntry: *mut IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY,
}
#[repr(C)]
#[cfg(any(target_arch = "arm64ec", target_arch = "x86_64"))]
#[derive(Clone, Copy)]
pub struct UNWIND_HISTORY_TABLE_ENTRY {
pub ImageBase: usize,
pub FunctionEntry: *mut IMAGE_RUNTIME_FUNCTION_ENTRY,
}
pub type WAIT_EVENT = u32;
#[repr(C)]
#[cfg(any(
target_arch = "aarch64",
target_arch = "arm64ec",
target_arch = "x86_64"
))]
#[derive(Clone, Copy)]
pub struct XSAVE_FORMAT {
pub ControlWord: u16,
pub StatusWord: u16,
pub TagWord: u8,
pub Reserved1: u8,
pub ErrorOpcode: u16,
pub ErrorOffset: u32,
pub ErrorSelector: u16,
pub Reserved2: u16,
pub DataOffset: u32,
pub DataSelector: u16,
pub Reserved3: u16,
pub MxCsr: u32,
pub MxCsr_Mask: u32,
pub FloatRegisters: [M128A; 8],
pub XmmRegisters: [M128A; 16],
pub Reserved4: [u8; 96],
}
#[repr(C)]
#[cfg(target_arch = "x86")]
#[derive(Clone, Copy)]
pub struct XSAVE_FORMAT {
pub ControlWord: u16,
pub StatusWord: u16,
pub TagWord: u8,
pub Reserved1: u8,
pub ErrorOpcode: u16,
pub ErrorOffset: u32,
pub ErrorSelector: u16,
pub Reserved2: u16,
pub DataOffset: u32,
pub DataSelector: u16,
pub Reserved3: u16,
pub MxCsr: u32,
pub MxCsr_Mask: u32,
pub FloatRegisters: [M128A; 8],
pub XmmRegisters: [M128A; 8],
pub Reserved4: [u8; 224],
}
#[cfg(target_arch = "arm")]
include!("./windows_sys_arm32_shim.rs");