From 3fe05a8b65aa4a70f17b789dd9f5c6f5cf70edbd Mon Sep 17 00:00:00 2001 From: Isaiah Inuwa Date: Mon, 10 Nov 2025 11:14:15 -0600 Subject: [PATCH] Use windows::core re-export everywhere --- .../windows_plugin_authenticator/src/assert.rs | 2 +- .../src/com_provider.rs | 16 ++++++++-------- .../src/com_registration.rs | 4 ++-- .../src/make_credential.rs | 4 ++-- .../windows_plugin_authenticator/src/util.rs | 2 +- .../windows_plugin_authenticator/src/webauthn.rs | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs index 8e2e77d94aa..cadff6d8e29 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/assert.rs @@ -5,7 +5,7 @@ use std::{ sync::Arc, time::Duration, }; -use windows_core::{s, HRESULT}; +use windows::core::{s, HRESULT}; use crate::ipc2::{ PasskeyAssertionRequest, PasskeyAssertionResponse, Position, TimedCallback, UserVerification, diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs index 6bff98a6c89..6ca9a844ee4 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_provider.rs @@ -1,10 +1,10 @@ use std::sync::Arc; use std::time::Duration; +use windows::core::{implement, interface, IInspectable, IUnknown, Interface, HRESULT}; use windows::Win32::Foundation::{RECT, S_OK}; use windows::Win32::System::Com::*; use windows::Win32::UI::WindowsAndMessaging::GetWindowRect; -use windows_core::{implement, interface, IInspectable, IUnknown, Interface, HRESULT}; use crate::assert::plugin_get_assertion; use crate::ipc2::{TimedCallback, WindowsProviderClient}; @@ -34,7 +34,7 @@ pub enum PluginLockStatus { #[derive(Debug, Copy, Clone)] pub struct WebAuthnPluginOperationRequest { pub window_handle: windows::Win32::Foundation::HWND, - pub transaction_id: windows_core::GUID, + pub transaction_id: windows::core::GUID, pub request_signature_byte_count: u32, pub request_signature_pointer: *mut u8, pub request_type: WebAuthnPluginRequestType, @@ -71,14 +71,14 @@ pub struct WebAuthnPluginOperationResponse { #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct WebAuthnPluginCancelOperationRequest { - pub transaction_id: windows_core::GUID, + pub transaction_id: windows::core::GUID, pub request_signature_byte_count: u32, pub request_signature_pointer: *mut u8, } // Stable IPluginAuthenticator interface #[interface("d26bcf6f-b54c-43ff-9f06-d5bf148625f7")] -pub unsafe trait IPluginAuthenticator: windows_core::IUnknown { +pub unsafe trait IPluginAuthenticator: windows::core::IUnknown { fn MakeCredential( &self, request: *const WebAuthnPluginOperationRequest, @@ -237,10 +237,10 @@ impl IPluginAuthenticator_Impl for PluginAuthenticatorComObject_Impl { impl IClassFactory_Impl for Factory_Impl { fn CreateInstance( &self, - _outer: windows_core::Ref, - iid: *const windows_core::GUID, + _outer: windows::core::Ref, + iid: *const windows::core::GUID, object: *mut *mut core::ffi::c_void, - ) -> windows_core::Result<()> { + ) -> windows::core::Result<()> { tracing::debug!("Creating COM server instance."); tracing::debug!("Trying to connect to Bitwarden IPC"); let client = WindowsProviderClient::connect(); @@ -249,7 +249,7 @@ impl IClassFactory_Impl for Factory_Impl { unsafe { unknown.query(iid, object).ok() } } - fn LockServer(&self, _lock: windows_core::BOOL) -> windows_core::Result<()> { + fn LockServer(&self, _lock: windows::core::BOOL) -> windows::core::Result<()> { Ok(()) } } diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_registration.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_registration.rs index f39cd3798c3..68e92145b77 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_registration.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/com_registration.rs @@ -1,8 +1,8 @@ use std::ptr; use base64::{engine::general_purpose::STANDARD, Engine as _}; +use windows::core::{s, ComObjectInterface, GUID, HRESULT, HSTRING, PCWSTR}; use windows::Win32::System::Com::*; -use windows_core::{s, ComObjectInterface, GUID, HRESULT, HSTRING, PCWSTR}; use crate::com_provider; use crate::util::delay_load; @@ -152,7 +152,7 @@ pub fn initialize_com_library() -> std::result::Result<(), String> { /// Registers the Bitwarden Plugin Authenticator COM library with Windows. pub fn register_com_library() -> std::result::Result<(), String> { - static FACTORY: windows_core::StaticComObject = + static FACTORY: windows::core::StaticComObject = com_provider::Factory.into_static(); let clsid_guid = parse_clsid_to_guid().map_err(|e| format!("Failed to parse CLSID: {}", e))?; let clsid: *const GUID = &clsid_guid; diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs index f5a6a32c36e..9043ed33d74 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/make_credential.rs @@ -4,7 +4,7 @@ use std::mem::ManuallyDrop; use std::ptr; use std::sync::Arc; use std::time::Duration; -use windows_core::{s, HRESULT}; +use windows::core::{s, HRESULT}; use crate::com_provider::{ parse_credential_list, WebAuthnPluginOperationRequest, WebAuthnPluginOperationResponse, @@ -627,7 +627,7 @@ pub unsafe fn plugin_make_credential( mod tests { use std::ptr; - use windows_core::s; + use windows::core::s; use crate::{ make_credential::{ diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/util.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/util.rs index e5bbc2b3d7f..aff046a841d 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/util.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/util.rs @@ -5,7 +5,7 @@ use std::time::{SystemTime, UNIX_EPOCH}; use windows::Win32::Foundation::*; use windows::Win32::System::LibraryLoader::*; -use windows_core::*; +use windows::core::*; use crate::com_buffer::ComBuffer; diff --git a/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs b/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs index 2971ef9724d..ca51b53dff0 100644 --- a/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs +++ b/apps/desktop/desktop_native/windows_plugin_authenticator/src/webauthn.rs @@ -5,7 +5,7 @@ https://github.com/microsoft/webauthn/blob/master/webauthnplugin.h */ -use windows_core::*; +use windows::core::*; use crate::com_buffer::ComBuffer; use crate::util::{delay_load, WindowsString};