// Detect It Easy: detection rule file
// Author: horsicq <horsicq@gmail.com>

meta("packer", "RLPack");

function detect() {
    // DLL
    var nEP = PE.compareEP("807C2408010F85") ? 11 : 0;
    if (PE.compareEP("608BDDE8000000005D9532C095899D80000000B8", nEP)) {
        sVersion = "0.7.3 beta";
        bDetected = true;
    } else if (PE.compareEP("60E8000000008D6424048B6C24FC8DB5........8D9D........33FF", nEP)) {
        sVersion = "1.0 beta";
        bDetected = true;
    } else if (PE.compareEP("60E8000000008B2C2483C404", nEP)) {
        if (PE.compareEP("33FFEB", nEP + 24)) {
            sVersion = "1.11-1.14";
            sOptions = "aPlib";
        } else if (PE.compareEP("33FF6A", nEP + 24)) {
            sVersion = "1.11-1.14";
            sOptions = "LZMA";
        } else if (PE.compareEP("0000EB", nEP + 29)) {
            sVersion = "1.15-1.18";
            sOptions = "aPlib";
        } else if (PE.compareEP("00006A", nEP + 29)) {
            sVersion = "1.15-1.18";
            sOptions = "LZMA";
        } else if (PE.compareEP("33FFE8", nEP + 55)) {
            sVersion = "1.19-1.20";
            sOptions = "aPlib";
        } else if (PE.compareEP("33FF6A", nEP + 55)) {
            sVersion = "1.19-1.20";
            sOptions = "LZMA";
        } else if (PE.compareEP("EB0FFF", nEP + 56)) {
            sVersion = "1.17 Full Edition";
            sOptions = "aPLib";
        } else if (PE.compareEP("6A4068", nEP + 51)) {
            sVersion = "1.17 Full Edition";
            sOptions = "LZMA";
        } else if (PE.compareEP("33ffe8", nEP + 60)) {
            sVersion = "1.21";
            sOptions = "aPLib";
        }

        bDetected = true;
    } else if (PE.getNumberOfImports() === 1 && PE.compareEP("60") && PE.isSectionNamePresent(".RLPack")) {
        bDetected = true;
    } else if (PE.compareEP("eb$$9c60e8........33c08bc483c0..938be3")) {
        sVersion = "1.16-1.21";
        bDetected = true;
    }

    return result();
}