ntoskrnl.exe: Implement PsGetProcessId.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-04-29 16:01:34 +02:00 committed by Alexandre Julliard
parent 1c2d517242
commit eb1146a500
4 changed files with 16 additions and 11 deletions

View File

@ -2462,6 +2462,7 @@ static void *create_process_object( HANDLE handle )
process->header.Type = 3;
process->header.WaitListHead.Blink = INVALID_HANDLE_VALUE; /* mark as kernel object */
NtQueryInformationProcess( handle, ProcessBasicInformation, &process->info, sizeof(process->info), NULL );
return process;
}
@ -2503,6 +2504,15 @@ NTSTATUS WINAPI PsLookupProcessByProcessId( HANDLE processid, PEPROCESS *process
return status;
}
/*********************************************************************
* PsGetProcessId (NTOSKRNL.@)
*/
HANDLE WINAPI PsGetProcessId(PEPROCESS process)
{
TRACE( "%p -> %lx\n", process, process->info.UniqueProcessId );
return (HANDLE)process->info.UniqueProcessId;
}
static void *create_thread_object( HANDLE handle )
{
@ -4239,16 +4249,6 @@ void WINAPI ExfUnblockPushLock( EX_PUSH_LOCK *lock, PEX_PUSH_LOCK_WAIT_BLOCK blo
FIXME( "stub: %p, %p\n", lock, block );
}
/*********************************************************************
* PsGetProcessId (NTOSKRNL.@)
*/
HANDLE WINAPI PsGetProcessId(PEPROCESS process)
{
FIXME("stub: %p\n", process);
return 0;
}
/*********************************************************************
* FsRtlRegisterFileSystemFilterCallbacks (NTOSKRNL.@)
*/

View File

@ -28,8 +28,10 @@ struct _OBJECT_TYPE
void (*release)(void*); /* called when the last reference is released */
};
struct _EPROCESS {
struct _EPROCESS
{
DISPATCHER_HEADER header;
PROCESS_BASIC_INFORMATION info;
};
struct _KTHREAD

View File

@ -334,6 +334,8 @@ static void test_currentprocess(void)
ret = wait_single(current, 0);
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);
ok(PsGetProcessId(current) == PsGetCurrentProcessId(), "process IDs don't match\n");
thread = PsGetCurrentThread();
ret = wait_single( thread, 0 );
ok(ret == STATUS_TIMEOUT, "got %#x\n", ret);

View File

@ -216,6 +216,7 @@ NTSTATUS WINAPI IoRegisterShutdownNotification(PDEVICE_OBJECT);
NTSTATUS WINAPI KeExpandKernelStackAndCallout(PEXPAND_STACK_CALLOUT,void*,SIZE_T);
void WINAPI KeSetTargetProcessorDpc(PRKDPC,CCHAR);
BOOLEAN WINAPI MmIsAddressValid(void *);
HANDLE WINAPI PsGetProcessId(PEPROCESS);
NTSTATUS WINAPI PsSetLoadImageNotifyRoutine(PLOAD_IMAGE_NOTIFY_ROUTINE);
void WINAPI RtlInitializeGenericTableAvl(PRTL_AVL_TABLE,PRTL_AVL_COMPARE_ROUTINE,PRTL_AVL_ALLOCATE_ROUTINE, PRTL_AVL_FREE_ROUTINE,void *);
void WINAPI RtlInsertElementGenericTableAvl(PRTL_AVL_TABLE,void *,ULONG,BOOL*);