mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 11:08:02 -06:00
Windows: correctly initialize global critical sections in case if system favorites service.
This commit is contained in:
@@ -389,6 +389,19 @@ typedef struct
|
|||||||
|
|
||||||
} MULTI_CHOICE_DLGPROC_PARAMS;
|
} MULTI_CHOICE_DLGPROC_PARAMS;
|
||||||
|
|
||||||
|
void InitGlobalLocks ()
|
||||||
|
{
|
||||||
|
InitializeCriticalSection (&csWNetCalls);
|
||||||
|
InitializeCriticalSection (&csMountableDevices);
|
||||||
|
InitializeCriticalSection (&csVolumeIdCandidates);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FinalizeGlobalLocks ()
|
||||||
|
{
|
||||||
|
DeleteCriticalSection (&csWNetCalls);
|
||||||
|
DeleteCriticalSection (&csMountableDevices);
|
||||||
|
DeleteCriticalSection (&csVolumeIdCandidates);
|
||||||
|
}
|
||||||
|
|
||||||
void cleanup ()
|
void cleanup ()
|
||||||
{
|
{
|
||||||
@@ -468,9 +481,7 @@ void cleanup ()
|
|||||||
EncryptionThreadPoolStop();
|
EncryptionThreadPoolStop();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DeleteCriticalSection (&csWNetCalls);
|
FinalizeGlobalLocks ();
|
||||||
DeleteCriticalSection (&csMountableDevices);
|
|
||||||
DeleteCriticalSection (&csVolumeIdCandidates);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2694,9 +2705,7 @@ void InitApp (HINSTANCE hInstance, wchar_t *lpszCommandLine)
|
|||||||
|
|
||||||
VirtualLock (&CmdTokenPin, sizeof (CmdTokenPin));
|
VirtualLock (&CmdTokenPin, sizeof (CmdTokenPin));
|
||||||
|
|
||||||
InitializeCriticalSection (&csWNetCalls);
|
InitGlobalLocks ();
|
||||||
InitializeCriticalSection (&csMountableDevices);
|
|
||||||
InitializeCriticalSection (&csVolumeIdCandidates);
|
|
||||||
|
|
||||||
LoadSystemDll (L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS);
|
LoadSystemDll (L"ntmarta.dll", &hntmartadll, TRUE, SRC_POS);
|
||||||
LoadSystemDll (L"MPR.DLL", &hmprdll, TRUE, SRC_POS);
|
LoadSystemDll (L"MPR.DLL", &hmprdll, TRUE, SRC_POS);
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ typedef struct
|
|||||||
#define ISO_BURNER_TOOL L"isoburn.exe"
|
#define ISO_BURNER_TOOL L"isoburn.exe"
|
||||||
#define PRINT_TOOL L"notepad.exe"
|
#define PRINT_TOOL L"notepad.exe"
|
||||||
|
|
||||||
|
void InitGlobalLocks ();
|
||||||
|
void FinalizeGlobalLocks ();
|
||||||
void cleanup ( void );
|
void cleanup ( void );
|
||||||
void LowerCaseCopy ( wchar_t *lpszDest , const wchar_t *lpszSource );
|
void LowerCaseCopy ( wchar_t *lpszDest , const wchar_t *lpszSource );
|
||||||
void UpperCaseCopy ( wchar_t *lpszDest , size_t cbDest, const wchar_t *lpszSource );
|
void UpperCaseCopy ( wchar_t *lpszDest , size_t cbDest, const wchar_t *lpszSource );
|
||||||
|
|||||||
@@ -9144,6 +9144,8 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
|
|||||||
if (!SystemFavoritesServiceStatusHandle)
|
if (!SystemFavoritesServiceStatusHandle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
InitGlobalLocks ();
|
||||||
|
|
||||||
SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
|
SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
|
||||||
|
|
||||||
SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices"));
|
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."));
|
SystemFavoritesServiceLogError (wstring (L"System Favorites mounting process failed."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FinalizeGlobalLocks ();
|
||||||
|
|
||||||
SystemFavoritesServiceSetStatus (SERVICE_RUNNING);
|
SystemFavoritesServiceSetStatus (SERVICE_RUNNING);
|
||||||
SystemFavoritesServiceSetStatus (SERVICE_STOPPED);
|
SystemFavoritesServiceSetStatus (SERVICE_STOPPED);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user