Skip to content

Commit

Permalink
build: upgrade windows-sys 0.52 → 0.59
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Jan 22, 2025
1 parent 30f46a8 commit 0318df0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mach = "0.3"
libc = "0.2"

[target.'cfg(target_os = "windows")'.dependencies.windows-sys]
version = "0.52"
version = "0.59"
features = [
"Win32_Foundation",
"Win32_System_LibraryLoader",
Expand Down
11 changes: 8 additions & 3 deletions src/rt_win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ pub fn demote_current_thread_from_real_time_internal(

mod avrt_lib {
use super::win32_utils::{win32_error_if, OwnedLibrary};
use std::sync::Once;
use std::{ptr::null_mut, sync::Once};
use windows_sys::{
core::PCWSTR,
s, w,
Expand Down Expand Up @@ -137,7 +137,7 @@ mod avrt_lib {
let task_handle = unsafe {
(self.av_set_mm_thread_characteristics_w)(task_name, &mut mmcss_task_index)
};
win32_error_if(task_handle == 0)?;
win32_error_if(task_handle == null_mut())?;
Ok((mmcss_task_index, task_handle))
}

Expand All @@ -152,6 +152,8 @@ mod avrt_lib {
}

mod win32_utils {
use std::ptr::null_mut;

use windows_sys::{
core::{PCSTR, PCWSTR},
Win32::{
Expand All @@ -174,7 +176,7 @@ mod win32_utils {
impl OwnedLibrary {
pub(super) fn try_new(lib_file_name: PCWSTR) -> Result<Self, WIN32_ERROR> {
let module = unsafe { LoadLibraryW(lib_file_name) };
win32_error_if(module == 0)?;
win32_error_if(module == null_mut())?;
Ok(Self(module))
}

Expand All @@ -201,6 +203,9 @@ mod win32_utils {
}
}
}

unsafe impl Send for OwnedLibrary {}
unsafe impl Sync for OwnedLibrary {}
}

#[cfg(test)]
Expand Down

0 comments on commit 0318df0

Please sign in to comment.