GetDirectCallerProcessId

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

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.

Replace GetCallerProcess with GetDirectCallerProcessId or GetCallerVMProcessId.

Requirements

Header pkfuncs.h
Library coredll.lib
Windows Embedded CE Windows Embedded CE 6.0 and later

See Also

Reference

Kernel Functions
ForwardDeviceIoControl
GetCallerProcess
GetCallerVMProcessId
Process ID Functions

Concepts

New Kernel APIs

Other Resources

DeviceIoControl
WriteFile