Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

pscid.c File Reference

#include "psp.h"

Go to the source code of this file.

Functions

NTSTATUS PsLookupProcessThreadByCid (IN PCLIENT_ID Cid, OUT PEPROCESS *Process OPTIONAL, OUT PETHREAD *Thread)
NTSTATUS PsLookupProcessByProcessId (IN HANDLE ProcessId, OUT PEPROCESS *Process)
NTSTATUS PsLookupThreadByThreadId (IN HANDLE ThreadId, OUT PETHREAD *Thread)


Function Documentation

NTSTATUS PsLookupProcessByProcessId IN HANDLE  ProcessId,
OUT PEPROCESS Process
 

Definition at line 94 of file pscid.c.

References ExMapHandleToPointer(), ExUnlockHandleTableEntry(), _EPROCESS::GrantedAccess, _KPROCESS::Header, NTSTATUS(), NULL, _HANDLE_TABLE_ENTRY::Object, ObReferenceObject, _EPROCESS::Pcb, ProcessObject, PSP_INVALID_ID, PspCidTable, Status, and _DISPATCHER_HEADER::Type.

Referenced by LpcpGetCreatorName(), and NtOpenProcess().

00101 : 00102 00103 This function accepts the process id of a process and returns a 00104 referenced pointer to the process. 00105 00106 Arguments: 00107 00108 ProcessId - Specifies the Process ID of the process. 00109 00110 Process - Returns a referenced pointer to the process specified by the 00111 process id. 00112 00113 Return Value: 00114 00115 STATUS_SUCCESS - A process was located based on the contents of 00116 the process id. 00117 00118 STATUS_INVALID_PARAMETER - The process was not found. 00119 00120 --*/ 00121 00122 { 00123 00124 PHANDLE_TABLE_ENTRY CidEntry; 00125 PEPROCESS lProcess; 00126 NTSTATUS Status; 00127 00128 CidEntry = ExMapHandleToPointer(PspCidTable, ProcessId); 00129 Status = STATUS_INVALID_PARAMETER; 00130 if (CidEntry != NULL) { 00131 lProcess = (PEPROCESS)CidEntry->Object; 00132 if (lProcess != (PEPROCESS)PSP_INVALID_ID && lProcess->Pcb.Header.Type == ProcessObject && lProcess->GrantedAccess ) { 00133 ObReferenceObject(lProcess); 00134 *Process = lProcess; 00135 Status = STATUS_SUCCESS; 00136 } 00137 00138 ExUnlockHandleTableEntry(PspCidTable, CidEntry); 00139 } 00140 00141 return Status; 00142 }

NTSTATUS PsLookupProcessThreadByCid IN PCLIENT_ID  Cid,
OUT PEPROCESS *Process  OPTIONAL,
OUT PETHREAD Thread
 

Definition at line 27 of file pscid.c.

References _ETHREAD::Cid, ExMapHandleToPointer(), ExUnlockHandleTableEntry(), _ETHREAD::GrantedAccess, _KTHREAD::Header, NTSTATUS(), NULL, _HANDLE_TABLE_ENTRY::Object, ObReferenceObject, PSP_INVALID_ID, PspCidTable, Status, _ETHREAD::Tcb, THREAD_TO_PROCESS, ThreadObject, and _DISPATCHER_HEADER::Type.

Referenced by LpcpCopyRequestData(), LpcRequestWaitReplyPort(), NtAcceptConnectPort(), NtImpersonateClientOfPort(), NtOpenProcess(), NtOpenThread(), NtReplyPort(), NtReplyWaitReceivePort(), NtReplyWaitReceivePortEx(), NtReplyWaitReplyPort(), NtRequestWaitReplyPort(), and VdmpIsThreadTerminating().

00035 : 00036 00037 This function accepts The Client ID of a thread, and returns a 00038 referenced pointer to the thread, and possibly a referenced pointer 00039 to the process. 00040 00041 Arguments: 00042 00043 Cid - Specifies the Client ID of the thread. 00044 00045 Process - If specified, returns a referenced pointer to the process 00046 specified in the Cid. 00047 00048 Thread - Returns a referenced pointer to the thread specified in the 00049 Cid. 00050 00051 Return Value: 00052 00053 STATUS_SUCCESS - A process and thread were located based on the contents 00054 of the Cid. 00055 00056 STATUS_INVALID_CID - The specified Cid is invalid. 00057 00058 --*/ 00059 00060 { 00061 00062 PHANDLE_TABLE_ENTRY CidEntry; 00063 PETHREAD lThread; 00064 NTSTATUS Status; 00065 00066 CidEntry = ExMapHandleToPointer(PspCidTable, Cid->UniqueThread); 00067 Status = STATUS_INVALID_CID; 00068 if (CidEntry != NULL) { 00069 lThread = (PETHREAD)CidEntry->Object; 00070 if ((lThread != (PETHREAD)PSP_INVALID_ID) && 00071 ( 00072 lThread->Tcb.Header.Type == ThreadObject && 00073 lThread->Cid.UniqueProcess == Cid->UniqueProcess && 00074 lThread->GrantedAccess 00075 ) ) { 00076 if (ARGUMENT_PRESENT(Process)) { 00077 *Process = THREAD_TO_PROCESS(lThread); 00078 ObReferenceObject(*Process); 00079 } 00080 00081 ObReferenceObject(lThread); 00082 *Thread = lThread; 00083 Status = STATUS_SUCCESS; 00084 } 00085 00086 ExUnlockHandleTableEntry(PspCidTable, CidEntry); 00087 } 00088 00089 return Status; 00090 }

NTSTATUS PsLookupThreadByThreadId IN HANDLE  ThreadId,
OUT PETHREAD Thread
 

Definition at line 146 of file pscid.c.

References ExMapHandleToPointer(), ExUnlockHandleTableEntry(), _ETHREAD::GrantedAccess, _KTHREAD::Header, NTSTATUS(), NULL, _HANDLE_TABLE_ENTRY::Object, ObReferenceObject, PSP_INVALID_ID, PspCidTable, Status, _ETHREAD::Tcb, ThreadObject, and _DISPATCHER_HEADER::Type.

Referenced by NtOpenThread().

00153 : 00154 00155 This function accepts the thread id of a thread and returns a 00156 referenced pointer to the thread. 00157 00158 Arguments: 00159 00160 ThreadId - Specifies the Thread ID of the thread. 00161 00162 Thread - Returns a referenced pointer to the thread specified by the 00163 thread id. 00164 00165 Return Value: 00166 00167 STATUS_SUCCESS - A thread was located based on the contents of 00168 the thread id. 00169 00170 STATUS_INVALID_PARAMETER - The thread was not found. 00171 00172 --*/ 00173 00174 { 00175 00176 PHANDLE_TABLE_ENTRY CidEntry; 00177 PETHREAD lThread; 00178 NTSTATUS Status; 00179 00180 CidEntry = ExMapHandleToPointer(PspCidTable, ThreadId); 00181 Status = STATUS_INVALID_PARAMETER; 00182 if (CidEntry != NULL) { 00183 lThread = (PETHREAD)CidEntry->Object; 00184 if (lThread != (PETHREAD)PSP_INVALID_ID && lThread->Tcb.Header.Type == ThreadObject && lThread->GrantedAccess ) { 00185 00186 ObReferenceObject(lThread); 00187 *Thread = lThread; 00188 Status = STATUS_SUCCESS; 00189 } 00190 00191 ExUnlockHandleTableEntry(PspCidTable, CidEntry); 00192 } 00193 00194 return Status; 00195 } }


Generated on Sat May 15 19:45:22 2004 for test by doxygen 1.3.7