Skip to content

Commit

Permalink
Rollup merge of #127320 - ChrisDenton:win-sys, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Update windows-bindgen to 0.58.0

This also switches from the bespoke `std` generated bindings to the normal `sys` ones everyone else uses.

This has almost no difference except that the  `sys` bindings use the `windows_targets::links!` macro for FFI imports, which we implement manually. This does cause the diff to look much larger than it really is but the bulk of the changes are mostly contained to the generated code.
  • Loading branch information
GuillaumeGomez authored Jul 5, 2024
2 parents 7a208c7 + 14f4ed2 commit 80a9717
Show file tree
Hide file tree
Showing 8 changed files with 168 additions and 856 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6356,9 +6356,9 @@ dependencies = [

[[package]]
name = "windows-bindgen"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ccb96113d6277ba543c0f77e1c5494af8094bf9daf9b85acdc3f1b620e7c7b4"
checksum = "91cd28d93c692351f3a6e5615567c56756e330bee1c99c6bdd57bfc5ab15f589"
dependencies = [
"proc-macro2",
"rayon",
Expand All @@ -6379,9 +6379,9 @@ dependencies = [

[[package]]
name = "windows-metadata"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8308d076825b9d9e5abc64f8113e96d02b2aeeba869b20fdd65c7e70cda13dfc"
checksum = "2e837f3c3012cfe9e7086302a93f441a7999439be1ad4c530d55d2f6d2921809"

[[package]]
name = "windows-sys"
Expand Down
9 changes: 4 additions & 5 deletions library/std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_vo
use crate::os::windows::io::{AsRawHandle, BorrowedHandle};
use crate::ptr;

mod windows_targets;

mod windows_sys;
pub use windows_sys::*;

Expand Down Expand Up @@ -504,11 +506,8 @@ if #[cfg(not(target_vendor = "uwp"))] {
#[cfg(target_arch = "arm")]
pub enum CONTEXT {}
}}

#[link(name = "ws2_32")]
extern "system" {
pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32;
}
// WSAStartup is only redefined here so that we can override WSADATA for Arm32
windows_targets::link!("ws2_32.dll" "system" fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32);
#[cfg(target_arch = "arm")]
#[repr(C)]
pub struct WSADATA {
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/windows/c/bindings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--out windows_sys.rs
--config flatten std
--config flatten sys
--filter
!Windows.Win32.Foundation.INVALID_HANDLE_VALUE
Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED
Expand Down
Loading

0 comments on commit 80a9717

Please sign in to comment.