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"));