MS-DOS 6.22 Corrupt EXE File Error Explained

When MS-DOS 6.22 attempts to execute a corrupted executable (.EXE) file, it primarily throws the error message "Error in EXE file". This article details the specific error messages generated by the operating system during execution failures, the internal verification process of the MS-DOS program loader, and other related error conditions that can arise from specific types of file damage.

The Primary Error: "Error in EXE file"

When you run an executable in MS-DOS 6.22, the command processor (COMMAND.COM) calls the DOS Exec function via Interrupt 21h, Subfunction 4Bh (INT 21h, AH=4Bh). If the loader detects that the file's internal structure is invalid or compromised, the interrupt fails and returns DOS Error Code 0Bh (decimal 11), defined as ERROR_BAD_FORMAT (Invalid Format).

COMMAND.COM translates this return code into the standard user-facing message:

Error in EXE file

Why MS-DOS Triggers This Error

MS-DOS executables begin with a standardized 28-byte header known as the "MZ" header (named after Microsoft engineer Mark Zbikowski). The DOS loader reads this header into memory before allocating conventional RAM to the program.

The error occurs when the loader encounters inconsistencies during validation:

  1. Invalid Signature: The first two bytes must contain the ASCII characters MZ (hexadecimal 4D 5A) or ZM (hexadecimal 5A 4D). If file corruption alters these bytes, DOS rejects the file.
  2. Relocation Table Errors: The header defines an offset to the relocation table and the total count of relocation items. If these values point beyond the end of the file or contain corrupted memory pointers, loading halts immediately.
  3. Mismatched File Size: The header records the exact page count (512-byte blocks) and the remainder bytes in the final page. If the actual physical file size on the disk is smaller than what the header defines, DOS flags the file as damaged.

Depending on where the corruption occurs within the binary or how memory is structured, MS-DOS 6.22 may display alternative messages:

  • "Program too big to fit in memory": Occurs when corruption affects the header fields specifying the minimum and maximum extra memory allocation (minalloc/maxalloc). If these fields become corrupted with excessively high values, DOS determines that available conventional memory is insufficient.
  • "Packed file is corrupt": Occurs in programs compressed with tools such as Microsoft's EXEPACK. If the decompression routine located inside the executable fails due to corrupted data payloads or conventional memory collisions below the 64 KB boundary, this message is generated by the executable's self-extracting runtime wrapper rather than the core DOS kernel.

Resolving the Error

Because the loader halts execution before handing control over to the binary, no corrupted code is run. Resolving the issue involves:

  • Restoring the executable from a clean, uncorrupted backup or original installation media.
  • Running SCANDISK or CHKDSK /F in MS-DOS 6.22 to fix potential file system defects, cross-linked clusters, or bad sectors.
  • Verifying that binary files transferred via FTP or network shares were copied in binary mode rather than ASCII mode, which commonly corrupts MZ headers by converting carriage returns and line feeds.