VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-09 01:12:29 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-07-09 09:49:32 +0200
commitf5841b884107fee7b55b2cf80148391297b49dfb (patch)
tree06944ea05948e3a8ad89923dfa281314d6e348d6 /src
parent1ebb0bf00fd764cdf9541e5e3af115e394e09132 (diff)
downloadVeraCrypt-f5841b884107fee7b55b2cf80148391297b49dfb.tar.gz
VeraCrypt-f5841b884107fee7b55b2cf80148391297b49dfb.zip
Windows: install crash handler in case of system favorites service in order to be able to clear Pre-Boot password from cache before the service is terminate if a crash happens.
Diffstat (limited to 'src')
-rw-r--r--src/Mount/Mount.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 1d046249..6a7e1353 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -9133,6 +9133,21 @@ static VOID WINAPI SystemFavoritesServiceCtrlHandler (DWORD control)
SystemFavoritesServiceSetStatus (SystemFavoritesServiceStatus.dwCurrentState);
}
+static LONG WINAPI SystemFavoritesServiceExceptionHandler (EXCEPTION_POINTERS *ep)
+{
+ SetUnhandledExceptionFilter (NULL);
+
+ if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD))
+ WipeCache (NULL, TRUE);
+
+ UnhandledExceptionFilter (ep);
+ return EXCEPTION_EXECUTE_HANDLER;
+}
+
+static void SystemFavoritesServiceInvalidParameterHandler (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t reserved)
+{
+ TC_THROW_FATAL_EXCEPTION;
+}
static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
{
@@ -9146,6 +9161,9 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
InitGlobalLocks ();
+ SetUnhandledExceptionFilter (SystemFavoritesServiceExceptionHandler);
+ _set_invalid_parameter_handler (SystemFavoritesServiceInvalidParameterHandler);
+
SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices"));