diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index a3dd7b93621..18b17f89fd8 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -3911,3 +3911,12 @@ ULONG WINAPI ExSetTimerResolution(ULONG time, BOOLEAN set_resolution) FIXME("stub: %u %d\n", time, set_resolution); return KeQueryTimeIncrement(); } + +/*********************************************************************** + * IoGetRequestorProcess (NTOSKRNL.EXE.@) + */ +PEPROCESS WINAPI IoGetRequestorProcess(IRP *irp) +{ + TRACE("irp %p.\n", irp); + return irp->Tail.Overlay.Thread->kthread.process; +} diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index 88c1a06cbeb..ddc3f72b8e3 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -406,7 +406,7 @@ @ stub IoGetInitialStack @ stub IoGetLowerDeviceObject @ stdcall IoGetRelatedDeviceObject(ptr) -@ stub IoGetRequestorProcess +@ stdcall IoGetRequestorProcess(ptr) @ stub IoGetRequestorProcessId @ stub IoGetRequestorSessionId @ stdcall IoGetStackLimits(ptr ptr) diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index 6ab3c622aec..0506011ce56 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -225,6 +225,8 @@ static void test_irp_struct(IRP *irp, DEVICE_OBJECT *device) ok(!irp->UserEvent, "UserEvent = %p\n", irp->UserEvent); ok(irp->Tail.Overlay.Thread == (PETHREAD)KeGetCurrentThread(), "IRP thread is not the current thread\n"); + + ok(IoGetRequestorProcess(irp) == IoGetCurrentProcess(), "processes didn't match\n"); } static void test_mdl_map(void) diff --git a/include/ddk/ntifs.h b/include/ddk/ntifs.h index b287b067992..39636e80730 100644 --- a/include/ddk/ntifs.h +++ b/include/ddk/ntifs.h @@ -131,6 +131,7 @@ typedef struct _FS_FILTER_CALLBACKS BOOLEAN WINAPI FsRtlIsNameInExpression(PUNICODE_STRING, PUNICODE_STRING, BOOLEAN, PWCH); DEVICE_OBJECT * WINAPI IoGetAttachedDevice(DEVICE_OBJECT*); +PEPROCESS WINAPI IoGetRequestorProcess(IRP*); NTSTATUS WINAPI ObOpenObjectByPointer(void*,ULONG,PACCESS_STATE,ACCESS_MASK,POBJECT_TYPE,KPROCESSOR_MODE,HANDLE*); NTSTATUS WINAPI ObQueryNameString(PVOID,POBJECT_NAME_INFORMATION,ULONG,PULONG); BOOLEAN WINAPI PsIsSystemThread(PETHREAD);