Skip to main content
GameDev.net gamedev.net
🔒 Locked

Creating exe's without compiling...

Started by jaymz Oct 9, 2000 at 11:34 AM 6 replies 250+ views
Original Post
jaymz
jaymz
In director, when you are finished with your project, you can create a self running exe with Directors projector built into it.. another example is PKZip, creating a self-extracting exe... Anyone have any clue how one would go about doing this in a Win32 environment? Creating a self running executable without compiling it into machine code?
jaxson
jaxson
It is not possible. Both of the examples that you gave have been compiled at one time or another. A self extracting executable _probably_ does something like this: It just appends your .zip data to the end of a normal EXE. This EXE''s sole purpose is to uncompress the file that has been appended to it.

This is similar to the old game programmer''s trick where your entire game appears to be one humongous EXE file, which is really just your actual game EXE and then all your data files appended to the EXE on disk.

Does that make any sense? You can''t have an EXE without machine code. Just because you didn''t see it compile in VC++ doesn''t mean it wasn''t compiled at some point.
mr BiCEPS
mr BiCEPS
As you probably already know, executables are usually made of several sections. Like Visual C++, that stores all the code in a section called .text (Borland compilers call it CODE ), and all of the data in a section called .data (Think it''s just DATA for Borland). Depending on the characteristics of the section, the OS can tell whether it contains code, data, maybe both, and whether it should be loaded into memory or not.

For example, a winzip Self-extractor, contains a section called WinZip, that isn''t loaded into memory. And this section contains all the compressed file data. So, all WinZip has to do, is put the stuff into that section, and change it''s size.
jaymz
jaymz
Ok, I think I am seeing the light... so basically, when you tell any of these types of programs to "build" your exe, they have an exe already waiting, which gets your data appended to the end of it, and saves it as a new file. Now, to get a bit more technical with this... how could you do this without messing up your machine code? I never really looked into exe''s past "compile and they run" so I don''t guess I understand the infrastucture of a Win32 exe file. I just see them as a backbox that has the machine code version of my code in it.(Any pointers to where I could learn this information would be great) How would you go about accessing the extra data in the exe? This does make more sense being that a lot of icons are stored in the exe.... and thats how resources in VC++ are stored if not loaded externally...
jaymz
jaymz
OMG mr Bicepts, you almost aswered my news questions before I posted them! Where can I find more information on the format of exe''s?
mr BiCEPS
mr BiCEPS
You could go to http://www.wotsit.org and check out the description os the portable executable file format (search for PE)
mr BiCEPS
mr BiCEPS
Or better yet, just search for EXE, PE gave too many hits

try here:
http://www.wotsit.org/search.asp?page=2&s=EXE
jaymz
jaymz
Thanks for the help jaxson and mr bicepts, I found a good article on my msdn cd (duh, should have looked there first)

Time to break some exe''s!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.