diff --git a/Cargo.lock b/Cargo.lock index 2c7de713..94dac377 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2126,7 +2126,7 @@ dependencies = [ "tokio", "tokio-util", "tun", - "windows 0.57.0", + "windows 0.58.0", "x25519-dalek", ] @@ -3675,7 +3675,17 @@ version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" dependencies = [ - "windows-core", + "windows-core 0.57.0", + "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", ] @@ -3685,9 +3695,22 @@ version = "0.57.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" dependencies = [ - "windows-implement", - "windows-interface", - "windows-result", + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result 0.1.2", + "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", "windows-targets 0.52.6", ] @@ -3702,6 +3725,17 @@ dependencies = [ "syn 2.0.92", ] +[[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 2.0.92", +] + [[package]] name = "windows-interface" version = "0.57.0" @@ -3713,6 +3747,17 @@ dependencies = [ "syn 2.0.92", ] +[[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 2.0.92", +] + [[package]] name = "windows-redirector" version = "0.12.0-dev" @@ -3739,6 +3784,25 @@ 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-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-sys" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index 0452c351..3fd2bb7a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -76,7 +76,7 @@ smoltcp = { git = 'https://github.com/smoltcp-rs/smoltcp', rev = 'ef67e7b46cabf4 boringtun = { git = 'https://github.com/cloudflare/boringtun', rev = 'e3252d9c4f4c8fc628995330f45369effd4660a1' } [target.'cfg(windows)'.dependencies.windows] -version = "0.57.0" +version = "0.58.0" features = [ "Win32_Foundation", "Win32_Graphics_Dwm", diff --git a/src/packet_sources/windows.rs b/src/packet_sources/windows.rs index 8d98a8ac..30a7075c 100755 --- a/src/packet_sources/windows.rs +++ b/src/packet_sources/windows.rs @@ -79,15 +79,15 @@ impl PacketSourceConf for WindowsConf { }; if cfg!(debug_assertions) { - if result.0 <= 32 { + if result.0 as u32 <= 32 { let err = windows::core::Error::from_win32(); log::warn!("Failed to start child process: {}", err); } - } else if result.0 == SE_ERR_ACCESSDENIED as isize { + } else if result.0 as u32 == SE_ERR_ACCESSDENIED { return Err(anyhow!( "Failed to start the interception process as administrator." )); - } else if result.0 <= 32 { + } else if result.0 as u32 <= 32 { let err = windows::core::Error::from_win32(); return Err(anyhow!("Failed to start the executable: {}", err)); } diff --git a/src/processes/windows_icons.rs b/src/processes/windows_icons.rs index 7f39723c..2da9309d 100644 --- a/src/processes/windows_icons.rs +++ b/src/processes/windows_icons.rs @@ -134,8 +134,8 @@ unsafe fn icon_to_pixels(icon: HICON) -> PixelData { let buf_size = width_usize.checked_mul(height_usize).unwrap(); let mut buf: Vec = Vec::with_capacity(buf_size); - let dc = GetDC(HWND(0)); - assert!(dc != HDC(0)); + let dc = GetDC(HWND(std::ptr::null_mut())); + assert!(dc != HDC(std::ptr::null_mut())); let mut bitmap_info = BITMAPINFOHEADER { biSize: biheader_size_u32, @@ -162,7 +162,7 @@ unsafe fn icon_to_pixels(icon: HICON) -> PixelData { assert!(result == bitmap.bmHeight); buf.set_len(buf.capacity()); - let result = ReleaseDC(HWND(0), dc); + let result = ReleaseDC(HWND(std::ptr::null_mut()), dc); assert!(result == 1); DeleteObject(info.hbmColor).unwrap();