VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-10 22:48:06 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-02-10 22:54:45 +0100
commit2061b4c28ca189781dc9d2625f1bd4899fccbd81 (patch)
tree5a1e91d6b7dd0c8be7c8d72e38656eb410ba0712 /src
parent3903fcc595cbdcd403fa6713e663cf542e99c814 (diff)
downloadVeraCrypt-2061b4c28ca189781dc9d2625f1bd4899fccbd81.tar.gz
VeraCrypt-2061b4c28ca189781dc9d2625f1bd4899fccbd81.zip
Windows: Ensure that only one thread at a time can create a secure desktop
Diffstat (limited to 'src')
-rw-r--r--src/Common/Dlgcode.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index c8efe2a7..12ca8543 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -214,6 +214,9 @@ CRITICAL_SECTION csVolumeIdCandidates;
static std::vector<HostDevice> mountableDevices;
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;
+
HINSTANCE hInst = NULL;
HCURSOR hCursor = NULL;
@@ -445,6 +448,7 @@ void InitGlobalLocks ()
InitializeCriticalSection (&csWNetCalls);
InitializeCriticalSection (&csMountableDevices);
InitializeCriticalSection (&csVolumeIdCandidates);
+ InitializeCriticalSection (&csSecureDesktop);
}
void FinalizeGlobalLocks ()
@@ -452,6 +456,7 @@ void FinalizeGlobalLocks ()
DeleteCriticalSection (&csWNetCalls);
DeleteCriticalSection (&csMountableDevices);
DeleteCriticalSection (&csVolumeIdCandidates);
+ DeleteCriticalSection (&csSecureDesktop);
}
void cleanup ()
@@ -13556,6 +13561,9 @@ INT_PTR SecureDesktopDialogBoxParam(
HDESK hInputDesk = NULL;
+ EnterCriticalSection (&csSecureDesktop);
+ finally_do ({ LeaveCriticalSection (&csSecureDesktop); });
+
// 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