summaryrefslogtreecommitdiffstats
path: root/third_party/rust/ntapi/src/ntapi_base.rs
blob: aa341af0b0d8089628ae7d4cd41dafc38fa26e3c (plain)
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
use winapi::shared::ntdef::{HANDLE, LONG, NTSTATUS, ULONG, ULONGLONG, USHORT};
use winapi::shared::ntstatus::FACILITY_NTWIN32;
pub type KPRIORITY = LONG;
pub type RTL_ATOM = USHORT;
pub type PRTL_ATOM = *mut RTL_ATOM;
pub const NT_FACILITY_MASK: ULONG = 0xfff;
pub const NT_FACILITY_SHIFT: ULONG = 16;
#[inline]
pub const fn NT_FACILITY(Status: NTSTATUS) -> ULONG {
    (Status as u32) >> NT_FACILITY_SHIFT & NT_FACILITY_MASK
}
#[inline]
pub const fn NT_NTWIN32(Status: NTSTATUS) -> bool {
    NT_FACILITY(Status) == FACILITY_NTWIN32 as u32
}
#[inline]
pub const fn WIN32_FROM_NTSTATUS(Status: NTSTATUS) -> ULONG {
    (Status as u32) & 0xffff
}
STRUCT!{struct CLIENT_ID {
    UniqueProcess: HANDLE,
    UniqueThread: HANDLE,
}}
pub type PCLIENT_ID = *mut CLIENT_ID;
STRUCT!{struct CLIENT_ID32 {
    UniqueProcess: ULONG,
    UniqueThread: ULONG,
}}
pub type PCLIENT_ID32 = *mut CLIENT_ID32;
STRUCT!{struct CLIENT_ID64 {
    UniqueProcess: ULONGLONG,
    UniqueThread: ULONGLONG,
}}
pub type PCLIENT_ID64 = *mut CLIENT_ID64;
STRUCT!{struct KSYSTEM_TIME {
    LowPart: ULONG,
    High1Time: LONG,
    High2Time: LONG,
}}
pub type PKSYSTEM_TIME = *mut KSYSTEM_TIME;