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

init("sfx", "CHZ SFX (ChSFX)");

function getChSFXVersion() {
    var sResult = "";
    var nStringOffset = MSDOS.findString(0, Math.min(0x100, MSDOS.getSize()), "ChSFX");
    if (nStringOffset != -1) {
        sResult = MSDOS.getString(nStringOffset + 6);
        sResult = sResult.replace(/\s+$/, '');
    }

    return sResult;
}

function detect(bShowType, bShowVersion, bShowOptions) {
    if (MSDOS.compareEP("ba....e8$$$$1e0e1fe8$$$$52568bf2fcb4..eb$$ac0ac075")) {
        sVersion = getChSFXVersion();
        bDetected = true;
    } else if (MSDOS.compareEP("8d16....e8$$$$1e0e1fe8$$$$52568bf2fcb4..eb$$ac0ac075")) {
        sVersion = getChSFXVersion();
        bDetected = true;
    }

    return result(bShowType, bShowVersion, bShowOptions);
}