Combine two executables into one

Is there a way to combine two executables into one?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Theoretically you can simply store two exe files like this:

[exe1][exe2][length of exe2]

Now if start this combined exe, only exe1 is executed. exe1 can now extract exe2 to a new (temporary) file and start it thereafter.

Does this help?

Starting exe2 DIRECTLY would be much more difficult.

Regards, Madshi.
You can use next trick:
1. include 2-nd exe in RC file.
2. During job save this resource to
   disk (with LoadResource and    WriteFile).
3. make this file.

shannonmAuthor Commented:
Isn't there a way of wrapping the two into one file and starting the second (calling its main function) from the first without using WriteFile?

If not, what does job save correspond to in Visual Studio C++??

If not how would "extract" be performed??

Hi, i think, that you must solve hard problem, if
don't want use WriteFile(and why? After using allways
may delete exe file).Nevermide, hard way is:
1. You must know structure PE header of exe file
see for example: "PORTABLE EXECUTABLE FORMAT" by Micheal J. O'Leary)
2. LoadResource back begin of Header.
3. You must from this info find place of entry point,
   load SS/DS registers and "jump" to this entry point.
   Of course,all this you must make only in Assembler.
More info about PE Header you can find in MSDN.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.