This function sets the internal permissions bitmask for the current thread, thereby enabling access to the address space of another process.
MapPtrToProcess();
The handle for hProc is obtained using GetCurrentProcess or GetCallerProcess.
Note that 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, GetCurrentProcess());
Then pPointer_retval can be passed within calls to the other process.