summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2023-08-03 11:51:58 +0200
committerLinus Färnstrand <linus@mullvad.net>2023-08-08 08:40:05 +0200
commit9ff2c031f62841cbfc2187017bcfd8890734a402 (patch)
tree6776a4348fc651f85ff9df068eacd8b7d708142f
parent4d464627e05cc8b4f767299da036a4867e1207e3 (diff)
downloadmullvadvpn-9ff2c031f62841cbfc2187017bcfd8890734a402.tar.xz
mullvadvpn-9ff2c031f62841cbfc2187017bcfd8890734a402.zip
Update talpid-openvpn to be windows-sys 0.48 compatible
-rw-r--r--talpid-openvpn/src/wintun.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/talpid-openvpn/src/wintun.rs b/talpid-openvpn/src/wintun.rs
index e9d461a241..afeeeecbf9 100644
--- a/talpid-openvpn/src/wintun.rs
+++ b/talpid-openvpn/src/wintun.rs
@@ -7,12 +7,12 @@ use std::{
ptr,
sync::{Arc, Mutex},
};
-use talpid_types::ErrorExt;
+use talpid_types::{win32_err, ErrorExt};
use widestring::{U16CStr, U16CString};
use windows_sys::{
core::GUID,
Win32::{
- Foundation::{HMODULE, NO_ERROR},
+ Foundation::HMODULE,
NetworkManagement::{IpHelper::ConvertInterfaceLuidToGuid, Ndis::NET_LUID_LH},
System::{
Com::StringFromGUID2,
@@ -121,10 +121,7 @@ impl WintunAdapter {
pub fn guid(&self) -> io::Result<GUID> {
let mut guid = mem::MaybeUninit::zeroed();
- let result = unsafe { ConvertInterfaceLuidToGuid(&self.luid(), guid.as_mut_ptr()) };
- if result != NO_ERROR as i32 {
- return Err(io::Error::from_raw_os_error(result));
- }
+ win32_err!(unsafe { ConvertInterfaceLuidToGuid(&self.luid(), guid.as_mut_ptr()) })?;
Ok(unsafe { guid.assume_init() })
}
@@ -205,10 +202,7 @@ impl WintunDll {
fn new_inner(
handle: HMODULE,
- get_proc_fn: unsafe fn(
- HMODULE,
- &CStr,
- ) -> io::Result<unsafe extern "system" fn() -> isize>,
+ get_proc_fn: unsafe fn(HMODULE, &CStr) -> io::Result<unsafe extern "system" fn() -> isize>,
) -> io::Result<Self> {
Ok(WintunDll {
handle,