Zebediah Figura : ntoskrnl.exe: Set the IRP thread also for create and close requests.
Alexandre Julliard
julliard at winehq.org
Thu Aug 22 15:09:54 CDT 2019
Module: wine
Branch: master
Commit: 37652d5cc4aed514581e2b3579520c955a0436e1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=37652d5cc4aed514581e2b3579520c955a0436e1
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Wed Aug 21 23:16:53 2019 -0500
ntoskrnl.exe: Set the IRP thread also for create and close requests.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47623
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntoskrnl.exe/ntoskrnl.c | 2 ++
dlls/ntoskrnl.exe/tests/driver.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
index 258c769..a3dd7b9 100644
--- a/dlls/ntoskrnl.exe/ntoskrnl.c
+++ b/dlls/ntoskrnl.exe/ntoskrnl.c
@@ -528,6 +528,7 @@ static NTSTATUS dispatch_create( struct dispatch_context *context )
irpsp->Parameters.Create.EaLength = 0;
irp->Tail.Overlay.OriginalFileObject = file;
+ irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
irp->RequestorMode = UserMode;
irp->AssociatedIrp.SystemBuffer = NULL;
irp->UserBuffer = NULL;
@@ -565,6 +566,7 @@ static NTSTATUS dispatch_close( struct dispatch_context *context )
irpsp->FileObject = file;
irp->Tail.Overlay.OriginalFileObject = file;
+ irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
irp->RequestorMode = UserMode;
irp->AssociatedIrp.SystemBuffer = NULL;
irp->UserBuffer = NULL;
diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c
index dc583f9..6ab3c62 100644
--- a/dlls/ntoskrnl.exe/tests/driver.c
+++ b/dlls/ntoskrnl.exe/tests/driver.c
@@ -60,6 +60,8 @@ static POBJECT_TYPE *pExEventObjectType, *pIoFileObjectType, *pPsThreadType, *pI
static PEPROCESS *pPsInitialSystemProcess;
static void *create_caller_thread;
+static PETHREAD create_irp_thread;
+
void WINAPI ObfReferenceObject( void *obj );
NTSTATUS WINAPI ZwQueryInformationProcess(HANDLE,PROCESSINFOCLASS,void*,ULONG,ULONG*);
@@ -342,7 +344,10 @@ static void test_current_thread(BOOL is_system)
ok(PsGetThreadId((PETHREAD)KeGetCurrentThread()) == PsGetCurrentThreadId(), "thread IDs don't match\n");
ok(PsIsSystemThread((PETHREAD)KeGetCurrentThread()) == is_system, "unexpected system thread\n");
if (!is_system)
+ {
ok(create_caller_thread == KeGetCurrentThread(), "thread is not create caller thread\n");
+ ok(create_irp_thread == (PETHREAD)KeGetCurrentThread(), "thread of create request is not current thread\n");
+ }
ret = ObOpenObjectByPointer(current, OBJ_KERNEL_HANDLE, NULL, PROCESS_QUERY_INFORMATION, NULL, KernelMode, &process_handle);
ok(!ret, "ObOpenObjectByPointer failed: %#x\n", ret);
@@ -1864,6 +1869,7 @@ static NTSTATUS WINAPI driver_Create(DEVICE_OBJECT *device, IRP *irp)
*context = create_count;
irpsp->FileObject->FsContext = context;
create_caller_thread = KeGetCurrentThread();
+ create_irp_thread = irp->Tail.Overlay.Thread;
irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(irp, IO_NO_INCREMENT);
More information about the wine-cvs
mailing list