Phil
Phil

Reputation: 6679

How are self-extracting executables made?

There are many programs out there that will allow you to pack a few files together and generate an executable that has the necessary code to extract them. Somehow, those files are residing inside the executable. I am interested in doing the same thing; how is this done?

FYI, I'm interested primarily in Windows .exe files, if it makes a difference.

Upvotes: 3

Views: 468

Answers (4)

t0mm13b
t0mm13b

Reputation: 34592

UPX is a well known packer for Windows .EXE which can be found here on WikiPedia. And here is the main site on sourceforge for UPX.

Hope this helps, Best regards, Tom.

Upvotes: 0

John Knoeller
John Knoeller

Reputation: 34148

Self extracting .exe files are usually archive files (zip, rar, tar, etc) concatenated together with a small program that does the extraction then executes the program that was extracted from the archive.

A really sophisticated one could extract the archive into memory and then jump to the extracted code and run it, but back in the old days, that sort of thing was easier to do.

If you wanted to write your own in Windows, you would create a small console application that did the extraction, and you would include the 'real' program in the console programs' resources.

Upvotes: 1

wallyk
wallyk

Reputation: 57774

There are also products like pkzip and winzip which do it for you. If your time is worth anything, those would be more efficient.

Upvotes: 0

John Boker
John Boker

Reputation: 83709

You could probably save a file/files in a resource, compile it into the exe then use some code in the exe to extract it out to a file.

ie:

http://www.codeproject.com/KB/winsdk/binaryresources.aspx

Upvotes: 1

Related Questions