mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-08-31 13:17:06 +00:00
Windows driver: queue volume flushes as ordered barriers
Route IRP_MJ_FLUSH_BUFFERS through EncryptedIoQueue for mounted writable non-system volumes. Flushes are represented as zero-length queue items handled by the I/O thread, so ZwFlushBuffersFile runs after earlier encrypted write fragments before completing to the caller. Also perform a best-effort ZwFlushBuffersFile before closing writable mounted-volume host handles, after the encrypted I/O queue has drained, so clean dismount/shutdown paths push the host file or raw device before close. This keeps the change focused on ordinary mounted-volume flush ordering and avoids system-encryption, boot-drive, and header-update paths.
This commit is contained in:
+12
-1
@@ -621,7 +621,18 @@ NTSTATUS TCDispatchQueueIRP (PDEVICE_OBJECT DeviceObject, PIRP Irp)
|
||||
return STATUS_PENDING;
|
||||
|
||||
case IRP_MJ_FLUSH_BUFFERS:
|
||||
return TCCompleteDiskIrp (Irp, STATUS_SUCCESS, 0);
|
||||
if (Extension->hDeviceFile == NULL || Extension->bReadOnly)
|
||||
return TCCompleteDiskIrp (Irp, STATUS_SUCCESS, 0);
|
||||
|
||||
if (!EncryptedIoQueueIsRunning (&Extension->Queue))
|
||||
return TCCompleteDiskIrp (Irp, STATUS_SUCCESS, 0);
|
||||
|
||||
ntStatus = EncryptedIoQueueAddIrp (&Extension->Queue, Irp);
|
||||
|
||||
if (ntStatus != STATUS_PENDING)
|
||||
TCCompleteDiskIrp (Irp, ntStatus, 0);
|
||||
|
||||
return ntStatus;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user