// Detect It Easy: detection rule file format
// Author: hypn0 <hypn0@mail.ru>

init("overlay", "");

function detect(bShowType, bShowVersion, bShowOptions) {
    if (MSDOS.compareOverlay("....'-lh'..2d") || MSDOS.compareOverlay("....'-lz'..2d")) {
        sName = "LHA archive";
        switch (MSDOS.readByte(MSDOS.getOverlayOffset() + 0x5)) {
            case 0x30:
                bDetected = true;
                break;
            case 0x31:
                bDetected = true;
                break;
            case 0x32:
                bDetected = true;
                break;
            case 0x33:
                bDetected = true;
                break;
            case 0x34:
                bDetected = true;
                break;
            case 0x35:
                bDetected = true;
                break;
            case 0x36:
                bDetected = true;
                break;
            case 0x64:
                bDetected = true;
                break;
            case 0x73:
                bDetected = true;
                break;
        }
    } else if (MSDOS.compareOverlay("60ea")) {
        sName = "ARJ archive";
        bDetected = true;
    } else if (MSDOS.compareOverlay("'ZOO'............'Archive'")) {
        bDetected = true;
        sName = "ZOO archive";
    } else if (MSDOS.compareOverlay("4c0103")) {
        bDetected = true;
        sName = "COFF executable";
    } else if (MSDOS.compareOverlay("0101'Aladdin'")) {
        sName = "Self UnStuffit data";
        sVersion = "1.1";
        sOptions = "by Aladdin Systems, Inc.";
        bDetected = true;
    } else if (MSDOS.compareOverlay("7f'ELF'010101")) {
        sName = "ELF executable";
        bDetected = true;
    } else if (MSDOS.compareOverlay("................'BSA'")) {
        sName = "BSN archive";
        bDetected = true;
    } else if (MSDOS.compareOverlay("'W4'")) {
        sName = "W4 executable";
        bDetected = true;
    } else if (MSDOS.compareOverlay("fef2fc")) {
        sName = "FOXPRO archive";
        bDetected = true;
    } else if (MSDOS.compareOverlay("'SXD'00")) {
        sName = "Sydex archive";
        bDetected = true;
    }

    return result(bShowType, bShowVersion, bShowOptions);
}