Search code examples
c++memoryprocesswin32-process

Unifying 2 space memories



Is there a way to read another process memory as if its memory was a part of my process memory in C++/Windows (without using "ReadProcessMemory")?

What about "CreateRemoteThread"? I want to be able to read the other process's memory but not only in my remote thread and from my application itself. will this do the job?


Solution

  • MSDN has a sample that explains how to use CreateFileMapping to share memory between two processes.

    Basically, you create a file mapping with an explicit name using the page file as a backing store, then open that file mapping in the second process with the same name. To map the same address in both processes, you will have to pass a previously agreed upon memory range and pass that to MapViewOfFileEx. Keep in mind that you cannot guarantee that any memory address is unused between two processes in general, so you might not want to base your design on having the same address between two processes.