Skip to content

Commit

Permalink
bumped windows-sys version to 0.59.0, windows.rs needed changed due t…
Browse files Browse the repository at this point in the history
…o 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)
  • Loading branch information
mid committed Sep 13, 2024
1 parent a9fa903 commit e9101d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 3 additions & 6 deletions src/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Check warning on line 14 in src/windows.rs

View workflow job for this annotation

GitHub Actions / Builds on windows-latest with x86_64-pc-windows-msvc

unused import: `ERROR_INVALID_PARAMETER`

Check warning on line 14 in src/windows.rs

View workflow job for this annotation

GitHub Actions / Builds on windows-latest with x86_64-pc-windows-gnu

unused import: `ERROR_INVALID_PARAMETER`
ERROR_NOT_SUPPORTED, ERROR_NO_DATA, ERROR_SUCCESS, WIN32_ERROR,
},
Expand All @@ -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::{
System::Diagnostics::Debug::{
FormatMessageW, FORMAT_MESSAGE_ALLOCATE_BUFFER, FORMAT_MESSAGE_FROM_SYSTEM,
},
Memory::LocalFree,
},
};

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit e9101d6

Please sign in to comment.