Using the windows api and C++, how could I load an exe from the hard drive and run it in its own thread?
- by returneax
For the sake of learning I'm trying to do what the OS does when launching a program ie. parsing a PE file and giving it a thread of execution.
If I have two exe's one called foo.exe and the other bar.exe, how could I have foo.exe load the contents of bar.exe into memory then have it execute from there in its own thread? I know how to get it into memory using MapViewOfFile or by simple loading the contents on the hard drive into a buffer. I'm assuming simply copying the contents of bar.exe on disk into its own suspended thread and running it wouldn't work. I am semi-familiar with PE file internals. All help is very much appreciated, of course :)