From 5c934d81227c74ef8806589997518c6823db17d3 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 3 Mar 2019 23:34:03 +0100 Subject: Windows Driver: Add IOCTL code to query RAM encryption status in VeraCrypt driver --- src/Common/Apidrvr.h | 2 ++ src/Driver/Ntdriver.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/Common/Apidrvr.h b/src/Common/Apidrvr.h index 2a6941a1..c56d9ff7 100644 --- a/src/Common/Apidrvr.h +++ b/src/Common/Apidrvr.h @@ -125,6 +125,8 @@ #define VC_IOCTL_EMERGENCY_CLEAR_ALL_KEYS TC_IOCTL (41) +#define VC_IOCTL_IS_RAM_ENCRYPTION_ENABLED TC_IOCTL (42) + // Legacy IOCTLs used before version 5.0 #define TC_IOCTL_LEGACY_GET_DRIVER_VERSION 466968 #define TC_IOCTL_LEGACY_GET_MOUNTED_VOLUMES 466948 diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c index 70b34f43..7293de2d 100644 --- a/src/Driver/Ntdriver.c +++ b/src/Driver/Ntdriver.c @@ -2796,6 +2796,15 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex } break; + case VC_IOCTL_IS_RAM_ENCRYPTION_ENABLED: + if (ValidateIOBufferSize (Irp, sizeof (int), ValidateOutput)) + { + *(int *) Irp->AssociatedIrp.SystemBuffer = IsRamEncryptionEnabled() ? 1 : 0; + Irp->IoStatus.Information = sizeof (int); + Irp->IoStatus.Status = STATUS_SUCCESS; + } + break; + default: return TCCompleteIrp (Irp, STATUS_INVALID_DEVICE_REQUEST, 0); } @@ -3204,6 +3213,8 @@ LPWSTR TCTranslateCode (ULONG ulCode) TC_CASE_RET_NAME (TC_IOCTL_WIPE_PASSWORD_CACHE); TC_CASE_RET_NAME (TC_IOCTL_WRITE_BOOT_DRIVE_SECTOR); TC_CASE_RET_NAME (VC_IOCTL_GET_DRIVE_GEOMETRY_EX); + TC_CASE_RET_NAME (VC_IOCTL_EMERGENCY_CLEAR_ALL_KEYS); + TC_CASE_RET_NAME (VC_IOCTL_IS_RAM_ENCRYPTION_ENABLED); TC_CASE_RET_NAME (IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS); -- cgit v1.2.3