// Detect It Easy: detection rule file
// Author: BJNFNE <bjnfne@web.de>
// Improved by: horsicq

// https://digitalmars.com
meta("compiler", "Digital Mars C/C++");

function detect() {
    if (PE.isNet()) return; // Doesn't support .NET

    if (PE.compare("'MZ'60000100000004001000FFFF0000FE0000001200000040000000000000000000000000000000000000000000000000000000000000000000000060000000'Requires Win32   $'161F33D2B409CD21B8014CCD2100'PE'0000")) {
        if (PE.isSectionNamePresent(".CRT$XIA")) {
            if (PE.compareEP("558BEC648B15........6AFF68........")) {
                bDetected = true;
            }
        }
    }

    if (bDetected) {
        var majorVersion = PE.getMajorLinkerVersion(),
            minorVersion = PE.getMinorLinkerVersion();

        if (majorVersion === 7 && minorVersion === 0x50) {
            sVersion = "8.45";
        } else if (majorVersion === 8 && minorVersion === 0) {
            sVersion = "8.52-8.57";
        }
    }

    sLang = "C/C++";

    return result();
}