VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-24 12:48:34 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-24 12:48:34 +0200
commit718f11d9c381b7a007346744a033fc37c09e9f1c (patch)
tree6c503f1936f574d1d1c9632d33e45494be8ca103 /src
parent2363506e099a8e55b6010f10f71ff8ea8e1c6dfc (diff)
downloadVeraCrypt-718f11d9c381b7a007346744a033fc37c09e9f1c.tar.gz
VeraCrypt-718f11d9c381b7a007346744a033fc37c09e9f1c.zip
Windows: make Setup correctly manage option to disable memory protection during upgrade
Diffstat (limited to 'src')
-rw-r--r--src/Setup/Setup.c6
-rw-r--r--src/Setup/Setup.h1
-rw-r--r--src/Setup/Wizard.c3
3 files changed, 8 insertions, 2 deletions
diff --git a/src/Setup/Setup.c b/src/Setup/Setup.c
index f757aafa..fe25a412 100644
--- a/src/Setup/Setup.c
+++ b/src/Setup/Setup.c
@@ -75,6 +75,7 @@ BOOL bSystemRestore = TRUE;
BOOL bDisableSwapFiles = FALSE;
BOOL bForAllUsers = TRUE;
BOOL bDisableMemoryProtection = FALSE;
+BOOL bOriginalDisableMemoryProtection = FALSE;
BOOL bRegisterFileExt = TRUE;
BOOL bAddToStartMenu = TRUE;
BOOL bDesktopIcon = TRUE;
@@ -2336,9 +2337,10 @@ void DoInstall (void *arg)
if (bSystemRestore)
SetSystemRestorePoint (hwndDlg, TRUE);
- if (bOK && bDisableMemoryProtection)
+ if (bOK && (bDisableMemoryProtection != bOriginalDisableMemoryProtection))
{
- WriteMemoryProtectionConfig(FALSE);
+ WriteMemoryProtectionConfig(bDisableMemoryProtection? FALSE : TRUE);
+ bRestartRequired = TRUE; // Restart is required to apply the new memory protection settings
}
if (bOK)
diff --git a/src/Setup/Setup.h b/src/Setup/Setup.h
index d284586a..70a04555 100644
--- a/src/Setup/Setup.h
+++ b/src/Setup/Setup.h
@@ -121,6 +121,7 @@ extern BOOL bSystemRestore;
extern BOOL bDisableSwapFiles;
extern BOOL bForAllUsers;
extern BOOL bDisableMemoryProtection;
+extern BOOL bOriginalDisableMemoryProtection;
extern BOOL bRegisterFileExt;
extern BOOL bAddToStartMenu;
extern BOOL bDesktopIcon;
diff --git a/src/Setup/Wizard.c b/src/Setup/Wizard.c
index 3dcb138e..abf76f69 100644
--- a/src/Setup/Wizard.c
+++ b/src/Setup/Wizard.c
@@ -883,6 +883,9 @@ BOOL CALLBACK MainDialogProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
DonColorSchemeId = GetDonVal (2, 9);
+ // get the initial value of bDisableMemoryProtection by reading the registry
+ bDisableMemoryProtection = bOriginalDisableMemoryProtection = ReadMemoryProtectionConfig()? FALSE : TRUE;
+
if (bDevm)
{
InitWizardDestInstallPath ();