Combine two executables into one

Posted on 1999-10-29
Medium Priority
Last Modified: 2013-12-04
Is there a way to combine two executables into one?
Question by:shannonm
  • 2
LVL 20

Expert Comment

ID: 2169497
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.
LVL 14

Expert Comment

ID: 2169653
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.


Author Comment

ID: 2174040
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??

LVL 14

Accepted Solution

AlexVirochovsky earned 150 total points
ID: 2182184
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.

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question