Skip to content

Commit

Permalink
Windows driver: Use IO_DISK_INCREMENT for event signaling in IRP comp…
Browse files Browse the repository at this point in the history
…letion routine

This provides a slight priority boost for waiting threads and maintains standard practice for disk device drivers.
  • Loading branch information
idrassi committed Dec 25, 2024
1 parent d9e1752 commit f3af65b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Driver/EncryptedIoQueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ static VOID CompleteIrpWorkItemRoutine(PDEVICE_OBJECT DeviceObject, PVOID Contex
// If no active work items remain, signal the event
if (InterlockedDecrement(&queue->ActiveWorkItems) == 0)
{
KeSetEvent(&queue->NoActiveWorkItemsEvent, IO_NO_INCREMENT, FALSE);
KeSetEvent(&queue->NoActiveWorkItemsEvent, IO_DISK_INCREMENT, FALSE);
}

// Return the work item to the free list
Expand All @@ -336,7 +336,7 @@ static VOID CompleteIrpWorkItemRoutine(PDEVICE_OBJECT DeviceObject, PVOID Contex
KeReleaseSpinLock(&queue->WorkItemLock, oldIrql);

// Release the semaphore to signal that a work item is available
KeReleaseSemaphore(&queue->WorkItemSemaphore, IO_NO_INCREMENT, 1, FALSE);
KeReleaseSemaphore(&queue->WorkItemSemaphore, IO_DISK_INCREMENT, 1, FALSE);

// Free the item
ReleasePoolBuffer(queue, item);
Expand Down

0 comments on commit f3af65b

Please sign in to comment.