Skip to content

Commit 7bfde77

Browse files
committed
Add Keyed Events API to sys::windows::c.
1 parent 92f7ba8 commit 7bfde77

File tree

1 file changed

+32
-0
lines changed
  • library/std/src/sys/windows

1 file changed

+32
-0
lines changed

library/std/src/sys/windows/c.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ pub type WORD = u16;
3131
pub type CHAR = c_char;
3232
pub type ULONG_PTR = usize;
3333
pub type ULONG = c_ulong;
34+
pub type NTSTATUS = LONG;
35+
pub type ACCESS_MASK = DWORD;
3436

3537
pub type LPBOOL = *mut BOOL;
3638
pub type LPBYTE = *mut BYTE;
@@ -286,6 +288,8 @@ pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000;
286288

287289
pub const HEAP_ZERO_MEMORY: DWORD = 0x00000008;
288290

291+
pub const STATUS_SUCCESS: NTSTATUS = 0x00000000;
292+
289293
#[repr(C)]
290294
#[cfg(not(target_pointer_width = "64"))]
291295
pub struct WSADATA {
@@ -1111,3 +1115,31 @@ compat_fn! {
11111115
// WaitOnAddress would've panicked. So it's fine to do nothing here.
11121116
}
11131117
}
1118+
1119+
compat_fn! {
1120+
"ntdll":
1121+
pub fn NtCreateKeyedEvent(
1122+
KeyedEventHandle: LPHANDLE,
1123+
DesiredAccess: ACCESS_MASK,
1124+
ObjectAttributes: LPVOID,
1125+
Flags: ULONG
1126+
) -> NTSTATUS {
1127+
panic!("keyed events not available")
1128+
}
1129+
pub fn NtReleaseKeyedEvent(
1130+
EventHandle: HANDLE,
1131+
Key: LPVOID,
1132+
Alertable: BOOLEAN,
1133+
Timeout: PLARGE_INTEGER
1134+
) -> NTSTATUS {
1135+
panic!("keyed events not available")
1136+
}
1137+
pub fn NtWaitForKeyedEvent(
1138+
EventHandle: HANDLE,
1139+
Key: LPVOID,
1140+
Alertable: BOOLEAN,
1141+
Timeout: PLARGE_INTEGER
1142+
) -> NTSTATUS {
1143+
panic!("keyed events not available")
1144+
}
1145+
}

0 commit comments

Comments
 (0)