ntoskrnl.exe: Implement PsGetProcessInheritedFromUniqueProcessId.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2019-05-16 19:50:27 +02:00 committed by Alexandre Julliard
parent ed140a7ac5
commit 850fd237bd
4 changed files with 28 additions and 2 deletions

View File

@ -2589,6 +2589,15 @@ HANDLE WINAPI PsGetProcessId(PEPROCESS process)
return (HANDLE)process->info.UniqueProcessId;
}
/*********************************************************************
* PsGetProcessInheritedFromUniqueProcessId (NTOSKRNL.@)
*/
HANDLE WINAPI PsGetProcessInheritedFromUniqueProcessId( PEPROCESS process )
{
HANDLE id = (HANDLE)process->info.InheritedFromUniqueProcessId;
TRACE( "%p -> %p\n", process, id );
return id;
}
static void *create_thread_object( HANDLE handle )
{

View File

@ -888,7 +888,7 @@
@ stub PsGetProcessExitTime
@ stdcall PsGetProcessId(ptr)
@ stub PsGetProcessImageFileName
@ stub PsGetProcessInheritedFromUniqueProcessId
@ stdcall PsGetProcessInheritedFromUniqueProcessId(ptr)
@ stub PsGetProcessJob
@ stub PsGetProcessPeb
@ stub PsGetProcessPriorityClass
@ -1374,7 +1374,7 @@
@ stdcall -private ZwQueryFullAttributesFile(ptr ptr) NtQueryFullAttributesFile
@ stdcall -private ZwQueryInformationFile(long ptr ptr long long) NtQueryInformationFile
@ stdcall -private ZwQueryInformationJobObject(long long ptr long ptr) NtQueryInformationJobObject
@ stdcall -private ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
@ stdcall ZwQueryInformationProcess(long long ptr long ptr) NtQueryInformationProcess
@ stdcall -private ZwQueryInformationThread(long long ptr long ptr) NtQueryInformationThread
@ stdcall -private ZwQueryInformationToken(long long ptr long ptr) NtQueryInformationToken
@ stdcall -private ZwQueryInstallUILanguage(ptr) NtQueryInstallUILanguage

View File

@ -55,6 +55,8 @@ static PEPROCESS *pPsInitialSystemProcess;
void WINAPI ObfReferenceObject( void *obj );
NTSTATUS WINAPI ZwQueryInformationProcess(HANDLE,PROCESSINFOCLASS,void*,ULONG,ULONG*);
extern int CDECL _vsnprintf(char *str, size_t len, const char *format, __ms_va_list argptr);
static void kvprintf(const char *format, __ms_va_list ap)
@ -323,7 +325,9 @@ static NTSTATUS wait_single_handle(HANDLE handle, ULONGLONG timeout)
static void test_current_thread(BOOL is_system)
{
PROCESS_BASIC_INFORMATION info;
DISPATCHER_HEADER *header;
HANDLE process_handle, id;
PEPROCESS current;
PETHREAD thread;
NTSTATUS ret;
@ -349,6 +353,18 @@ static void test_current_thread(BOOL is_system)
ok(PsGetThreadId((PETHREAD)KeGetCurrentThread()) == PsGetCurrentThreadId(), "thread IDs don't match\n");
ok(PsIsSystemThread((PETHREAD)KeGetCurrentThread()) == is_system, "unexpected system thread\n");
ret = ObOpenObjectByPointer(current, OBJ_KERNEL_HANDLE, NULL, PROCESS_QUERY_INFORMATION, NULL, KernelMode, &process_handle);
ok(!ret, "ObOpenObjectByPointer failed: %#x\n", ret);
ret = ZwQueryInformationProcess(process_handle, ProcessBasicInformation, &info, sizeof(info), NULL);
ok(!ret, "ZwQueryInformationProcess failed: %#x\n", ret);
id = PsGetProcessInheritedFromUniqueProcessId(current);
ok(id == (HANDLE)info.InheritedFromUniqueProcessId, "unexpected process id %p\n", id);
ret = ZwClose(process_handle);
ok(!ret, "ZwClose failed: %#x\n", ret);
}
static void sleep(void)

View File

@ -1663,6 +1663,7 @@ NTSTATUS WINAPI PsCreateSystemThread(PHANDLE,ULONG,POBJECT_ATTRIBUTES,HANDLE,PC
#define PsGetCurrentThread() ((PETHREAD)KeGetCurrentThread())
HANDLE WINAPI PsGetCurrentProcessId(void);
HANDLE WINAPI PsGetCurrentThreadId(void);
HANDLE WINAPI PsGetProcessInheritedFromUniqueProcessId(PEPROCESS);
BOOLEAN WINAPI PsGetVersion(ULONG*,ULONG*,ULONG*,UNICODE_STRING*);
NTSTATUS WINAPI PsTerminateSystemThread(NTSTATUS);