Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to windows-sys 0.36 #1569

Merged
merged 2 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ log = "0.4.8"
libc = "0.2.121"

[target.'cfg(windows)'.dependencies.windows-sys]
version = ">=0.32, <=0.34"
version = "=0.36"
features = [
"Win32_Storage_FileSystem", # Enables NtCreateFile
"Win32_Foundation", # Basic types eg HANDLE
"Win32_Networking_WinSock", # winsock2 types/functions
"Win32_NetworkManagement_IpHelper", # AF_INET and AF_INET6 constants
"Win32_System_IO", # IO types like OVERLAPPED etc
"Win32_System_WindowsProgramming", # General future used for various types/funcs
]
Expand Down
9 changes: 2 additions & 7 deletions src/sys/windows/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ use std::net::SocketAddr;
use std::sync::Once;

use windows_sys::Win32::Networking::WinSock::{
ioctlsocket, socket, FIONBIO, IN6_ADDR, IN6_ADDR_0, INVALID_SOCKET, IN_ADDR, IN_ADDR_0,
SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKET,
ioctlsocket, socket, AF_INET, AF_INET6, FIONBIO, IN6_ADDR, IN6_ADDR_0, INVALID_SOCKET, IN_ADDR,
IN_ADDR_0, SOCKADDR, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR_IN6_0, SOCKET,
};
// We need to import a giant feature set for these 2 constants, they will hopefully
// be moved to `Win32::Networking::WinSock` in the future, since this needlessly
// increases compile times for all downstream users
// <https://github.com/microsoft/win32metadata/issues/845>
pub(crate) use windows_sys::Win32::NetworkManagement::IpHelper::{AF_INET, AF_INET6};

/// Initialise the network stack for Windows.
pub(crate) fn init() {
Expand Down
14 changes: 5 additions & 9 deletions src/sys/windows/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,15 +536,11 @@ cfg_io_source! {
use std::mem::size_of;
use std::ptr::null_mut;

use windows_sys::Win32::Networking::WinSock::{WSAGetLastError, SOCKET_ERROR, WSAIoctl, IOC_OUT, IOC_WS2};

// These constants were part of winapi but are not yet in windows-sys
//
// https://github.com/microsoft/win32metadata/issues/844
const SIO_BSP_HANDLE: u32 = IOC_OUT | IOC_WS2 | 27; // 1_207_959_579u32
const SIO_BSP_HANDLE_SELECT: u32 = IOC_OUT | IOC_WS2 | 28; // 1_207_959_580u32
const SIO_BSP_HANDLE_POLL: u32 = IOC_OUT | IOC_WS2 | 29; // 1_207_959_581u32
const SIO_BASE_HANDLE: u32 = IOC_OUT | IOC_WS2 | 34; // 1_207_959_586u32
use windows_sys::Win32::Networking::WinSock::{
WSAGetLastError, WSAIoctl, SIO_BASE_HANDLE, SIO_BSP_HANDLE,
SIO_BSP_HANDLE_POLL, SIO_BSP_HANDLE_SELECT, SOCKET_ERROR,
};


impl SelectorInner {
fn register(
Expand Down
6 changes: 4 additions & 2 deletions src/sys/windows/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ use std::io;
use std::net::{self, SocketAddr};
use std::os::windows::io::AsRawSocket;

use windows_sys::Win32::Networking::WinSock::{self, SOCKET, SOCKET_ERROR, SOCK_STREAM};
use windows_sys::Win32::Networking::WinSock::{
self, AF_INET, AF_INET6, SOCKET, SOCKET_ERROR, SOCK_STREAM,
};

use crate::sys::windows::net::{init, new_socket, socket_addr, AF_INET, AF_INET6};
use crate::sys::windows::net::{init, new_socket, socket_addr};

pub(crate) fn new_for_addr(address: SocketAddr) -> io::Result<SOCKET> {
init();
Expand Down