diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2023-08-03 11:11:43 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2023-08-08 08:40:05 +0200 |
| commit | 4d464627e05cc8b4f767299da036a4867e1207e3 (patch) | |
| tree | d85a5ae68f79122ab3f43f698d1f95bd22582d90 | |
| parent | 4434de4fdb50f68af1a3397dec2a4338b8ef874b (diff) | |
| download | mullvadvpn-4d464627e05cc8b4f767299da036a4867e1207e3.tar.xz mullvadvpn-4d464627e05cc8b4f767299da036a4867e1207e3.zip | |
Use HMODULE instead of HINSTANCE in DLL handling code
| -rw-r--r-- | talpid-openvpn/src/wintun.rs | 12 | ||||
| -rw-r--r-- | talpid-wireguard/src/wireguard_nt.rs | 15 |
2 files changed, 12 insertions, 15 deletions
diff --git a/talpid-openvpn/src/wintun.rs b/talpid-openvpn/src/wintun.rs index 65b990693f..e9d461a241 100644 --- a/talpid-openvpn/src/wintun.rs +++ b/talpid-openvpn/src/wintun.rs @@ -12,7 +12,7 @@ use widestring::{U16CStr, U16CString}; use windows_sys::{ core::GUID, Win32::{ - Foundation::{HINSTANCE, NO_ERROR}, + Foundation::{HMODULE, NO_ERROR}, NetworkManagement::{IpHelper::ConvertInterfaceLuidToGuid, Ndis::NET_LUID_LH}, System::{ Com::StringFromGUID2, @@ -55,7 +55,7 @@ enum WintunLoggerLevel { } pub struct WintunDll { - handle: HINSTANCE, + handle: HMODULE, func_create: WintunCreateAdapterFn, func_close: WintunCloseAdapterFn, func_get_adapter_luid: WintunGetAdapterLuidFn, @@ -204,9 +204,9 @@ impl WintunDll { } fn new_inner( - handle: HINSTANCE, + handle: HMODULE, get_proc_fn: unsafe fn( - HINSTANCE, + HMODULE, &CStr, ) -> io::Result<unsafe extern "system" fn() -> isize>, ) -> io::Result<Self> { @@ -240,7 +240,7 @@ impl WintunDll { } unsafe fn get_proc_address( - handle: HINSTANCE, + handle: HMODULE, name: &CStr, ) -> io::Result<unsafe extern "system" fn() -> isize> { let handle = GetProcAddress(handle, name.as_ptr() as *const u8); @@ -371,7 +371,7 @@ mod tests { use super::*; fn get_proc_fn( - _handle: HINSTANCE, + _handle: HMODULE, _symbol: &CStr, ) -> io::Result<unsafe extern "system" fn() -> isize> { Ok(null_fn) diff --git a/talpid-wireguard/src/wireguard_nt.rs b/talpid-wireguard/src/wireguard_nt.rs index 8c6a7a0945..00cbeed0a9 100644 --- a/talpid-wireguard/src/wireguard_nt.rs +++ b/talpid-wireguard/src/wireguard_nt.rs @@ -27,7 +27,7 @@ use widestring::{U16CStr, U16CString}; use windows_sys::{ core::GUID, Win32::{ - Foundation::{BOOL, ERROR_MORE_DATA, HINSTANCE}, + Foundation::{BOOL, ERROR_MORE_DATA, HMODULE}, NetworkManagement::Ndis::NET_LUID_LH, Networking::WinSock::{ ADDRESS_FAMILY, AF_INET, AF_INET6, IN6_ADDR, IN_ADDR, SOCKADDR_INET, @@ -621,7 +621,7 @@ impl Drop for WgNtAdapter { } struct WgNtDll { - handle: HINSTANCE, + handle: HMODULE, func_create: WireGuardCreateAdapterFn, func_close: WireGuardCloseAdapterFn, func_get_adapter_luid: WireGuardGetAdapterLuidFn, @@ -649,11 +649,8 @@ impl WgNtDll { } fn new_inner( - handle: HINSTANCE, - get_proc_fn: unsafe fn( - HINSTANCE, - &CStr, - ) -> io::Result<unsafe extern "system" fn() -> isize>, + handle: HMODULE, + get_proc_fn: unsafe fn(HMODULE, &CStr) -> io::Result<unsafe extern "system" fn() -> isize>, ) -> io::Result<Self> { Ok(WgNtDll { handle, @@ -709,7 +706,7 @@ impl WgNtDll { } unsafe fn get_proc_address( - handle: HINSTANCE, + handle: HMODULE, name: &CStr, ) -> io::Result<unsafe extern "system" fn() -> isize> { let handle = GetProcAddress(handle, name.as_ptr() as *const u8); @@ -1065,7 +1062,7 @@ mod tests { }); fn get_proc_fn( - _handle: HINSTANCE, + _handle: HMODULE, _symbol: &CStr, ) -> io::Result<unsafe extern "system" fn() -> isize> { Ok(null_fn) |
