mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-24 12:03:28 +01:00
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.
This commit is contained in:
parent
a11cada735
commit
c1bc9dee0e
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user