Coder's Guild Mailing List

Self extracting Executable

Posted by Ulli Conrad on 2001-01-09

On 9 Jan 2001, Ric wrote:

> Anyone got ideas on how to write a self-extracting executable file in
> Delphi???

Hi,

I've done this some time ago, but can't find the source at the 
moment (must be on any backup CD). Anyway, the way to 
success is to append the exe by the data to be extracted. I've 
counted the size of the data to be appended and wrote a small 
record with information about the appended data after that at the 
very end of the modified exe.
Then, when extracting, I've read from SizeOf(exe)-
SizeOf(InfoBlock), got the data and read then from SizeOf(exe)-
InfoBlock.DataSize, somewhat that way. Does this help you?
BTW: The exe wasn't VCL based, but written only by WinAPI use 
to keep it small. You'll find an example in the CKB at 
http://ckb.noreply.org under Delphi / MISCELLANEOUS / A non-
VCL program

Happy coding
- Ulli -




--
Sunburn In Cyprus - Remix-/Construction project
http://sic.surmusic.org/

Free MP3 downloads at
http://www.mp3.com/sic/