// Detect It Easy: detection rule file
// Author: horsicq <horsicq@gmail.com>
// https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Compiler_Versions
// coauthor: sendersu (If errors pls contact sendersu on cracklab.team)

meta("compiler", "Borland C++");

includeScript("Borland");

function detect() {
    bDetected = bBorlandC;

    if (bDetected == 2) {
        sVersion = "1999";
        bDetected = true;
    }

    if (bDetected) {
        var dvclalResource = PE.resource["DVCLAL"];

        if (PE.resource["PACKAGEINFO"] || dvclalResource) {
            sVersion = "Builder";

            if (dvclalResource) {
                // try to decode DVCLAL (Delphi Visual Component Library Access License) values
                nOffset = PE.getResourceNameOffset("DVCLAL");
                if (PE.compare("A28CDF987B3C3A7926713F090F2A2517", nOffset)) {
                    sOptions = "Professional";
                } else if (PE.compare("23785D23B6A5F31943F3400226D111C7", nOffset)) {
                    sOptions = "Standard";
                } else if (PE.compare("263D4F38C28237B8F3244203179B3A83", nOffset)) {
                    sOptions = "Enterprise";
                }
            }
        }
    }

    sLang = "C++";

    return result();
}