[PATCH 2/2] ntoskrnl.exe: Call completion callbacks with the correct device.

Zebediah Figura z.figura12 at gmail.com
Mon Jun 15 17:58:23 CDT 2020


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/ntoskrnl.exe/ntoskrnl.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index ebdd623eec..b49b288fa9 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -1902,6 +1902,7 @@ VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
     IO_STACK_LOCATION *irpsp;
     PIO_COMPLETION_ROUTINE routine;
     NTSTATUS status, stat;
+    DEVICE_OBJECT *device;
     int call_flag = 0;
 
     TRACE( "%p %u\n", irp, priority_boost );
@@ -1923,11 +1924,14 @@ VOID WINAPI IoCompleteRequest( IRP *irp, UCHAR priority_boost )
         }
         ++irp->CurrentLocation;
         ++irp->Tail.Overlay.s.u2.CurrentStackLocation;
+        if (irp->CurrentLocation <= irp->StackCount)
+            device = IoGetCurrentIrpStackLocation(irp)->DeviceObject;
+        else
+            device = NULL;
         if (call_flag)
         {
-            TRACE( "calling %p( %p, %p, %p )\n", routine,
-                    irpsp->DeviceObject, irp, irpsp->Context );
-            stat = routine( irpsp->DeviceObject, irp, irpsp->Context );
+            TRACE( "calling %p( %p, %p, %p )\n", routine, device, irp, irpsp->Context );
+            stat = routine( device, irp, irpsp->Context );
             TRACE( "CompletionRoutine returned %x\n", stat );
             if (STATUS_MORE_PROCESSING_REQUIRED == stat)
                 return;
-- 
2.27.0




More information about the wine-devel mailing list