An extract from the online DDK …
HANDLE
PsGetCurrentProcessId(
);
Include
ntddk.h
Return Value
PsGetCurrentProcessId returns the 4-byte identifier of the current process.
On 64 bit systems a HANDLE is 8 bytes long. Is it safe to discard the upper
4 bytes of the return value from PsGetCurrentProcessId on a 64 bit system?
I use this function to check that there hasn’t been a context switch between
user and driver (the interface makes extensive use of METHOD_NEITHER
ioctls). I’d like to continue to use it, for both 64 bit user-mode apps and
32 bit user-mode apps running on a 64 bit system.
On the user side, GetCurrentProcessId() is documented as returning a DWORD
so I suspect it will be OK to truncate.
Don