Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!nwnexus!apex!rennyk From: rennyk@apex.com (Renny K) Newsgroups: comp.compression Subject: Re: Self Extracting Files Message-ID: <1991Jun17.205910.17669@apex.com> Date: 17 Jun 91 20:59:10 GMT References: <309pollarda@physc1.byu.edu> Reply-To: rennyk@apex.UUCP (Renny K) Organization: Apex Computer Co., Redmond WA Lines: 52 In article <309pollarda@physc1.byu.edu> pollarda@physc1.byu.edu writes: > >PKZip as well as several other file compression utilities I have seen >have the option to have the files self extracting. I understand that >the files have the machine code to self extract along with the data >combined somehow. But how exactly does it work? >What tells the computer to stop loading in the file as machine code >and handle the rest as data? 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- tion loaded by modifying this header. >What codes are needed to be able to achieve this? And what changes >are needed to be made to the program in order for it to work on >this kind of file? You don't need any special codes. It's done by DOS (and the linker) >Some programs have something embeded in them so that if you "type" >them, they will display the program name and the material will stop >scrolling on the screen and the DOS prompt will appear again. >If there is anyone with the answer (or at least a good guess at one) >to either of these two questions, I would greatly appreciate it >if you could let me know what is going on. This is also easy to do. It's much easier in a .COM program than an .EXE program. In a COM program: Start off the program with a jump instruction, followed by the message and then end the message with the hex character 01Ah. This is the DOS End-Of-File character, which will cause the type command to stop. ex: JMP START DB 'My Program',13,10 DB 'Version 1.0',13,10 DB 'Copyright 1991, Renny Koshy',13,10,10,10,01Ah In an EXE program it's harder because of the header in the beginning, and I don't know how to do it without showing SOME garbage (i.e. the header). -- ------------------------------------------------------------------------------- Renny Koshy rennyk@apex.com Apex Computer, Redmond, WA.