diff options
Diffstat (limited to 'src/Mount')
-rw-r--r-- | src/Mount/Favorites.cpp | 7 | ||||
-rw-r--r-- | src/Mount/Mount.c | 32 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/Mount/Favorites.cpp b/src/Mount/Favorites.cpp index eafc4734..e93b9203 100644 --- a/src/Mount/Favorites.cpp +++ b/src/Mount/Favorites.cpp @@ -260,6 +260,13 @@ namespace VeraCrypt if (reqConfig != (ReadDriverConfigurationFlags() & TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES)) BootEncObj.SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD_FOR_SYS_FAVORITES, reqConfig ? true : false); + if (!BootEncObj.IsSystemFavoritesServiceRunning()) + { + // The system favorites service should be always running + // If it is stopped for some reason, we reconfigure it + BootEncObj.RegisterSystemFavoritesService (TRUE); + } + SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_NONADMIN_SYS_FAVORITES_ACCESS, IsDlgButtonChecked (hwndDlg, IDC_FAVORITE_DISABLE_HOTKEY)); } catch (Exception &e) diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c index ed57a617..4ee32dfb 100644 --- a/src/Mount/Mount.c +++ b/src/Mount/Mount.c @@ -11626,6 +11626,14 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA BOOL bClearKeysEnabled = (driverConfig & VC_DRIVER_CONFIG_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION)? TRUE : FALSE; BOOL bIsHiddenOS = IsHiddenOSRunning (); + if (bClearKeysEnabled) + { + // the clear keys option works only if the service is running + if (!BootEncObj->IsSystemFavoritesServiceRunning()) + bClearKeysEnabled = false; + } + + if (!BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig, &customUserMessage, &bootLoaderVersion)) { // operations canceled @@ -11789,6 +11797,17 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA BOOL bPimCacheEnabled = IsDlgButtonChecked (hwndDlg, IDC_BOOT_LOADER_CACHE_PIM); BOOL bBlockSysEncTrimEnabled = IsDlgButtonChecked (hwndDlg, IDC_BLOCK_SYSENC_TRIM); BOOL bClearKeysEnabled = IsDlgButtonChecked (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION); + + if (bClearKeysEnabled && !BootEncObj->IsSystemFavoritesServiceRunning()) + { + // the system favorite service service should be running + // if it is not the case, report a failure and quit + std::string techInfo = SRC_POS; + techInfo += "\nIsSystemFavoritesServiceRunning = False."; + ReportUnexpectedState (techInfo.c_str()); + return 1; + } + BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim, prop.pkcs5); SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD, bPasswordCacheEnabled); SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? TRUE : FALSE); @@ -11841,7 +11860,18 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA case IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION: if (IsDlgButtonChecked (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION)) { - Warning ("CLEAR_KEYS_ON_DEVICE_INSERTION_WARNING", hwndDlg); + if (!BootEncObj->IsSystemFavoritesServiceRunning()) + { + // the system favorite service service should be running + // if it is not the case, report a failure + std::string techInfo = SRC_POS; + techInfo += "\nIsSystemFavoritesServiceRunning = False."; + ReportUnexpectedState (techInfo.c_str()); + + CheckDlgButton (hwndDlg, IDC_CLEAR_KEYS_ON_NEW_DEVICE_INSERTION, BST_UNCHECKED); + } + else + Warning ("CLEAR_KEYS_ON_DEVICE_INSERTION_WARNING", hwndDlg); } break; |