diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-23 17:44:48 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-23 17:44:48 +0100 |
commit | 453ff2880e1e59e1471d3f16804315879128ce46 (patch) | |
tree | 9c7a143d1f5ff91d12e41718d562a430ef6f0e73 /src/Driver/Ntdriver.c | |
parent | 5a85c54c6ef556b96cc1ed844620a4ccee1b7837 (diff) | |
download | VeraCrypt-453ff2880e1e59e1471d3f16804315879128ce46.tar.gz VeraCrypt-453ff2880e1e59e1471d3f16804315879128ce46.zip |
Windows Driver: Make max work items count configurable. Increase default to 1024. Queue write IRPs.
- Made the maximum work items count configurable to allow flexibility based on system needs.
- Increased the default value of max work items count to 1024 to better handle high-throughput scenarios.
- Queue write IRPs in system worker thread to avoid potential deadlocks in write scenarios.
Diffstat (limited to 'src/Driver/Ntdriver.c')
-rw-r--r-- | src/Driver/Ntdriver.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c index ac2fb00a..12943dc8 100644 --- a/src/Driver/Ntdriver.c +++ b/src/Driver/Ntdriver.c @@ -145,6 +145,7 @@ static BOOL RamEncryptionActivated = FALSE; int EncryptionIoRequestCount = 0; int EncryptionItemCount = 0; int EncryptionFragmentSize = 0; +int EncryptionMaxWorkItems = 0; PDEVICE_OBJECT VirtualVolumeDeviceObjects[MAX_MOUNTED_VOLUME_DRIVE_NUMBER + 1]; @@ -2776,6 +2777,7 @@ NTSTATUS ProcessMainDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Ex if (ValidateIOBufferSize (Irp, sizeof (EncryptionQueueParameters), ValidateOutput)) { EncryptionQueueParameters* pParams = (EncryptionQueueParameters*) Irp->AssociatedIrp.SystemBuffer; + pParams->EncryptionMaxWorkItems = EncryptionMaxWorkItems; pParams->EncryptionFragmentSize = EncryptionFragmentSize; pParams->EncryptionIoRequestCount = EncryptionIoRequestCount; pParams->EncryptionItemCount = EncryptionItemCount; @@ -4646,6 +4648,14 @@ NTSTATUS ReadRegistryConfigFlags (BOOL driverEntry) TCfree (data); } + if (driverEntry && NT_SUCCESS(TCReadRegistryKey(&name, VC_ENCRYPTION_MAX_WORK_ITEMS, &data))) + { + if (data->Type == REG_DWORD) + EncryptionMaxWorkItems = *(uint32*)data->Data; + + TCfree(data); + } + if (driverEntry) { if (EncryptionIoRequestCount < TC_ENC_IO_QUEUE_PREALLOCATED_IO_REQUEST_COUNT) @@ -4663,6 +4673,9 @@ NTSTATUS ReadRegistryConfigFlags (BOOL driverEntry) EncryptionFragmentSize = TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE; else if (EncryptionFragmentSize > (8 * TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE)) EncryptionFragmentSize = 8 * TC_ENC_IO_QUEUE_MAX_FRAGMENT_SIZE; + + if (EncryptionMaxWorkItems == 0) + EncryptionMaxWorkItems = VC_MAX_WORK_ITEMS; } |