From d97b81f6efd77897654a6e2cb5191fbc8a844be1 Mon Sep 17 00:00:00 2001 From: Manu Bretelle Date: Tue, 1 Oct 2024 15:35:40 -0700 Subject: [PATCH 1/3] Bump windows-sys to 0.59.0 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d59aadbe..f857f312 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ futures = { version = "0.3", optional = true } gat-std = { version = "0.1.1", optional = true } [target.'cfg(target_os = "windows")'.dependencies] -windows-sys = { version = "0.36.1", features = ["Win32_Foundation", "Win32_Networking_WinSock"] } +windows-sys = { version = "0.59.0", features = ["Win32_Foundation", "Win32_Networking_WinSock"] } [dev-dependencies] etherparse = "0.13.0" From 6279422321e8f7c0fa31ad236ab85616d7d8e237 Mon Sep 17 00:00:00 2001 From: chantra Date: Sun, 27 Oct 2024 17:46:56 -0700 Subject: [PATCH 2/3] WinSock::ADRESS_FAMILY is now u16. Since windows-sys-0.45.0, `windows_sys::Win32::Networking::WinSock::ADDRESS_FAMILY` are u16 instead of u32. --- src/device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device.rs b/src/device.rs index 561b11fd..3e716604 100644 --- a/src/device.rs +++ b/src/device.rs @@ -266,7 +266,7 @@ impl Address { return None; } - match (*ptr).sa_family as u32 { + match (*ptr).sa_family as u16 { WinSock::AF_INET => { let ptr: *const WinSock::SOCKADDR_IN = std::mem::transmute(ptr); let addr: [u8; 4] = ((*ptr).sin_addr.S_un.S_addr).to_ne_bytes(); From f9178747ce82ad1384e7248a651c231c3a18d93e Mon Sep 17 00:00:00 2001 From: chantra Date: Sun, 1 Dec 2024 17:38:54 -0800 Subject: [PATCH 3/3] fix capture test windows_sys::Win32::Foundation::HANDLE type has changed since https://github.com/microsoft/windows-rs/commit/d331301dacd2f1cb4d79d31a10a8f07cff951df9 update the tests accordingly. --- src/capture/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/capture/mod.rs b/src/capture/mod.rs index 1e67a4a3..50d132a9 100644 --- a/src/capture/mod.rs +++ b/src/capture/mod.rs @@ -222,6 +222,8 @@ pub mod testmod { #[cfg(test)] mod tests { + use core::ffi::c_void; + use crate::{ capture::testmod::test_capture, raw::testmod::{as_pcap_t, RAWMTX}, @@ -276,10 +278,10 @@ mod tests { let ctx = raw::pcap_getevent_context(); ctx.expect() .withf_st(move |arg1| *arg1 == pcap) - .return_once(|_| 5); + .return_once(|_| 5 as *mut c_void); let handle = unsafe { capture.get_event() }; - assert_eq!(handle, 5); + assert_eq!(handle, 5 as *mut c_void); } #[test]