mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Implemented PsLookupXxx() functions.
svn path=/trunk/; revision=2477
This commit is contained in:
parent
3221f88ce3
commit
1806f623e7
6 changed files with 142 additions and 21 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $Id: psfuncs.h,v 1.16 2001/11/29 16:39:45 ekohl Exp $
|
||||
/* $Id: psfuncs.h,v 1.17 2002/01/03 14:01:16 ekohl Exp $
|
||||
*/
|
||||
#ifndef _INCLUDE_DDK_PSFUNCS_H
|
||||
#define _INCLUDE_DDK_PSFUNCS_H
|
||||
|
@ -38,6 +38,15 @@ NTSTATUS STDCALL PsCreateSystemProcess(PHANDLE ProcessHandle,
|
|||
ACCESS_MASK DesiredAccess,
|
||||
POBJECT_ATTRIBUTES ObjectAttributes);
|
||||
|
||||
NTSTATUS STDCALL PsCreateWin32Process(PEPROCESS Process);
|
||||
|
||||
VOID STDCALL PsEstablishWin32Callouts(PVOID Param1,
|
||||
PVOID Param2,
|
||||
PVOID Param3,
|
||||
PVOID Param4,
|
||||
PVOID Param5,
|
||||
ULONG W32ProcessSize);
|
||||
|
||||
struct _ETHREAD* STDCALL PsGetCurrentThread(VOID);
|
||||
struct _EPROCESS* STDCALL PsGetCurrentProcess(VOID);
|
||||
PACCESS_TOKEN STDCALL PsReferenceImpersonationToken(struct _ETHREAD* Thread,
|
||||
|
@ -66,6 +75,18 @@ VOID STDCALL PsDispatchThread(ULONG NewThreadStatus);
|
|||
LARGE_INTEGER STDCALL PsGetProcessExitTime(VOID);
|
||||
BOOLEAN STDCALL PsIsThreadTerminating(struct _ETHREAD* Thread);
|
||||
|
||||
NTSTATUS STDCALL PsLookupProcessByProcessId(IN PVOID ProcessId,
|
||||
OUT PEPROCESS *Process);
|
||||
|
||||
NTSTATUS STDCALL PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||
OUT PEPROCESS *Process OPTIONAL,
|
||||
OUT struct _ETHREAD **Thread);
|
||||
// OUT PETHREAD *Thread);
|
||||
|
||||
NTSTATUS STDCALL PsLookupThreadByThreadId(IN PVOID ThreadId,
|
||||
OUT struct _ETHREAD **Thread);
|
||||
// OUT PETHREAD *Thread);
|
||||
|
||||
#endif
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.def,v 1.120 2001/11/29 16:41:22 ekohl Exp $
|
||||
; $Id: ntoskrnl.def,v 1.121 2002/01/03 14:02:04 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -601,9 +601,9 @@ PsGetVersion@16
|
|||
PsImpersonateClient@20
|
||||
PsInitialSystemProcess DATA
|
||||
PsIsThreadTerminating@4
|
||||
;PsLookupProcessByProcessId@8
|
||||
;PsLookupProcessThreadByCid@12
|
||||
;PsLookupThreadByThreadId@8
|
||||
PsLookupProcessByProcessId@8
|
||||
PsLookupProcessThreadByCid@12
|
||||
PsLookupThreadByThreadId@8
|
||||
PsProcessType DATA
|
||||
PsReferenceImpersonationToken@16
|
||||
PsReferencePrimaryToken@4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
; $Id: ntoskrnl.edf,v 1.106 2001/11/29 16:41:22 ekohl Exp $
|
||||
; $Id: ntoskrnl.edf,v 1.107 2002/01/03 14:02:04 ekohl Exp $
|
||||
;
|
||||
; reactos/ntoskrnl/ntoskrnl.def
|
||||
;
|
||||
|
@ -590,9 +590,9 @@ PsAssignImpersonationToken=PsAssignImpersonationToken@8
|
|||
;PsChargePoolQuota=PsChargePoolQuota@12
|
||||
PsCreateSystemProcess=PsCreateSystemProcess@12
|
||||
PsCreateSystemThread=PsCreateSystemThread@28
|
||||
;PsCreateWin32Process
|
||||
;PsCreateWin32Process=PsCreateWin32Process@4
|
||||
PsDispatchThread=PsDispatchThread@4
|
||||
;PsEstablishWin32Callouts
|
||||
;PsEstablishWin32Callouts=PsEstablishWin32Callouts@24
|
||||
PsGetCurrentProcessId=PsGetCurrentProcessId@0
|
||||
PsGetCurrentThreadId=PsGetCurrentThreadId@0
|
||||
PsGetCurrentThread=PsGetCurrentThread@0
|
||||
|
@ -601,9 +601,9 @@ PsGetVersion=PsGetVersion@16
|
|||
PsImpersonateClient=PsImpersonateClient@20
|
||||
PsInitialSystemProcess DATA
|
||||
PsIsThreadTerminating=PsIsThreadTerminating@4
|
||||
;PsLookupProcessByProcessId
|
||||
;PsLookupProcessThreadByCid
|
||||
;PsLookupThreadByThreadId
|
||||
PsLookupProcessByProcessId=PsLookupProcessByProcessId@8
|
||||
PsLookupProcessThreadByCid=PsLookupProcessThreadByCid@12
|
||||
PsLookupThreadByThreadId=PsLookupThreadByThreadId@8
|
||||
PsProcessType DATA
|
||||
PsReferenceImpersonationToken=PsReferenceImpersonationToken@16
|
||||
PsReferencePrimaryToken=PsReferencePrimaryToken@4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: process.c,v 1.73 2002/01/03 12:48:02 chorns Exp $
|
||||
/* $Id: process.c,v 1.74 2002/01/03 14:03:05 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -1152,4 +1152,35 @@ PsIsThreadTerminating(IN PETHREAD Thread)
|
|||
return(Thread->DeadThread);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
PsLookupProcessByProcessId(IN PVOID ProcessId,
|
||||
OUT PEPROCESS *Process)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
PEPROCESS current;
|
||||
|
||||
KeAcquireSpinLock(&PsProcessListLock, &oldIrql);
|
||||
|
||||
current_entry = PsProcessListHead.Flink;
|
||||
while (current_entry != &PsProcessListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,
|
||||
EPROCESS,
|
||||
ProcessListEntry);
|
||||
if (current->UniqueProcessId == (ULONG)ProcessId)
|
||||
{
|
||||
*Process = current;
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: thread.c,v 1.81 2001/12/31 19:06:48 dwelch Exp $
|
||||
/* $Id: thread.c,v 1.82 2002/01/03 14:03:05 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -542,4 +542,71 @@ NtYieldExecution(VOID)
|
|||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||
OUT PEPROCESS *Process OPTIONAL,
|
||||
OUT PETHREAD *Thread)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
|
||||
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
||||
|
||||
current_entry = PiThreadListHead.Flink;
|
||||
while (current_entry != &PiThreadListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,
|
||||
ETHREAD,
|
||||
Tcb.ThreadListEntry);
|
||||
if (current->Cid.UniqueThread == Cid->UniqueThread &&
|
||||
current->Cid.UniqueProcess == Cid->UniqueProcess)
|
||||
{
|
||||
if (Process != NULL)
|
||||
*Process = current->ThreadsProcess;
|
||||
*Thread = current;
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS STDCALL
|
||||
PsLookupThreadByThreadId(IN PVOID ThreadId,
|
||||
OUT PETHREAD *Thread)
|
||||
{
|
||||
KIRQL oldIrql;
|
||||
PLIST_ENTRY current_entry;
|
||||
PETHREAD current;
|
||||
|
||||
KeAcquireSpinLock(&PiThreadListLock, &oldIrql);
|
||||
|
||||
current_entry = PiThreadListHead.Flink;
|
||||
while (current_entry != &PiThreadListHead)
|
||||
{
|
||||
current = CONTAINING_RECORD(current_entry,
|
||||
ETHREAD,
|
||||
Tcb.ThreadListEntry);
|
||||
if (current->Cid.UniqueThread == (HANDLE)ThreadId)
|
||||
{
|
||||
*Thread = current;
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
current_entry = current_entry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PiThreadListLock, oldIrql);
|
||||
|
||||
return(STATUS_INVALID_PARAMETER);
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id: tinfo.c,v 1.16 2001/09/07 21:35:45 ea Exp $
|
||||
/* $Id: tinfo.c,v 1.17 2002/01/03 14:03:05 ekohl Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
|
@ -30,7 +30,7 @@ NtSetInformationThread(HANDLE ThreadHandle,
|
|||
Status = ObReferenceObjectByHandle(ThreadHandle,
|
||||
THREAD_SET_INFORMATION,
|
||||
PsThreadType,
|
||||
UserMode,
|
||||
ExGetPreviousMode(),
|
||||
(PVOID*)&Thread,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -112,8 +112,10 @@ NtSetInformationThread(HANDLE ThreadHandle,
|
|||
break;
|
||||
|
||||
case ThreadZeroTlsCell:
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
{
|
||||
Status = STATUS_NOT_IMPLEMENTED;
|
||||
break;
|
||||
}
|
||||
|
||||
case ThreadPerformanceCount:
|
||||
/* Can only be queried */
|
||||
|
@ -167,7 +169,7 @@ NtQueryInformationThread (IN HANDLE ThreadHandle,
|
|||
Status = ObReferenceObjectByHandle(ThreadHandle,
|
||||
THREAD_QUERY_INFORMATION,
|
||||
PsThreadType,
|
||||
UserMode,
|
||||
ExGetPreviousMode(),
|
||||
(PVOID*)&Thread,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
|
Loading…
Reference in a new issue