From 135b8bc4f6e62a2b41ecc63c6804a01cc7d67b69 Mon Sep 17 00:00:00 2001 From: Vladyslav Nikonov Date: Wed, 9 Apr 2025 11:54:48 +0300 Subject: [PATCH] build(deps): update `windows` crate to 0.61.1 (#743) --- Cargo.lock | 72 ++----------------- crates/ironrdp-client/Cargo.toml | 2 +- crates/ironrdp-cliprdr-native/Cargo.toml | 2 +- crates/ironrdp-cliprdr-native/src/windows.rs | 2 +- .../src/windows/clipboard_impl.rs | 4 +- .../src/windows/cliprdr_backend.rs | 2 +- .../src/windows/os_clipboard.rs | 6 +- .../src/windows/utils.rs | 4 +- 8 files changed, 15 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 09bd1998..9cfff1a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2441,7 +2441,7 @@ dependencies = [ "tracing-subscriber", "uuid", "whoami", - "windows 0.58.0", + "windows 0.61.1", "winit", ] @@ -2474,7 +2474,7 @@ dependencies = [ "ironrdp-core", "thiserror", "tracing", - "windows 0.58.0", + "windows 0.61.1", ] [[package]] @@ -5898,16 +5898,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" -dependencies = [ - "windows-core 0.58.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows" version = "0.61.1" @@ -5949,27 +5939,14 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" -dependencies = [ - "windows-implement 0.58.0", - "windows-interface 0.58.0", - "windows-result 0.2.0", - "windows-strings 0.1.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows-core" version = "0.61.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" dependencies = [ - "windows-implement 0.60.0", - "windows-interface 0.59.1", + "windows-implement", + "windows-interface", "windows-link", "windows-result 0.3.2", "windows-strings 0.4.0", @@ -5985,17 +5962,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-implement" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "windows-implement" version = "0.60.0" @@ -6007,17 +5973,6 @@ dependencies = [ "syn", ] -[[package]] -name = "windows-interface" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "windows-interface" version = "0.59.1" @@ -6065,15 +6020,6 @@ dependencies = [ "windows-targets 0.52.6", ] -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-result" version = "0.3.2" @@ -6083,16 +6029,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "windows-strings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result 0.2.0", - "windows-targets 0.52.6", -] - [[package]] name = "windows-strings" version = "0.3.1" diff --git a/crates/ironrdp-client/Cargo.toml b/crates/ironrdp-client/Cargo.toml index a8c65b0e..3c808b00 100644 --- a/crates/ironrdp-client/Cargo.toml +++ b/crates/ironrdp-client/Cargo.toml @@ -78,7 +78,7 @@ raw-window-handle = "0.6" uuid = { version = "1.16" } [target.'cfg(windows)'.dependencies] -windows = { version = "0.58", features = ["Win32_Foundation"] } +windows = { version = "0.61", features = ["Win32_Foundation"] } [lints] workspace = true diff --git a/crates/ironrdp-cliprdr-native/Cargo.toml b/crates/ironrdp-cliprdr-native/Cargo.toml index c9e28f35..7d0ec69f 100644 --- a/crates/ironrdp-cliprdr-native/Cargo.toml +++ b/crates/ironrdp-cliprdr-native/Cargo.toml @@ -22,7 +22,7 @@ tracing = { version = "0.1", features = ["log"] } [target.'cfg(windows)'.dependencies] thiserror = "1" -windows = { version = "0.58", features = [ +windows = { version = "0.61", features = [ "Win32_Foundation", "Win32_Graphics_Gdi", "Win32_System_DataExchange", diff --git a/crates/ironrdp-cliprdr-native/src/windows.rs b/crates/ironrdp-cliprdr-native/src/windows.rs index 3166829d..09a3e536 100644 --- a/crates/ironrdp-cliprdr-native/src/windows.rs +++ b/crates/ironrdp-cliprdr-native/src/windows.rs @@ -152,7 +152,7 @@ impl WinClipboard { CW_USEDEFAULT, None, None, - instance, + Some(instance.into()), None, )? }; diff --git a/crates/ironrdp-cliprdr-native/src/windows/clipboard_impl.rs b/crates/ironrdp-cliprdr-native/src/windows/clipboard_impl.rs index 82903d55..cd651da7 100644 --- a/crates/ironrdp-cliprdr-native/src/windows/clipboard_impl.rs +++ b/crates/ironrdp-cliprdr-native/src/windows/clipboard_impl.rs @@ -271,7 +271,7 @@ impl WinClipboardImpl { // SAFETY: `SetTimer` is always safe to call when `hwnd` is a valid window handle unsafe { SetTimer( - self.window, + Some(self.window), IDT_CLIPBOARD_RETRY, self.attempt * PROCESSING_TIMEOUT_MS, None, @@ -370,7 +370,7 @@ pub(crate) unsafe extern "system" fn clipboard_subproc( // Timer is one-shot, we need to stop it immediately // SAFETY: `KillTimer` is always safe to call when `hwnd` is a valid window handle. - if let Err(err) = unsafe { KillTimer(hwnd, IDT_CLIPBOARD_RETRY) } { + if let Err(err) = unsafe { KillTimer(Some(hwnd), IDT_CLIPBOARD_RETRY) } { tracing::error!("Failed to kill timer: {}", err); } diff --git a/crates/ironrdp-cliprdr-native/src/windows/cliprdr_backend.rs b/crates/ironrdp-cliprdr-native/src/windows/cliprdr_backend.rs index 0192ab3e..f7da46bc 100644 --- a/crates/ironrdp-cliprdr-native/src/windows/cliprdr_backend.rs +++ b/crates/ironrdp-cliprdr-native/src/windows/cliprdr_backend.rs @@ -38,7 +38,7 @@ impl WinCliprdrBackend { // Wake up subproc event loop; Dont wait for result // // SAFETY: it is safe to call PostMessageW from any thread with a valid window handle - if let Err(err) = unsafe { PostMessageW(self.window, WM_CLIPRDR_BACKEND_EVENT, WPARAM(0), LPARAM(0)) } { + if let Err(err) = unsafe { PostMessageW(Some(self.window), WM_CLIPRDR_BACKEND_EVENT, WPARAM(0), LPARAM(0)) } { tracing::error!("Failed to post message to wake up subproc event loop: {}", err); } } diff --git a/crates/ironrdp-cliprdr-native/src/windows/os_clipboard.rs b/crates/ironrdp-cliprdr-native/src/windows/os_clipboard.rs index e75a6fb0..54ccaa14 100644 --- a/crates/ironrdp-cliprdr-native/src/windows/os_clipboard.rs +++ b/crates/ironrdp-cliprdr-native/src/windows/os_clipboard.rs @@ -1,6 +1,6 @@ use ironrdp_cliprdr::pdu::{ClipboardFormat, ClipboardFormatId, ClipboardFormatName}; use tracing::error; -use windows::Win32::Foundation::{HANDLE, HWND}; +use windows::Win32::Foundation::HWND; use windows::Win32::System::DataExchange::{ CloseClipboard, EmptyClipboard, EnumClipboardFormats, GetClipboardFormatNameW, OpenClipboard, SetClipboardData, }; @@ -14,7 +14,7 @@ pub(crate) struct OwnedOsClipboard; impl OwnedOsClipboard { pub(crate) fn new(window: HWND) -> Result { // SAFETY: `window` is valid handle, therefore it is safe to call `OpenClipboard`. - unsafe { OpenClipboard(window)? }; + unsafe { OpenClipboard(Some(window))? }; Ok(Self) } @@ -87,7 +87,7 @@ impl OwnedOsClipboard { pub(crate) fn delay_render(&mut self, format: ClipboardFormatId) -> Result<(), WinCliprdrError> { // SAFETY: We own the clipboard at moment of method invocation, therefore it is safe to // call `SetClipboardData`. - let result = unsafe { SetClipboardData(format.value(), HANDLE(core::ptr::null_mut())) }; + let result = unsafe { SetClipboardData(format.value(), None) }; if let Err(err) = result { // `windows` crate will return `Err(..)` on err zero handle, but for `SetClipboardData` diff --git a/crates/ironrdp-cliprdr-native/src/windows/utils.rs b/crates/ironrdp-cliprdr-native/src/windows/utils.rs index 45255613..b890ef98 100644 --- a/crates/ironrdp-cliprdr-native/src/windows/utils.rs +++ b/crates/ironrdp-cliprdr-native/src/windows/utils.rs @@ -44,7 +44,7 @@ impl GlobalMemoryBuffer { impl Drop for GlobalMemoryBuffer { fn drop(&mut self) { // SAFETY: It is safe to call GlobalFree on a valid handle - if let Err(err) = unsafe { GlobalFree(self.0) } { + if let Err(err) = unsafe { GlobalFree(Some(self.0)) } { error!("Failed to free global clipboard data handle: {}", err); } } @@ -63,7 +63,7 @@ pub(crate) unsafe fn render_format(format: ClipboardFormatId, data: &[u8]) -> Wi // SAFETY: If described above safety requirements of `render_format` call are met, then // `SetClipboardData` is safe to call. - let _ = unsafe { SetClipboardData(format.value(), handle) }; + let _ = unsafe { SetClipboardData(format.value(), Some(handle)) }; // We successfully transferred ownership of the data to the clipboard, we don't need to // call drop on handle