Zebediah Figura : ntoskrnl.exe: Call completion callbacks with the correct device.

Alexandre Julliard julliard at winehq.org
Tue Jun 16 17:08:48 CDT 2020


Module: wine
Branch: master
Commit: 3e0e12d5975e8fef5f46387f390f664b409e315b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3e0e12d5975e8fef5f46387f390f664b409e315b

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jun 15 18:19:56 2020 -0500

ntoskrnl.exe: Call completion callbacks with the correct device.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ntoskrnl.exe/ntoskrnl.c     | 10 +++++++---
 dlls/ntoskrnl.exe/tests/driver.c |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index f0d529d6c4..2da58dc104 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;
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c
index f4b373264f..bb5bbeb4fa 100644
--- a/dlls/ntoskrnl.exe/tests/driver.c
+++ b/dlls/ntoskrnl.exe/tests/driver.c
@@ -1574,7 +1574,7 @@ static unsigned int got_completion;
 
 static NTSTATUS WINAPI completion_cb(DEVICE_OBJECT *device, IRP *irp, void *context)
 {
-    todo_wine ok(device == context, "Got device %p; expected %p.\n", device, context);
+    ok(device == context, "Got device %p; expected %p.\n", device, context);
     ++got_completion;
     return STATUS_SUCCESS;
 }




More information about the wine-cvs mailing list