Exemple #1
0
void UEFITool::search()
{
    // Set focus to edit box
    searchDialog->ui->searchEdit->setFocus();

    if (searchDialog->exec() != QDialog::Accepted)
        return;

    int index = searchDialog->ui->dataTypeComboBox->currentIndex();
    if (index == 0) { // Hex pattern
        QByteArray pattern = QByteArray::fromHex(searchDialog->ui->searchEdit->text().toLatin1());
        if (pattern.isEmpty())
            return;
        UINT8 mode;
        if (searchDialog->ui->headerOnlyRadioButton->isChecked())
            mode = SEARCH_MODE_HEADER;
        else if (searchDialog->ui->bodyOnlyRadioButton->isChecked())
            mode = SEARCH_MODE_BODY;
        else
            mode = SEARCH_MODE_ALL;
        ffsEngine->findHexPattern(pattern, mode);
        showMessages();
    }
    else if (index == 1) { // Text string
        QString pattern = searchDialog->ui->searchEdit->text();
        if (pattern.isEmpty())
            return;
        ffsEngine->findTextPattern(pattern, searchDialog->ui->unicodeCheckBox->isChecked(),
                                   (Qt::CaseSensitivity) searchDialog->ui->caseSensitiveCheckBox->isChecked());
        showMessages();
    }
}
Exemple #2
0
void UEFITool::search()
{
    if (searchDialog->exec() != QDialog::Accepted)
        return;

    QModelIndex rootIndex = ffsEngine->treeModel()->index(0, 0);

    int index = searchDialog->ui->tabWidget->currentIndex();
    if (index == 0) { // Hex pattern
        searchDialog->ui->hexEdit->setFocus();
        QByteArray pattern = searchDialog->ui->hexEdit->text().toLatin1();
        if (pattern.isEmpty())
            return;
        UINT8 mode;
        if (searchDialog->ui->hexScopeHeaderRadioButton->isChecked())
            mode = SEARCH_MODE_HEADER;
        else if (searchDialog->ui->hexScopeBodyRadioButton->isChecked())
            mode = SEARCH_MODE_BODY;
        else
            mode = SEARCH_MODE_ALL;
        ffsEngine->findHexPattern(rootIndex, pattern, mode);
        showMessages();
    }
    else if (index == 1) { // GUID
        searchDialog->ui->guidEdit->setFocus();
        searchDialog->ui->guidEdit->setCursorPosition(0);
        QByteArray pattern = searchDialog->ui->guidEdit->text().toLatin1();
        if (pattern.isEmpty())
            return;
        UINT8 mode;
        if (searchDialog->ui->guidScopeHeaderRadioButton->isChecked())
            mode = SEARCH_MODE_HEADER;
        else if (searchDialog->ui->guidScopeBodyRadioButton->isChecked())
            mode = SEARCH_MODE_BODY;
        else
            mode = SEARCH_MODE_ALL;
        ffsEngine->findGuidPattern(rootIndex, pattern, mode);
        showMessages();
    }
    else if (index == 2) { // Text string
        searchDialog->ui->textEdit->setFocus();
        QString pattern = searchDialog->ui->textEdit->text();
        if (pattern.isEmpty())
            return;
        ffsEngine->findTextPattern(rootIndex, pattern, searchDialog->ui->textUnicodeCheckBox->isChecked(),
            (Qt::CaseSensitivity) searchDialog->ui->textCaseSensitiveCheckBox->isChecked());
        showMessages();
    }
}
Exemple #3
0
      void
      handleGET(TCPSocket* sock, TupleList& headers, const char* uri)
      {
        debug("GET request: %s", uri);

        if (isSpecialURI(uri))
        {
          if (matchURL(uri, "/dune/time/set", true))
            setTime(sock, headers, uri);
          else if (matchURL(uri, "/dune/version.js"))
            sendVersionJSON(sock, headers, uri);
          else if (matchURL(uri, "/dune/agent.js"))
            sendAgentJSON(sock, headers, uri);
          else if (matchURL(uri, "/dune/state/messages.js"))
            showMessages(sock, headers, uri);
          else if (matchURL(uri, "/dune/power/channel/", true))
            handlePowerChannel(sock, headers, uri);
          else
            sendResponse404(sock);
        }
        else
        {
          Path path;
          if (std::strcmp("/", uri) == 0)
            path = m_ctx.dir_www / "index.html";
          else
            path = m_ctx.dir_www / uri;

          sendStaticFile(sock, headers, path);
        }
      }
