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@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2019-08-21 23:16:53 -05:00 committed by Alexandre Julliard
parent 8ce1c66b5e
commit 37652d5cc4
2 changed files with 8 additions and 0 deletions

View File

@ -528,6 +528,7 @@ static NTSTATUS dispatch_create( struct dispatch_context *context )
irpsp->Parameters.Create.EaLength = 0; irpsp->Parameters.Create.EaLength = 0;
irp->Tail.Overlay.OriginalFileObject = file; irp->Tail.Overlay.OriginalFileObject = file;
irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
irp->RequestorMode = UserMode; irp->RequestorMode = UserMode;
irp->AssociatedIrp.SystemBuffer = NULL; irp->AssociatedIrp.SystemBuffer = NULL;
irp->UserBuffer = NULL; irp->UserBuffer = NULL;
@ -565,6 +566,7 @@ static NTSTATUS dispatch_close( struct dispatch_context *context )
irpsp->FileObject = file; irpsp->FileObject = file;
irp->Tail.Overlay.OriginalFileObject = file; irp->Tail.Overlay.OriginalFileObject = file;
irp->Tail.Overlay.Thread = (PETHREAD)KeGetCurrentThread();
irp->RequestorMode = UserMode; irp->RequestorMode = UserMode;
irp->AssociatedIrp.SystemBuffer = NULL; irp->AssociatedIrp.SystemBuffer = NULL;
irp->UserBuffer = NULL; irp->UserBuffer = NULL;

View File

@ -60,6 +60,8 @@ static POBJECT_TYPE *pExEventObjectType, *pIoFileObjectType, *pPsThreadType, *pI
static PEPROCESS *pPsInitialSystemProcess; static PEPROCESS *pPsInitialSystemProcess;
static void *create_caller_thread; static void *create_caller_thread;
static PETHREAD create_irp_thread;
void WINAPI ObfReferenceObject( void *obj ); void WINAPI ObfReferenceObject( void *obj );
NTSTATUS WINAPI ZwQueryInformationProcess(HANDLE,PROCESSINFOCLASS,void*,ULONG,ULONG*); 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(PsGetThreadId((PETHREAD)KeGetCurrentThread()) == PsGetCurrentThreadId(), "thread IDs don't match\n");
ok(PsIsSystemThread((PETHREAD)KeGetCurrentThread()) == is_system, "unexpected system thread\n"); ok(PsIsSystemThread((PETHREAD)KeGetCurrentThread()) == is_system, "unexpected system thread\n");
if (!is_system) if (!is_system)
{
ok(create_caller_thread == KeGetCurrentThread(), "thread is not create caller thread\n"); 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); ret = ObOpenObjectByPointer(current, OBJ_KERNEL_HANDLE, NULL, PROCESS_QUERY_INFORMATION, NULL, KernelMode, &process_handle);
ok(!ret, "ObOpenObjectByPointer failed: %#x\n", ret); ok(!ret, "ObOpenObjectByPointer failed: %#x\n", ret);
@ -1864,6 +1869,7 @@ static NTSTATUS WINAPI driver_Create(DEVICE_OBJECT *device, IRP *irp)
*context = create_count; *context = create_count;
irpsp->FileObject->FsContext = context; irpsp->FileObject->FsContext = context;
create_caller_thread = KeGetCurrentThread(); create_caller_thread = KeGetCurrentThread();
create_irp_thread = irp->Tail.Overlay.Thread;
irp->IoStatus.Status = STATUS_SUCCESS; irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(irp, IO_NO_INCREMENT); IoCompleteRequest(irp, IO_NO_INCREMENT);