.EXE format 
Author Message
 .EXE format

I'm using Borland Turbo Pascal for Windows v1.5 (under Win3.11).

I'm trying to write a program which can append, to its own .exe file
image, an arbitrarily sized graphic. Fairly obviously, the application
is a self-contained "graphic with viewer" but with the requirement
that the client should be able to change the image through the
application without needing access to the source code and compiler.
My viewer works fine. However, when I try to append *anything* to
the end of the .exe image I get an invalid format error when I
run the application. I'm guessing that there's something I need to
know about .exe file format. Can anybody help, please?

Regards -

--

http://www.*-*-*.com/
Pager: 01426-217402



Wed, 18 Jun 1902 08:00:00 GMT  
 .EXE format


Quote:

> I'm using Borland Turbo Pascal for Windows v1.5 (under Win3.11).

> I'm trying to write a program which can append, to its own .exe file
> image, an arbitrarily sized graphic. Fairly obviously, the application
> is a self-contained "graphic with viewer" but with the requirement
> that the client should be able to change the image through the
> application without needing access to the source code and compiler.
> My viewer works fine. However, when I try to append *anything* to
> the end of the .exe image I get an invalid format error when I
> run the application. I'm guessing that there's something I need to
> know about .exe file format. Can anybody help, please?

it could be how you're appending the image.

if you're using copy, you must use the /b (binary) switch ..

copy /b file1.exe + file2.img bigfile.exe
     ^^

if you don't, dos will stop coping when it hits a ^Z (end of file) so
you'll have a truncated exe which won't run.

but it's a good question.. normally i use a const that stores the size of
the compiled exe before the image gets added to the end of it - but that
information has to be as part of the exe header (so dos knows how much to
load in memory).



Wed, 18 Jun 1902 08:00:00 GMT  
 .EXE format

Quote:
> > I'm trying to write a program which can append, to its own .exe file
> > image, an arbitrarily sized graphic. Fairly obviously, the application
> > is a self-contained "graphic with viewer" but with the requirement
> > that the client should be able to change the image through the
> > application without needing access to the source code and compiler.
> > My viewer works fine. However, when I try to append *anything* to
> > the end of the .exe image I get an invalid format error when I
> > run the application. I'm guessing that there's something I need to
> > know about .exe file format. Can anybody help, please?

> but it's a good question.. normally i use a const that stores the size of
> the compiled exe before the image gets added to the end of it - but that
> information has to be as part of the exe header (so dos knows how much to
> load in memory).

i'll answer my own question :

from http://www.zekes.com/~blunt/exehdr.html

   HdrID     dw  00h     ; ID signature ('MZ') ******** EXE header *********
   excess    dw  00h     ; Image size mod 512 (bytes on last page)
   pages     dw  00h     ; # 512-byte pages in image
   reloct    dw  00h     ; count of relocation table entries
   hdrsize   dw  00h     ; size of header, in paragraphs
   minmem    dw  00h     ; min required mem
   maxmem    dw  00h     ; max required mem
   stacks    dw  00h     ; stack seg offset in load module
   stackp    dw  00h     ; initial value of sp
   cksum     dw  00h     ; file checksum
   ipointer  dw  00h     ; initial value of IP
   codes     dw  00h     ; cs offset in load module
   relostart dw  00h     ; offset of first reloc item
   ovlnum    dw  00h     ; overlay number



Wed, 18 Jun 1902 08:00:00 GMT  
 .EXE format

Why don't you just compile it with a Dummy FileSize, look at the filesize and
then Recompile it and append the file at the end?? Then you could pack it using
PKLite or whatever, use the packed size and protect it from decompression at the
same time!!



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Borland Debug Format (on end of EXE files)

2. EXE file format

3. TPX.EXE AND TURBO.EXE {difference between}

4. TPX.EXE and TURBO.EXE

5. Windows EXE and DOS EXE

6. EXE to PAS or EXE to C\c++ ?

7. Appending exe to exe file

8. an exe form an exe

9. Tlink.exe - Tasm.exe .....

10. fc TURBO.EXE TPX.EXE /b

11. convert differents formats under delphi format

12. DBASE Format or Paradox format

 

 
Powered by phpBB® Forum Software