Update windows ffi bindings
This commit is contained in:
parent
9f48a85447
commit
d9c85daa51
7 changed files with 104 additions and 127 deletions
18
Cargo.lock
18
Cargo.lock
|
@ -5851,19 +5851,21 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-bindgen"
|
name = "windows-bindgen"
|
||||||
version = "0.49.0"
|
version = "0.51.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b6935fb09b84ee57929ae92518b475f5dfdfbeb87c5334756acc28ee8e202b60"
|
checksum = "bc1f16b778125675feee0d15d6dd9f6af0e3ac52b3233d63a10aa39230c1cd75"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"rayon",
|
||||||
|
"syn 2.0.27",
|
||||||
"windows-metadata",
|
"windows-metadata",
|
||||||
"windows-tokens",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-metadata"
|
name = "windows-metadata"
|
||||||
version = "0.49.0"
|
version = "0.51.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2f5bca94a32bf1e6a376522b6601275a3b611ee885ec0f1b6a05f17e8cfd3385"
|
checksum = "753135d996f9da437c0b31dbde3032489a61708361929bcc07d4fba0b161000e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
|
@ -5889,12 +5891,6 @@ dependencies = [
|
||||||
"windows_x86_64_msvc",
|
"windows_x86_64_msvc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-tokens"
|
|
||||||
version = "0.48.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b34c9a3b28cb41db7385546f7f9a8179348dffc89923dde66857b1ba5312f6b4"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.48.0"
|
version = "0.48.0"
|
||||||
|
|
|
@ -46,10 +46,6 @@ pub use FD_SET as fd_set;
|
||||||
pub use LINGER as linger;
|
pub use LINGER as linger;
|
||||||
pub use TIMEVAL as timeval;
|
pub use TIMEVAL as timeval;
|
||||||
|
|
||||||
pub type CONDITION_VARIABLE = RTL_CONDITION_VARIABLE;
|
|
||||||
pub type SRWLOCK = RTL_SRWLOCK;
|
|
||||||
pub type INIT_ONCE = RTL_RUN_ONCE;
|
|
||||||
|
|
||||||
pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() };
|
pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() };
|
||||||
pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() };
|
pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() };
|
||||||
pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() };
|
pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() };
|
||||||
|
@ -224,7 +220,7 @@ pub unsafe extern "system" fn ReadFileEx(
|
||||||
) -> BOOL {
|
) -> BOOL {
|
||||||
windows_sys::ReadFileEx(
|
windows_sys::ReadFileEx(
|
||||||
hFile.as_raw_handle(),
|
hFile.as_raw_handle(),
|
||||||
lpBuffer,
|
lpBuffer.cast::<u8>(),
|
||||||
nNumberOfBytesToRead,
|
nNumberOfBytesToRead,
|
||||||
lpOverlapped,
|
lpOverlapped,
|
||||||
lpCompletionRoutine,
|
lpCompletionRoutine,
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
--out windows_sys.rs
|
||||||
|
--config flatten std
|
||||||
|
--filter
|
||||||
// tidy-alphabetical-start
|
// tidy-alphabetical-start
|
||||||
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
|
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
|
||||||
Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION
|
Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION
|
||||||
|
@ -2108,7 +2111,6 @@ Windows.Win32.Networking.WinSock.WSABASEERR
|
||||||
Windows.Win32.Networking.WinSock.WSABUF
|
Windows.Win32.Networking.WinSock.WSABUF
|
||||||
Windows.Win32.Networking.WinSock.WSACleanup
|
Windows.Win32.Networking.WinSock.WSACleanup
|
||||||
Windows.Win32.Networking.WinSock.WSADATA
|
Windows.Win32.Networking.WinSock.WSADATA
|
||||||
Windows.Win32.Networking.WinSock.WSADATA
|
|
||||||
Windows.Win32.Networking.WinSock.WSADuplicateSocketW
|
Windows.Win32.Networking.WinSock.WSADuplicateSocketW
|
||||||
Windows.Win32.Networking.WinSock.WSAEACCES
|
Windows.Win32.Networking.WinSock.WSAEACCES
|
||||||
Windows.Win32.Networking.WinSock.WSAEADDRINUSE
|
Windows.Win32.Networking.WinSock.WSAEADDRINUSE
|
||||||
|
@ -2420,8 +2422,6 @@ Windows.Win32.System.Console.STD_OUTPUT_HANDLE
|
||||||
Windows.Win32.System.Console.WriteConsoleW
|
Windows.Win32.System.Console.WriteConsoleW
|
||||||
Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128
|
Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128
|
||||||
Windows.Win32.System.Diagnostics.Debug.CONTEXT
|
Windows.Win32.System.Diagnostics.Debug.CONTEXT
|
||||||
Windows.Win32.System.Diagnostics.Debug.CONTEXT
|
|
||||||
Windows.Win32.System.Diagnostics.Debug.CONTEXT
|
|
||||||
Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD
|
Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD
|
||||||
Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE
|
Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE
|
||||||
Windows.Win32.System.Diagnostics.Debug.FACILITY_NT_BIT
|
Windows.Win32.System.Diagnostics.Debug.FACILITY_NT_BIT
|
||||||
|
@ -2435,7 +2435,6 @@ Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_OPTIONS
|
||||||
Windows.Win32.System.Diagnostics.Debug.FormatMessageW
|
Windows.Win32.System.Diagnostics.Debug.FormatMessageW
|
||||||
Windows.Win32.System.Diagnostics.Debug.M128A
|
Windows.Win32.System.Diagnostics.Debug.M128A
|
||||||
Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
|
Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
|
||||||
Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
|
|
||||||
Windows.Win32.System.Environment.FreeEnvironmentStringsW
|
Windows.Win32.System.Environment.FreeEnvironmentStringsW
|
||||||
Windows.Win32.System.Environment.GetCommandLineW
|
Windows.Win32.System.Environment.GetCommandLineW
|
||||||
Windows.Win32.System.Environment.GetCurrentDirectoryW
|
Windows.Win32.System.Environment.GetCurrentDirectoryW
|
||||||
|
@ -2456,7 +2455,6 @@ Windows.Win32.System.Kernel.ExceptionContinueExecution
|
||||||
Windows.Win32.System.Kernel.ExceptionContinueSearch
|
Windows.Win32.System.Kernel.ExceptionContinueSearch
|
||||||
Windows.Win32.System.Kernel.ExceptionNestedException
|
Windows.Win32.System.Kernel.ExceptionNestedException
|
||||||
Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
|
Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
|
||||||
Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
|
|
||||||
Windows.Win32.System.Kernel.OBJ_DONT_REPARSE
|
Windows.Win32.System.Kernel.OBJ_DONT_REPARSE
|
||||||
Windows.Win32.System.LibraryLoader.GetModuleFileNameW
|
Windows.Win32.System.LibraryLoader.GetModuleFileNameW
|
||||||
Windows.Win32.System.LibraryLoader.GetModuleHandleA
|
Windows.Win32.System.LibraryLoader.GetModuleHandleA
|
||||||
|
|
|
@ -32,11 +32,11 @@ extern "system" {
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn AcquireSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> ();
|
pub fn AcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn AcquireSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> ();
|
pub fn AcquireSRWLockShared(srwlock: *mut SRWLOCK) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
|
@ -189,18 +189,15 @@ extern "system" {
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn FindClose(hfindfile: FindFileHandle) -> BOOL;
|
pub fn FindClose(hfindfile: HANDLE) -> BOOL;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn FindFirstFileW(
|
pub fn FindFirstFileW(lpfilename: PCWSTR, lpfindfiledata: *mut WIN32_FIND_DATAW) -> HANDLE;
|
||||||
lpfilename: PCWSTR,
|
|
||||||
lpfindfiledata: *mut WIN32_FIND_DATAW,
|
|
||||||
) -> FindFileHandle;
|
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn FindNextFileW(hfindfile: FindFileHandle, lpfindfiledata: *mut WIN32_FIND_DATAW) -> BOOL;
|
pub fn FindNextFileW(hfindfile: HANDLE, lpfindfiledata: *mut WIN32_FIND_DATAW) -> BOOL;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
|
@ -360,7 +357,7 @@ extern "system" {
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn InitOnceBeginInitialize(
|
pub fn InitOnceBeginInitialize(
|
||||||
lpinitonce: *mut RTL_RUN_ONCE,
|
lpinitonce: *mut INIT_ONCE,
|
||||||
dwflags: u32,
|
dwflags: u32,
|
||||||
fpending: *mut BOOL,
|
fpending: *mut BOOL,
|
||||||
lpcontext: *mut *mut ::core::ffi::c_void,
|
lpcontext: *mut *mut ::core::ffi::c_void,
|
||||||
|
@ -369,7 +366,7 @@ extern "system" {
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn InitOnceComplete(
|
pub fn InitOnceComplete(
|
||||||
lpinitonce: *mut RTL_RUN_ONCE,
|
lpinitonce: *mut INIT_ONCE,
|
||||||
dwflags: u32,
|
dwflags: u32,
|
||||||
lpcontext: *const ::core::ffi::c_void,
|
lpcontext: *const ::core::ffi::c_void,
|
||||||
) -> BOOL;
|
) -> BOOL;
|
||||||
|
@ -424,7 +421,7 @@ extern "system" {
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn ReadFile(
|
pub fn ReadFile(
|
||||||
hfile: HANDLE,
|
hfile: HANDLE,
|
||||||
lpbuffer: *mut ::core::ffi::c_void,
|
lpbuffer: *mut u8,
|
||||||
nnumberofbytestoread: u32,
|
nnumberofbytestoread: u32,
|
||||||
lpnumberofbytesread: *mut u32,
|
lpnumberofbytesread: *mut u32,
|
||||||
lpoverlapped: *mut OVERLAPPED,
|
lpoverlapped: *mut OVERLAPPED,
|
||||||
|
@ -434,7 +431,7 @@ extern "system" {
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn ReadFileEx(
|
pub fn ReadFileEx(
|
||||||
hfile: HANDLE,
|
hfile: HANDLE,
|
||||||
lpbuffer: *mut ::core::ffi::c_void,
|
lpbuffer: *mut u8,
|
||||||
nnumberofbytestoread: u32,
|
nnumberofbytestoread: u32,
|
||||||
lpoverlapped: *mut OVERLAPPED,
|
lpoverlapped: *mut OVERLAPPED,
|
||||||
lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE,
|
lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE,
|
||||||
|
@ -442,11 +439,11 @@ extern "system" {
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn ReleaseSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> ();
|
pub fn ReleaseSRWLockExclusive(srwlock: *mut SRWLOCK) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn ReleaseSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> ();
|
pub fn ReleaseSRWLockShared(srwlock: *mut SRWLOCK) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
|
@ -513,8 +510,8 @@ extern "system" {
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn SleepConditionVariableSRW(
|
pub fn SleepConditionVariableSRW(
|
||||||
conditionvariable: *mut RTL_CONDITION_VARIABLE,
|
conditionvariable: *mut CONDITION_VARIABLE,
|
||||||
srwlock: *mut RTL_SRWLOCK,
|
srwlock: *mut SRWLOCK,
|
||||||
dwmilliseconds: u32,
|
dwmilliseconds: u32,
|
||||||
flags: u32,
|
flags: u32,
|
||||||
) -> BOOL;
|
) -> BOOL;
|
||||||
|
@ -549,11 +546,11 @@ extern "system" {
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn TryAcquireSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> BOOLEAN;
|
pub fn TryAcquireSRWLockExclusive(srwlock: *mut SRWLOCK) -> BOOLEAN;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn TryAcquireSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> BOOLEAN;
|
pub fn TryAcquireSRWLockShared(srwlock: *mut SRWLOCK) -> BOOLEAN;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
|
@ -574,19 +571,19 @@ extern "system" {
|
||||||
lphandles: *const HANDLE,
|
lphandles: *const HANDLE,
|
||||||
bwaitall: BOOL,
|
bwaitall: BOOL,
|
||||||
dwmilliseconds: u32,
|
dwmilliseconds: u32,
|
||||||
) -> WIN32_ERROR;
|
) -> WAIT_EVENT;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> WIN32_ERROR;
|
pub fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> WAIT_EVENT;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn WakeAllConditionVariable(conditionvariable: *mut RTL_CONDITION_VARIABLE) -> ();
|
pub fn WakeAllConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn WakeConditionVariable(conditionvariable: *mut RTL_CONDITION_VARIABLE) -> ();
|
pub fn WakeConditionVariable(conditionvariable: *mut CONDITION_VARIABLE) -> ();
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
|
@ -899,7 +896,17 @@ impl ::core::clone::Clone for BY_HANDLE_FILE_INFORMATION {
|
||||||
}
|
}
|
||||||
pub const CALLBACK_CHUNK_FINISHED: LPPROGRESS_ROUTINE_CALLBACK_REASON = 0u32;
|
pub const CALLBACK_CHUNK_FINISHED: LPPROGRESS_ROUTINE_CALLBACK_REASON = 0u32;
|
||||||
pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32;
|
pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32;
|
||||||
pub type COMPARESTRING_RESULT = u32;
|
pub type COMPARESTRING_RESULT = i32;
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct CONDITION_VARIABLE {
|
||||||
|
pub Ptr: *mut ::core::ffi::c_void,
|
||||||
|
}
|
||||||
|
impl ::core::marker::Copy for CONDITION_VARIABLE {}
|
||||||
|
impl ::core::clone::Clone for CONDITION_VARIABLE {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
pub type CONSOLE_MODE = u32;
|
pub type CONSOLE_MODE = u32;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct CONSOLE_READCONSOLE_CONTROL {
|
pub struct CONSOLE_READCONSOLE_CONTROL {
|
||||||
|
@ -917,7 +924,7 @@ impl ::core::clone::Clone for CONSOLE_READCONSOLE_CONTROL {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
pub struct CONTEXT {
|
pub struct CONTEXT {
|
||||||
pub ContextFlags: u32,
|
pub ContextFlags: CONTEXT_FLAGS,
|
||||||
pub Cpsr: u32,
|
pub Cpsr: u32,
|
||||||
pub Anonymous: CONTEXT_0,
|
pub Anonymous: CONTEXT_0,
|
||||||
pub Sp: u64,
|
pub Sp: u64,
|
||||||
|
@ -1004,7 +1011,7 @@ pub struct CONTEXT {
|
||||||
pub P4Home: u64,
|
pub P4Home: u64,
|
||||||
pub P5Home: u64,
|
pub P5Home: u64,
|
||||||
pub P6Home: u64,
|
pub P6Home: u64,
|
||||||
pub ContextFlags: u32,
|
pub ContextFlags: CONTEXT_FLAGS,
|
||||||
pub MxCsr: u32,
|
pub MxCsr: u32,
|
||||||
pub SegCs: u16,
|
pub SegCs: u16,
|
||||||
pub SegDs: u16,
|
pub SegDs: u16,
|
||||||
|
@ -1100,7 +1107,7 @@ impl ::core::clone::Clone for CONTEXT_0_0 {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
pub struct CONTEXT {
|
pub struct CONTEXT {
|
||||||
pub ContextFlags: u32,
|
pub ContextFlags: CONTEXT_FLAGS,
|
||||||
pub Dr0: u32,
|
pub Dr0: u32,
|
||||||
pub Dr1: u32,
|
pub Dr1: u32,
|
||||||
pub Dr2: u32,
|
pub Dr2: u32,
|
||||||
|
@ -1134,6 +1141,7 @@ impl ::core::clone::Clone for CONTEXT {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pub type CONTEXT_FLAGS = u32;
|
||||||
pub const CP_UTF8: u32 = 65001u32;
|
pub const CP_UTF8: u32 = 65001u32;
|
||||||
pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32;
|
pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32;
|
||||||
pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32;
|
pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32;
|
||||||
|
@ -1151,9 +1159,9 @@ pub const CREATE_SEPARATE_WOW_VDM: PROCESS_CREATION_FLAGS = 2048u32;
|
||||||
pub const CREATE_SHARED_WOW_VDM: PROCESS_CREATION_FLAGS = 4096u32;
|
pub const CREATE_SHARED_WOW_VDM: PROCESS_CREATION_FLAGS = 4096u32;
|
||||||
pub const CREATE_SUSPENDED: PROCESS_CREATION_FLAGS = 4u32;
|
pub const CREATE_SUSPENDED: PROCESS_CREATION_FLAGS = 4u32;
|
||||||
pub const CREATE_UNICODE_ENVIRONMENT: PROCESS_CREATION_FLAGS = 1024u32;
|
pub const CREATE_UNICODE_ENVIRONMENT: PROCESS_CREATION_FLAGS = 1024u32;
|
||||||
pub const CSTR_EQUAL: COMPARESTRING_RESULT = 2u32;
|
pub const CSTR_EQUAL: COMPARESTRING_RESULT = 2i32;
|
||||||
pub const CSTR_GREATER_THAN: COMPARESTRING_RESULT = 3u32;
|
pub const CSTR_GREATER_THAN: COMPARESTRING_RESULT = 3i32;
|
||||||
pub const CSTR_LESS_THAN: COMPARESTRING_RESULT = 1u32;
|
pub const CSTR_LESS_THAN: COMPARESTRING_RESULT = 1i32;
|
||||||
pub const DEBUG_ONLY_THIS_PROCESS: PROCESS_CREATION_FLAGS = 2u32;
|
pub const DEBUG_ONLY_THIS_PROCESS: PROCESS_CREATION_FLAGS = 2u32;
|
||||||
pub const DEBUG_PROCESS: PROCESS_CREATION_FLAGS = 1u32;
|
pub const DEBUG_PROCESS: PROCESS_CREATION_FLAGS = 1u32;
|
||||||
pub const DELETE: FILE_ACCESS_RIGHTS = 65536u32;
|
pub const DELETE: FILE_ACCESS_RIGHTS = 65536u32;
|
||||||
|
@ -3369,7 +3377,6 @@ pub const FileRenameInfoEx: FILE_INFO_BY_HANDLE_CLASS = 22i32;
|
||||||
pub const FileStandardInfo: FILE_INFO_BY_HANDLE_CLASS = 1i32;
|
pub const FileStandardInfo: FILE_INFO_BY_HANDLE_CLASS = 1i32;
|
||||||
pub const FileStorageInfo: FILE_INFO_BY_HANDLE_CLASS = 16i32;
|
pub const FileStorageInfo: FILE_INFO_BY_HANDLE_CLASS = 16i32;
|
||||||
pub const FileStreamInfo: FILE_INFO_BY_HANDLE_CLASS = 7i32;
|
pub const FileStreamInfo: FILE_INFO_BY_HANDLE_CLASS = 7i32;
|
||||||
pub type FindFileHandle = *mut ::core::ffi::c_void;
|
|
||||||
pub type GENERIC_ACCESS_RIGHTS = u32;
|
pub type GENERIC_ACCESS_RIGHTS = u32;
|
||||||
pub const GENERIC_ALL: GENERIC_ACCESS_RIGHTS = 268435456u32;
|
pub const GENERIC_ALL: GENERIC_ACCESS_RIGHTS = 268435456u32;
|
||||||
pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32;
|
pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32;
|
||||||
|
@ -3383,6 +3390,12 @@ pub struct GUID {
|
||||||
pub data3: u16,
|
pub data3: u16,
|
||||||
pub data4: [u8; 8],
|
pub data4: [u8; 8],
|
||||||
}
|
}
|
||||||
|
impl ::core::marker::Copy for GUID {}
|
||||||
|
impl ::core::clone::Clone for GUID {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
impl GUID {
|
impl GUID {
|
||||||
pub const fn from_u128(uuid: u128) -> Self {
|
pub const fn from_u128(uuid: u128) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -3393,12 +3406,6 @@ impl GUID {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ::core::marker::Copy for GUID {}
|
|
||||||
impl ::core::clone::Clone for GUID {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
*self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub type HANDLE = *mut ::core::ffi::c_void;
|
pub type HANDLE = *mut ::core::ffi::c_void;
|
||||||
pub type HANDLE_FLAGS = u32;
|
pub type HANDLE_FLAGS = u32;
|
||||||
pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32;
|
pub const HANDLE_FLAG_INHERIT: HANDLE_FLAGS = 1u32;
|
||||||
|
@ -3431,6 +3438,16 @@ impl ::core::clone::Clone for IN6_ADDR_0 {
|
||||||
pub const INFINITE: u32 = 4294967295u32;
|
pub const INFINITE: u32 = 4294967295u32;
|
||||||
pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32;
|
pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32;
|
||||||
pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32;
|
pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32;
|
||||||
|
#[repr(C)]
|
||||||
|
pub union INIT_ONCE {
|
||||||
|
pub Ptr: *mut ::core::ffi::c_void,
|
||||||
|
}
|
||||||
|
impl ::core::marker::Copy for INIT_ONCE {}
|
||||||
|
impl ::core::clone::Clone for INIT_ONCE {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
pub const INIT_ONCE_INIT_FAILED: u32 = 4u32;
|
pub const INIT_ONCE_INIT_FAILED: u32 = 4u32;
|
||||||
pub const INVALID_FILE_ATTRIBUTES: u32 = 4294967295u32;
|
pub const INVALID_FILE_ATTRIBUTES: u32 = 4294967295u32;
|
||||||
pub const INVALID_HANDLE_VALUE: HANDLE = ::core::ptr::invalid_mut(-1i32 as _);
|
pub const INVALID_HANDLE_VALUE: HANDLE = ::core::ptr::invalid_mut(-1i32 as _);
|
||||||
|
@ -3659,10 +3676,10 @@ pub type NTSTATUS = i32;
|
||||||
pub struct OBJECT_ATTRIBUTES {
|
pub struct OBJECT_ATTRIBUTES {
|
||||||
pub Length: u32,
|
pub Length: u32,
|
||||||
pub RootDirectory: HANDLE,
|
pub RootDirectory: HANDLE,
|
||||||
pub ObjectName: *mut UNICODE_STRING,
|
pub ObjectName: *const UNICODE_STRING,
|
||||||
pub Attributes: u32,
|
pub Attributes: u32,
|
||||||
pub SecurityDescriptor: *mut ::core::ffi::c_void,
|
pub SecurityDescriptor: *const ::core::ffi::c_void,
|
||||||
pub SecurityQualityOfService: *mut ::core::ffi::c_void,
|
pub SecurityQualityOfService: *const ::core::ffi::c_void,
|
||||||
}
|
}
|
||||||
impl ::core::marker::Copy for OBJECT_ATTRIBUTES {}
|
impl ::core::marker::Copy for OBJECT_ATTRIBUTES {}
|
||||||
impl ::core::clone::Clone for OBJECT_ATTRIBUTES {
|
impl ::core::clone::Clone for OBJECT_ATTRIBUTES {
|
||||||
|
@ -3712,8 +3729,8 @@ pub type PCSTR = *const u8;
|
||||||
pub type PCWSTR = *const u16;
|
pub type PCWSTR = *const u16;
|
||||||
pub type PIO_APC_ROUTINE = ::core::option::Option<
|
pub type PIO_APC_ROUTINE = ::core::option::Option<
|
||||||
unsafe extern "system" fn(
|
unsafe extern "system" fn(
|
||||||
apccontext: *const ::core::ffi::c_void,
|
apccontext: *mut ::core::ffi::c_void,
|
||||||
iostatusblock: *const IO_STATUS_BLOCK,
|
iostatusblock: *mut IO_STATUS_BLOCK,
|
||||||
reserved: u32,
|
reserved: u32,
|
||||||
) -> (),
|
) -> (),
|
||||||
>;
|
>;
|
||||||
|
@ -3755,36 +3772,6 @@ pub type PSTR = *mut u8;
|
||||||
pub type PWSTR = *mut u16;
|
pub type PWSTR = *mut u16;
|
||||||
pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32;
|
pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32;
|
||||||
pub const REALTIME_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 256u32;
|
pub const REALTIME_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 256u32;
|
||||||
#[repr(C)]
|
|
||||||
pub struct RTL_CONDITION_VARIABLE {
|
|
||||||
pub Ptr: *mut ::core::ffi::c_void,
|
|
||||||
}
|
|
||||||
impl ::core::marker::Copy for RTL_CONDITION_VARIABLE {}
|
|
||||||
impl ::core::clone::Clone for RTL_CONDITION_VARIABLE {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
*self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[repr(C)]
|
|
||||||
pub union RTL_RUN_ONCE {
|
|
||||||
pub Ptr: *mut ::core::ffi::c_void,
|
|
||||||
}
|
|
||||||
impl ::core::marker::Copy for RTL_RUN_ONCE {}
|
|
||||||
impl ::core::clone::Clone for RTL_RUN_ONCE {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
*self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#[repr(C)]
|
|
||||||
pub struct RTL_SRWLOCK {
|
|
||||||
pub Ptr: *mut ::core::ffi::c_void,
|
|
||||||
}
|
|
||||||
impl ::core::marker::Copy for RTL_SRWLOCK {}
|
|
||||||
impl ::core::clone::Clone for RTL_SRWLOCK {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
*self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub const SD_BOTH: WINSOCK_SHUTDOWN_HOW = 2i32;
|
pub const SD_BOTH: WINSOCK_SHUTDOWN_HOW = 2i32;
|
||||||
pub const SD_RECEIVE: WINSOCK_SHUTDOWN_HOW = 0i32;
|
pub const SD_RECEIVE: WINSOCK_SHUTDOWN_HOW = 0i32;
|
||||||
pub const SD_SEND: WINSOCK_SHUTDOWN_HOW = 1i32;
|
pub const SD_SEND: WINSOCK_SHUTDOWN_HOW = 1i32;
|
||||||
|
@ -3821,10 +3808,7 @@ impl ::core::clone::Clone for SOCKADDR {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[cfg(target_pointer_width = "32")]
|
pub type SOCKET = usize;
|
||||||
pub type SOCKET = u32;
|
|
||||||
#[cfg(target_pointer_width = "64")]
|
|
||||||
pub type SOCKET = u64;
|
|
||||||
pub const SOCKET_ERROR: i32 = -1i32;
|
pub const SOCKET_ERROR: i32 = -1i32;
|
||||||
pub const SOCK_DGRAM: WINSOCK_SOCKET_TYPE = 2i32;
|
pub const SOCK_DGRAM: WINSOCK_SOCKET_TYPE = 2i32;
|
||||||
pub const SOCK_RAW: WINSOCK_SOCKET_TYPE = 3i32;
|
pub const SOCK_RAW: WINSOCK_SOCKET_TYPE = 3i32;
|
||||||
|
@ -3838,6 +3822,16 @@ pub const SO_LINGER: i32 = 128i32;
|
||||||
pub const SO_RCVTIMEO: i32 = 4102i32;
|
pub const SO_RCVTIMEO: i32 = 4102i32;
|
||||||
pub const SO_SNDTIMEO: i32 = 4101i32;
|
pub const SO_SNDTIMEO: i32 = 4101i32;
|
||||||
pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32;
|
pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32;
|
||||||
|
#[repr(C)]
|
||||||
|
pub struct SRWLOCK {
|
||||||
|
pub Ptr: *mut ::core::ffi::c_void,
|
||||||
|
}
|
||||||
|
impl ::core::marker::Copy for SRWLOCK {}
|
||||||
|
impl ::core::clone::Clone for SRWLOCK {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
*self
|
||||||
|
}
|
||||||
|
}
|
||||||
pub const STACK_SIZE_PARAM_IS_A_RESERVATION: THREAD_CREATION_FLAGS = 65536u32;
|
pub const STACK_SIZE_PARAM_IS_A_RESERVATION: THREAD_CREATION_FLAGS = 65536u32;
|
||||||
pub const STANDARD_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 2031616u32;
|
pub const STANDARD_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 2031616u32;
|
||||||
pub const STANDARD_RIGHTS_EXECUTE: FILE_ACCESS_RIGHTS = 131072u32;
|
pub const STANDARD_RIGHTS_EXECUTE: FILE_ACCESS_RIGHTS = 131072u32;
|
||||||
|
@ -4008,12 +4002,13 @@ impl ::core::clone::Clone for UNICODE_STRING {
|
||||||
pub const VOLUME_NAME_DOS: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32;
|
pub const VOLUME_NAME_DOS: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32;
|
||||||
pub const VOLUME_NAME_GUID: GETFINALPATHNAMEBYHANDLE_FLAGS = 1u32;
|
pub const VOLUME_NAME_GUID: GETFINALPATHNAMEBYHANDLE_FLAGS = 1u32;
|
||||||
pub const VOLUME_NAME_NONE: GETFINALPATHNAMEBYHANDLE_FLAGS = 4u32;
|
pub const VOLUME_NAME_NONE: GETFINALPATHNAMEBYHANDLE_FLAGS = 4u32;
|
||||||
pub const WAIT_ABANDONED: WIN32_ERROR = 128u32;
|
pub const WAIT_ABANDONED: WAIT_EVENT = 128u32;
|
||||||
pub const WAIT_ABANDONED_0: WIN32_ERROR = 128u32;
|
pub const WAIT_ABANDONED_0: WAIT_EVENT = 128u32;
|
||||||
pub const WAIT_FAILED: WIN32_ERROR = 4294967295u32;
|
pub type WAIT_EVENT = u32;
|
||||||
pub const WAIT_IO_COMPLETION: WIN32_ERROR = 192u32;
|
pub const WAIT_FAILED: WAIT_EVENT = 4294967295u32;
|
||||||
pub const WAIT_OBJECT_0: WIN32_ERROR = 0u32;
|
pub const WAIT_IO_COMPLETION: WAIT_EVENT = 192u32;
|
||||||
pub const WAIT_TIMEOUT: WIN32_ERROR = 258u32;
|
pub const WAIT_OBJECT_0: WAIT_EVENT = 0u32;
|
||||||
|
pub const WAIT_TIMEOUT: WAIT_EVENT = 258u32;
|
||||||
pub const WC_ERR_INVALID_CHARS: u32 = 128u32;
|
pub const WC_ERR_INVALID_CHARS: u32 = 128u32;
|
||||||
pub type WIN32_ERROR = u32;
|
pub type WIN32_ERROR = u32;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
|
|
@ -143,13 +143,8 @@ impl Handle {
|
||||||
) -> io::Result<Option<usize>> {
|
) -> io::Result<Option<usize>> {
|
||||||
let len = cmp::min(buf.len(), <c::DWORD>::MAX as usize) as c::DWORD;
|
let len = cmp::min(buf.len(), <c::DWORD>::MAX as usize) as c::DWORD;
|
||||||
let mut amt = 0;
|
let mut amt = 0;
|
||||||
let res = cvt(c::ReadFile(
|
let res =
|
||||||
self.as_raw_handle(),
|
cvt(c::ReadFile(self.as_raw_handle(), buf.as_mut_ptr(), len, &mut amt, overlapped));
|
||||||
buf.as_ptr() as c::LPVOID,
|
|
||||||
len,
|
|
||||||
&mut amt,
|
|
||||||
overlapped,
|
|
||||||
));
|
|
||||||
match res {
|
match res {
|
||||||
Ok(_) => Ok(Some(amt as usize)),
|
Ok(_) => Ok(Some(amt as usize)),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|
|
@ -4,4 +4,4 @@ version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies.windows-bindgen]
|
[dependencies.windows-bindgen]
|
||||||
version = "0.49"
|
version = "0.51.1"
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
use std::env;
|
||||||
|
use std::error::Error;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Read, Seek, Write};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
/// This is printed to the file before the rest of the contents.
|
/// This is printed to the file before the rest of the contents.
|
||||||
|
@ -11,25 +13,20 @@ const PRELUDE: &str = r#"// This file is autogenerated.
|
||||||
// ignore-tidy-filelength
|
// ignore-tidy-filelength
|
||||||
"#;
|
"#;
|
||||||
|
|
||||||
fn main() -> io::Result<()> {
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let mut path: PathBuf =
|
let mut path: PathBuf =
|
||||||
std::env::args_os().nth(1).expect("a path to the rust repository is required").into();
|
env::args_os().nth(1).expect("a path to the rust repository is required").into();
|
||||||
path.push("library/std/src/sys/windows/c/windows_sys.lst");
|
path.push("library/std/src/sys/windows/c");
|
||||||
|
env::set_current_dir(&path)?;
|
||||||
|
|
||||||
// Load the list of APIs
|
let info = windows_bindgen::bindgen(["--etc", "windows_sys.lst"])?;
|
||||||
let buffer = fs::read_to_string(&path)?;
|
println!("{info}");
|
||||||
let names: Vec<&str> = buffer
|
|
||||||
.lines()
|
|
||||||
.filter_map(|line| {
|
|
||||||
let line = line.trim();
|
|
||||||
if line.is_empty() || line.starts_with("//") { None } else { Some(line) }
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
// Write the bindings to windows-sys.rs
|
// add some gunk to the output file.
|
||||||
let bindings = windows_bindgen::standalone_std(&names);
|
let mut f = fs::File::options().read(true).write(true).open("windows_sys.rs")?;
|
||||||
path.set_extension("rs");
|
let mut bindings = String::new();
|
||||||
let mut f = std::fs::File::create(&path)?;
|
f.read_to_string(&mut bindings)?;
|
||||||
|
f.seek(io::SeekFrom::Start(0))?;
|
||||||
f.write_all(PRELUDE.as_bytes())?;
|
f.write_all(PRELUDE.as_bytes())?;
|
||||||
f.write_all(bindings.as_bytes())?;
|
f.write_all(bindings.as_bytes())?;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue