ntoskrnl.exe: Implement IoGetCurrentProcess.
Based on patch by Derek Lesho. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=29460 Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2be769d648
commit
6ebc223955
|
@ -2477,8 +2477,7 @@ POBJECT_TYPE PsProcessType = &process_type;
|
|||
*/
|
||||
PEPROCESS WINAPI IoGetCurrentProcess(void)
|
||||
{
|
||||
FIXME("() stub\n");
|
||||
return NULL;
|
||||
return KeGetCurrentThread()->process;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -2505,6 +2504,7 @@ static void *create_thread_object( HANDLE handle )
|
|||
{
|
||||
THREAD_BASIC_INFORMATION info;
|
||||
struct _KTHREAD *thread;
|
||||
HANDLE process;
|
||||
|
||||
if (!(thread = alloc_kernel_object( PsThreadType, handle, sizeof(*thread), 0 ))) return NULL;
|
||||
|
||||
|
@ -2512,7 +2512,15 @@ static void *create_thread_object( HANDLE handle )
|
|||
thread->header.WaitListHead.Blink = INVALID_HANDLE_VALUE; /* mark as kernel object */
|
||||
|
||||
if (!NtQueryInformationThread( handle, ThreadBasicInformation, &info, sizeof(info), NULL ))
|
||||
{
|
||||
thread->id = info.ClientId;
|
||||
if ((process = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, HandleToUlong(thread->id.UniqueProcess) )))
|
||||
{
|
||||
kernel_object_from_handle( process, PsProcessType, (void**)&thread->process );
|
||||
NtClose( process );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return thread;
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ struct _EPROCESS {
|
|||
struct _KTHREAD
|
||||
{
|
||||
DISPATCHER_HEADER header;
|
||||
PEPROCESS process;
|
||||
CLIENT_ID id;
|
||||
};
|
||||
|
||||
|
|
|
@ -321,14 +321,19 @@ static NTSTATUS wait_single_handle(HANDLE handle, ULONGLONG timeout)
|
|||
|
||||
static void test_currentprocess(void)
|
||||
{
|
||||
DISPATCHER_HEADER *header;
|
||||
PEPROCESS current;
|
||||
PETHREAD thread;
|
||||
NTSTATUS ret;
|
||||
|
||||
current = IoGetCurrentProcess();
|
||||
todo_wine
|
||||
ok(current != NULL, "Expected current process to be non-NULL\n");
|
||||
|
||||
header = (DISPATCHER_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);
|
||||
|
|
Loading…
Reference in New Issue