VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount/Mount.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-15 15:03:08 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2019-01-15 15:05:19 +0100
commit202caea3a983198231e4ebde458817355e6629fb (patch)
tree0d660aef702ce040d9b4bf1f1d25ae9c4c49d984 /src/Mount/Mount.c
parent07fd2aa9a58cc86dd447826865ca317cad92fd45 (diff)
downloadVeraCrypt-202caea3a983198231e4ebde458817355e6629fb.tar.gz
VeraCrypt-202caea3a983198231e4ebde458817355e6629fb.zip
Windows: enhancements to EFI system encryption, like handling of Multi-Boot and better compatibility with Windows Upgrade process.
Diffstat (limited to 'src/Mount/Mount.c')
-rw-r--r--src/Mount/Mount.c86
1 files changed, 48 insertions, 38 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 13c353fa..337f20d8 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -9350,33 +9350,36 @@ static DWORD WINAPI SystemFavoritesServiceCtrlHandler ( DWORD dwControl,
switch (dwControl)
{
case SERVICE_CONTROL_PRESHUTDOWN:
+ case SERVICE_CONTROL_STOP:
SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING);
- if (BootEncObj && BootEncStatus.DriveMounted && BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT)
+ if (bSystemIsGPT)
{
- try
- {
- BootEncryption::UpdateSetupConfigFile (true);
- // re-install our bootloader again in case the update process has removed it.
- BootEncryption bootEnc (NULL, true);
- bootEnc.InstallBootLoader (true);
- }
- catch (...)
+ uint32 serviceFlags = BootEncObj->ReadServiceConfigurationFlags ();
+ if (!(serviceFlags & VC_SYSTEM_FAVORITES_SERVICE_CONFIG_DONT_UPDATE_LOADER))
{
+ try
+ {
+ BootEncryption::UpdateSetupConfigFile (true);
+ if (!BootEncStatus.HiddenSystem)
+ {
+ // re-install our bootloader again in case the update process has removed it.
+ BootEncryption bootEnc (NULL, true);
+ bootEnc.InstallBootLoader (true);
+ }
+ }
+ catch (...)
+ {
+ }
}
}
/* 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_STOP:
- SetEvent (SystemFavoriteServiceStopEvent);
- SystemFavoritesServiceSetStatus (SERVICE_STOP_PENDING);
- break;
case SERVICE_CONTROL_DEVICEEVENT:
if (DBT_DEVICEARRIVAL == dwEventType)
{
@@ -9437,11 +9440,15 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
{
BOOL status = FALSE;
DEV_BROADCAST_DEVICEINTERFACE hdr;
+ BOOL bSkipMount = FALSE;
memset (&SystemFavoritesServiceStatus, 0, sizeof (SystemFavoritesServiceStatus));
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;
+
+ if ((argc >= 2) && (0 == _wcsicmp (argv[1], VC_SYSTEM_FAVORITES_SERVICE_ARG_SKIP_MOUNT)))
+ bSkipMount = TRUE;
ZeroMemory (&hdr, sizeof(hdr));
hdr.dbcc_size = sizeof (hdr);
@@ -9457,38 +9464,40 @@ static VOID WINAPI SystemFavoritesServiceMain (DWORD argc, LPTSTR *argv)
SystemFavoriteServiceNotify = RegisterDeviceNotification (SystemFavoritesServiceStatusHandle, &hdr,DEVICE_NOTIFY_SERVICE_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
- InitGlobalLocks ();
-
SetUnhandledExceptionFilter (SystemFavoritesServiceExceptionHandler);
_set_invalid_parameter_handler (SystemFavoritesServiceInvalidParameterHandler);
- SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
+ if (!bSkipMount)
+ {
+ InitGlobalLocks ();
+ SystemFavoritesServiceSetStatus (SERVICE_START_PENDING, 120000);
- SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices"));
- // initialize the list of devices available for mounting as early as possible
- UpdateMountableHostDeviceList ();
+ SystemFavoritesServiceLogInfo (wstring (L"Initializing list of host devices"));
+ // initialize the list of devices available for mounting as early as possible
+ UpdateMountableHostDeviceList ();
- SystemFavoritesServiceLogInfo (wstring (L"Starting System Favorites mounting process"));
+ SystemFavoritesServiceLogInfo (wstring (L"Starting System Favorites mounting process"));
- try
- {
- status = MountFavoriteVolumes (NULL, TRUE);
- }
- catch (...) { }
+ try
+ {
+ status = MountFavoriteVolumes (NULL, TRUE);
+ }
+ catch (...) { }
- if (status)
- {
- SystemFavoritesServiceLogInfo (wstring (L"System Favorites mounting process finished"));
- }
- else
- {
- SystemFavoritesServiceLogError (wstring (L"System Favorites mounting process failed."));
- }
+ if (status)
+ {
+ SystemFavoritesServiceLogInfo (wstring (L"System Favorites mounting process finished"));
+ }
+ else
+ {
+ SystemFavoritesServiceLogError (wstring (L"System Favorites mounting process failed."));
+ }
- FinalizeGlobalLocks ();
+ FinalizeGlobalLocks ();
- if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD))
- WipeCache (NULL, TRUE);
+ if (!(ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD))
+ WipeCache (NULL, TRUE);
+ }
SystemFavoritesServiceSetStatus (SERVICE_RUNNING);
@@ -9525,6 +9534,7 @@ static BOOL StartSystemFavoritesService ()
{
BootEncObj = new BootEncryption (NULL);
BootEncStatus = BootEncObj->GetStatus();
+ bSystemIsGPT = BootEncObj->GetSystemDriveConfiguration().SystemPartition.IsGPT;
}
catch (Exception &)
{