diff --git a/Cargo.toml b/Cargo.toml index 13e047c..66bc36a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", diff --git a/src/rt_win.rs b/src/rt_win.rs index 480c5bd..80892fa 100644 --- a/src/rt_win.rs +++ b/src/rt_win.rs @@ -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, @@ -135,7 +135,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)) } @@ -150,6 +150,8 @@ mod avrt_lib { } mod win32_utils { + use std::ptr::null_mut; + use windows_sys::{ core::{PCSTR, PCWSTR}, Win32::{ @@ -172,7 +174,7 @@ mod win32_utils { impl OwnedLibrary { pub(super) fn try_new(lib_file_name: PCWSTR) -> Result { let module = unsafe { LoadLibraryW(lib_file_name) }; - win32_error_if(module == 0)?; + win32_error_if(module == null_mut())?; Ok(Self(module)) } @@ -199,6 +201,9 @@ mod win32_utils { } } } + + unsafe impl Send for OwnedLibrary {} + unsafe impl Sync for OwnedLibrary {} } #[cfg(test)]