Jacek Caban : ntoskrnl.exe: Set IRP caller thread.

Alexandre Julliard julliard at winehq.org
Thu May 30 16:27:13 CDT 2019


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu May 30 13:12:25 2019 +0200

ntoskrnl.exe: Set IRP caller thread.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

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

diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index df8c4c1..7ef3159 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -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;
 }
 
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c
index c08452b..468b183 100644
--- a/dlls/ntoskrnl.exe/tests/driver.c
+++ b/dlls/ntoskrnl.exe/tests/driver.c
@@ -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;
 }




More information about the wine-cvs mailing list