Other versions of this page are also available for the following:
Windows Mobile Not SupportedWindows Embedded CE Supported

This function maps an unmapped pointer to a process.

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

LPVOID MapPtrToProcess(
  LPVOID lpv,
  HANDLE hProc


[out] Long pointer to be mapped.


[in] Handle to the process which the lpv pointer is to be mapped to.

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

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.

Windows Embedded CEWindows CE 2.10 and later

Community Additions