This is the size of the executable file of the format "whole" MZ, the whole past of the last byte on the last page is ignored. When MS-DOS loads an executable file in the MZ format, it copies everything to the file after the headers to this limit. Thus, the fact that in most PECOFF executables this field is set to a value greater than the MS-DOS stub means that the PECOFF headers and part of the PECOFF section data will be loaded into memory when the executable is launched under MS-DOS.
I donβt know why the default DOS stub used by the Microsoft linker (and the GNU linker, but not Borland or Watcom) says that its size is 1168 bytes, when in fact it is much smaller. If you use your own stub when using the Microsoft linker, it uses the size from the provided executable. Windows seems to ignore this value when loading PECOFF executables, and the DOS stub is not used by default for additional data.
Please note that using the Microsoft linker, you can create a valid PECOFF executable that is only 1024 bytes long. This requires that the executable file has only one partition and has a size of less than 512 bytes. While Windows will load and run the executable file, MS-DOS will refuse because the file size is smaller than the size 1168 specified in the MZ headers.
source share