diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-07-08 23:59:22 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2017-07-09 00:19:17 +0200 |
commit | 1ebb0bf00fd764cdf9541e5e3af115e394e09132 (patch) | |
tree | 1f98254d64a5757c15ce34465f46c96d5c353aa2 /src/Common | |
parent | 37a070cdeac37a96e0bd156a7cd77a5ab65f8fd0 (diff) | |
download | VeraCrypt-1ebb0bf00fd764cdf9541e5e3af115e394e09132.tar.gz VeraCrypt-1ebb0bf00fd764cdf9541e5e3af115e394e09132.zip |
Windows: correctly initialize global critical sections in case if system favorites service.
Diffstat (limited to 'src/Common')
-rw-r--r-- | src/Common/Dlgcode.c | 21 | ||||
-rw-r--r-- | src/Common/Dlgcode.h | 2 |
2 files changed, 17 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); diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 2849aa5e..47ab035d 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -238,6 +238,8 @@ typedef struct #define ISO_BURNER_TOOL L"isoburn.exe" #define PRINT_TOOL L"notepad.exe" +void InitGlobalLocks (); +void FinalizeGlobalLocks (); void cleanup ( void ); void LowerCaseCopy ( wchar_t *lpszDest , const wchar_t *lpszSource ); void UpperCaseCopy ( wchar_t *lpszDest , size_t cbDest, const wchar_t *lpszSource ); |