Exemplo n.º 1
0
void CDialogProxyRefresh::CreatThreads()
{
	CThreadRefresh *pThread;

	// 已刷完
	if (m_iRefreshNums>=m_iRefreshMax)
	{
		if(m_iThreadNums <= 0)
		{
			m_bRefresh = false;
			m_btnRefresh->Enable(true);
			m_textCtrlInfo->AppendText("*****Finish...............\n");
		}
		else 
			m_textCtrlInfo->AppendText(wxString::Format("! wait thread exit...%d\n", m_iThreadNums));
	}

	// 如果未达到最大线程,创建线程
	// 理论会多刷m_iThreadMax,但加快速度总比等待好
	if (m_iRefreshNums<m_iRefreshMax && m_iThreadNums<m_iThreadMax) 
	{
		if (m_iProxyPos>=m_pConfig->GetCount())
			m_iProxyPos = 0;
		wxString proxy = m_pConfig->GetProxyHttp(m_iProxyPos);

		if (m_bUseProxy)
			pThread = new CThreadRefresh(m_url, proxy, this);
		else
			pThread = new CThreadRefresh(m_url, wxEmptyString, this);
		m_iThreadNums++;
		m_iProxyPos++;
		pThread->Run();
	}
	RefreshInfo();
}
Exemplo n.º 2
0
void CDialogProxyRefresh::OnRefreshCMD( wxCommandEvent& event )
{
	switch(event.GetInt())
	{
	case EVENT_TYPE_REFRESH_INFO:
		m_textCtrlInfo->AppendText(event.GetString());
		break;
	case EVENT_TYPE_REFRESH_SUCC:
		{
			m_textCtrlInfo->AppendText(wxString::Format("* %s succ\n", event.GetString()));
			m_iRefreshNums++;
			RefreshInfo();
		}
		break;
	case EVENT_TYPE_REFRESH_FAIL:
		{
			if (m_bUseProxy) {
				wxString key = event.GetString();
				if (key.Len()>0)
					m_pConfig->Remove(key);
			}

			m_textCtrlInfo->AppendText(wxString::Format("* %s fail\n", event.GetString()));
		}
		break;
	case EVENT_TYPE_THREAD_EXIT:
		m_iThreadNums--;
		CreatThreads();
		break;
	default:
		m_textCtrlInfo->AppendText(event.GetString());
		break;
	}
}
Exemplo n.º 3
0
bool cPackBase::Check(bool recursive) {
	bool sel = IsSelected();
	if (sel!=selected) {
		selected = sel;
		return true;
	}
	RefreshInfo();
	return false;
}
Exemplo n.º 4
0
void InitReg( void ) {
    InitializeCriticalSection( &readCntSection );
    InitializeCriticalSection( &costlyReadCntSection );
    InitializeCriticalSection( &dataRefreshSection );
    writeMutex = CreateMutex( NULL, FALSE, WRITE_SEM_NAME );
    costlyWriteMutex = CreateMutex( NULL, FALSE, COSTLY_WRITE_SEM_NAME );
    RefreshInfo();
    RefreshCostlyInfo();
}
Exemplo n.º 5
0
void MainWindow::createInfoDock()//创建文件Dock
{
    m_infodock=new SAMInfoDock(this);
//    m_infodock->refresh(core);
    m_infodock->setCore(core);
    this->addDockWidget(Qt::LeftDockWidgetArea,m_infodock);
    connect(m_filedock,SIGNAL(InfoRefresh(QString)),m_infodock,SLOT(RefreshInfo(QString)));

    connect(core,SIGNAL(writeLog()),m_infodock,SLOT(RefreshLog()));
}
Exemplo n.º 6
0
void RedisInfoUI::BackgroundWork()
{
    const int sleepTime = 1000; /// ms
    do 
    {       
        RefreshInfo();

        /// 便于快速响应
        for (int i=0; m_bIsRefresh && i<sleepTime/10; ++i)
        {
            Base::Thread::sleep(10);
        }        
    } while (m_bIsRefresh);
}
Exemplo n.º 7
0
void CQueueListCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult)
{
//	Reset selection in DL list
	POSITION posSelClient = g_App.m_pMDlg->m_wndTransfer.m_ctlDownloadList.GetFirstSelectedItemPosition();
	NOPRM(pNMHDR);

	while (posSelClient != NULL)
	{
		int iSelClientListIndex = g_App.m_pMDlg->m_wndTransfer.m_ctlDownloadList.GetNextSelectedItem(posSelClient);
		g_App.m_pMDlg->m_wndTransfer.m_ctlDownloadList.SetItemState(iSelClientListIndex, 0, LVIS_SELECTED);
	}

	RefreshInfo();
	*pResult = 0;
}
Exemplo n.º 8
0
/*
 * InitAutoAttatch
 */
