From 0f3ae268a4b0dfac7090f4fbf969601a1c35c86f Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Wed, 20 Sep 2023 09:39:22 +0200 Subject: Windows: Add setting in main UI and setup wizard to disable memory protection This can be useful for users who need Accessibility software that may not work when memory protection is active in VeraCrypt --- src/Common/Dlgcode.c | 11 +++++++++-- src/Common/Dlgcode.h | 1 + src/Common/Language.xml | 1 + src/Common/Resource.h | 3 ++- 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/Common') diff --git a/src/Common/Dlgcode.c b/src/Common/Dlgcode.c index 8f357208..fb7184b4 100644 --- a/src/Common/Dlgcode.c +++ b/src/Common/Dlgcode.c @@ -32,8 +32,8 @@ #include #include #endif -#ifdef _WIN32_WINNT >= 0x0602 -#include "processthreadsapi.h"" +#if _WIN32_WINNT >= 0x0602 +#include "processthreadsapi.h" #endif #include "Resource.h" @@ -3256,6 +3256,13 @@ BOOL ReadMemoryProtectionConfig () return (config)? TRUE: FALSE; } +BOOL WriteMemoryProtectionConfig (BOOL bEnable) +{ + DWORD config = bEnable? 1: 0; + + return WriteLocalMachineRegistryDword (L"SYSTEM\\CurrentControlSet\\Services\\veracrypt", VC_ENABLE_MEMORY_PROTECTION, config); +} + BOOL LoadSysEncSettings () { BOOL status = TRUE; diff --git a/src/Common/Dlgcode.h b/src/Common/Dlgcode.h index 245df6c1..7947fcf9 100644 --- a/src/Common/Dlgcode.h +++ b/src/Common/Dlgcode.h @@ -350,6 +350,7 @@ uint32 ReadDriverConfigurationFlags (); uint32 ReadServiceConfigurationFlags (); uint32 ReadEncryptionThreadPoolFreeCpuCountLimit (); BOOL ReadMemoryProtectionConfig (); +BOOL WriteMemoryProtectionConfig (BOOL bEnable); BOOL LoadSysEncSettings (); int LoadNonSysInPlaceEncSettings (WipeAlgorithmId *wipeAlgorithm); void RemoveNonSysInPlaceEncNotifications (void); diff --git a/src/Common/Language.xml b/src/Common/Language.xml index e819be47..ddb20159 100644 --- a/src/Common/Language.xml +++ b/src/Common/Language.xml @@ -1633,6 +1633,7 @@ Extending file system ...\n Warning: The system partition you attempted to mount was not fully encrypted. As a safety measure to prevent potential corruption or unwanted modifications, volume '%s' was mounted as read-only. Important information on using third-party file extensions + Disable memory protection in VeraCrypt diff --git a/src/Common/Resource.h b/src/Common/Resource.h index a099c655..b6ad14c0 100644 --- a/src/Common/Resource.h +++ b/src/Common/Resource.h @@ -226,6 +226,7 @@ #define IDC_DISABLE_MOUNT_MANAGER 5142 #define IDC_KEYFILES_SIZE_UNIT 5143 #define IDC_LINK_KEYFILES_EXTENSIONS_WARNING 5144 +#define IDC_DISABLE_MEMORY_PROTECTION 5145 // Next default values for new objects // @@ -234,7 +235,7 @@ #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 578 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 5145 +#define _APS_NEXT_CONTROL_VALUE 5146 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif -- cgit v1.2.3