// DIE's signature file
// https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Compiler_Versions
// coauthor: sendersu (If errors pls contact sendersu on cracklab.team)

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

includeScript("Borland");

function detect(bShowType, bShowVersion, bShowOptions) {
    bDetected = bBorlandC;
    if (bDetected == 2) {
        sVersion = "1999";
        bDetected = true;
    }

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

            if (PE.resource["DVCLAL"]) {
                // 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";
                }
            }
        }
    }

    _setLang("C++", bDetected);
    return result(bShowType, bShowVersion, bShowOptions);
}