void InitAutoAttatch( void ) {

    ProcList            info;
    ProcPlace           place;
    BOOL                rc;
//    DWORD             threadid;

    RefreshInfo();
    rc = GetNextProcess( &info, &place, TRUE );
    while( rc ) {
        addDontAttatch( info.pid );
        rc = GetNextProcess( &info, &place, FALSE );
    }
//    CreateThread( NULL, 0, AutoAttatchMain, 0, 0, &threadid );
    _beginthread( AutoAttatchMain, 0, 0 );
}
Exemplo n.º 9
0
//DWORD WINAPI AutoAttatchMain( void *dum ) {
static void AutoAttatchMain( void *dum ) {

    HANDLE      hdl;

    dum = dum;
    hdl = GetCurrentThread();
    SetThreadPriority( hdl, THREAD_PRIORITY_IDLE );
    for( ;; ) {
        if( ConfigData.auto_attatch ) {
            if( RefreshInfo() ) {
                removeDeadProcs();
                doAutoAttatch();
            }
        }
        Sleep( REFRESH_INTERVAL );
    }
}
Exemplo n.º 10
0
static void logProcessList( void ) {

    ProcList    info;
    ProcPlace   place;
    BOOL        rc;

    RefreshInfo();
    logPrintf( STR_CURRENT_PROCESSES );
    rc = GetNextProcess( &info, &place, TRUE );
    while( rc ) {
        logStrPrintf( "%*s%08lX %s\n", INDENT, "", info.pid, info.name );
        if( LogData.log_modules ) {
            logModules( info.pid, INDENT + 9 );
        }
        rc = GetNextProcess( &info, &place, FALSE );
    }
}
void CostomerRegisterInfoDialog::on_pbnSave_clicked()
{
    QString customerNo = ui->CustomerNo->text();
    QString customerSex = ui->ledSex->text();
    QString customerName = ui->CustomerName->text();
    QString customerPwd = ui->CustomerRePwd->text();
    QString customerPhone = ui->CustomerPhone->text();
    QString customerAddress = ui->CustomerAddress->text();
    QString customeDate = ui->ledCustomDate->text();
    QString customeRemark = ui->CustomerRemark->text();

    if(customerNo.isEmpty() && customerName.isEmpty()&& customerPwd.isEmpty()&&customerPhone.isEmpty())
    {
        myHelper::ShowMessageBoxInfo(tr("必须填满带 * 的内容!"));
    }
    else
    {
        QSqlQuery query;
        bool ok = query.prepare("INSERT INTO Customer (Id, CustomerName,CustomerSex,CustomerPassword,"
                                "CustomerPhone,CustomerAddress,CustomerData,CustomerRemark)"
                                "VALUES (:Id,:CustomerName,:CustomerSex,:CustomerPassword,:CustomerPhone,:CustomerAddress,:CustomerData,:CustomerRemark)");
        query.bindValue(":Id",customerNo);
        query.bindValue(":CustomerName",customerName);
        query.bindValue(":CustomerSex",customerSex);
        query.bindValue(":CustomerPassword",customerPwd);
        query.bindValue(":CustomerPhone",customerPhone);
        query.bindValue(":CustomerAddress",customerAddress);
        query.bindValue(":CustomerData",customeDate);
        query.bindValue(":CustomerRemark",customeRemark);
        query.setForwardOnly(true);
        query.exec();

        if(ok)
        {
            myHelper::ShowMessageBoxInfo(tr("注册成功!"));
        }
        RefreshInfo();

        ui->pbnAddUser->setEnabled(true);
        ui->pbnModify->setEnabled(true);
    }

}
Exemplo n.º 12
0
NeighborMap StandardRule::StartSelection(const int client_pid,
                                     const IntSet& in_swarm_set)
{
    g_peers.at(client_pid).clear_neighbors();  // clear previous neighbors

    selector_pid_ = client_pid;

    NeighborMap neighbors;

    size_t candidates_size = SetCandidates(in_swarm_set,
                                           RSC::STD_PEERSELECT,
                                           false);

    AssignNeighbors(neighbors, candidates_size);

    DebugInfo(neighbors, client_pid);

    RefreshInfo();

    return neighbors;
}
Exemplo n.º 13
0
NeighborMap ClusterBasedRule::StartSelection(const int client_pid,
                                             const IntSet& in_swarm_set)
{
    g_peers.at(client_pid).clear_neighbors();  // clear previous neighbors

    selector_pid_ = client_pid;

    NeighborMap neighbors;

    // Set parameter of sort_cid_flag to true, in order to get
    // candidates (most part, not all) which have
    // same cluster id as selector.
    size_t candidates_size = SetCandidates(in_swarm_set, RSC::CB_PEERSELECT, true);

    const int client_cid = g_peers.at(client_pid).get_cid();
    AssignNeighbors(neighbors, candidates_size, client_cid);

    //DebugInfo(neighbors, client_pid);

    RefreshInfo();

    return neighbors;
}
Exemplo n.º 14
0
/*
 * ThreadCtlProc
 */
