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.

This commit is contained in:
Mounir IDRASSI 2017-07-09 01:12:29 +02:00
parent 1ebb0bf00f
commit f5841b8841
No known key found for this signature in database
GPG Key ID: DD0C382D5FCFB8FC

View File

@ -9133,6 +9133,21 @@ static VOID WINAPI SystemFavoritesServiceCtrlHandler (DWORD control)
SystemFavoritesServiceSetStatus (SystemFavoritesServiceStatus.dwCurrentState); 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) static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
{ {
@ -9146,6 +9161,9 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
InitGlobalLocks (); InitGlobalLocks ();
SetUnhandledExceptionFilter (SystemFavoritesServiceExceptionHandler);
_set_invalid_parameter_handler (SystemFavoritesServiceInvalidParameterHandler);
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"));