// Detect It Easy: detection rule file format
// Author: Jason Hood <jadoxa@yahoo.com.au>

includeScript("cab");

function detect(bShowType, bShowVersion, bShowOptions) {
    if (!detect_Cab(0, Binary.getSize(), bShowOptions)) {
        if (Binary.compare("'ISc('")) {
            sName = "InstallShield Cabinet File";
            var nVer = Binary.readWord(4);
            switch (Binary.readByte(7)) {
                case 1:
                    sVersion = (nVer >> 12) & 15;
                    break;
                case 2:
                case 4:
                    sVersion = (nVer / 100).toFixed(2);
                    break;
            }
            bDetected = true;
        }
    }

    return result(bShowType, bShowVersion, bShowOptions);
}