BOOL CALLBACK ThreadCtlProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
    WORD                cmd;
    ThreadCtlInfo       *info;
    LRESULT             index;
    char                buf[200];
    DWORD               threadid;
    ThreadNode          *thread;
    ProcNode            *process;
    DWORD               susp_cnt;
    DWORD               rc;
    char                *action;

    info = (ThreadCtlInfo *)GET_DLGDATA( hwnd );
    switch( msg ) {
    case WM_INITDIALOG:
        info = MemAlloc( sizeof( ThreadCtlInfo ) );
        if( !GetProcessInfo( lparam, &info->procinfo ) ) {
             RCsprintf( buf, STR_CANT_GET_PROC_INFO, info->procid );
             MessageBox( hwnd, buf, AppName, MB_OK | MB_ICONEXCLAMATION );
             SendMessage( hwnd, WM_CLOSE, 0, 0 );
        }
        info->procid = lparam;
        ThreadDlg = hwnd;
        SET_DLGDATA( hwnd, info );
        fillThreadCtl( hwnd, &info->procinfo, buf );
        RCsprintf( buf, STR_THREAD_4_PROC_X, lparam );
        SetDlgItemText( hwnd, THREAD_PROC_NAME, buf );
        sprintf( buf, "(%s)", info->procinfo.name );
        SetDlgItemText( hwnd, THREAD_PROC_PATH, buf );
        SendDlgItemMessage( hwnd, THREAD_LIST, LB_SETCURSEL, 0, 0L );
        index = SendDlgItemMessage( hwnd, THREAD_LIST, LB_GETCURSEL, 0, 0L );
        if( index != LB_ERR ) {
            enableChoices( hwnd, TRUE );
        }
        fillThreadInfo( hwnd, &info->procinfo );
        break;
    case WM_COMMAND:
        cmd = LOWORD( wparam );
        if( cmd == THREAD_SUSPEND || cmd == THREAD_RESUME ||
            cmd == THREAD_KILL || cmd == THREAD_SET_PRIORITY ) {
            index = SendDlgItemMessage( hwnd, THREAD_LIST, LB_GETCURSEL, 0, 0L );
            if( index == LB_ERR ) {
                RCMessageBox( hwnd, STR_NO_SELECTED_THREAD, AppName, MB_OK | MB_ICONEXCLAMATION );
                break;
            }
            SendDlgItemMessage( hwnd, THREAD_LIST, LB_GETTEXT, (WPARAM)index, (LPARAM)(LPSTR)buf );
            threadid = getThreadId( buf );
            process = FindProcess( info->procinfo.pid );
            thread = FindThread( process, threadid );
        }
        switch( cmd ) {
        case IDOK:
            SendMessage( hwnd, WM_CLOSE, 0, 0L );
            break;
        case THREAD_REFRESH:
            RefreshInfo();
            if( GetProcessInfo( info->procid, &info->procinfo ) ) {
                fillThreadCtl( hwnd, &info->procinfo, buf );
                fillThreadInfo( hwnd, &info->procinfo );
            } else {
                action = AllocRCString( STR_REFRESH );
                RCMessageBox( hwnd, STR_CANT_REFRESH_THRD, action,
                              MB_OK | MB_ICONEXCLAMATION );
                FreeRCString( action );
            }
            break;
        case THREAD_SUSPEND:
            action = AllocRCString( STR_THREAD_SUSPEND );
            if( thread == NULL ) {
                RCsprintf( buf, STR_CANT_GET_HDL_4_THD_X, threadid );
                MessageBox( hwnd, buf, action, MB_OK | MB_ICONEXCLAMATION );
            } else {
                susp_cnt = SuspendThread( thread->threadhdl );
                if( susp_cnt == -1 ) {
                    RCsprintf( buf, STR_CANT_SUSPEND_THRD_X, threadid );
                    MessageBox( hwnd, buf, action, MB_ICONQUESTION | MB_OK );
                } else if( susp_cnt > 0 ) {
                    RCsprintf( buf, STR_THREAD_ALREADY_SUSP, threadid, susp_cnt );
                    index = MessageBox( hwnd, buf, action, MB_ICONQUESTION | MB_YESNO );
                    if( index == IDNO ) {
                        ResumeThread( thread->threadhdl );
                    }
                }
                SendMessage( hwnd, WM_COMMAND, THREAD_REFRESH, 0L );
            }
            FreeRCString( action );
            break;
        case THREAD_RESUME:
            action = AllocRCString( STR_RESUME );
            if( thread == NULL ) {
                RCsprintf( buf, STR_THREAD_NOT_RESUMED , threadid );
                MessageBox( hwnd, buf, action, MB_OK | MB_ICONEXCLAMATION );
            } else {
                susp_cnt = ResumeThread( thread->threadhdl );
                if( susp_cnt == -1 ) {
                    RCsprintf( buf, STR_CANT_RESUME_THRD_X, threadid );
                    MessageBox( hwnd, buf, action,
                                MB_ICONEXCLAMATION | MB_OK );
                } else if( susp_cnt == 0 ) {
                    RCsprintf( buf, STR_THRD_IS_NOT_SUSP, threadid );
                    MessageBox( hwnd, buf, action,
                                MB_ICONEXCLAMATION | MB_OK );
                } else if( susp_cnt > 1 ) {
                    RCsprintf( buf, STR_SUSP_COUNT_DECREMENTED,
                                threadid, susp_cnt );
                    MessageBox( hwnd, buf, action,
                                MB_ICONEXCLAMATION | MB_OK );
                }
                SendMessage( hwnd, WM_COMMAND, THREAD_REFRESH, 0L );
            }
            FreeRCString( action );
            break;
        case THREAD_KILL:
            action = AllocRCString( STR_KILL );
            if( thread == NULL ) {
                RCsprintf( buf, STR_THRD_NOT_TERMINATED, threadid );
                MessageBox( hwnd, buf, action, MB_OK | MB_ICONEXCLAMATION );
            } else if( GetRetCode( hwnd, RETCD_THREAD, thread->threadid, &rc ) ) {
                if( !TerminateThread( thread->threadhdl, rc ) ) {
                    RCsprintf( buf, STR_CANT_KILL_THRD_X, threadid );
                    MessageBox( hwnd, buf, action,
                                MB_OK | MB_ICONEXCLAMATION );
                }
                SendMessage( hwnd, WM_COMMAND, THREAD_REFRESH, 0L );
            }
            FreeRCString( action );
            break;
        case THREAD_SET_PRIORITY:
//          {
//              ThreadPriorityInfo      prinfo;
//
//              if( thread == NULL ) {
//                  sprintf( buf, "Unable to get a handle for thread %08X.\n",
//                           threadid );
//                  MessageBox( hwnd, buf, "Set Priority",
//                              MB_OK | MB_ICONEXCLAMATION );
//              } else {
//                  prinfo.procid = info->procid;
//                  prinfo.thread = thread;
//                  prinfo.priority = GetThreadPriority( thread->threadhdl );
//                  prinfo.procinfo = &info->procinfo;
//                  DialogBoxParam( Instance, "THREAD_PRIORITY_DLG", hwnd,
//                                  ThreadPriorityDlgProc, (DWORD)&prinfo );
//                  fillThreadInfo( hwnd, &info->procinfo );
//              }
//          }
//          break;
        case THREAD_LIST:
            if( HIWORD( wparam ) == LBN_SELCHANGE ) {
                fillThreadInfo( hwnd, &info->procinfo );
            }
            break;
        }
        break;
    case DR_TASK_LIST_CHANGE:
        /* make sure this process still exists */
//here  if( FindProcess( info->procid ) == NULL ) {
//here      SendDlgItemMessage( hwnd, THREAD_LIST, LB_RESETCONTENT, 0, 0L );
//here      enableChoices( hwnd, FALSE );
//here      info->proc = NULL;
//here  } else {
//here      fillThreadCtl( hwnd, info->proc, buf );
//here  }
        break;
    case WM_CLOSE:
        EndDialog( hwnd, 0 );
        break;
    case WM_DESTROY:
        MemFree( info );
        ThreadDlg = NULL;
        break;
    default:
        return( FALSE );
    }
    return( TRUE );
}
Exemplo n.º 15
0
/*
 * logFaultInfo
 */
