VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Driver/Ntdriver.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-10 18:43:15 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2017-06-10 18:44:49 +0200
commit458bb091bb8e6ffa73a1c7c9736e93b52a0a95d7 (patch)
tree89310156a81efcddc26062f69a3f5cd523929e41 /src/Driver/Ntdriver.c
parentc7cd89a24a3663cb375f9d6a901d34586d0d9192 (diff)
downloadVeraCrypt-458bb091bb8e6ffa73a1c7c9736e93b52a0a95d7.tar.gz
VeraCrypt-458bb091bb8e6ffa73a1c7c9736e93b52a0a95d7.zip
Windows Driver Security: Use enhanced protection of NX pool under Windows 8 and later.
Diffstat (limited to 'src/Driver/Ntdriver.c')
-rw-r--r--src/Driver/Ntdriver.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c
index a84ada37..4172a193 100644
--- a/src/Driver/Ntdriver.c
+++ b/src/Driver/Ntdriver.c
@@ -92,6 +92,9 @@ static BOOL SystemFavoriteVolumeDirty = FALSE;
static BOOL PagingFileCreationPrevented = FALSE;
static BOOL EnableExtendedIoctlSupport = FALSE;
+POOL_TYPE ExDefaultNonPagedPoolType = NonPagedPool;
+ULONG ExDefaultMdlProtection = 0;
+
PDEVICE_OBJECT VirtualVolumeDeviceObjects[MAX_MOUNTED_VOLUME_DRIVE_NUMBER + 1];
@@ -109,6 +112,13 @@ NTSTATUS DriverEntry (PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
Dump ("OsMajorVersion=%d OsMinorVersion=%d\n", OsMajorVersion, OsMinorVersion);
+ // NX pool support is available starting from Windows 8
+ if ((OsMajorVersion > 6) || (OsMajorVersion == 6 && OsMinorVersion >= 2))
+ {
+ ExDefaultNonPagedPoolType = (POOL_TYPE) NonPagedPoolNx;
+ ExDefaultMdlProtection = MdlMappingNoExecute;
+ }
+
// Load dump filter if the main driver is already loaded
if (NT_SUCCESS (TCDeviceIoControl (NT_ROOT_PREFIX, TC_IOCTL_GET_DRIVER_VERSION, NULL, 0, &version, sizeof (version))))
return DumpFilterEntry ((PFILTER_EXTENSION) DriverObject, (PFILTER_INITIALIZATION_DATA) RegistryPath);