// DIE's signature file
// Author: hypn0 <hypn0@mail.ru>

init("protection", "Rainbow Sentinel dongle reference");

function detect(bShowType, bShowVersion, bShowOptions) {
    // I'm (adoxa) guessing these don't occur in the overlay, so don't search it (avoid wasting time on big installers).
    var nSize = PE.isOverlayPresent() ? PE.getOverlayOffset() : PE.getSize();

    if (nSize > 50000000)
        nSize = 50000000;

    if (PE.findString(0, nSize, "SNTNLUSB") != -1) {
        bDetected = true;
    } else {
        var nOffset = 0;
        while ((nOffset = PE.findString(nOffset, nSize - nOffset, "\\\\.\\")) != -1) {
            nOffset += 4;
            if (PE.compare("'SENTINEL.VXD'", nOffset) ||
                PE.compare("'SntnlUsb'", nOffset)) {
                bDetected = true;
                break;
            }
        }
    }

    return result(bShowType, bShowVersion, bShowOptions);
}