PsGetCurrentProcessId identifies the current process.
HANDLE
PsGetCurrentProcessId(
);
ntddk.h
PsGetCurrentProcessId returns the 4-byte identifier of the current process.
Highest-level drivers, such as system profilers or IFSs, that register their own callback(s) with PsSetCreateProcessNotifyRoutine, PsSetCreateThreadNotifyRoutine, and/or PsSetLoadImageNotifyRoutine are likely to call PsGetCurrentProcessId.
Callers of PsGetCurrentProcessId should treat the returned ID as a read-only value.
Callers of PsGetCurrentProcessId can be running at any IRQL.
IoGetCurrentProcess, PsGetCurrentProcess, PsGetCurrentThread, PsGetCurrentThreadId, PsSetCreateProcessNotifyRoutine, PsSetCreateThreadNotifyRoutine, PsSetLoadImageNotifyRoutine