Windows Driver Kit: Kernel-Mode Driver Architecture
PsGetProcessId
The PsGetProcessId routine returns the process identifier (process ID) that is associated with a specified process.
HANDLE
PsGetProcessId(
IN PEPROCESS Process
);
Parameters
- Process
- A pointer to a process object structure.
Return Value
PsGetProcessId returns the process ID of the process that the Process parameter specifies.
Comments
The EPROCESS-typed process object structure is an opaque data structure that the operating system uses internally. To obtain a pointer to the EPROCESS structure for the current process, a driver can call PsGetCurrentProcess. To obtain a pointer to the EPROCESS structure for a different process, the driver can call ObReferenceObjectByHandle.
Requirements
Versions: PsGetProcessID is available on Windows XP and later versions of Windows.
IRQL: Any level
Headers: Declared in Ntddk.h. Include Ntddk.h.
See Also
ObReferenceObjectByHandle, PsGetCurrentProcess