// DIE's signature file

init("archive", "7-Zip");

function detect(bShowType, bShowVersion, bShowOptions) {
    const overlayOffset = PE.getOverlayOffset();

    if (PE.compareOverlay("';!@Install@!UTF-8!'") || PE.compareOverlay("efbbbf';!@Install@!UTF-8!'")) {
        if (PE.isSignaturePresent(overlayOffset, 0x2000, "'7z'BCAF271C")) {
            bDetected = true;
        }
    } else if (PE.compare("'7z'BCAF271C", overlayOffset)) {
        bDetected = true;
    }

    if (bDetected) {
        sVersion = PE.readByte(overlayOffset + 6) + "." + PE.readByte(overlayOffset + 7);
    }

    return result(bShowType, bShowVersion, bShowOptions);
}