Spenser Truex
Spenser Truex

Reputation: 159

Combining two programs into one?

If I have two windows executables, am I able to combine them into one executable, and run them in sequence?

I tried doing this crudely and exactly, by using a simple program that read them both into one. The result was the second program was run, but the first program never was. Below I attempt to explain this better:

C:\> bind.exe a.exe b.exe >out.exe

b.exe is written after a.exe into out.exe If you look at out.exe it looks like a.exe THEN b.exe, written exactly in binary, including headers and other information that should not be repeated twice. Running it results in b.exe being run, while a.exe is NOT run. I tried switching the order like

C:\> bind.exe b.exe a.exe >out.exe

in which case a.exe was run.

Basically that method didn't work, so how should I go about doing this? I considered doing something with a hex editor while following format of this explanation of the windows PE format (the one used for windows executables) and removing the headers and such, but I feel like there is a less time consuming route to take.

Upvotes: 1

Views: 4421

Answers (1)

Rohit Gupta
Rohit Gupta

Reputation: 4193

BATCH FILE

The easiest way is to use a batch file. And run one after the other.

RESOURCE FILE

Another way is to create a third exe and add the first two as resources to it. At run time, write the resources to a folder and run one after the other.

OTHER SOLUTIONS

Other suggestions are here

Merge two exe files into one programmatically

Upvotes: 1

Related Questions