Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-19471] Update Rust windows crate to 0.61.1 #13974

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@
"webpack-node-externals",
"widestring",
"windows",
"windows-future",
"windows-registry",
"zbus",
"zbus_polkit",
Expand Down
95 changes: 59 additions & 36 deletions apps/desktop/desktop_native/Cargo.lock

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

3 changes: 2 additions & 1 deletion apps/desktop/desktop_native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ tokio-util = "=0.7.13"
typenum = "=1.17.0"
uniffi = "=0.28.3"
widestring = "=1.1.0"
windows = "=0.58.0"
windows = "=0.61.1"
windows-future = "=0.2.0"
windows-registry = "=0.4.0"
zbus = "=4.4.0"
zbus_polkit = "=4.0.0"
1 change: 1 addition & 0 deletions apps/desktop/desktop_native/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ windows = { workspace = true, features = [
"Win32_UI_WindowsAndMessaging",
"Win32_System_Pipes",
], optional = true }
windows-future = { workspace = true }

[target.'cfg(windows)'.dev-dependencies]
keytar = { workspace = true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rand::RngCore;
use sha2::{Digest, Sha256};
use windows::{
core::{factory, h, HSTRING},
Foundation::IAsyncOperation,
Security::{
Credentials::{
KeyCredentialCreationOption, KeyCredentialManager, KeyCredentialStatus, UI::*,
Expand All @@ -19,6 +18,7 @@ use windows::{
},
Win32::{Foundation::HWND, System::WinRT::IUserConsentVerifierInterop},
};
use windows_future::IAsyncOperation;

use crate::{
biometric::{KeyMaterial, OsDerivedKey},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ pub fn focus_security_prompt() {
pub(crate) fn set_focus(window: HWND) {
unsafe {
let _ = SetForegroundWindow(window);
let _ = SetFocus(window);
let _ = SetFocus(Some(window));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For qa: We have an existing bug, when called from a browser (chrome/firefox), the focusing does not work on windows. Even if this changes that code, feel free to have QA disregard if they note this behavior as a bug.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up!

}
}
10 changes: 2 additions & 8 deletions apps/desktop/desktop_native/core/src/password/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub async fn get_password(service: &str, account: &str) -> Result<String> {
CredReadW(
PCWSTR(target_name.as_ptr()),
CRED_TYPE_GENERIC,
CRED_FLAGS_NONE,
None,
credential_ptr,
)
};
Expand Down Expand Up @@ -79,13 +79,7 @@ pub async fn set_password(service: &str, account: &str, password: &str) -> Resul
pub async fn delete_password(service: &str, account: &str) -> Result<()> {
let target_name = U16CString::from_str(target_name(service, account))?;

unsafe {
CredDeleteW(
PCWSTR(target_name.as_ptr()),
CRED_TYPE_GENERIC,
CRED_FLAGS_NONE,
)?
};
unsafe { CredDeleteW(PCWSTR(target_name.as_ptr()), CRED_TYPE_GENERIC, None)? };

Ok(())
}
Expand Down
Loading