PsGetProcessId function (ntddk.h)

The PsGetProcessId routine returns the process identifier (process ID) that is associated with a specified process.

Syntax

HANDLE PsGetProcessId(
  [in] PEPROCESS Process
);

Parameters

[in] Process

A pointer to a process object structure.

Return value

PsGetProcessId returns the process ID of the process that the Process parameter specifies.

Remarks

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

Requirement Value
Minimum supported client Available in Windows XP and later versions of Windows.
Target Platform Universal
Header ntddk.h (include Ntddk.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL Any level

See also

ObReferenceObjectByHandle

PsGetCurrentProcess