mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
1. get rid of InternalGetProcessId()
2. Implemented GetProcessIdOfThread() and GetThreadId() svn path=/trunk/; revision=11531
This commit is contained in:
parent
91ae432126
commit
de6c4c8cb3
5 changed files with 64 additions and 36 deletions
|
@ -1,4 +1,4 @@
|
|||
#define _WIN32_WINNT 0x0501
|
||||
#define _WIN32_WINNT 0x0502
|
||||
#define __USE_W32API
|
||||
#define NTOS_MODE_USER
|
||||
#define __NO_CTYPE_INLINES
|
||||
|
|
|
@ -439,6 +439,7 @@ GetProcessHandleCount@8
|
|||
GetProcessHeap@0
|
||||
GetProcessHeaps@8
|
||||
GetProcessId@4
|
||||
GetProcessIdOfThread@4
|
||||
GetProcessIoCounters@8
|
||||
GetProcessPriorityBoost@8
|
||||
GetProcessShutdownParameters@8
|
||||
|
@ -485,6 +486,7 @@ GetTempFileNameW@16
|
|||
GetTempPathA@8
|
||||
GetTempPathW@8
|
||||
GetThreadContext@8
|
||||
GetThreadId@4
|
||||
GetThreadIOPendingFlag@8
|
||||
GetThreadLocale@0
|
||||
GetThreadPriority@4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: handle.c,v 1.18 2004/10/24 12:36:12 weiden Exp $
|
||||
/* $Id: handle.c,v 1.19 2004/11/02 21:51:25 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -213,8 +213,9 @@ BOOL STDCALL DuplicateHandle(HANDLE hSourceProcessHandle,
|
|||
|
||||
if (IsConsoleHandle(hSourceHandle))
|
||||
{
|
||||
if (FALSE == InternalGetProcessId(hSourceProcessHandle, &SourceProcessId) ||
|
||||
FALSE == InternalGetProcessId(hTargetProcessHandle, &TargetProcessId) ||
|
||||
SourceProcessId = GetProcessId(hSourceProcessHandle);
|
||||
TargetProcessId = GetProcessId(hTargetProcessHandle);
|
||||
if (!SourceProcessId || !TargetProcessId ||
|
||||
SourceProcessId != TargetProcessId ||
|
||||
SourceProcessId != GetCurrentProcessId())
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: proc.c,v 1.70 2004/10/19 10:27:11 weiden Exp $
|
||||
/* $Id: proc.c,v 1.71 2004/11/02 21:51:25 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -26,10 +26,6 @@ LPSTARTUPINFOA lpLocalStartupInfo = NULL;
|
|||
VOID STDCALL
|
||||
RegisterWaitForInputIdle(WaitForInputIdleType lpfnRegisterWaitForInputIdle);
|
||||
|
||||
BOOL STDCALL
|
||||
InternalGetProcessId (HANDLE hProcess, LPDWORD lpProcessId);
|
||||
|
||||
|
||||
/* FUNCTIONS ****************************************************************/
|
||||
|
||||
/*
|
||||
|
@ -301,44 +297,25 @@ GetExitCodeProcess(HANDLE hProcess,
|
|||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOL STDCALL
|
||||
InternalGetProcessId(HANDLE hProcess,
|
||||
LPDWORD lpProcessId)
|
||||
DWORD
|
||||
STDCALL
|
||||
GetProcessId(HANDLE Process)
|
||||
{
|
||||
PROCESS_BASIC_INFORMATION ProcessBasic;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtQueryInformationProcess(hProcess,
|
||||
Status = NtQueryInformationProcess(Process,
|
||||
ProcessBasicInformation,
|
||||
&ProcessBasic,
|
||||
sizeof(PROCESS_BASIC_INFORMATION),
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
memcpy(lpProcessId, &ProcessBasic.UniqueProcessId, sizeof(DWORD));
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD
|
||||
STDCALL
|
||||
GetProcessId(HANDLE Process)
|
||||
{
|
||||
DWORD ProcessId;
|
||||
|
||||
if(!InternalGetProcessId(Process, &ProcessId))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return 0;
|
||||
}
|
||||
return ProcessId;
|
||||
|
||||
return ProcessBasic.UniqueProcessId;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.55 2004/11/02 20:42:06 weiden Exp $
|
||||
/* $Id: thread.c,v 1.56 2004/11/02 21:51:25 weiden Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS system libraries
|
||||
|
@ -714,6 +714,54 @@ SetThreadIdealProcessor(HANDLE hThread,
|
|||
return dwIdealProcessor;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
GetProcessIdOfThread(HANDLE Thread)
|
||||
{
|
||||
THREAD_BASIC_INFORMATION ThreadBasic;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtQueryInformationThread(Thread,
|
||||
ThreadBasicInformation,
|
||||
&ThreadBasic,
|
||||
sizeof(THREAD_BASIC_INFORMATION),
|
||||
NULL);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (DWORD)ThreadBasic.ClientId.UniqueProcess;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
DWORD STDCALL
|
||||
GetThreadId(HANDLE Thread)
|
||||
{
|
||||
THREAD_BASIC_INFORMATION ThreadBasic;
|
||||
NTSTATUS Status;
|
||||
|
||||
Status = NtQueryInformationThread(Thread,
|
||||
ThreadBasicInformation,
|
||||
&ThreadBasic,
|
||||
sizeof(THREAD_BASIC_INFORMATION),
|
||||
NULL);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
SetLastErrorByStatus(Status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (DWORD)ThreadBasic.ClientId.UniqueThread;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue