PsGetProcessId - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
// ntddk.h

HANDLE PsGetProcessId(
  [in] PEPROCESS Process
);

View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-ntddk-psgetprocessid)

PsGetProcessId function

Description

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

Parameters

Process [in]

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.

When used with PsGetCurrentProcess, this function returns the process ID of the process that the current thread is attached to (from APC state). This may differ from PsGetCurrentProcessId, which returns the process ID of the process that created the current thread.

See also

ObReferenceObjectByHandle

PsGetCurrentProcess

PsGetCurrentProcessId