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

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-06-15 18:19:56 -05:00 committed by Alexandre Julliard
parent 4da92f3203
commit 3e0e12d597
2 changed files with 8 additions and 4 deletions

View File

@ -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;

View File

@ -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;
}