From 47544054a2c4fd41c2dfa4f9af6a1c7309d005cf Mon Sep 17 00:00:00 2001 From: rustdesk Date: Sat, 10 Oct 2026 17:40:43 +0800 Subject: [PATCH] windows: drop the LogonUI.exe check from is_logon_screen LogonUI.exe can outlive the unlock and is matched by name only, so its presence reported a lock screen on an unlocked desktop and let the password through. Only the WTS lock flag decides now; on Windows 7 and Server 2008 R2, which report it reversed, the result is inverted. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01P1grQ39ByRWPUtTBdTzEBF --- src/platform/windows.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/platform/windows.rs b/src/platform/windows.rs index a10f9018c..f3bc92d1f 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -1283,16 +1283,16 @@ pub fn is_logon_ui() -> ResultType { .any(|pid| get_session_id_of_process(pid) == Some(current_sid))) } -// Windows 7 and Server 2008 R2 report the WTS lock flag reversed (see WTSINFOEX_LEVEL1), so -// there only LogonUI.exe tells the lock screen apart. +// No `is_logon_ui()`: a LogonUI.exe that outlives the unlock would let the password through. +// Windows 7 and Server 2008 R2 report the WTS lock flag reversed (see WTSINFOEX_LEVEL1); there a +// failed query reads as locked, which types the password as before. pub fn is_logon_screen() -> bool { - let lock_flag_works = base::platform::windows::is_windows_version_or_greater(6, 2, 0, 0, 0); - is_prelogin() - || (lock_flag_works && is_locked()) - || is_logon_ui().unwrap_or_else(|e| { - log::error!("Failed to detect logon UI: {:?}", e); - false - }) + let locked = if base::platform::windows::is_windows_version_or_greater(6, 2, 0, 0, 0) { + is_locked() + } else { + !is_locked() + }; + is_prelogin() || locked } pub fn is_root() -> bool {