From 88d1c8266b39140d70d5b614b6dd322c483f5dd1 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Mon, 5 Aug 2024 23:21:03 -0500 Subject: [PATCH 1/3] Update windows-sys. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 234389e55..e8c407d9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ libc = "0.2.149" libc = { package = "hermit-abi", version = "0.3.9" } [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.52" +version = "0.59" features = [ "Wdk_Foundation", # Required for AFD. "Wdk_Storage_FileSystem", # Required for AFD. From 7d6e2eda4d13a8ae9cfcafee46994208eb7c0b97 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Tue, 6 Aug 2024 07:13:56 -0500 Subject: [PATCH 2/3] fix mismatched types. --- src/sys/windows/afd.rs | 4 ++-- src/sys/windows/iocp.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/sys/windows/afd.rs b/src/sys/windows/afd.rs index 11373cfca..741259050 100644 --- a/src/sys/windows/afd.rs +++ b/src/sys/windows/afd.rs @@ -66,7 +66,7 @@ impl Afd { (*iosb).Anonymous.Status = STATUS_PENDING; let status = NtDeviceIoControlFile( self.fd.as_raw_handle() as HANDLE, - 0, + null_mut(), None, overlapped, iosb, @@ -131,7 +131,7 @@ cfg_io_source! { const AFD_HELPER_ATTRIBUTES: OBJECT_ATTRIBUTES = OBJECT_ATTRIBUTES { Length: size_of::() as u32, - RootDirectory: 0, + RootDirectory: null_mut(), ObjectName: &AFD_OBJ_NAME as *const _ as *mut _, Attributes: 0, SecurityDescriptor: null_mut(), diff --git a/src/sys/windows/iocp.rs b/src/sys/windows/iocp.rs index 0590bb43f..b97031cd7 100644 --- a/src/sys/windows/iocp.rs +++ b/src/sys/windows/iocp.rs @@ -45,8 +45,8 @@ impl CompletionPort { /// allowed for threads associated with this port. Consult the Windows /// documentation for more information about this value. pub fn new(threads: u32) -> io::Result { - let ret = unsafe { CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, threads) }; - if ret == 0 { + let ret = unsafe { CreateIoCompletionPort(INVALID_HANDLE_VALUE, null_mut(), 0, threads) }; + if ret == null_mut() { Err(io::Error::last_os_error()) } else { Ok(CompletionPort { @@ -69,7 +69,7 @@ impl CompletionPort { let ret = unsafe { CreateIoCompletionPort(t.as_raw_handle() as HANDLE, self.handle.raw(), token, 0) }; - if ret == 0 { + if ret == null_mut() { Err(io::Error::last_os_error()) } else { Ok(()) From d53aa8451b7d7eceff4a48fe3f857fa7122895f0 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Thu, 15 Aug 2024 20:49:22 -0500 Subject: [PATCH 3/3] Fix imports. --- src/sys/windows/afd.rs | 2 +- src/sys/windows/iocp.rs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sys/windows/afd.rs b/src/sys/windows/afd.rs index 741259050..bd9293546 100644 --- a/src/sys/windows/afd.rs +++ b/src/sys/windows/afd.rs @@ -66,7 +66,7 @@ impl Afd { (*iosb).Anonymous.Status = STATUS_PENDING; let status = NtDeviceIoControlFile( self.fd.as_raw_handle() as HANDLE, - null_mut(), + std::ptr::null_mut(), None, overlapped, iosb, diff --git a/src/sys/windows/iocp.rs b/src/sys/windows/iocp.rs index b97031cd7..eb2f9784c 100644 --- a/src/sys/windows/iocp.rs +++ b/src/sys/windows/iocp.rs @@ -6,6 +6,7 @@ use std::fmt; use std::io; use std::mem; use std::os::windows::io::*; +use std::ptr::null_mut; use std::time::Duration; use windows_sys::Win32::Foundation::{HANDLE, INVALID_HANDLE_VALUE}; @@ -191,7 +192,7 @@ impl CompletionStatus { /// This function is useful when creating a stack buffer or vector of /// completion statuses to be passed to the `get_many` function. pub fn zero() -> Self { - Self::new(0, 0, std::ptr::null_mut()) + Self::new(0, 0, null_mut()) } /// Returns the number of bytes that were transferred for the I/O operation