VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Mount
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2020-07-21 10:59:44 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2020-07-21 12:47:20 +0200
commitf9782fb3f6393b967d2997feff85d59c01a7db80 (patch)
treebe475906690b04857b551003c47b041e2b286553 /src/Mount
parent425e4e7d365795b820fa145403b2be372894c48b (diff)
downloadVeraCrypt-f9782fb3f6393b967d2997feff85d59c01a7db80.tar.gz
VeraCrypt-f9782fb3f6393b967d2997feff85d59c01a7db80.zip
Windows: Implement detection of Hibernate and Fast Startup and disable them if RAM encryption is activated.
Diffstat (limited to 'src/Mount')
-rw-r--r--src/Mount/Mount.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Mount/Mount.c b/src/Mount/Mount.c
index 7d4fa81b..ff66fab5 100644
--- a/src/Mount/Mount.c
+++ b/src/Mount/Mount.c
@@ -11462,7 +11462,26 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
{
BOOL originalRamEncryptionEnabled = (driverConfig & VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION)? TRUE : FALSE;
if (originalRamEncryptionEnabled != enableRamEncryption)
+ {
+ if (enableRamEncryption)
+ {
+ // Disable Hibernate and Fast Startup if they are enabled
+ BOOL bHibernateEnabled, bHiberbootEnabled;
+ if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled))
+ {
+ if (bHibernateEnabled)
+ {
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Power", L"HibernateEnabled", 0);
+ }
+
+ if (bHiberbootEnabled)
+ {
+ BootEncObj->WriteLocalMachineRegistryDwordValue (L"SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Power", L"HiberbootEnabled", 0);
+ }
+ }
+ }
rebootRequired = true;
+ }
SetDriverConfigurationFlag (VC_DRIVER_CONFIG_ENABLE_RAM_ENCRYPTION, enableRamEncryption);
}
@@ -11538,7 +11557,25 @@ static BOOL CALLBACK PerformanceSettingsDlgProc (HWND hwndDlg, UINT msg, WPARAM
BOOL enableRamEncryption = IsDlgButtonChecked (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION);
if (originalRamEncryptionEnabled != enableRamEncryption)
+ {
+ if (enableRamEncryption)
+ {
+ // check if Hibernate or Fast Startup are enabled
+ BOOL bHibernateEnabled, bHiberbootEnabled;
+ if (GetHibernateStatus (bHibernateEnabled, bHiberbootEnabled))
+ {
+ if (bHibernateEnabled || bHiberbootEnabled)
+ {
+ if (AskWarnYesNo ("RAM_ENCRYPTION_DISABLE_HIBERNATE", hwndDlg) == IDNO)
+ {
+ CheckDlgButton (hwndDlg, IDC_ENABLE_RAM_ENCRYPTION, BST_UNCHECKED);
+ return 1;
+ }
+ }
+ }
+ }
Warning ("SETTING_REQUIRES_REBOOT", hwndDlg);
+ }
}
return 1;