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

meta("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() {
    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();
}