static void logFaultInfo( ExceptDlgInfo *info ) {

    char        *str;
    char        buf[150];
    char        addr_buf[64];
    char        fname[ FNAME_BUFLEN ];
    DWORD       type;
    DWORD       line;
    msg_id      gptype;
    ProcStats   stats;

    logStrPrintf( "\n" );
    logPrintf( STR_OFFENDING_PROC_ULINE );
    logPrintf( STR_OFFENDING_PROC_INFO );
    logPrintf( STR_OFFENDING_PROC_ULINE );

    while( !GetProcessInfo( info->procinfo->procid, &stats ) ) {
        Sleep( 100 );
        RefreshInfo();
    }
    logPrintf( STR_OFFENDING_PROC_X, stats.name, info->procinfo->procid );
    type = info->dbinfo->u.Exception.ExceptionRecord.ExceptionCode;
    FormatException( buf, type );
    MADCliAddrToString( info->init_ip,
        MADTypeDefault( MTK_ADDRESS, MAF_FULL, NULL, &( info->init_ip ) ),
        MLK_CODE, addr_buf, 63 );
    logPrintf( STR_ERR_OCCURRED_AT_X_Y, buf, addr_buf );
    if( type == EXCEPTION_ACCESS_VIOLATION ) {
        if( info->dbinfo->u.Exception.ExceptionRecord.ExceptionInformation[0] ) {
            gptype = STR_LOG_INV_WRITE_TO;
        } else {
            gptype = STR_LOG_INV_READ_FROM;
        }
        logPrintf( gptype,
          info->dbinfo->u.Exception.ExceptionRecord.ExceptionInformation[1] );
    }
    str = SrchMsg( info->action, Actions, NULL );
    if( str != NULL ) {
        logStrPrintf( "%s\n", str );
    }

    logPrintf( STR_MODULES_LOADED );
    logModules( info->procinfo->procid, INDENT );
    logRegisters( info );
    logPrintf( STR_SOURCE_INFORMATION );
    if( info->got_dbginfo && GetLineNum( &info->init_ip, fname,
            FNAME_BUFLEN, &line ) ) {
        logPrintf( STR_LOG_LINE_X_OF_FILE, INDENT, "", line, fname );
    } else {
        logPrintf( STR_LOG_N_A, INDENT, "" );
    }
    logPrintf( STR_DISASSEMBLY );
    logDisasm( info );
    logStack( info );
#ifndef CHICAGO
    if( LogData.log_mem_manager ) {
        logMemManInfo( info->procinfo->procid );
    }
#endif
    if( LogData.log_mem_dmp ) {
        logMemDmp( info );
    }
}
Exemplo n.º 16
0
void CQueueListCtrl::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
	RefreshInfo();
	CMuleListCtrl::OnKeyUp(nChar, nRepCnt, nFlags);
}
Exemplo n.º 17
0
static void fillExceptionDlg( HWND hwnd, ExceptDlgInfo *info ) {

    char                buf[BUF_SIZE];
    char                fname[ FNAME_BUFLEN ];
    DWORD               line;
    ProcStats           stats;
    HWND                ctl;
    address             addr;

    GetCurrAddr(&addr,info->regs);
    SetDlgCourierFont( hwnd, INT_TASK_NAME );
    SetDlgCourierFont( hwnd, INT_TASK_PATH );
    SetDlgCourierFont( hwnd, INT_FAULT_TYPE );
    SetDlgCourierFont( hwnd, INT_CS_IP );
    SetDlgCourierFont( hwnd, INT_SOURCE_INFO );
    SetDlgCourierFont( hwnd, INT_SOURCE_INFO2 );

    RCsprintf( buf, STR_EXCEPTION_ENCOUNTERED, AppName );
    SetWindowText( hwnd, buf );

    CopyRCString( STR_PROCESS_NAME, buf, BUF_SIZE );
    SetDlgItemText( hwnd, INT_TASK_NAME_TEXT, buf );

    if( !info->dbinfo->u.Exception.dwFirstChance ) {
        if( ConfigData.exception_action == INT_CHAIN_TO_NEXT ) {
            ConfigData.exception_action = INT_TERMINATE;
        }
        ctl = GetDlgItem( hwnd, INT_CHAIN_TO_NEXT );
        EnableWindow( ctl, FALSE );
    }
    CheckDlgButton( hwnd, ConfigData.exception_action, BST_CHECKED );
    CopyRCString( STR_PROCESS_ID, buf, BUF_SIZE );
    SetDlgItemText( hwnd, INT_TASK_PATH_TEXT, buf );

    while( !GetProcessInfo( info->procinfo->procid, &stats ) ) {
        Sleep( 100 );
        RefreshInfo();
    }
    SetDlgItemText( hwnd, INT_TASK_NAME, stats.name );

    sprintf( buf, "%08lX", info->procinfo->procid );
    SetDlgItemText( hwnd, INT_TASK_PATH, buf );

    FormatException( buf, info->dbinfo->u.Exception.ExceptionRecord.ExceptionCode );
    SetDlgItemText( hwnd, INT_FAULT_TYPE, buf );

    if( info->threadinfo != NULL ) {
        strcpy( buf, "Fault " );
        MADRegSpecialName( MSR_IP, info->regs, MAF_FULL, BUF_SIZE - 7, buf+6 );
        SetDlgItemText( hwnd, INT_IP_NAME, buf );
        SetIp( hwnd, &addr );
    }
    if( info->got_dbginfo && GetLineNum( &addr,fname, FNAME_BUFLEN, &line ) ) {
        RCsprintf( buf, STR_LINE_X_OF, line );
        SetDlgItemText( hwnd, INT_SOURCE_INFO, buf );
        SetDlgItemText( hwnd, INT_SOURCE_INFO2, fname );
    } else {
        CopyRCString( STR_N_A, buf, BUF_SIZE );
        SetDlgItemText( hwnd, INT_SOURCE_INFO, buf );
        SetDlgItemText( hwnd, INT_SOURCE_INFO2, "" );
    }
}