mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: Implement detection of Hibernate and Fast Startup and disable them if RAM encryption is activated.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user