Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!caen!spool.mu.edu!snorkelwacker.mit.edu!ai-lab!life.ai.mit.edu!mycroft From: mycroft@kropotki.gnu.ai.mit.edu (Charles Hannum) Newsgroups: comp.compression Subject: Re: Self Extracting Files Message-ID: Date: 19 Jun 91 17:51:25 GMT References: <309pollarda@physc1.byu.edu> <1991Jun17.205910.17669@apex.com> <1991Jun19.140345.18650@bellcore.bellcore.com> Sender: news@ai.mit.edu Organization: None. Utter chaos. Lines: 26 In-reply-to: aaron@backyard.bae.bellcore.com's message of 19 Jun 91 14:03:45 GMT In article <1991Jun19.140345.18650@bellcore.bellcore.com> aaron@backyard.bae.bellcore.com (Aaron Akman) writes: In article <1991Jun17.205910.17669@apex.com>, rennyk@apex.com (Renny K) writes: >In article <309pollarda@physc1.byu.edu> pollarda@physc1.byu.edu writes: > >There is a EXE Header as it is called, at the beginning of EVERY EXE file. >The DOS loader looks at this information before loading the file for length, >where to load, relocation etc. It's possible to change the amount of informa- This goes back a bit, but I appended data to an EXE this way: Compiled the EXE completely, created a little utility program to open(file.exe), seek(file.exe, EOF), and write(file.exe, extra stuff). As I recall, I tried 2 methods for ``finding'' the data from within the executing EXE: [stuff deleted] This is unnecessary and unreliable. The .EXE header tells you exactly how large the executable portion is. Most programs also put their own header on the data, so they know exactly how large it is. If you choose to do this, you should make your header compatible with a .EXE header, but with a different magic value. (It only requires 16 bytes -- a small price to pay for the flexibility it adds.) This also allows you to add more than one data segment to your program, each with a different magic value, and simply have your loader search the headers for the right one. This is very fast.