Skip to content
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
93 changes: 10 additions & 83 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ tokio = { version = "1.36.0", features = [
futures-core = { version = "0.3.28", optional = true }

[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.52.0", features = [
windows-sys = { version = "0.61.2", features = [
"Win32_Foundation",
"Win32_Security",
"Win32_Security_Authorization",
Expand Down
4 changes: 2 additions & 2 deletions src/os/windows/adv_handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl<const TAG0: bool, const TAG1: bool> AdvOwnedHandle<TAG0, TAG1> {
fn new(h: OwnedHandle, tag0: bool, tag1: bool) -> Self {
// SAFETY: valid handles (as guaranteed by OwnedHandle) are never zero
Self(unsafe {
NonZeroIsize::new_unchecked(h.into_int_handle() | Self::mk_tag(tag0, tag1))
NonZeroIsize::new_unchecked((h.into_int_handle() as isize) | Self::mk_tag(tag0, tag1))
})
}
#[inline(always)]
Expand Down Expand Up @@ -116,7 +116,7 @@ impl<const TAG0: bool, const TAG1: bool> AsHandle for AdvOwnedHandle<TAG0, TAG1>
impl From<OwnedHandle> for AdvOwnedHandle<false, false> {
#[inline(always)]
fn from(h: OwnedHandle) -> Self {
Self(unsafe { NonZeroIsize::new_unchecked(h.into_int_handle()) })
Self(unsafe { NonZeroIsize::new_unchecked(h.into_int_handle() as isize) })
}
}
impl FromRawHandle for AdvOwnedHandle<false, false> {
Expand Down
31 changes: 17 additions & 14 deletions src/os/windows/c_wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,24 @@ use {
super::{downgrade_eof, winprelude::*},
crate::{mut2ptr, timeout_expiry, AsBuf, CannotUnwind, OrErrno as _, SubUsizeExt as _},
std::{
io, ptr,
ffi::c_void, io, ptr,
time::{Duration, Instant},
},
windows_sys::Win32::{
Foundation::{
DuplicateHandle, GetLastError, BOOL, DUPLICATE_SAME_ACCESS, ERROR_IO_PENDING,
ERROR_NOT_FOUND, MAX_PATH, WAIT_IO_COMPLETION,
},
Storage::FileSystem::{
FlushFileBuffers, GetFinalPathNameByHandleW, ReadFile, ReadFileEx, WriteFile,
WriteFileEx,
},
System::{
Threading::{GetCurrentProcess, SleepEx},
IO::{CancelIoEx, OVERLAPPED},
windows_sys::{
core::BOOL,
Win32::{
Foundation::{
DuplicateHandle, GetLastError, DUPLICATE_SAME_ACCESS, ERROR_IO_PENDING,
ERROR_NOT_FOUND, MAX_PATH, WAIT_IO_COMPLETION,
},
Storage::FileSystem::{
FlushFileBuffers, GetFinalPathNameByHandleW, ReadFile, ReadFileEx, WriteFile,
WriteFileEx,
},
System::{
Threading::{GetCurrentProcess, SleepEx},
IO::{CancelIoEx, OVERLAPPED},
},
},
},
};
Expand All @@ -30,7 +33,7 @@ struct CompletionResult {
}
impl CompletionResult {
pub fn write_to_overlapped(&mut self, overlapped: &mut OVERLAPPED) {
overlapped.hEvent = self as *mut _ as isize
overlapped.hEvent = self as *mut _ as *mut c_void
}
#[allow(clippy::cast_sign_loss)] // not a number
pub unsafe fn from_overlapped<'s>(overlapped: *mut OVERLAPPED) -> &'s mut Self {
Expand Down
2 changes: 1 addition & 1 deletion src/os/windows/named_pipe/c_wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub(crate) fn connect_without_waiting(
ptr::null_mut(),
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
0,
ptr::null_mut(),
)
.handle_or_errno()
.map(|h|
Expand Down
19 changes: 11 additions & 8 deletions src/os/windows/security_descriptor/c_wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ use {
crate::{BoolExt, OrErrno, SubUsizeExt},
std::{ffi::c_void, io, ptr},
widestring::U16CStr,
windows_sys::Win32::{
Foundation::{LocalFree, BOOL, PSID},
Security::{
Authorization::{
ConvertSecurityDescriptorToStringSecurityDescriptorW,
ConvertStringSecurityDescriptorToSecurityDescriptorW, SDDL_REVISION_1,
windows_sys::{
core::BOOL,
Win32::{
Foundation::LocalFree,
Security::{
Authorization::{
ConvertSecurityDescriptorToStringSecurityDescriptorW,
ConvertStringSecurityDescriptorToSecurityDescriptorW, SDDL_REVISION_1,
},
FreeSid, GetSecurityDescriptorControl, SetSecurityDescriptorControl, ACL,
SECURITY_DESCRIPTOR_CONTROL, PSID,
},
FreeSid, GetSecurityDescriptorControl, SetSecurityDescriptorControl, ACL,
SECURITY_DESCRIPTOR_CONTROL,
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ fn get_self_exe(obuf: &mut [MaybeUninit<u16>]) -> io::Result<&U16CStr> {
}
let base = obuf.as_mut_ptr().cast();
let cap = obuf.len().try_into().unwrap_or(u32::MAX);
unsafe { GetModuleFileNameW(0, base, cap) != 0 }.true_val_or_errno(()).and_then(|()| unsafe {
unsafe { GetModuleFileNameW(std::ptr::null_mut(), base, cap) != 0 }.true_val_or_errno(()).and_then(|()| unsafe {
U16CStr::from_ptr_truncate(base.cast_const(), cap.to_usize()).map_err(io::Error::other)
})
}
Expand Down