GetDirectCallerProcessId (Compact 2013)
3/28/2014
This function obtains the direct caller's process identifier.
Syntax
DWORD GetDirectCallerProcessId (void);
Parameters
None.
Return Value
If GetDirectCallerProcessId is called from kernel mode, it returns the kernel process identifier if a kernel component is making a call to the driver or the process identifier of the user application that made the call directly, which is the same as calling GetCallerVMProcessId.
If GetDirectCallerProcessId is called from user mode, it behaves the same way as GetCallerVMProcessId.
Remarks
Device drivers need to know where calls originate so that they can access the virtual memory and the handle of the caller. Device drivers also need to know if they were called from a trusted source, or directly from a user process. For example, a driver can be called from a user application with WriteFile, which calls DeviceIoControl into the driver. A driver can also be called with DeviceIoControl directly. In one case, the parameters are coming from the kernel and so they can be trusted. In the other case the user parameters need to be validated. GetCallerVMProcessId and ForwardDeviceIoControl resolve these issues.
Requirements
Header |
pkfuncs.h |
Library |
coredll.lib |
See Also
Reference
Kernel Functions
ForwardDeviceIoControl
GetCallerVMProcessId