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

windows-sys 0.52 #1727

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 8 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,17 @@ log = { version = "0.4.8", optional = true }
libc = "0.2.149"

[target.'cfg(windows)'.dependencies.windows-sys]
version = "0.48"
version = "0.52"
features = [
"Win32_Foundation", # Basic types eg HANDLE
"Win32_Networking_WinSock", # winsock2 types/functions
"Win32_Storage_FileSystem", # Enables NtCreateFile

# NtCreateFile and associated
"Win32_Storage_FileSystem",
"Wdk_Foundation",
"Wdk_System_IO",
"Wdk_Storage_FileSystem",

"Win32_System_IO", # IO types like OVERLAPPED etc
"Win32_System_WindowsProgramming", # General future used for various types/funcs
]
Expand Down
19 changes: 12 additions & 7 deletions src/sys/windows/afd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ use std::os::windows::io::AsRawHandle;
use windows_sys::Win32::Foundation::{
RtlNtStatusToDosError, HANDLE, NTSTATUS, STATUS_NOT_FOUND, STATUS_PENDING, STATUS_SUCCESS,
};
use windows_sys::Win32::System::WindowsProgramming::{
NtDeviceIoControlFile, IO_STATUS_BLOCK, IO_STATUS_BLOCK_0,
use windows_sys::{
Wdk::System::IO::NtDeviceIoControlFile,
Win32::System::IO::{IO_STATUS_BLOCK, IO_STATUS_BLOCK_0},
};

const IOCTL_AFD_POLL: u32 = 0x00012024;
Expand Down Expand Up @@ -133,12 +134,16 @@ cfg_io_source! {
use std::sync::atomic::{AtomicUsize, Ordering};

use super::iocp::CompletionPort;
use windows_sys::Win32::{
Foundation::{UNICODE_STRING, INVALID_HANDLE_VALUE},
System::WindowsProgramming::{
OBJECT_ATTRIBUTES, FILE_SKIP_SET_EVENT_ON_HANDLE,
use windows_sys::{
Win32::{
Foundation::{UNICODE_STRING, INVALID_HANDLE_VALUE},
System::WindowsProgramming::FILE_SKIP_SET_EVENT_ON_HANDLE,
Storage::FileSystem::{SetFileCompletionNotificationModes, SYNCHRONIZE, FILE_SHARE_READ, FILE_SHARE_WRITE},
},
Wdk::{
Foundation::OBJECT_ATTRIBUTES,
Storage::FileSystem::{FILE_OPEN, NtCreateFile},
},
Storage::FileSystem::{FILE_OPEN, NtCreateFile, SetFileCompletionNotificationModes, SYNCHRONIZE, FILE_SHARE_READ, FILE_SHARE_WRITE},
};

const AFD_HELPER_ATTRIBUTES: OBJECT_ATTRIBUTES = OBJECT_ATTRIBUTES {
Expand Down
4 changes: 2 additions & 2 deletions src/sys/windows/io_status_block.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fmt;
use std::ops::{Deref, DerefMut};

use windows_sys::Win32::System::WindowsProgramming::IO_STATUS_BLOCK;
use windows_sys::Win32::System::IO::IO_STATUS_BLOCK;

pub struct IoStatusBlock(IO_STATUS_BLOCK);

cfg_io_source! {
use windows_sys::Win32::System::WindowsProgramming::{IO_STATUS_BLOCK_0};
use windows_sys::Win32::System::IO::IO_STATUS_BLOCK_0;

impl IoStatusBlock {
pub fn zeroed() -> Self {
Expand Down
2 changes: 1 addition & 1 deletion src/sys/windows/iocp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl CompletionStatus {
/// A completion key is a per-handle key that is specified when it is added
/// to an I/O completion port via `add_handle` or `add_socket`.
pub fn token(&self) -> usize {
self.0.lpCompletionKey as usize
self.0.lpCompletionKey
}

/// Returns a pointer to the `Overlapped` structure that was specified when
Expand Down
4 changes: 2 additions & 2 deletions src/sys/windows/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, i32) {
};

let sockaddr_in = SOCKADDR_IN {
sin_family: AF_INET as u16, // 1
sin_family: AF_INET, // 1
sin_port: addr.port().to_be(),
sin_addr,
sin_zero: [0; 8],
Expand All @@ -97,7 +97,7 @@ pub(crate) fn socket_addr(addr: &SocketAddr) -> (SocketAddrCRepr, i32) {
};

let sockaddr_in6 = SOCKADDR_IN6 {
sin6_family: AF_INET6 as u16, // 23
sin6_family: AF_INET6, // 23
sin6_port: addr.port().to_be(),
sin6_addr,
sin6_flowinfo: addr.flowinfo(),
Expand Down
4 changes: 2 additions & 2 deletions src/sys/windows/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ pub(crate) fn only_v6(socket: &net::UdpSocket) -> io::Result<bool> {
syscall!(
getsockopt(
socket.as_raw_socket() as usize,
IPPROTO_IPV6 as i32,
IPV6_V6ONLY as i32,
IPPROTO_IPV6,
IPV6_V6ONLY,
optval.as_mut_ptr().cast(),
&mut optlen,
),
Expand Down
4 changes: 2 additions & 2 deletions tests/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ pub fn set_linger_zero(socket: &TcpStream) {
let res = unsafe {
setsockopt(
socket.as_raw_socket() as _,
SOL_SOCKET as i32,
SO_LINGER as i32,
SOL_SOCKET,
SO_LINGER,
&mut val as *mut _ as *mut _,
size_of::<LINGER>() as _,
)
Expand Down