Using the windows api and C++, how could I load an exe from the hard drive and run it in its own thread?
Posted
by
returneax
on Stack Overflow
See other posts from Stack Overflow
or by returneax
Published on 2011-01-10T07:18:26Z
Indexed on
2011/01/10
7:53 UTC
Read the original article
Hit count: 193
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 :)
© Stack Overflow or respective owner