VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Common/Dlgcode.c21
-rw-r--r--src/Common/Dlgcode.h2
-rw-r--r--src/Mount/Mount.c4
3 files changed, 21 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 );
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index d3886726..1d046249 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -9144,6 +9144,8 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
if (!SystemFavoritesServiceStatusHandle)
return;
+ InitGlobalLocks ();
+
SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices"));
@@ -9167,6 +9169,8 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
SystemFavoritesServiceLogError (wstring (L"System Favorites mounting process failed."));
}
+ FinalizeGlobalLocks ();
+
SystemFavoritesServiceSetStatus (SERVICE_RUNNING);
SystemFavoritesServiceSetStatus (SERVICE_STOPPED);
}