strangly_large.exe? 
Author Message
 strangly_large.exe?

I'm using TASM 5.0 to build a 32 Windows application.  I've noticed that even
if my only code is a call to ExitProcess the compiled executable is still 4 KB.
 Even if I haven't included any data or resources I still get 4 KB.  Why?  My
code is less than a dozen bytes long, no data, no resources, and my stub is
only about 600 bytes.  What is occuping all that disk space?  Thanks.


Tue, 08 Jan 2002 03:00:00 GMT  
 strangly_large.exe?

Quote:
> I'm using TASM 5.0 to build a 32 Windows application.  I've noticed that even
> if my only code is a call to ExitProcess the compiled executable is still 4 KB.
>  Even if I haven't included any data or resources I still get 4 KB.  Why?  My
> code is less than a dozen bytes long, no data, no resources, and my stub is
> only about 600 bytes.  What is occuping all that disk space?  Thanks.

 the PE format (the executable format used by windows) has first some headers,
which occupy say 100-200 bytes, and then they have one requirement: all
code/data must be page aligned in position. page means the size of a block
used by the virtual memory manager, in simple words (on intel machines
this is hardwired to 4kb). so, your code gets aligned to the next multiple
of 4 kilobytes, which means it is stored AT 4kb. so comes the large size ;)

Fabian Giesen
ryg/teklords

(or am i wrong and it is the size which gets aligned? or both? i don't
 remember exactly ;)



Tue, 08 Jan 2002 03:00:00 GMT  
 strangly_large.exe?

Quote:

> I'm using TASM 5.0 to build a 32 Windows application.  I've noticed that even
> if my only code is a call to ExitProcess the compiled executable is still 4 KB.
>  Even if I haven't included any data or resources I still get 4 KB.  Why?  My
> code is less than a dozen bytes long, no data, no resources, and my stub is
> only about 600 bytes.  What is occuping all that disk space?  Thanks.

The file headers, + the fact that all sections must have a alignment of 512 byte or
better in the file (on win 9x that is, NT can get a way with just 32 byte alignment
i think, but 512 is the default on most linkers).

BTW it is theoretically possible to get smaller win 32 exe files bay avoiding to
have that many sections, the liker that came with the win 98 ddk (can be DL for
free from MS web site) dose a pretty good job to get around the alignment problem,
i think something close to 1.5 - 1.6 kb for a "hello world" program should be
possible with that linker...

If your interested in more "in deep" info abut the win 32 exe format, go her
http://www.wotsit.org/ in the "binary" section under "PE" format, DL the file
pe1.zip (98kb), it's the best description of the win 32 exe file format i have fond
this far.

--
Leif

--------------------------------------------------
I don't mind get an email or two, but I do hate

--------------------------------------------------
 Love, Peace, Understanding
            And
    Freedom To Every One



Tue, 08 Jan 2002 03:00:00 GMT  
 strangly_large.exe?

Quote:

> (or am i wrong and it is the size which gets aligned? or both? i don't
>  remember exactly ;)

Just a little ;), for win 9x sections has to be aligned on 512 bytes (may work with
better alignment, i haven't tried) in the _file_, then the file is loaded the
sections must be loaded on a 4kb bordary (aligned on 4kb = page aligned). And since
the linker vill pull in a number of sections on it's own (+ your sections) the file
size vill start grow pretty fast...

--
Leif

--------------------------------------------------
I don't mind get an email or two, but I do hate

--------------------------------------------------
 Love, Peace, Understanding
            And
    Freedom To Every One



Tue, 08 Jan 2002 03:00:00 GMT  
 strangly_large.exe?

Quote:
> Just a little ;), for win 9x sections has to be aligned on 512 bytes (may work with
> better alignment, i haven't tried) in the _file_, then the file is loaded the
> sections must be loaded on a 4kb bordary (aligned on 4kb = page aligned). And since
> the linker vill pull in a number of sections on it's own (+ your sections) the file
> size vill start grow pretty fast...

gnaaa.
didn't remember the exact parameters, however i told him the _idea_. isn't that
nice of me? ;)

fg



Tue, 08 Jan 2002 03:00:00 GMT  
 strangly_large.exe?

Quote:

> gnaaa.
> didn't remember the exact parameters, however i told him the _idea_. isn't that
> nice of me? ;)

Oh yes, defiantly :-), it's always nice to se people how like to help other people. I
just wanted to clear things up a bit since you and I gave him different answers. I did
not men to be "picky" (i think that's the right word for it, im not native English) or
anything like that...

BTW After all, the main thing is that one is happy...

--
Leif

--------------------------------------------------
I don't mind get an email or two, but I do hate

--------------------------------------------------
 Love, Peace, Understanding
            And
    Freedom To Every One



Wed, 09 Jan 2002 03:00:00 GMT  
 strangly_large.exe?

Quote:
> Oh yes, defiantly :-), it's always nice to se people how like to help other people. I

yes.

Quote:
> just wanted to clear things up a bit since you and I gave him different answers. I did
> not men to be "picky" (i think that's the right word for it, im not native English) or
> anything like that...

hehe. it's just that I am picky normally (also don't know if it's the right word, but
who cares? you know what i mean ;) and i'm somewhat.. er... forget it ;)

Quote:
> BTW After all, the main thing is that one is happy...

yes.

fg



Wed, 09 Jan 2002 03:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. 32-Bit NMAKE.EXE, LINK.EXE, LIB.EXE, & RC.EXE

2. c5print.exe and c5printx.exe cannot run in the root directory of a network drive

3. cscn.exe and cvvt.exe

4. ABC Exe Called From Clarion Exe

5. Splitting a big .exe in a smale.exe and many ddl's in C4b

6. ntvdm.exe - Application Error when running C55EE.exe

7. close exe form another exe

8. need cw21lpex.exe or c4lpex.exe

9. Running one EXE from another EXE

10. making the exe readonly / exe in a network

11. GPF in EXE calling EXE

12. EXE + DLL ----> EXE

 

 
Powered by phpBB® Forum Software