chore(windows client): update windows and windows-implement deps (#3919)

Closes #3879 and #3902 

I re-created Cargo.lock, so it incidentally updated a bunch of other
stuff. I can revert that file if it's a problem.

Had to search a bit for the breaking changes. Found here that they
renamed `ComInterface`:
https://github.com/microsoft/windows-rs/issues/2875#issuecomment-1962332067

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
Reactor Scram
2024-03-05 09:38:19 -06:00
committed by GitHub
parent d5922eade0
commit 379f577291
7 changed files with 202 additions and 169 deletions

View File

@@ -35,6 +35,11 @@ updates:
- tracing-stackdriver
update-types:
- minor
windows:
patterns:
- windows
- windows-implement
- windows-sys
- package-ecosystem: gradle
directory: kotlin/android/
schedule:

341
rust/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -66,7 +66,7 @@ wintun = "0.4.0"
# Windows Win32 API
[target.'cfg(windows)'.dependencies.windows]
version = "0.52.0"
version = "0.54.0"
features = [
"Win32_Foundation",
]

View File

@@ -56,7 +56,7 @@ wintun = "0.4.0"
# Windows Win32 API
[target.'cfg(windows)'.dependencies.windows]
version = "0.52.0"
version = "0.54.0"
features = [
"Win32_Foundation",
"Win32_NetworkManagement_IpHelper",

View File

@@ -159,7 +159,7 @@ impl Tun {
let entry = self.forward_entry(route);
// SAFETY: Windows shouldn't store the reference anywhere, it's just a way to pass lots of arguments at once. And no other thread sees this variable.
match unsafe { CreateIpForwardEntry2(&entry) } {
match unsafe { CreateIpForwardEntry2(&entry) }.ok() {
Ok(()) => Ok(()),
Err(e) if e.code().0 as u32 == DUPLICATE_ERR => {
tracing::debug!(%route, "Failed to add duplicate route, ignoring");
@@ -174,9 +174,7 @@ impl Tun {
let entry = self.forward_entry(route);
// SAFETY: Windows shouldn't store the reference anywhere, it's just a way to pass lots of arguments at once. And no other thread sees this variable.
unsafe {
DeleteIpForwardEntry2(&entry)?;
}
unsafe { DeleteIpForwardEntry2(&entry) }.ok()?;
Ok(())
}
@@ -304,7 +302,7 @@ fn set_iface_config(luid: wintun::NET_LUID_LH, mtu: u32) -> Result<()> {
};
// SAFETY: TODO
unsafe { GetIpInterfaceEntry(&mut row) }?;
unsafe { GetIpInterfaceEntry(&mut row) }.ok()?;
// https://stackoverflow.com/questions/54857292/setipinterfaceentry-returns-error-invalid-parameter
row.SitePrefixLength = 0;
@@ -313,7 +311,7 @@ fn set_iface_config(luid: wintun::NET_LUID_LH, mtu: u32) -> Result<()> {
row.NlMtu = mtu;
// SAFETY: TODO
unsafe { SetIpInterfaceEntry(&mut row) }?;
unsafe { SetIpInterfaceEntry(&mut row) }.ok()?;
}
// Set MTU for IPv6
@@ -325,7 +323,7 @@ fn set_iface_config(luid: wintun::NET_LUID_LH, mtu: u32) -> Result<()> {
};
// SAFETY: TODO
unsafe { GetIpInterfaceEntry(&mut row) }?;
unsafe { GetIpInterfaceEntry(&mut row) }.ok()?;
// https://stackoverflow.com/questions/54857292/setipinterfaceentry-returns-error-invalid-parameter
row.SitePrefixLength = 0;
@@ -334,7 +332,7 @@ fn set_iface_config(luid: wintun::NET_LUID_LH, mtu: u32) -> Result<()> {
row.NlMtu = mtu;
// SAFETY: TODO
unsafe { SetIpInterfaceEntry(&mut row) }?;
unsafe { SetIpInterfaceEntry(&mut row) }.ok()?;
}
Ok(())
}

View File

@@ -59,12 +59,12 @@ futures = "0.3.30"
[target.'cfg(target_os = "windows")'.dependencies]
tauri-winrt-notification = "0.1.3"
windows-implement = "0.52.0"
windows-implement = "0.53.0"
winreg = "0.52.0"
wintun = "0.4.0"
[target.'cfg(target_os = "windows")'.dependencies.windows]
version = "0.52.0"
version = "0.54.0"
features = [
# For implementing COM interfaces
"implement",

View File

@@ -37,7 +37,7 @@ use anyhow::Result;
use std::sync::Arc;
use tokio::{runtime::Runtime, sync::Notify};
use windows::{
core::{ComInterface, Result as WinResult, GUID},
core::{Interface, Result as WinResult, GUID},
Win32::{
Networking::NetworkListManager::{
INetworkEvents, INetworkEvents_Impl, INetworkListManager, NetworkListManager,
@@ -203,6 +203,7 @@ impl ComGuard {
// SAFETY: Threading shouldn't be a problem since this is meant to initialize
// COM per-thread anyway.
unsafe { Com::CoInitializeEx(None, Com::COINIT_MULTITHREADED) }
.ok()
.map_err(Error::ComInitialize)?;
Ok(Self {
dropped: false,