ntoskrnl.exe: Set IRP caller thread.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-05-30 13:12:25 +02:00 committed by Alexandre Julliard
parent 7f0883ae88
commit 828ac9880d
2 changed files with 10 additions and 0 deletions

View file

@ -1363,6 +1363,7 @@ PIRP WINAPI IoBuildDeviceIoControlRequest( ULONG code, PDEVICE_OBJECT device,
irp->UserBuffer = out_buff;
irp->UserIosb = iosb;
irp->UserEvent = event;
irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
return irp;
}
@ -1415,6 +1416,7 @@ PIRP WINAPI IoBuildAsynchronousFsdRequest(ULONG majorfunc, DEVICE_OBJECT *device
irp->UserIosb = iosb;
irp->UserEvent = NULL;
irp->UserBuffer = buffer;
irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
return irp;
}

View file

@ -239,6 +239,8 @@ static void test_irp_struct(IRP *irp, DEVICE_OBJECT *device)
ok(irpsp->DeviceObject == device, "unexpected DeviceObject\n");
ok(irpsp->FileObject->DeviceObject == device, "unexpected FileObject->DeviceObject\n");
ok(!irp->UserEvent, "UserEvent = %p\n", irp->UserEvent);
ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(),
"IRP thread is not the current thread\n");
}
static void test_mdl_map(void)
@ -751,6 +753,8 @@ static void test_call_driver(DEVICE_OBJECT *device)
ok(!irp->CancelRoutine, "CancelRoutine = %x\n", irp->CancelRoutine);
ok(!irp->UserEvent, "UserEvent = %p\n", irp->UserEvent);
ok(irp->CurrentLocation == 2, "CurrentLocation = %u\n", irp->CurrentLocation);
ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(),
"IRP thread is not the current thread\n");
irpsp = IoGetNextIrpStackLocation(irp);
ok(irpsp->MajorFunction == IRP_MJ_FLUSH_BUFFERS, "MajorFunction = %u\n", irpsp->MajorFunction);
@ -773,6 +777,8 @@ static void test_call_driver(DEVICE_OBJECT *device)
ok(!irp->CancelRoutine, "CancelRoutine = %x\n", irp->CancelRoutine);
ok(irp->UserEvent == &event, "UserEvent = %p\n", irp->UserEvent);
ok(irp->CurrentLocation == 2, "CurrentLocation = %u\n", irp->CurrentLocation);
ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(),
"IRP thread is not the current thread\n");
irpsp = IoGetNextIrpStackLocation(irp);
ok(irpsp->MajorFunction == IRP_MJ_FLUSH_BUFFERS, "MajorFunction = %u\n", irpsp->MajorFunction);
@ -1698,6 +1704,8 @@ static NTSTATUS WINAPI driver_FlushBuffers(DEVICE_OBJECT *device, IRP *irp)
{
IO_STACK_LOCATION *irpsp = IoGetCurrentIrpStackLocation(irp);
ok(irpsp->DeviceObject == device, "device != DeviceObject\n");
ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(),
"IRP thread is not the current thread\n");
IoMarkIrpPending(irp);
return STATUS_PENDING;
}