mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2024-09-12 04:12:44 +02:00
Windows: Try to workaround Windows Updates issues by fixing of bootloader and SetupConfig.ini when session logged in/unlocked or system resumes
This commit is contained in:
parent
79738a4e5a
commit
622aaf4ef2
1 changed files with 51 additions and 27 deletions
|
@ -9663,18 +9663,8 @@ static void SystemFavoritesServiceSetStatus (DWORD status, DWORD waitHint = 0)
|
|||
SetServiceStatus (SystemFavoritesServiceStatusHandle, &SystemFavoritesServiceStatus);
|
||||
}
|
||||
|
||||
|
||||
static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
|
||||
DWORD dwEventType,
|
||||
LPVOID lpEventData,
|
||||
LPVOID lpContext)
|
||||
static void SystemFavoritesServiceUpdateLoaderProcessing ()
|
||||
{
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_PRESHUTDOWN:
|
||||
case SERVICE_CONTROL_STOP:
|
||||
SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING);
|
||||
|
||||
if (!(BootEncObj->ReadServiceConfigurationFlags () & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER))
|
||||
{
|
||||
try
|
||||
|
@ -9701,12 +9691,44 @@ static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
|
||||
DWORD dwEventType,
|
||||
LPVOID lpEventData,
|
||||
LPVOID lpContext)
|
||||
{
|
||||
switch (dwControl)
|
||||
{
|
||||
case SERVICE_CONTROL_PRESHUTDOWN:
|
||||
case SERVICE_CONTROL_STOP:
|
||||
SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING);
|
||||
|
||||
SystemFavoritesServiceUpdateLoaderProcessing ();
|
||||
|
||||
/* clear VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION flag */
|
||||
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, FALSE);
|
||||
SetEvent (SystemFavoriteServiceStopEvent);
|
||||
SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING);
|
||||
|
||||
break;
|
||||
case SERVICE_CONTROL_POWEREVENT:
|
||||
{
|
||||
/* perform fixing of bootloader and SetupConfig.ini when the system resumes from sleep */
|
||||
if (dwEventType == PBT_APMRESUMEAUTOMATIC)
|
||||
{
|
||||
SystemFavoritesServiceUpdateLoaderProcessing ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SERVICE_CONTROL_SESSIONCHANGE:
|
||||
{
|
||||
/* perform fixing of bootloader and SetupConfig.ini when the user logs in or when he unlocks his locked session */
|
||||
if ((dwEventType == WTS_SESSION_UNLOCK) || (dwEventType == WTS_SESSION_LOGON))
|
||||
{
|
||||
SystemFavoritesServiceUpdateLoaderProcessing ();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SERVICE_CONTROL_DEVICEEVENT:
|
||||
if (DBT_DEVICEARRIVAL == dwEventType)
|
||||
|
@ -9773,7 +9795,7 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
|
|||
SystemFavoritesServiceStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
|
||||
SystemFavoritesServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
|
||||
if (IsOSAtLeast (WIN_VISTA))
|
||||
SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN;
|
||||
SystemFavoritesServiceStatus.dwControlsAccepted |= SERVICE_ACCEPT_PRESHUTDOWN | SERVICE_ACCEPT_SESSIONCHANGE | SERVICE_ACCEPT_POWEREVENT;
|
||||
|
||||
if ((argc >= 2) && (0 == _wcsicmp (argv[1], VC_SYSTEM_FAVORITES_SERVICE_ARG_SKIP_MOUNT)))
|
||||
bSkipMount = TRUE;
|
||||
|
@ -9823,6 +9845,8 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
|
|||
|
||||
if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD))
|
||||
WipeCache (NULL, TRUE);
|
||||
|
||||
SystemFavoritesServiceUpdateLoaderProcessing ();
|
||||
}
|
||||
|
||||
SystemFavoritesServiceSetStatus (SERVICE_RUNNING);
|
||||
|
|
Loading…
Reference in a new issue