build(deps): update windows crate to 0.61.1 (#743)

This commit is contained in:
Vladyslav Nikonov 2025-04-09 11:54:48 +03:00 committed by GitHub
parent a8b9614323
commit 135b8bc4f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 15 additions and 79 deletions

View file

@ -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

View file

@ -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",

View file

@ -152,7 +152,7 @@ impl WinClipboard {
CW_USEDEFAULT,
None,
None,
instance,
Some(instance.into()),
None,
)?
};

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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<Self, WinCliprdrError> {
// 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`

View file

@ -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