kernel32: Implement GetProcessIdOfThread().

This commit is contained in:
Nikolay Sivov 2015-03-20 12:45:33 +03:00 committed by Alexandre Julliard
parent b861aed2c1
commit 85a3d09329
5 changed files with 33 additions and 4 deletions

View File

@ -16,7 +16,7 @@
@ stdcall GetExitCodeThread(long ptr) kernel32.GetExitCodeThread @ stdcall GetExitCodeThread(long ptr) kernel32.GetExitCodeThread
@ stdcall GetPriorityClass(long) kernel32.GetPriorityClass @ stdcall GetPriorityClass(long) kernel32.GetPriorityClass
@ stdcall GetProcessId(long) kernel32.GetProcessId @ stdcall GetProcessId(long) kernel32.GetProcessId
@ stub GetProcessIdOfThread @ stdcall GetProcessIdOfThread(long) kernel32.GetProcessIdOfThread
@ stdcall GetProcessTimes(long ptr ptr ptr ptr) kernel32.GetProcessTimes @ stdcall GetProcessTimes(long ptr ptr ptr ptr) kernel32.GetProcessTimes
@ stdcall GetProcessVersion(long) kernel32.GetProcessVersion @ stdcall GetProcessVersion(long) kernel32.GetProcessVersion
@ stdcall GetStartupInfoW(ptr) kernel32.GetStartupInfoW @ stdcall GetStartupInfoW(ptr) kernel32.GetStartupInfoW

View File

@ -21,7 +21,7 @@
@ stdcall GetPriorityClass(long) kernel32.GetPriorityClass @ stdcall GetPriorityClass(long) kernel32.GetPriorityClass
@ stdcall GetProcessHandleCount(long ptr) kernel32.GetProcessHandleCount @ stdcall GetProcessHandleCount(long ptr) kernel32.GetProcessHandleCount
@ stdcall GetProcessId(long) kernel32.GetProcessId @ stdcall GetProcessId(long) kernel32.GetProcessId
@ stub GetProcessIdOfThread @ stdcall GetProcessIdOfThread(long) kernel32.GetProcessIdOfThread
@ stub GetProcessMitigationPolicy @ stub GetProcessMitigationPolicy
@ stdcall GetProcessTimes(long ptr ptr ptr ptr) kernel32.GetProcessTimes @ stdcall GetProcessTimes(long ptr ptr ptr ptr) kernel32.GetProcessTimes
@ stdcall GetProcessVersion(long) kernel32.GetProcessVersion @ stdcall GetProcessVersion(long) kernel32.GetProcessVersion

View File

@ -21,7 +21,7 @@
@ stdcall GetPriorityClass(long) kernel32.GetPriorityClass @ stdcall GetPriorityClass(long) kernel32.GetPriorityClass
@ stdcall GetProcessHandleCount(long ptr) kernel32.GetProcessHandleCount @ stdcall GetProcessHandleCount(long ptr) kernel32.GetProcessHandleCount
@ stdcall GetProcessId(long) kernel32.GetProcessId @ stdcall GetProcessId(long) kernel32.GetProcessId
@ stub GetProcessIdOfThread @ stdcall GetProcessIdOfThread(long) kernel32.GetProcessIdOfThread
@ stub GetProcessMitigationPolicy @ stub GetProcessMitigationPolicy
@ stdcall GetProcessPriorityBoost(long ptr) kernel32.GetProcessPriorityBoost @ stdcall GetProcessPriorityBoost(long ptr) kernel32.GetProcessPriorityBoost
@ stdcall GetProcessTimes(long ptr ptr ptr ptr) kernel32.GetProcessTimes @ stdcall GetProcessTimes(long ptr ptr ptr ptr) kernel32.GetProcessTimes

View File

@ -780,7 +780,7 @@
@ stdcall -norelay GetProcessHeap() @ stdcall -norelay GetProcessHeap()
@ stdcall GetProcessHeaps(long ptr) @ stdcall GetProcessHeaps(long ptr)
@ stdcall GetProcessId(long) @ stdcall GetProcessId(long)
# @ stub GetProcessIdOfThread @ stdcall GetProcessIdOfThread(long)
@ stdcall GetProcessIoCounters(long ptr) @ stdcall GetProcessIoCounters(long ptr)
# @ stub GetProcessPreferredUILanguages # @ stub GetProcessPreferredUILanguages
@ stdcall GetProcessPriorityBoost(long ptr) @ stdcall GetProcessPriorityBoost(long ptr)

View File

@ -557,6 +557,35 @@ DWORD WINAPI GetThreadId(HANDLE Thread)
return HandleToULong(tbi.ClientId.UniqueThread); return HandleToULong(tbi.ClientId.UniqueThread);
} }
/**********************************************************************
* GetProcessIdOfThread [KERNEL32.@]
*
* Retrieve process identifier given thread belongs to.
*
* PARAMS
* Thread [I] The thread identifier.
*
* RETURNS
* Success: Process identifier
* Failure: 0
*/
DWORD WINAPI GetProcessIdOfThread(HANDLE Thread)
{
THREAD_BASIC_INFORMATION tbi;
NTSTATUS status;
TRACE("(%p)\n", Thread);
status = NtQueryInformationThread(Thread, ThreadBasicInformation, &tbi,
sizeof(tbi), NULL);
if (status)
{
SetLastError( RtlNtStatusToDosError(status) );
return 0;
}
return HandleToULong(tbi.ClientId.UniqueProcess);
}
/*********************************************************************** /***********************************************************************
* GetCurrentThread [KERNEL32.@] Gets pseudohandle for current thread * GetCurrentThread [KERNEL32.@] Gets pseudohandle for current thread