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
use windows::Win32::Foundation::BOOLEAN;

pub const NT_FACILITY_MASK: u32 = 4095;
pub const NT_FACILITY_SHIFT: u32 = 16;
pub const OBJ_PROTECT_CLOSE: u32 = 1;
pub const INT_ERROR: i32 = -1;
pub const DESKTOP_ALL_ACCESS: u32 = 983551;
pub const DESKTOP_GENERIC_READ: u32 = 131137;
pub const DESKTOP_GENERIC_WRITE: u32 = 131262;
pub const DESKTOP_GENERIC_EXECUTE: u32 = 131328;
pub const WINSTA_GENERIC_READ: u32 = 131843;
pub const WINSTA_GENERIC_WRITE: u32 = 131100;
pub const WINSTA_GENERIC_EXECUTE: u32 = 131168;
pub const WMIGUID_GENERIC_READ: u32 = 131085;
pub const WMIGUID_GENERIC_WRITE: u32 = 131170;
pub const WMIGUID_GENERIC_EXECUTE: u32 = 134800;

#[repr(C)]
#[repr(align(16))]
pub struct QUAD_PTR {
    pub DoNotUseThisField1: usize,
    pub DoNotUseThisField2: usize,
}

impl Default for QUAD_PTR {
    fn default() -> Self {
        unsafe { std::mem::zeroed() }
    }
}

impl std::fmt::Debug for QUAD_PTR {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        write!(f, "QUAD_PTR {{  }}")
    }
}

#[repr(transparent)]
#[derive(Copy, Hash, PartialEq, Eq)]
pub struct PREGHANDLE(pub u64);

impl PREGHANDLE {
    pub const fn is_invalid(&self) -> bool {
        self.0 == 0
    }
}

impl std::default::Default for PREGHANDLE {
    fn default() -> Self {
        unsafe { std::mem::zeroed() }
    }
}

impl std::clone::Clone for PREGHANDLE {
    fn clone(&self) -> Self {
        *self
    }
}

impl std::fmt::Debug for PREGHANDLE {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_tuple("HANDLE").field(&self.0).finish()
    }
}

impl windows::core::TypeKind for PREGHANDLE {
    type TypeKind = windows::core::CopyType;
}

#[repr(transparent)]
#[derive(Copy, Hash, PartialEq, Eq)]
pub struct TRACEHANDLE(pub u64);

impl TRACEHANDLE {
    pub const fn is_invalid(&self) -> bool {
        self.0 == 0
    }
}

impl std::default::Default for TRACEHANDLE {
    fn default() -> Self {
        unsafe { std::mem::zeroed() }
    }
}

impl std::clone::Clone for TRACEHANDLE {
    fn clone(&self) -> Self {
        *self
    }
}

impl std::fmt::Debug for TRACEHANDLE {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_tuple("HANDLE").field(&self.0).finish()
    }
}

impl windows::core::TypeKind for TRACEHANDLE {
    type TypeKind = windows::core::CopyType;
}

pub type PENCLAVE_ROUTINE =
    Option<unsafe extern "system" fn(lpThreadParameter: *mut std::ffi::c_void) -> u32>;

pub type WAITORTIMERCALLBACKFUNC =
    Option<unsafe extern "system" fn(_: *mut std::ffi::c_void, _: BOOLEAN)>;