Windows: Fix sporadic keyboard issue in Secure Desktop for password dialog by not using the trick to put it reliably in foreground. The trick is based on a emulation of ALT+TAB but sometimes ALT key would remain pressed in case of Secure Desktop making it impossible to type the password (a workaround was to press CTRL key which reset the state of ALT key)

This commit is contained in:
Mounir IDRASSI 2019-09-26 23:00:07 +02:00
parent 0e2be7153f
commit 684259b438
No known key found for this signature in database
GPG Key ID: 02C30AE90FAE4A6F
3 changed files with 12 additions and 2 deletions

View File

@ -221,6 +221,9 @@ static std::vector<HostDevice> rawHostDeviceList;
/* Critical section used to ensure that only one thread at a time can create a secure desktop */
CRITICAL_SECTION csSecureDesktop;
/* Boolean that indicates if our Secure Desktop is active and being user of not */
BOOL bSecureDesktopOngoing = FALSE;
HINSTANCE hInst = NULL;
HCURSOR hCursor = NULL;
@ -13584,7 +13587,8 @@ INT_PTR SecureDesktopDialogBoxParam(
HDESK hInputDesk = NULL;
EnterCriticalSection (&csSecureDesktop);
finally_do ({ LeaveCriticalSection (&csSecureDesktop); });
bSecureDesktopOngoing = TRUE;
finally_do ({ bSecureDesktopOngoing = FALSE; LeaveCriticalSection (&csSecureDesktop); });
// wait for the input desktop to be available before switching to
// secure desktop. Under Windows 10, the user session can be started

View File

@ -124,6 +124,7 @@ extern BOOL bHideWaitingDialog;
extern BOOL bCmdHideWaitingDialog;
extern BOOL bCmdHideWaitingDialogValid;
extern BOOL bUseSecureDesktop;
extern BOOL bSecureDesktopOngoing;
extern BOOL bUseLegacyMaxPasswordLength;
extern BOOL bCmdUseSecureDesktop;
extern BOOL bCmdUseSecureDesktopValid;

View File

@ -2968,7 +2968,12 @@ BOOL CALLBACK PasswordDlgProc (HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
SetWindowPos (hwndDlg, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
}
SetFocus (GetDlgItem (hwndDlg, IDC_PASSWORD));
SetTimer (hwndDlg, TIMER_ID_CHECK_FOREGROUND, TIMER_INTERVAL_CHECK_FOREGROUND, NULL);
/* Start the timer to check if we are foreground only if Secure Desktop is not used */
if (!bSecureDesktopOngoing)
{
SetTimer (hwndDlg, TIMER_ID_CHECK_FOREGROUND, TIMER_INTERVAL_CHECK_FOREGROUND, NULL);
}
}
return 0;