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?

ᔕᖺᘎᕊ
  • 6,173
  • 4
  • 33
  • 45
Cyclone
  • 143
  • 1
  • 2
  • 8
  • 1
    There 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 Feb 01 '12 at 02:13
  • `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 Feb 01 '12 at 02:31
  • Let me know if you need more informations. – Cyclone Feb 01 '12 at 02:31
  • 1
    How 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 Feb 01 '12 at 02:35
  • Yea, I know, but I would like to hide both `first.exe` and `second.exe` and only the `combined.exe` to be displayed. =/ – Cyclone Feb 01 '12 at 02:43

4 Answers4

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
  • 68,243
  • 36
  • 223
  • 356
  • 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 Feb 01 '12 at 02:47
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.

Tamara Wijsman
  • 57,083
  • 27
  • 185
  • 256
user30441
  • 151
  • 2
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
  • 319
  • 2
  • 11
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
  • 23,459
  • 13
  • 85
  • 122