Share via


MapPtrToProcess

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

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This function maps an unmapped pointer to a process.

Note   This function is no longer supported as of CE 6.0.

Syntax

LPVOID MapPtrToProcess(
  LPVOID lpv,
  HANDLE hProc
);

Parameters

  • lpv
    [out] Long pointer to be mapped.
  • hProc
    [in] Handle to the process which the lpv pointer is to be mapped to.

Return Value

A mapped version of the lpv pointer indicates success. NULL indicates failure.

Remarks

The handle to hProc is obtained using GetCurrentProcessId or GetCallerProcess.

The OEM*** functions typically do not call this function. This kernel function is primarily provided for use by device drivers. However, any application can call this function.

If the pointer is already mapped, MapPtrToProcess returns the original pointer if the application calling the function has the access necessary to dereference that pointer. Otherwise, NULL is returned.

If the pointer is unmapped, MapPtrToProcess first maps the pointer, and then returns the mapped pointer if the application calling the function can access it. Otherwise, NULL is returned.

This function should be called to map pointers that are passed to a protected server library where the pointer is not a parameter directly, but it is, rather, obtained from a structure and must be adjusted for the address space.

For example, to pass the pointer pPointer to another process, first make the following call:

pPointer_retval = MapPtrToProcess(pPointer, (HANDLE) GetCurrentProcessId());

Then pPointer_retval can be passed in calls to the other process.

Requirements

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

See Also

Reference

Kernel Buffer Marshaling Functions
UnMapPtr
GetOwnerProcess
GetCallerProcess

Concepts

Unsupported Kernel APIs

Other Resources

GetCurrentProcessId