|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
The structure of an EXE.
So for the first time, I actually browsed one of my exe files in a hex editor. I was pretty amazed at what I saw. I have a 140 kB exe, and within it, I have huge blocks of repeating bytes. The worse one I found was 65kB of consecutive null bytes. Other blocks existed too, none of them as big, and not always null bytes either.
What purpose do these blocks serve? Is it space for the locals and such that are declared as the program executes? |
|
#2
|
||||
|
||||
|
I think what you're seeing is part of the EXE file header. In a DOS EXE file, the first 256 bytes formed the EXE header. They have extended it quite a bit for Windows. The header gave the OS loader information on how to load the various parts of the EXE file (code segments vs data segments) into memory. In DOS, the .com files did not have this header, since the code and data segments were the same and hence .com programs could not exceed 64K in size.
The first two bytes of an EXE are always MZ (which is what identifies it as an EXE. If the file did not contain this, DOS would treat it as a .COM file irrespective of the .EXE extension). Supposedly MZ stands for Mark Zbikowski (spelling?), who was an early programmer at Microsoft. The rest of the header contains information about various program segments. Not all of the header fields were used for every executable, so a lot of them may be zero. For more info on these fields: http://support.microsoft.com/defaul...kb;EN-US;q65122 |
|
#3
|
|||
|
|||
|
Hmm. That's neat. I was wondering what exactly made an exe what it is. It just shocked me that over 50% of my file size was 'nothing'.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > The structure of an EXE. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|