mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-11-28 14:03:29 +01:00
Windows: Only update boot configuration on disk if the user actually changed something in the UI
This commit is contained in:
parent
2722b46530
commit
b1b692d4a3
@ -11599,6 +11599,8 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
|||||||
{
|
{
|
||||||
WORD lw = LOWORD (wParam);
|
WORD lw = LOWORD (wParam);
|
||||||
static std::string platforminfo;
|
static std::string platforminfo;
|
||||||
|
static byte currentUserConfig;
|
||||||
|
static string currentCustomUserMessage;
|
||||||
|
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
@ -11640,6 +11642,10 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we store current configuration in order to be able to detect if user changed it or not after clicking OK
|
||||||
|
currentUserConfig = userConfig;
|
||||||
|
currentCustomUserMessage = customUserMessage;
|
||||||
|
|
||||||
if (bootLoaderVersion != VERSION_NUM)
|
if (bootLoaderVersion != VERSION_NUM)
|
||||||
Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES", hwndDlg);
|
Warning ("BOOT_LOADER_VERSION_INCORRECT_PREFERENCES", hwndDlg);
|
||||||
|
|
||||||
@ -11709,11 +11715,16 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
std::string dcsprop = ReadESPFile (L"\\EFI\\VeraCrypt\\DcsProp", true);
|
std::string currentDcsprop = ReadESPFile (L"\\EFI\\VeraCrypt\\DcsProp", true);
|
||||||
|
std::string dcsprop = currentDcsprop;
|
||||||
|
|
||||||
while (TextEditDialogBox(FALSE, hwndDlg, GetString ("BOOT_LOADER_CONFIGURATION_FILE"), dcsprop) == IDOK)
|
while (TextEditDialogBox(FALSE, hwndDlg, GetString ("BOOT_LOADER_CONFIGURATION_FILE"), dcsprop) == IDOK)
|
||||||
{
|
{
|
||||||
if (validateDcsPropXml (dcsprop.c_str()))
|
if (dcsprop == currentDcsprop)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else if (validateDcsPropXml (dcsprop.c_str()))
|
||||||
{
|
{
|
||||||
WriteESPFile (L"\\EFI\\VeraCrypt\\DcsProp", (LPBYTE) dcsprop.c_str(), (DWORD) dcsprop.size(), true);
|
WriteESPFile (L"\\EFI\\VeraCrypt\\DcsProp", (LPBYTE) dcsprop.c_str(), (DWORD) dcsprop.size(), true);
|
||||||
break;
|
break;
|
||||||
@ -11753,17 +11764,7 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
|||||||
if (!bSystemIsGPT)
|
if (!bSystemIsGPT)
|
||||||
GetDlgItemTextA (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage, sizeof (customUserMessage));
|
GetDlgItemTextA (hwndDlg, IDC_CUSTOM_BOOT_LOADER_MESSAGE, customUserMessage, sizeof (customUserMessage));
|
||||||
|
|
||||||
byte userConfig;
|
byte userConfig = currentUserConfig;
|
||||||
try
|
|
||||||
{
|
|
||||||
if (!BootEncObj->ReadBootSectorConfig (nullptr, 0, &userConfig))
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
catch (Exception &e)
|
|
||||||
{
|
|
||||||
e.Show (hwndDlg);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT))
|
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_PIM_PROMPT))
|
||||||
userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_PIM;
|
userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_PIM;
|
||||||
@ -11772,22 +11773,22 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
|||||||
|
|
||||||
if (bSystemIsGPT)
|
if (bSystemIsGPT)
|
||||||
{
|
{
|
||||||
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_HASH_PROMPT))
|
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_HASH_PROMPT))
|
||||||
userConfig |= TC_BOOT_USER_CFG_FLAG_STORE_HASH;
|
userConfig |= TC_BOOT_USER_CFG_FLAG_STORE_HASH;
|
||||||
else
|
else
|
||||||
userConfig &= ~TC_BOOT_USER_CFG_FLAG_STORE_HASH;
|
userConfig &= ~TC_BOOT_USER_CFG_FLAG_STORE_HASH;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT))
|
if (IsDlgButtonChecked (hwndDlg, IDC_DISABLE_BOOT_LOADER_OUTPUT))
|
||||||
userConfig |= TC_BOOT_USER_CFG_FLAG_SILENT_MODE;
|
userConfig |= TC_BOOT_USER_CFG_FLAG_SILENT_MODE;
|
||||||
else
|
else
|
||||||
userConfig &= ~TC_BOOT_USER_CFG_FLAG_SILENT_MODE;
|
userConfig &= ~TC_BOOT_USER_CFG_FLAG_SILENT_MODE;
|
||||||
|
|
||||||
if (!IsDlgButtonChecked (hwndDlg, IDC_ALLOW_ESC_PBA_BYPASS))
|
if (!IsDlgButtonChecked (hwndDlg, IDC_ALLOW_ESC_PBA_BYPASS))
|
||||||
userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_ESC;
|
userConfig |= TC_BOOT_USER_CFG_FLAG_DISABLE_ESC;
|
||||||
else
|
else
|
||||||
userConfig &= ~TC_BOOT_USER_CFG_FLAG_DISABLE_ESC;
|
userConfig &= ~TC_BOOT_USER_CFG_FLAG_DISABLE_ESC;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -11807,7 +11808,10 @@ static BOOL CALLBACK BootLoaderPreferencesDlgProc (HWND hwndDlg, UINT msg, WPARA
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim, prop.pkcs5);
|
// only write boot configuration if something changed
|
||||||
|
if ((userConfig != currentUserConfig) || (!bSystemIsGPT && (customUserMessage != currentCustomUserMessage)))
|
||||||
|
BootEncObj->WriteBootSectorUserConfig (userConfig, customUserMessage, prop.volumePim, prop.pkcs5);
|
||||||
|
|
||||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD, bPasswordCacheEnabled);
|
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PASSWORD, bPasswordCacheEnabled);
|
||||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? TRUE : FALSE);
|
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_CACHE_BOOT_PIM, (bPasswordCacheEnabled && bPimCacheEnabled)? TRUE : FALSE);
|
||||||
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_EVIL_MAID_ATTACK_DETECTION, IsDlgButtonChecked (hwndDlg, IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION));
|
SetDriverConfigurationFlag (TC_DRIVER_CONFIG_DISABLE_EVIL_MAID_ATTACK_DETECTION, IsDlgButtonChecked (hwndDlg, IDC_DISABLE_EVIL_MAID_ATTACK_DETECTION));
|
||||||
|
Loading…
Reference in New Issue
Block a user