VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-08-05 21:37:09 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-08-05 22:13:16 (GMT)
commitc1bc9dee0eb0744817aff7fac230ca5cfd940c26 (patch)
tree7ce8e769473bb66073469e46d520326aebc971eb
parenta11cada73596ce5b67e460ae5259d227f349e83c (diff)
downloadVeraCrypt-c1bc9dee0eb0744817aff7fac230ca5cfd940c26.zip
VeraCrypt-c1bc9dee0eb0744817aff7fac230ca5cfd940c26.tar.gz
Windows: avoid timeout of Secure Desktop display by waiting for the user to be really authenticated. Under Windows 10, a user session can be started in the background even before the user has been authenticated and this was causing VeraCrypt to be started before the user has logged in, in turn this was causing Secure Desktop to fail.
-rw-r--r--src/Common/Dlgcode.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index 48a5e85..cff7fd6 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -13259,11 +13259,9 @@ static DWORD WINAPI SecureDesktopThread(LPVOID lpThreadParameter)
SecureDesktopMonitoringThreadParam monitorParam;
HDESK hOriginalDesk = GetThreadDesktop (GetCurrentThreadId ());
BOOL bNewDesktopSet = FALSE;
- int counter = 0;
// wait for SwitchDesktop to succeed before using it for current thread
- // we wait a maximum of 5 seconds
- for (counter = 0; counter < 10; counter++)
+ while (true)
{
if (SwitchDesktop (pParam->hDesk))
{
@@ -13352,6 +13350,21 @@ INT_PTR SecureDesktopDialogBoxParam(
map<DWORD, BOOL> ctfmonBeforeList, ctfmonAfterList;
DWORD desktopAccess = DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_READOBJECTS | DESKTOP_SWITCHDESKTOP | DESKTOP_WRITEOBJECTS;
HDESK hSecureDesk;
+
+ HDESK hInputDesk = NULL;
+
+ // wait for the input desktop to be available before switching to
+ // secure desktop. Under Windows 10, the user session can be started
+ // in the background even before the user has authenticated and in this
+ // case, we wait for the user to be really authenticated before starting
+ // secure desktop mechanism
+
+ while (!(hInputDesk = OpenInputDesktop (0, TRUE, GENERIC_READ)))
+ {
+ Sleep (SECUREDESKTOP_MONOTIR_PERIOD);
+ }
+
+ CloseDesktop (hInputDesk);
// get the initial list of ctfmon.exe processes before creating new desktop
GetCtfMonProcessIdList (ctfmonBeforeList);