Exemple #4
0
void UEFITool::openImageFile(QString path)
{
    QFileInfo fileInfo = QFileInfo(path);
    if (!fileInfo.exists()) {
        ui->statusBar->showMessage(tr("Please select existing file"));
        return;
    }

    QFile inputFile;
    inputFile.setFileName(path);

    if (!inputFile.open(QFile::ReadOnly)) {
        QMessageBox::critical(this, tr("Image parsing failed"), tr("Can't open input file for reading"), QMessageBox::Ok);
        return;
    }

    QByteArray buffer = inputFile.readAll();
    inputFile.close();

    init();
    UINT8 result = ffsEngine->parseImageFile(buffer);
    showMessages();
    if (result)
        QMessageBox::critical(this, tr("Image parsing failed"), tr("Error code: %1").arg(result), QMessageBox::Ok);
    else
        ui->statusBar->showMessage(tr("Opened: %1").arg(fileInfo.fileName()));

    // Enable search
    ui->actionSearch->setEnabled(true);
}
Exemple #5
0
void UEFITool::saveImageFile()
{
    QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"),".","BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.efi);;All files (*.*)");
    
    if (path.isEmpty())
        return;

    QByteArray reconstructed;
    UINT8 result = ffsEngine->reconstructImageFile(reconstructed);
    showMessages();
    if (result) {
        QMessageBox::critical(this, tr("Image reconstruction failed"), tr("Error code: %1").arg(result), QMessageBox::Ok);
        return;
    }

    QFile outputFile;
    outputFile.setFileName(path);
    if (!outputFile.open(QFile::WriteOnly)) {
        QMessageBox::critical(this, tr("Image reconstruction failed"), tr("Can't open output file for rewriting"), QMessageBox::Ok);
        return;
    }

    outputFile.resize(0);
    outputFile.write(reconstructed);
    outputFile.close();
    if (QMessageBox::information(this, tr("Image reconstruction successful"), tr("Open reconstructed file?"), QMessageBox::Yes, QMessageBox::No)
        == QMessageBox::Yes)
        openImageFile(path);
}
Exemple #6
0
void UEFITool::openImageFile(QString path)
{
    if (path.trimmed().isEmpty())
        return;

    QFileInfo fileInfo = QFileInfo(path);

    if (!fileInfo.exists()) {
        ui->statusBar->showMessage(tr("Please select existing file"));
        return;
    }

    QFile inputFile;
    inputFile.setFileName(path);

    if (!inputFile.open(QFile::ReadOnly)) {
        QMessageBox::critical(this, tr("Image parsing failed"), tr("Can't open input file for reading"), QMessageBox::Ok);
        return;
    }

    QByteArray buffer = inputFile.readAll();
    inputFile.close();

    init();
	this->setWindowTitle(tr("UEFITool %1 - %2").arg(version).arg(fileInfo.fileName()));

    UINT8 result = ffsEngine->parseImageFile(buffer);
    showMessages();
    if (result)
        QMessageBox::critical(this, tr("Image parsing failed"), errorMessage(result), QMessageBox::Ok);
    else
        ui->statusBar->showMessage(tr("Opened: %1").arg(fileInfo.fileName()));

    // Enable search
    ui->actionSearch->setEnabled(true);

    // Set current directory
    currentDir = fileInfo.absolutePath();
}
Exemple #7
0
/////////////////////////////////////////////////////////////////////////////////
// Main application's code
//
void application(void) {
   // Screen tilemap
   TScreenTilemap scr = { 0, 0, { 0, 0, MAP_WIDTH, MAP_HEIGHT} };

   // First show user messages
   showMessages();

   // Initialize the application
   cpct_disableFirmware();     // Firmware must be disabled for this application to work
   cpct_setBorder(0x00);       //    Set the border colour gray and.. 
   cpct_setPALColour(0, 0x14); // ...background black

   // VERY IMPORTANT: Before using EasyTileMap functions (etm), the internal
   // pointer to the tileset must be set. 
   cpct_etm_setTileset2x4(g_tileset);

   // Indefinitely draw the tilemap, listen to user input, 
   // do changes and draw it again
   while(1) {
      drawScreenTilemap(&scr);   // Redraws the tilemap
      readKeyboardInput(&scr);   // Waits for a user input and makes associated changes
   }
}
Exemple #8
0
/* -------------------------------------------------------------------- */
void doLogin(char moreYet)
{
    int foundIt;
    char InitPw[NAMESIZE+NAMESIZE+2];
    char password[NAMESIZE+NAMESIZE+2];
    char initials[NAMESIZE+NAMESIZE+2];
    char *semicolon;

    Mflush();

    if (!CARRIER) return;

    if (login_user || login_pw) /* handle command line log-ins */
    {
        if (!modStat) 
            if (cfg.offhook)  offhook();

        /* login using initials and pw */
        if (login_pw)
        {
            normalizepw(cmd_login, initials, password);
            login_pw = FALSE;
        }
        else

        if (login_user)
        {
            normalizeString(cmd_login);
            if (findPerson(cmd_login, &logBuf) != ERROR)
            {
                strcpy(initials, logBuf.lbin);
                strcpy(password, logBuf.lbpw);
            }
            login_user = FALSE;
        }

    }
    else   /* ask user for initials and password */
    {


    if (moreYet == 2)
        moreYet = FALSE;
    else
    {
        /* dont print Login when hitting 'L' from console mode */
        if (!(!moreYet && !loggedIn && !modStat))
        {
            mPrintf("Login ");
        }
    }



    if (loggedIn)  
    {
        mPrintf("\n Already logged in!\n ");
        return;
    }

    if (!modStat) 
        if (cfg.offhook)  offhook();


  getNormStr((moreYet) ? "" : "your initials", InitPw, NAMESIZE+NAMESIZE+1, NO_ECHO);
    if (!CARRIER) return;

        dospCR();

        semicolon = strchr(InitPw, ';');

        if (!semicolon)
        {
            strcpy(initials, InitPw);
            getNormStr( "password",  password, NAMESIZE, NO_ECHO);
            dospCR();
        }     
        else  
        {
            normalizepw(InitPw, initials, password);
        }

        /* dont allow anything over 19 characters */
        initials[NAMESIZE] = '\0';
    }
    
    /* reset transmitted & received */
    transmitted = 0l;
    received    = 0l;

    /* reset read & entered */
    mread   = 0;
    entered = 0;

    foundIt = ((pwslot(initials, password)) != ERROR);

    if (foundIt && *password)
    {
        loggedIn    = TRUE;
        update25();

        /* trap it */
        if (!logBuf.lbflags.NODE) 
        {
            sprintf( msgBuf->mbtext, "Login %s", logBuf.lbname);
            if (onConsole)
                strcat(msgBuf->mbtext, " (Console)");

            trap(msgBuf->mbtext, T_LOGIN);
        }
        else
        {
            sprintf( msgBuf->mbtext, "NetLogin %s", logBuf.lbname);
            trap(msgBuf->mbtext, T_NETWORK);
        }
    }
    else
    {
        loginNew(initials, password);
    }

    if (!loggedIn)
        return;

    heldMessage = FALSE;

    setsysconfig();
    setgroupgen();
    setroomgen();
    setlbvisit();

    slideLTab(thisSlot);

    /* cant log in now. */
    if (cfg.accounting && !logBuf.lbflags.NOACCOUNT)
    {
        negotiate();
        logincrement();
        if (!logincheck()) 
        {
            Hangup();
            return;
        }
    }

    /* can't log in now. */
    if (logBuf.VERIFIED && !onConsole)
    {
        tutorial("verified.blb");
        Hangup();
        return;
    }

    if (logBuf.lbflags.NODE)
    {
#ifdef  TRASH       
        if (debug)
        {
            readnode();

            cPrintf("Node:  \"%s\" \"%s\"", node.ndname, node.ndregion);  doccr();
            cPrintf("Phone: \"%s\" %d", node.ndphone, node.nddialto);     doccr();
            cPrintf("Login: \"%s\" %d", node.ndlogin, node.ndwaitto);     doccr();
            cPrintf("Baud:  %d    Protocol: \"%s\"\n ", node.ndbaud, node.ndprotocol);
            cPrintf("Expire:%d    Waitout:  %d", node.ndexpire, node.ndwaitto); doccr();
            cPrintf("Network: %d  ZIP: %s UNZIP: %s", node.network, node.zip, node.unzip); doccr();
        }
#endif        
        
        time(&logtimestamp);
        return;
    }

    if (logBuf.PSYCHO)
    {
        backout = TRUE;
    }
    
    /* reverse engineering Minibin?!?! */
    if (logBuf.MINIBIN)
    {
        minibin();
    }
    
    changedir(cfg.helppath); 

    if ( filexists("bulletin.blb") )
    {
        tutorial("bulletin.blb");
    }
    
    gotodefaulthall();

    roomtalley();

    mf.mfLim = 0;   /* just to make sure. */
    mf.mfMai = 0;
    mf.mfPub = 0;
    mf.mfUser[0]=0;

    nochat(TRUE);       /* reset chats */
    
    /* verbose = FALSE; */
    verbose = logBuf.VERBOSE;

    /* hmmm... where to put this */
    if (roomBuf.rbflags.APLIC && roomBuf.rbflags.AUTOAPP )
        ExeAplic();

    showMessages(NEWoNLY, FALSE);

    verbose = FALSE;
    if (expert) listRooms(NEWRMS, FALSE);
    else        listRooms(OLDNEW, FALSE);

    outFlag = OUTOK;
    setio(whichIO, echo, outFlag);
    
    /* record login time, date */
    time(&logtimestamp);

    cfg.callno++;

    storeLog();
}
Exemple #9
0
	void GroupMessage::notifyFrameStarted(float _time)
	{
		showMessages();
	}