Search code examples
windowsheaderdos

DLL starts with MZx in DOS header - what does it mean?


I found a program which uses a dll-file, which starts with MZx in the DOS header. I never saw this before in my life. I get ZERO results at google when i try to find explanations what this means. Here is a screenshot:

enter image description here

What exactly does the MZx mean? Are there differences to a typical MZ header? Can i replace the dll with a "normal" one which starts with MZ or will it be not compatible?


Solution

  • Only the first two bytes are part of the signature, the rest is the configuration of the DOS program:

    typedef struct _IMAGE_DOS_HEADER
    {
         WORD e_magic; // MZ
         WORD e_cblp;  // Bytes on last page of file
         WORD e_cp;    // Pages in file
         ...
    

    These "unusual" values are either required by the DOS program (unlikely in a .dll) or used as some kind of marker/storage for something. Either way, leave the values alone...