Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29460
Signed-off-by: Derek Lesho dereklesho52@Gmail.com --- dlls/ntoskrnl.exe/ntoskrnl.c | 6 ++++-- dlls/ntoskrnl.exe/ntoskrnl_private.h | 1 + dlls/ntoskrnl.exe/tests/driver.c | 9 ++++++++- 3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 533ac662d1..711386c5ad 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -2478,8 +2478,7 @@ POBJECT_TYPE PsProcessType = &process_type; */ PEPROCESS WINAPI IoGetCurrentProcess(void) { - FIXME("() stub\n"); - return NULL; + return KeGetCurrentThread()->process; }
/*********************************************************************** @@ -2528,6 +2527,9 @@ static void *create_thread_object( HANDLE handle ) NtClose( info_handle ); }
+ PsLookupProcessByProcessId( thread->id.UniqueProcess, &thread->process ); + ObDereferenceObject( thread->process ); + thread->critical_region_count = 0;
return thread; diff --git a/dlls/ntoskrnl.exe/ntoskrnl_private.h b/dlls/ntoskrnl.exe/ntoskrnl_private.h index 4f5ae14cfb..5c62e0d29c 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl_private.h +++ b/dlls/ntoskrnl.exe/ntoskrnl_private.h @@ -37,6 +37,7 @@ struct _KTHREAD DISPATCHER_HEADER header; CLIENT_ID id; unsigned int critical_region_count; + PEPROCESS process; };
void *alloc_kernel_object( POBJECT_TYPE type, HANDLE handle, SIZE_T size, LONG ref ) DECLSPEC_HIDDEN; diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index f70f865c40..0410c32ccc 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -326,9 +326,16 @@ static void test_currentprocess(void) NTSTATUS ret;
current = IoGetCurrentProcess(); -todo_wine ok(current != NULL, "Expected current process to be non-NULL\n");
+ if (!!current) + { + DISPATCHER_HEADER *header = current; + ok(header->Type == 3, "header->Type != 3, = %u\n", header->Type); + ret = wait_single( current, 0 ); + ok(ret == STATUS_TIMEOUT, "got %#x\n", ret); + } + thread = PsGetCurrentThread(); ret = wait_single( thread, 0 ); ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);