generated from EmbarkStudios/opensource-template
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwin_bindings.rs
77 lines (77 loc) · 2.15 KB
/
win_bindings.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
//! Bindings generated by `minwin` 0.1.0
#![allow(
non_snake_case,
non_upper_case_globals,
non_camel_case_types,
clippy::upper_case_acronyms
)]
#[link(name = "kernel32")]
extern "system" {
#[link_name = "CloseHandle"]
pub fn close_handle(object: Handle) -> Bool;
#[link_name = "CreateEventA"]
pub fn create_event_a(
event_attributes: *const ::core::ffi::c_void,
manual_reset: Bool,
initial_state: Bool,
name: Pcstr,
) -> Handle;
#[link_name = "LockFileEx"]
pub fn lock_file_ex(
file: Handle,
flags: LockFileFlags::Enum,
reserved: u32,
number_of_bytes_to_lock_low: u32,
number_of_bytes_to_lock_high: u32,
overlapped: *mut Overlapped,
) -> Bool;
#[link_name = "UnlockFile"]
pub fn unlock_file(
file: Handle,
file_offset_low: u32,
file_offset_high: u32,
number_of_bytes_to_unlock_low: u32,
number_of_bytes_to_unlock_high: u32,
) -> Bool;
#[link_name = "WaitForSingleObject"]
pub fn wait_for_single_object(handle: Handle, milliseconds: u32) -> Win32Error::Enum;
}
pub const Infinite: u32 = 4294967295;
pub type Bool = i32;
pub mod FileFlagsAndAttributes {
pub type Enum = u32;
pub const FileFlagOverlapped: Enum = 1073741824;
}
pub type Handle = isize;
pub mod LockFileFlags {
pub type Enum = u32;
pub const LockfileFailImmediately: Enum = 1;
pub const LockfileExclusiveLock: Enum = 2;
}
#[repr(C)]
pub struct Overlapped {
pub internal: usize,
pub internal_high: usize,
pub anonymous: Overlapped_0,
pub event: Handle,
}
#[repr(C)]
pub union Overlapped_0 {
pub anonymous: ::std::mem::ManuallyDrop<Overlapped_0_0>,
pub pointer: *mut ::core::ffi::c_void,
}
#[repr(C)]
pub struct Overlapped_0_0 {
pub offset: u32,
pub offset_high: u32,
}
pub type Pcstr = *const u8;
pub mod Win32Error {
pub type Enum = u32;
pub const WaitObject0: Enum = 0;
pub const ErrorInvalidFunction: Enum = 1;
pub const ErrorLockViolation: Enum = 33;
pub const WaitIoCompletion: Enum = 192;
pub const WaitTimeout: Enum = 258;
pub const ErrorIoPending: Enum = 997;
}