Use-case
- Create a new process ( running an arbitrary application ) in suspended mode ( using eg. exec )
- Process created ( MachO loaded ) but no single line of code executed
- Do some stuff w/ the suspended process memory
- Resume the process
On windows, once can use CreateProcess in conjunction with the “CREATE_SUSPENDED” to achieve the above mentioned.
Is there a “CREATE_SUSPENDED” C++/Obj-C equivalent for MacOS ???
( NSTask created in suspended mode is an equivalent of what I am looking for )
Advertisement
Answer
You can use posix_spawn()
with a spawn attribute of POSIX_SPAWN_START_SUSPENDED
.
It’s a bit of a pain to use but will do what you want, however I am unsure how you can access the memory of the child process.