Skip to content

Commit dd91aba

Browse files
committed
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
2 parents c01d8d2 + e790860 commit dd91aba

File tree

9 files changed

+138
-154
lines changed

9 files changed

+138
-154
lines changed

Cargo.lock

+7-11
Original file line numberDiff line numberDiff line change
@@ -6025,19 +6025,21 @@ dependencies = [
60256025

60266026
[[package]]
60276027
name = "windows-bindgen"
6028-
version = "0.49.0"
6028+
version = "0.51.1"
60296029
source = "registry+https://github.com/rust-lang/crates.io-index"
6030-
checksum = "b6935fb09b84ee57929ae92518b475f5dfdfbeb87c5334756acc28ee8e202b60"
6030+
checksum = "bc1f16b778125675feee0d15d6dd9f6af0e3ac52b3233d63a10aa39230c1cd75"
60316031
dependencies = [
6032+
"proc-macro2",
6033+
"rayon",
6034+
"syn 2.0.29",
60326035
"windows-metadata",
6033-
"windows-tokens",
60346036
]
60356037

60366038
[[package]]
60376039
name = "windows-metadata"
6038-
version = "0.49.0"
6040+
version = "0.51.1"
60396041
source = "registry+https://github.com/rust-lang/crates.io-index"
6040-
checksum = "2f5bca94a32bf1e6a376522b6601275a3b611ee885ec0f1b6a05f17e8cfd3385"
6042+
checksum = "753135d996f9da437c0b31dbde3032489a61708361929bcc07d4fba0b161000e"
60416043

60426044
[[package]]
60436045
name = "windows-sys"
@@ -6087,12 +6089,6 @@ dependencies = [
60876089
"windows_x86_64_msvc 0.48.0",
60886090
]
60896091

6090-
[[package]]
6091-
name = "windows-tokens"
6092-
version = "0.48.0"
6093-
source = "registry+https://github.com/rust-lang/crates.io-index"
6094-
checksum = "b34c9a3b28cb41db7385546f7f9a8179348dffc89923dde66857b1ba5312f6b4"
6095-
60966092
[[package]]
60976093
name = "windows_aarch64_gnullvm"
60986094
version = "0.42.2"

library/std/src/os/windows/io/socket.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl BorrowedSocket<'_> {
116116
let mut info = unsafe { mem::zeroed::<sys::c::WSAPROTOCOL_INFOW>() };
117117
let result = unsafe {
118118
sys::c::WSADuplicateSocketW(
119-
self.as_raw_socket(),
119+
self.as_raw_socket() as sys::c::SOCKET,
120120
sys::c::GetCurrentProcessId(),
121121
&mut info,
122122
)
@@ -134,7 +134,7 @@ impl BorrowedSocket<'_> {
134134
};
135135

136136
if socket != sys::c::INVALID_SOCKET {
137-
unsafe { Ok(OwnedSocket::from_raw_socket(socket)) }
137+
unsafe { Ok(OwnedSocket::from_raw_socket(socket as RawSocket)) }
138138
} else {
139139
let error = unsafe { sys::c::WSAGetLastError() };
140140

@@ -158,7 +158,7 @@ impl BorrowedSocket<'_> {
158158
}
159159

160160
unsafe {
161-
let socket = OwnedSocket::from_raw_socket(socket);
161+
let socket = OwnedSocket::from_raw_socket(socket as RawSocket);
162162
socket.set_no_inherit()?;
163163
Ok(socket)
164164
}
@@ -211,7 +211,7 @@ impl Drop for OwnedSocket {
211211
#[inline]
212212
fn drop(&mut self) {
213213
unsafe {
214-
let _ = sys::c::closesocket(self.socket);
214+
let _ = sys::c::closesocket(self.socket as sys::c::SOCKET);
215215
}
216216
}
217217
}

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ pub use FD_SET as fd_set;
4646
pub use LINGER as linger;
4747
pub use TIMEVAL as timeval;
4848

49-
pub type CONDITION_VARIABLE = RTL_CONDITION_VARIABLE;
50-
pub type SRWLOCK = RTL_SRWLOCK;
51-
pub type INIT_ONCE = RTL_RUN_ONCE;
52-
5349
pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() };
5450
pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() };
5551
pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() };
@@ -224,7 +220,7 @@ pub unsafe extern "system" fn ReadFileEx(
224220
) -> BOOL {
225221
windows_sys::ReadFileEx(
226222
hFile.as_raw_handle(),
227-
lpBuffer,
223+
lpBuffer.cast::<u8>(),
228224
nNumberOfBytesToRead,
229225
lpOverlapped,
230226
lpCompletionRoutine,

library/std/src/sys/windows/c/windows_sys.lst

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
--out windows_sys.rs
2+
--config flatten std
3+
--filter
14
// tidy-alphabetical-start
25
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
36
Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION
@@ -2108,7 +2111,6 @@ Windows.Win32.Networking.WinSock.WSABASEERR
21082111
Windows.Win32.Networking.WinSock.WSABUF
21092112
Windows.Win32.Networking.WinSock.WSACleanup
21102113
Windows.Win32.Networking.WinSock.WSADATA
2111-
Windows.Win32.Networking.WinSock.WSADATA
21122114
Windows.Win32.Networking.WinSock.WSADuplicateSocketW
21132115
Windows.Win32.Networking.WinSock.WSAEACCES
21142116
Windows.Win32.Networking.WinSock.WSAEADDRINUSE
@@ -2328,7 +2330,6 @@ Windows.Win32.Storage.FileSystem.FileStandardInfo
23282330
Windows.Win32.Storage.FileSystem.FileStorageInfo
23292331
Windows.Win32.Storage.FileSystem.FileStreamInfo
23302332
Windows.Win32.Storage.FileSystem.FindClose
2331-
Windows.Win32.Storage.FileSystem.FindFileHandle
23322333
Windows.Win32.Storage.FileSystem.FindFirstFileW
23332334
Windows.Win32.Storage.FileSystem.FindNextFileW
23342335
Windows.Win32.Storage.FileSystem.FlushFileBuffers
@@ -2420,8 +2421,6 @@ Windows.Win32.System.Console.STD_OUTPUT_HANDLE
24202421
Windows.Win32.System.Console.WriteConsoleW
24212422
Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128
24222423
Windows.Win32.System.Diagnostics.Debug.CONTEXT
2423-
Windows.Win32.System.Diagnostics.Debug.CONTEXT
2424-
Windows.Win32.System.Diagnostics.Debug.CONTEXT
24252424
Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD
24262425
Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE
24272426
Windows.Win32.System.Diagnostics.Debug.FACILITY_NT_BIT
@@ -2435,7 +2434,6 @@ Windows.Win32.System.Diagnostics.Debug.FORMAT_MESSAGE_OPTIONS
24352434
Windows.Win32.System.Diagnostics.Debug.FormatMessageW
24362435
Windows.Win32.System.Diagnostics.Debug.M128A
24372436
Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
2438-
Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT
24392437
Windows.Win32.System.Environment.FreeEnvironmentStringsW
24402438
Windows.Win32.System.Environment.GetCommandLineW
24412439
Windows.Win32.System.Environment.GetCurrentDirectoryW
@@ -2456,7 +2454,6 @@ Windows.Win32.System.Kernel.ExceptionContinueExecution
24562454
Windows.Win32.System.Kernel.ExceptionContinueSearch
24572455
Windows.Win32.System.Kernel.ExceptionNestedException
24582456
Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
2459-
Windows.Win32.System.Kernel.FLOATING_SAVE_AREA
24602457
Windows.Win32.System.Kernel.OBJ_DONT_REPARSE
24612458
Windows.Win32.System.LibraryLoader.GetModuleFileNameW
24622459
Windows.Win32.System.LibraryLoader.GetModuleHandleA
@@ -2482,6 +2479,7 @@ Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime
24822479
Windows.Win32.System.SystemInformation.GetWindowsDirectoryW
24832480
Windows.Win32.System.SystemInformation.PROCESSOR_ARCHITECTURE
24842481
Windows.Win32.System.SystemInformation.SYSTEM_INFO
2482+
Windows.Win32.System.SystemServices.ALL_PROCESSOR_GROUPS
24852483
Windows.Win32.System.SystemServices.DLL_PROCESS_DETACH
24862484
Windows.Win32.System.SystemServices.DLL_THREAD_DETACH
24872485
Windows.Win32.System.SystemServices.EXCEPTION_MAXIMUM_PARAMETERS
@@ -2514,6 +2512,7 @@ Windows.Win32.System.Threading.DeleteProcThreadAttributeList
25142512
Windows.Win32.System.Threading.DETACHED_PROCESS
25152513
Windows.Win32.System.Threading.ExitProcess
25162514
Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT
2515+
Windows.Win32.System.Threading.GetActiveProcessorCount
25172516
Windows.Win32.System.Threading.GetCurrentProcess
25182517
Windows.Win32.System.Threading.GetCurrentProcessId
25192518
Windows.Win32.System.Threading.GetCurrentThread
@@ -2542,9 +2541,6 @@ Windows.Win32.System.Threading.PROFILE_USER
25422541
Windows.Win32.System.Threading.REALTIME_PRIORITY_CLASS
25432542
Windows.Win32.System.Threading.ReleaseSRWLockExclusive
25442543
Windows.Win32.System.Threading.ReleaseSRWLockShared
2545-
Windows.Win32.System.Threading.RTL_CONDITION_VARIABLE
2546-
Windows.Win32.System.Threading.RTL_RUN_ONCE
2547-
Windows.Win32.System.Threading.RTL_SRWLOCK
25482544
Windows.Win32.System.Threading.SetThreadStackGuarantee
25492545
Windows.Win32.System.Threading.Sleep
25502546
Windows.Win32.System.Threading.SleepConditionVariableSRW
@@ -2584,8 +2580,6 @@ Windows.Win32.System.Threading.WaitForMultipleObjects
25842580
Windows.Win32.System.Threading.WaitForSingleObject
25852581
Windows.Win32.System.Threading.WakeAllConditionVariable
25862582
Windows.Win32.System.Threading.WakeConditionVariable
2587-
Windows.Win32.System.WindowsProgramming.IO_STATUS_BLOCK
2588-
Windows.Win32.System.WindowsProgramming.OBJECT_ATTRIBUTES
25892583
Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE
25902584
Windows.Win32.UI.Shell.GetUserProfileDirectoryW
25912585
// tidy-alphabetical-end

0 commit comments

Comments
 (0)