VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/Dlgcode.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-08 23:59:22 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-09 00:19:17 +0200
commit1ebb0bf00fd764cdf9541e5e3af115e394e09132 (patch)
tree1f98254d64a5757c15ce34465f46c96d5c353aa2 /src/Common/Dlgcode.c
parent37a070cdeac37a96e0bd156a7cd77a5ab65f8fd0 (diff)
downloadVeraCrypt-1ebb0bf00fd764cdf9541e5e3af115e394e09132.tar.gz
VeraCrypt-1ebb0bf00fd764cdf9541e5e3af115e394e09132.zip
Windows: correctly initialize global critical sections in case if system favorites service.
Diffstat (limited to 'src/Common/Dlgcode.c')
-rw-r--r--src/Common/Dlgcode.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c
index c0f1b034..8ea025e5 100644
--- a/src/Common/Dlgcode.c
+++ b/src/Common/Dlgcode.c
@@ -389,6 +389,19 @@ typedef struct
} MULTI_CHOICE_DLGPROC_PARAMS;
+void InitGlobalLocks ()
+{
+ InitializeCriticalSection (&csWNetCalls);
+ InitializeCriticalSection (&csMountableDevices);
+ InitializeCriticalSection (&csVolumeIdCandidates);
+}
+
+void FinalizeGlobalLocks ()
+{
+ DeleteCriticalSection (&csWNetCalls);
+ DeleteCriticalSection (&csMountableDevices);
+ DeleteCriticalSection (&csVolumeIdCandidates);
+}
void cleanup ()
{
@@ -468,9 +481,7 @@ void cleanup ()
EncryptionThreadPoolStop();
#endif
- DeleteCriticalSection (&csWNetCalls);
- DeleteCriticalSection (&csMountableDevices);
- DeleteCriticalSection (&csVolumeIdCandidates);
+ FinalizeGlobalLocks ();
}
@@ -2694,9 +2705,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
VirtualLock (&CmdTokenPin, sizeof (CmdTokenPin));
- InitializeCriticalSection (&csWNetCalls);
- InitializeCriticalSection (&csMountableDevices);
- InitializeCriticalSection (&csVolumeIdCandidates);
+ InitGlobalLocks ();
LoadSystemDll (L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS);
LoadSystemDll (L"MPR.DLL", &hmprdll, TRUE, SRC_POS);