Skip to content

Commit

Permalink
Update windows dependency (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils authored Jan 2, 2025
1 parent 5ae11e5 commit 045f463
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 12 deletions.
74 changes: 69 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/packet_sources/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
6 changes: 3 additions & 3 deletions src/processes/windows_icons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32> = 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,
Expand All @@ -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();

Expand Down

0 comments on commit 045f463

Please sign in to comment.