VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-20 09:39:22 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2023-09-20 09:39:22 +0200
commit0f3ae268a4b0dfac7090f4fbf969601a1c35c86f (patch)
tree7c0a8afeae852abc98f81d402e3889d526a6fe2c /src/Common
parentb1657e88e4f7922cda6795d843b5b7723b27102f (diff)
downloadVeraCrypt-0f3ae268a4b0dfac7090f4fbf969601a1c35c86f.tar.gz
VeraCrypt-0f3ae268a4b0dfac7090f4fbf969601a1c35c86f.zip
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
Diffstat (limited to 'src/Common')
-rw-r--r--src/Common/Dlgcode.c11
-rw-r--r--src/Common/Dlgcode.h1
-rw-r--r--src/Common/Language.xml1
-rw-r--r--src/Common/Resource.h3
4 files changed, 13 insertions, 3 deletions
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 <process.h>
#include <Tlhelp32.h>
#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 @@
<entry lang="en" key="EXPANDER_EXTENDING_FILESYSTEM">Extending file system ...\n</entry>
<entry lang="en" key="PARTIAL_SYSENC_MOUNT_READONLY">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.</entry>
<entry lang="en" key="IDC_LINK_KEYFILES_EXTENSIONS_WARNING">Important information on using third-party file extensions</entry>
+ <entry lang="en" key="IDC_DISABLE_MEMORY_PROTECTION">Disable memory protection in VeraCrypt</entry>
</localization>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="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