mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-04 19:29:07 +00:00
Auto merge of #114882 - ChrisDenton:riddle-me, r=dtolnay
Update windows ffi bindings Bump `windows-bindgen` to version 0.51.1. This brings with it some changes to the generated FFI bindings, but little that affects the code. One change that does have more of an impact is `SOCKET` being `usize` instead of either `u64` or `u32` (as is used in std's public `SOCKET` type). However, it's now easy enough to abstract over that difference. Finally I added a few new bindings that are likely to be used in pending PRs, mostly to make sure they're ok with the new metadata. r? libs
This commit is contained in:
commit
dd91aba2fd
18
Cargo.lock
18
Cargo.lock
@ -6025,19 +6025,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.29",
|
||||||
"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"
|
||||||
@ -6087,12 +6089,6 @@ dependencies = [
|
|||||||
"windows_x86_64_msvc 0.48.0",
|
"windows_x86_64_msvc 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[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.42.2"
|
version = "0.42.2"
|
||||||
|
@ -116,7 +116,7 @@ impl BorrowedSocket<'_> {
|
|||||||
let mut info = unsafe { mem::zeroed::<sys::c::WSAPROTOCOL_INFOW>() };
|
let mut info = unsafe { mem::zeroed::<sys::c::WSAPROTOCOL_INFOW>() };
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
sys::c::WSADuplicateSocketW(
|
sys::c::WSADuplicateSocketW(
|
||||||
self.as_raw_socket(),
|
self.as_raw_socket() as sys::c::SOCKET,
|
||||||
sys::c::GetCurrentProcessId(),
|
sys::c::GetCurrentProcessId(),
|
||||||
&mut info,
|
&mut info,
|
||||||
)
|
)
|
||||||
@ -134,7 +134,7 @@ impl BorrowedSocket<'_> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if socket != sys::c::INVALID_SOCKET {
|
if socket != sys::c::INVALID_SOCKET {
|
||||||
unsafe { Ok(OwnedSocket::from_raw_socket(socket)) }
|
unsafe { Ok(OwnedSocket::from_raw_socket(socket as RawSocket)) }
|
||||||
} else {
|
} else {
|
||||||
let error = unsafe { sys::c::WSAGetLastError() };
|
let error = unsafe { sys::c::WSAGetLastError() };
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ impl BorrowedSocket<'_> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let socket = OwnedSocket::from_raw_socket(socket);
|
let socket = OwnedSocket::from_raw_socket(socket as RawSocket);
|
||||||
socket.set_no_inherit()?;
|
socket.set_no_inherit()?;
|
||||||
Ok(socket)
|
Ok(socket)
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ impl Drop for OwnedSocket {
|
|||||||
#[inline]
|
#[inline]
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let _ = sys::c::closesocket(self.socket);
|
let _ = sys::c::closesocket(self.socket as sys::c::SOCKET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
@ -2328,7 +2330,6 @@ Windows.Win32.Storage.FileSystem.FileStandardInfo
|
|||||||
Windows.Win32.Storage.FileSystem.FileStorageInfo
|
Windows.Win32.Storage.FileSystem.FileStorageInfo
|
||||||
Windows.Win32.Storage.FileSystem.FileStreamInfo
|
Windows.Win32.Storage.FileSystem.FileStreamInfo
|
||||||
Windows.Win32.Storage.FileSystem.FindClose
|
Windows.Win32.Storage.FileSystem.FindClose
|
||||||
Windows.Win32.Storage.FileSystem.FindFileHandle
|
|
||||||
Windows.Win32.Storage.FileSystem.FindFirstFileW
|
Windows.Win32.Storage.FileSystem.FindFirstFileW
|
||||||
Windows.Win32.Storage.FileSystem.FindNextFileW
|
Windows.Win32.Storage.FileSystem.FindNextFileW
|
||||||
Windows.Win32.Storage.FileSystem.FlushFileBuffers
|
Windows.Win32.Storage.FileSystem.FlushFileBuffers
|
||||||
@ -2420,8 +2421,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 +2434,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 +2454,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
|
||||||
@ -2482,6 +2479,7 @@ Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime
|
|||||||
Windows.Win32.System.SystemInformation.GetWindowsDirectoryW
|
Windows.Win32.System.SystemInformation.GetWindowsDirectoryW
|
||||||
Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE
|
Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE
|
||||||
Windows.Win32.System.SystemInformation.SYSTEM_INFO
|
Windows.Win32.System.SystemInformation.SYSTEM_INFO
|
||||||
|
Windows.Win32.System.SystemServices.ALL_PROCESSOR_GROUPS
|
||||||
Windows.Win32.System.SystemServices.DLL_PROCESS_DETACH
|
Windows.Win32.System.SystemServices.DLL_PROCESS_DETACH
|
||||||
Windows.Win32.System.SystemServices.DLL_THREAD_DETACH
|
Windows.Win32.System.SystemServices.DLL_THREAD_DETACH
|
||||||
Windows.Win32.System.SystemServices.EXCEPTION_MAXIMUM_PARAMETERS
|
Windows.Win32.System.SystemServices.EXCEPTION_MAXIMUM_PARAMETERS
|
||||||
@ -2514,6 +2512,7 @@ Windows.Win32.System.Threading.DeleteProcThreadAttributeList
|
|||||||
Windows.Win32.System.Threading.DETACHED_PROCESS
|
Windows.Win32.System.Threading.DETACHED_PROCESS
|
||||||
Windows.Win32.System.Threading.ExitProcess
|
Windows.Win32.System.Threading.ExitProcess
|
||||||
Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT
|
Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT
|
||||||
|
Windows.Win32.System.Threading.GetActiveProcessorCount
|
||||||
Windows.Win32.System.Threading.GetCurrentProcess
|
Windows.Win32.System.Threading.GetCurrentProcess
|
||||||
Windows.Win32.System.Threading.GetCurrentProcessId
|
Windows.Win32.System.Threading.GetCurrentProcessId
|
||||||
Windows.Win32.System.Threading.GetCurrentThread
|
Windows.Win32.System.Threading.GetCurrentThread
|
||||||
@ -2542,9 +2541,6 @@ Windows.Win32.System.Threading.PROFILE_USER
|
|||||||
Windows.Win32.System.Threading.REALTIME_PRIORITY_CLASS
|
Windows.Win32.System.Threading.REALTIME_PRIORITY_CLASS
|
||||||
Windows.Win32.System.Threading.ReleaseSRWLockExclusive
|
Windows.Win32.System.Threading.ReleaseSRWLockExclusive
|
||||||
Windows.Win32.System.Threading.ReleaseSRWLockShared
|
Windows.Win32.System.Threading.ReleaseSRWLockShared
|
||||||
Windows.Win32.System.Threading.RTL_CONDITION_VARIABLE
|
|
||||||
Windows.Win32.System.Threading.RTL_RUN_ONCE
|
|
||||||
Windows.Win32.System.Threading.RTL_SRWLOCK
|
|
||||||
Windows.Win32.System.Threading.SetThreadStackGuarantee
|
Windows.Win32.System.Threading.SetThreadStackGuarantee
|
||||||
Windows.Win32.System.Threading.Sleep
|
Windows.Win32.System.Threading.Sleep
|
||||||
Windows.Win32.System.Threading.SleepConditionVariableSRW
|
Windows.Win32.System.Threading.SleepConditionVariableSRW
|
||||||
@ -2584,8 +2580,6 @@ Windows.Win32.System.Threading.WaitForMultipleObjects
|
|||||||
Windows.Win32.System.Threading.WaitForSingleObject
|
Windows.Win32.System.Threading.WaitForSingleObject
|
||||||
Windows.Win32.System.Threading.WakeAllConditionVariable
|
Windows.Win32.System.Threading.WakeAllConditionVariable
|
||||||
Windows.Win32.System.Threading.WakeConditionVariable
|
Windows.Win32.System.Threading.WakeConditionVariable
|
||||||
Windows.Win32.System.WindowsProgramming.IO_STATUS_BLOCK
|
|
||||||
Windows.Win32.System.WindowsProgramming.OBJECT_ATTRIBUTES
|
|
||||||
Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE
|
Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE
|
||||||
Windows.Win32.UI.Shell.GetUserProfileDirectoryW
|
Windows.Win32.UI.Shell.GetUserProfileDirectoryW
|
||||||
// tidy-alphabetical-end
|
// tidy-alphabetical-end
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// regenerate the bindings.
|
// regenerate the bindings.
|
||||||
//
|
//
|
||||||
// ignore-tidy-filelength
|
// ignore-tidy-filelength
|
||||||
// Bindings generated by `windows-bindgen` 0.49.0
|
// Bindings generated by `windows-bindgen` 0.51.1
|
||||||
|
|
||||||
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
|
#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)]
|
||||||
#[link(name = "advapi32")]
|
#[link(name = "advapi32")]
|
||||||
@ -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" {
|
||||||
@ -223,6 +220,10 @@ extern "system" {
|
|||||||
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL;
|
pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL;
|
||||||
}
|
}
|
||||||
#[link(name = "kernel32")]
|
#[link(name = "kernel32")]
|
||||||
|
extern "system" {
|
||||||
|
pub fn GetActiveProcessorCount(groupnumber: u16) -> u32;
|
||||||
|
}
|
||||||
|
#[link(name = "kernel32")]
|
||||||
extern "system" {
|
extern "system" {
|
||||||
pub fn GetCommandLineW() -> PCWSTR;
|
pub fn GetCommandLineW() -> PCWSTR;
|
||||||
}
|
}
|
||||||
@ -360,7 +361,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 +370,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 +425,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 +435,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 +443,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 +514,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 +550,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 +575,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" {
|
||||||
@ -847,6 +848,7 @@ impl ::core::clone::Clone for ADDRINFOA {
|
|||||||
pub const AF_INET: ADDRESS_FAMILY = 2u16;
|
pub const AF_INET: ADDRESS_FAMILY = 2u16;
|
||||||
pub const AF_INET6: ADDRESS_FAMILY = 23u16;
|
pub const AF_INET6: ADDRESS_FAMILY = 23u16;
|
||||||
pub const AF_UNSPEC: ADDRESS_FAMILY = 0u16;
|
pub const AF_UNSPEC: ADDRESS_FAMILY = 0u16;
|
||||||
|
pub const ALL_PROCESSOR_GROUPS: u32 = 65535u32;
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub union ARM64_NT_NEON128 {
|
pub union ARM64_NT_NEON128 {
|
||||||
pub Anonymous: ARM64_NT_NEON128_0,
|
pub Anonymous: ARM64_NT_NEON128_0,
|
||||||
@ -899,7 +901,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 +929,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 +1016,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 +1112,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 +1146,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 +1164,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 +3382,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 +3395,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 +3411,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 +3443,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 +3681,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 +3734,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 +3777,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 +3813,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 +3827,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 +4007,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) => {
|
||||||
|
@ -117,7 +117,7 @@ impl Socket {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if socket != c::INVALID_SOCKET {
|
if socket != c::INVALID_SOCKET {
|
||||||
unsafe { Ok(Self::from_raw_socket(socket)) }
|
unsafe { Ok(Self::from_raw(socket)) }
|
||||||
} else {
|
} else {
|
||||||
let error = unsafe { c::WSAGetLastError() };
|
let error = unsafe { c::WSAGetLastError() };
|
||||||
|
|
||||||
@ -133,7 +133,7 @@ impl Socket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let socket = Self::from_raw_socket(socket);
|
let socket = Self::from_raw(socket);
|
||||||
socket.0.set_no_inherit()?;
|
socket.0.set_no_inherit()?;
|
||||||
Ok(socket)
|
Ok(socket)
|
||||||
}
|
}
|
||||||
@ -144,7 +144,7 @@ impl Socket {
|
|||||||
self.set_nonblocking(true)?;
|
self.set_nonblocking(true)?;
|
||||||
let result = {
|
let result = {
|
||||||
let (addr, len) = addr.into_inner();
|
let (addr, len) = addr.into_inner();
|
||||||
let result = unsafe { c::connect(self.as_raw_socket(), addr.as_ptr(), len) };
|
let result = unsafe { c::connect(self.as_raw(), addr.as_ptr(), len) };
|
||||||
cvt(result).map(drop)
|
cvt(result).map(drop)
|
||||||
};
|
};
|
||||||
self.set_nonblocking(false)?;
|
self.set_nonblocking(false)?;
|
||||||
@ -170,7 +170,7 @@ impl Socket {
|
|||||||
let fds = {
|
let fds = {
|
||||||
let mut fds = unsafe { mem::zeroed::<c::fd_set>() };
|
let mut fds = unsafe { mem::zeroed::<c::fd_set>() };
|
||||||
fds.fd_count = 1;
|
fds.fd_count = 1;
|
||||||
fds.fd_array[0] = self.as_raw_socket();
|
fds.fd_array[0] = self.as_raw();
|
||||||
fds
|
fds
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -202,11 +202,11 @@ impl Socket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn accept(&self, storage: *mut c::SOCKADDR, len: *mut c_int) -> io::Result<Socket> {
|
pub fn accept(&self, storage: *mut c::SOCKADDR, len: *mut c_int) -> io::Result<Socket> {
|
||||||
let socket = unsafe { c::accept(self.as_raw_socket(), storage, len) };
|
let socket = unsafe { c::accept(self.as_raw(), storage, len) };
|
||||||
|
|
||||||
match socket {
|
match socket {
|
||||||
c::INVALID_SOCKET => Err(last_error()),
|
c::INVALID_SOCKET => Err(last_error()),
|
||||||
_ => unsafe { Ok(Self::from_raw_socket(socket)) },
|
_ => unsafe { Ok(Self::from_raw(socket)) },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,9 +218,8 @@ impl Socket {
|
|||||||
// On unix when a socket is shut down all further reads return 0, so we
|
// On unix when a socket is shut down all further reads return 0, so we
|
||||||
// do the same on windows to map a shut down socket to returning EOF.
|
// do the same on windows to map a shut down socket to returning EOF.
|
||||||
let length = cmp::min(buf.capacity(), i32::MAX as usize) as i32;
|
let length = cmp::min(buf.capacity(), i32::MAX as usize) as i32;
|
||||||
let result = unsafe {
|
let result =
|
||||||
c::recv(self.as_raw_socket(), buf.as_mut().as_mut_ptr() as *mut _, length, flags)
|
unsafe { c::recv(self.as_raw(), buf.as_mut().as_mut_ptr() as *mut _, length, flags) };
|
||||||
};
|
|
||||||
|
|
||||||
match result {
|
match result {
|
||||||
c::SOCKET_ERROR => {
|
c::SOCKET_ERROR => {
|
||||||
@ -257,7 +256,7 @@ impl Socket {
|
|||||||
let mut flags = 0;
|
let mut flags = 0;
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
c::WSARecv(
|
c::WSARecv(
|
||||||
self.as_raw_socket(),
|
self.as_raw(),
|
||||||
bufs.as_mut_ptr() as *mut c::WSABUF,
|
bufs.as_mut_ptr() as *mut c::WSABUF,
|
||||||
length,
|
length,
|
||||||
&mut nread,
|
&mut nread,
|
||||||
@ -305,7 +304,7 @@ impl Socket {
|
|||||||
// do the same on windows to map a shut down socket to returning EOF.
|
// do the same on windows to map a shut down socket to returning EOF.
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
c::recvfrom(
|
c::recvfrom(
|
||||||
self.as_raw_socket(),
|
self.as_raw(),
|
||||||
buf.as_mut_ptr() as *mut _,
|
buf.as_mut_ptr() as *mut _,
|
||||||
length,
|
length,
|
||||||
flags,
|
flags,
|
||||||
@ -341,7 +340,7 @@ impl Socket {
|
|||||||
let mut nwritten = 0;
|
let mut nwritten = 0;
|
||||||
let result = unsafe {
|
let result = unsafe {
|
||||||
c::WSASend(
|
c::WSASend(
|
||||||
self.as_raw_socket(),
|
self.as_raw(),
|
||||||
bufs.as_ptr() as *const c::WSABUF as *mut _,
|
bufs.as_ptr() as *const c::WSABUF as *mut _,
|
||||||
length,
|
length,
|
||||||
&mut nwritten,
|
&mut nwritten,
|
||||||
@ -392,14 +391,14 @@ impl Socket {
|
|||||||
Shutdown::Read => c::SD_RECEIVE,
|
Shutdown::Read => c::SD_RECEIVE,
|
||||||
Shutdown::Both => c::SD_BOTH,
|
Shutdown::Both => c::SD_BOTH,
|
||||||
};
|
};
|
||||||
let result = unsafe { c::shutdown(self.as_raw_socket(), how) };
|
let result = unsafe { c::shutdown(self.as_raw(), how) };
|
||||||
cvt(result).map(drop)
|
cvt(result).map(drop)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
|
pub fn set_nonblocking(&self, nonblocking: bool) -> io::Result<()> {
|
||||||
let mut nonblocking = nonblocking as c_ulong;
|
let mut nonblocking = nonblocking as c_ulong;
|
||||||
let result =
|
let result =
|
||||||
unsafe { c::ioctlsocket(self.as_raw_socket(), c::FIONBIO as c_int, &mut nonblocking) };
|
unsafe { c::ioctlsocket(self.as_raw(), c::FIONBIO as c_int, &mut nonblocking) };
|
||||||
cvt(result).map(drop)
|
cvt(result).map(drop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,8 +432,15 @@ impl Socket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is used by sys_common code to abstract over Windows and Unix.
|
// This is used by sys_common code to abstract over Windows and Unix.
|
||||||
pub fn as_raw(&self) -> RawSocket {
|
pub fn as_raw(&self) -> c::SOCKET {
|
||||||
self.as_inner().as_raw_socket()
|
debug_assert_eq!(mem::size_of::<c::SOCKET>(), mem::size_of::<RawSocket>());
|
||||||
|
debug_assert_eq!(mem::align_of::<c::SOCKET>(), mem::align_of::<RawSocket>());
|
||||||
|
self.as_inner().as_raw_socket() as c::SOCKET
|
||||||
|
}
|
||||||
|
pub unsafe fn from_raw(raw: c::SOCKET) -> Self {
|
||||||
|
debug_assert_eq!(mem::size_of::<c::SOCKET>(), mem::size_of::<RawSocket>());
|
||||||
|
debug_assert_eq!(mem::align_of::<c::SOCKET>(), mem::align_of::<RawSocket>());
|
||||||
|
Self::from_raw_socket(raw as RawSocket)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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…
Reference in New Issue
Block a user