How to create a child process to an existing process in windows - C / C ++

0

I need to call via CreateProcess () or another windows function a process and bind to an existing process, is it possible?

Thank you!

    
asked by anonymous 14.02.2017 / 14:55

1 answer

0

Unfortunately, no. The CreateProcess() (as well as the fork() in Unix) create processes linked to the process that created them (for example, it is they that report output status), it is from them that they inherit the variables of environment, etc. ). A third process would not know that you had a child raised by someone else to receive the exit status or something.

If you need to create a process that communicates with another, already existing process, Windows has several Interprocess Communication (IPC) that you can try to use. But the preexisting process has to support these communication methods.

In the very last case, DebugActiveProcess() and allies (mostly WriteProcessMemory() can to allow you (under certain circumstances) to inject information into an active process, but how to determine the mapping of variables to memory addresses is extremely non-trivial. own and manages the physical process requires a very thorough machine language knowledge, and may ultimately not meet your true requirement, whatever it may be.

    
17.02.2017 / 15:56