From 5e08ccd09f5e86b724547cd78157757105807250 Mon Sep 17 00:00:00 2001 From: git-g00d <116173551+git-g00d@users.noreply.github.com> Date: Mon, 16 Sep 2024 18:30:10 -0400 Subject: [PATCH] chore(win): bumped windows-sys to v0.59.0 (#142) * bumped windows-sys version to 0.59.0, windows.rs needed changed due to LocalFree method call being moved to windows_sysWin32::foUNDATION, and pointer passed to LocalFree requires *mut c_void now (not sure if the fix I did is correct, but it compiles and the example works) * ran cargo fmt --------- Co-authored-by: mid --- Cargo.toml | 2 +- src/windows.rs | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index efe8d04..8e64daa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ libc = "0.2" neli = "0.6" [target.'cfg(windows)'.dependencies.windows-sys] -version = "0.48.0" +version = "0.59.0" features = [ "Win32_Foundation", "Win32_Networking_WinSock", diff --git a/src/windows.rs b/src/windows.rs index 59bbc7c..2a3c9ee 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -10,7 +10,7 @@ use std::{ use windows_sys::Win32::{ Foundation::{ - GetLastError, BOOL, ERROR_ADDRESS_NOT_ASSOCIATED, ERROR_BUFFER_OVERFLOW, + GetLastError, LocalFree, BOOL, ERROR_ADDRESS_NOT_ASSOCIATED, ERROR_BUFFER_OVERFLOW, ERROR_INSUFFICIENT_BUFFER, ERROR_INVALID_PARAMETER, ERROR_NOT_ENOUGH_MEMORY, ERROR_NOT_SUPPORTED, ERROR_NO_DATA, ERROR_SUCCESS, WIN32_ERROR, }, @@ -21,11 +21,8 @@ use windows_sys::Win32::{ Networking::WinSock::{ ADDRESS_FAMILY, AF_INET, AF_INET6, AF_UNSPEC, SOCKADDR_IN, SOCKADDR_IN6, SOCKADDR, }, - System::{ - Diagnostics::Debug::{ - FormatMessageW, FORMAT_MESSAGE_ALLOCATE_BUFFER, FORMAT_MESSAGE_FROM_SYSTEM, - }, - Memory::LocalFree, + System::Diagnostics::Debug::{ + FormatMessageW, FORMAT_MESSAGE_ALLOCATE_BUFFER, FORMAT_MESSAGE_FROM_SYSTEM, }, }; @@ -260,7 +257,7 @@ fn format_error_code(error_code: WIN32_ERROR) -> String { let error_message = String::from_utf16_lossy(slice); unsafe { - LocalFree(wide_ptr as isize); + LocalFree(&mut wide_ptr as *mut _ as *mut _); } error_message