cwindowsmemorysharecode-injection

Sharing memory between two processes (C, Windows)


Since I haven't found an answer to the question asked previously here I'm trying a different approach.

Is there any way to share memory between two processes?

The second process gets the information from an injection since it's a legacy program that it's not being supported anymore.

My idea is to inject some code there, in the struct that I am passing to the injected program pass the address (or whatever) to the share memory where the data I need to run is located. Once I get the data I will populate my own variables inside the injected thread.

Is this possible? How?

Code is appreciated.

EDIT:

I think it's not clear so I'll clarify. I do know how to inject. I am doing it already. The issue here is to pass dynamic data to the injection.


Solution

  • You can try a memory-mapped file.

    This gives a bit more step-by-step detail.