Combining two exe files

1

Is that possible, to combine two exe files?

I need it to work like this:

  • User is running combined.exe (combination of 2 exe files).
  • When first exe is loaded and user has clicked "Start" there (I got the source code), then second exe file will run.

Is that even possible?

Cyclone

Posted 2012-02-01T02:11:01.373

Reputation: 143

1There are many ways to do this. Which language are you coding in? Also, to clarify, is this the structure: Combined.exe runs first.exe; After first.exe ends, prompt to run second.exe? Or is first.exe the prompt? – iglvzx – 2012-02-01T02:13:14.037

first.exe is coded in AutoIT, and user will be able to click "Start" there, to run second.exe (and then first.exe will close itself). – Cyclone – 2012-02-01T02:31:21.167

Let me know if you need more informations. – Cyclone – 2012-02-01T02:31:41.103

1How familiar are you with AutoIt? You should be able to write this whole thing using AutoIt. I use AutoHotkey myself, and such a program would be a few lines of code. – iglvzx – 2012-02-01T02:35:38.057

Yea, I know, but I would like to hide both first.exe and second.exe and only the combined.exe to be displayed. =/ – Cyclone – 2012-02-01T02:43:36.093

Answers

1

Add the second EXE file as a resource in the wrapper program. Then when you need to run it, you can extract it to a temporary directory and run it.

(I take it that by I got [sic] the source code, you mean AutoIt code?) I did only a quick check, but I think AutoIt (or at least the compiler) supports adding and extracting resources and it should support using the Windows API. As for protecting the EXE, there’s really little you can do short of strong encryption, but you can lock the file, and close it with the FILE_FLAG_DELETE_ON_CLOSE flag set to automatically delete it.

Synetech

Posted 2012-02-01T02:11:01.373

Reputation: 63 242

Yea, good points, but I would like to prevent the both files to be extracted or something, because I dont want any user to have permissions to view first and second.exe (even if it would be extracting to the temporary directory). Also too bad I have no idea about coding in C# =/ – Cyclone – 2012-02-01T02:47:46.803

1

In the malware world people often use .exe binders to combine two and sometimes encrypt the final result to prevent detection, so you may find that much of the software available to do this will result in your application being flagged as malware.

Example of software intended for malicious purposes: File Joiner

However, if you omit the encryption stub you may find that the is not flagged, just upload to virustotal.com and check the results. I would do this regardless of which solution you choose.

user30441

Posted 2012-02-01T02:11:01.373

Reputation: 141

0

You should look at EXE protectors if you don't want users to be poking at your code. It's hard to dynamically start a new process without a stub EXE of some sort, and I wouldn't even try to write EXE segments from AutoIt. (Actually, I've been able to execute pieces of assembly from AutoIt, but on Vista+ Data Execution Prevention usually kills it.)

cyanic

Posted 2012-02-01T02:11:01.373

Reputation: 189

0

This is slightly different from your example, but this is how to combine .exe's using AutoHotkey: compile the following script with First.exe and Second.exe in the same folder. After compiling, you only need to keep the single wrapper .exe.

FileCreateDir, tmp

FileInstall, First.exe, tmp\First.exe
FileInstall, Second.exe, tmp\Second.exe

RunWait, tmp\First.exe

MsgBox, 4, , Run Second.exe?

IfMsgBox, Yes
    RunWait, tmp\Second.exe

FileRemoveDir, tmp, 1

ExitApp

iglvzx

Posted 2012-02-01T02:11:01.373

Reputation: 21 611