17.2 Executable-File Format

DOS applications have a simple format, which consists of a single header followed by a relocation table and the load module. Segmented executable files have two headers. The first header, usually called the DOS header, has a simple format. The second header, sometimes called the new .EXE header, has a more detailed format. Figure 17.1 shows the arrangement of the headers in a segmented executable file. When the executable file runs under DOS, the operating system uses the old header to load the file. Otherwise, the system ignores the DOS (or “old”) header and uses the new header.

The listing generated by EXEHDR shows the contents of the file header and information about each segment in the file. The type of listing generated reflects the structure of the header for the kind of file being checked. (For more information about the structure of DOS applications and segmented executable files, see the MS-DOS Encyclopedia.)