设为首页 | 收藏本站 | 每日归档
当前位置:ucbug游戏网 > 新闻中心 > 游戏开发 >
征途外挂的vc部分源码(3)
作者:网络来源:本站整理发布时间:2009-06-25 05:41

int CZhengTuDlg::ShowAttrib()
{
    HANDLE Process=NULL;
    if( MyOpenProcess( &Process ) )
        return -1;

//    ULONG lCurLife= 0;        //当前血值
    ULONG lMaxLife= 0;        //最大血值
//    ULONG lCurMag = 0;        //当前法值
    ULONG lMaxMag = 0;        //最大法值
    ULONG lXOffset = 0x24C;        //人物所在X坐标相对人物地址的偏移
    ULONG lOffset = lRenAdd + 0x4CE;        //血地址
    ULONG lTotalOffset = 0x3C;        //经验相对血的偏移
    ULONG lCurTotal = 0;    //当前经验
    ULONG lMaxTotal = 0;
    long lX = 0;
    long lY = 0;
    CString strTmp;
    char  cName[33];
    CStatic *pStatic;
    //CFont  cfont;
    //cfont.CreateFont(0,0,0,0,FW_NORMAL,FALSE,FALSE,0,ANSI_CHARSET,OUT_STROKE_PRECIS,CLIP_STROKE_PRECIS,DRAFT_QUALITY,VARIABLE_PITCH|FF_SWISS,NULL);

    memset( cName, 0x00, sizeof(cName));
    ReadProcessMemory(Process,(LPVOID)(lRenAdd),cName,32,NULL);

    ReadProcessMemory(Process,(LPVOID)(lOffset + lTotalOffset),&lCurTotal,4,NULL);
    ReadProcessMemory(Process,(LPVOID)(lOffset + lTotalOffset + 8 ),&lMaxTotal,4,NULL);
//    strTmp.Format("%ld/%ld  0X%08X",lCurTotal,lMaxTotal,lRenAdd);

    if( (long)lCurTotal < 0 || (long)lMaxTotal < (long)lCurTotal  )
    {
        CloseHandle( Process );
        return -1;
    }

    ReadProcessMemory(Process,(LPVOID)lOffset,&lCurLife,4,NULL);
    ReadProcessMemory(Process,(LPVOID)(lOffset+4),&lMaxLife,4,NULL);
    if( (long)lCurLife < 0 || (long)lMaxLife < (long)lCurLife || (long)lMaxLife < 500 )
    {
        CloseHandle( Process );
        return -1;
    }
    ReadProcessMemory(Process,(LPVOID)(lOffset + 4 + 4 + 4),&lCurMag,4,NULL);
    ReadProcessMemory(Process,(LPVOID)(lOffset + 4 + 4 + 4 + 4 ),&lMaxMag,4,NULL);
    if( (long)lCurMag < 0 || (long)lMaxMag < (long)lCurMag )
    {
        CloseHandle( Process );
        return -1;
    }

    ReadProcessMemory(Process,(LPVOID)(lRenAdd + lXOffset),&lX,4,NULL);
    ReadProcessMemory(Process,(LPVOID)(lRenAdd + lXOffset + 4 ),&lY,4,NULL);
    //pStatic->SetFont(&cfont,TRUE);
    if( lX < -20 || lY < -20 )
    {
        CloseHandle( Process );
        return -1;
    }

    pStatic=(CStatic *)GetDlgItem(IDC_STATIC1);
    pStatic->SetWindowText(cName);

    strTmp.Format("%ld/%ld",lCurTotal,lMaxTotal);
    pStatic=(CStatic *)GetDlgItem(IDC_STATIC2);
    pStatic->SetWindowText(strTmp);

    strTmp.Format("%ld/%ld",lCurLife,lMaxLife);
    pStatic=(CStatic *)GetDlgItem(IDC_STATIC3);
    pStatic->SetWindowText(strTmp);

    strTmp.Format("%ld/%ld",lCurMag,lMaxMag);
    pStatic=(CStatic *)GetDlgItem(IDC_STATIC4);
    pStatic->SetWindowText(strTmp);

    strTmp.Format("%ld/%ld",lX,lY);
    pStatic=(CStatic *)GetDlgItem(IDC_STATIC5);
    pStatic->SetWindowText(strTmp);

    CloseHandle( Process );

    return 0;

}

void CZhengTuDlg::OnButton4()
{
    // TODO: Add your control notification handler code here
    CButton *bt=(CButton *)GetDlgItem(IDC_BUTTON4);
   
    if( iFront ==  0 )
    {
        SetWindowPos(&wndTopMost,-1,-1,-1,-1,SWP_NOMOVE|SWP_NOSIZE);
        iFront = 1;
        bt->SetWindowText("不在最前面");
    }
    else
    {
        SetWindowPos(&wndNoTopMost,-1,-1,-1,-1,SWP_NOMOVE|SWP_NOSIZE);
        iFront = 0;
        bt->SetWindowText("在最前面");
    }
}

void CZhengTuDlg::GetData1()
{
    if( lNumQuestion > 0 )
        return;

    CDataBase1 Record;

    try
    {
        Record.Open();
    }
    catch( CDaoException *e )
    {
        char cTmp[1201];
        CString cstr;
        e->GetErrorMessage(cTmp,1000,NULL);
        cstr.Format("打开数据库失败!原因:%s",cTmp);
        AfxMessageBox(cstr);
        EndWaitCursor();
        e->Delete();
        return;
    }
    Record.MoveFirst();

    Question = new char * [100000];
    Anser = new char * [100000];

    lNumQuestion=0;
    while( !Record.IsEOF() )
    {
        Question[lNumQuestion] = new char[121];
        Anser[lNumQuestion] = new char[51];
        sprintf(Question[lNumQuestion],"%.120s",Record.m_column1);
        sprintf(Anser[lNumQuestion],"%.50s",Record.m_column2);

        lNumQuestion++;
        Record.MoveNext();
    }
    Record.Close();
    EndWaitCursor();
}

void CZhengTuDlg::ChiYao( )
{
    UpdateData(TRUE);

    if( lCurLife <= 0 )
    {
        return;
    }

    if( lCurLife < m_Xue )
    {
        CComboBox *comboXue=(CComboBox *)GetDlgItem( IDC_COMBO_XUE );
        int iCurSel = comboXue->GetCurSel();
        int iKey ;
        if( iCurSel <= 9 )
            iKey = 0x30 + iCurSel;
        else
            iKey = 0x70 + iCurSel - 10;
       
        HWND cWnd = ::FindWindow("zhengtu_client",NULL);
        if( cWnd == NULL )
            return ;

        ::SetForegroundWindow(cWnd);

        ::SetActiveWindow(cWnd);

        ::keybd_event(iKey,0,0,0);
        ::keybd_event(iKey,0,KEYEVENTF_KEYUP,0);
    }
    if( lCurMag < m_Lan )
    {
        CComboBox *comboLan=(CComboBox *)GetDlgItem( IDC_COMBO_LAN );
        int iCurSel = comboLan->GetCurSel();
        int iKey ;
        if( iCurSel <= 9 )
            iKey = 0x30 + iCurSel;
        else
            iKey = 0x70 + iCurSel - 9;
       
        HWND cWnd = ::FindWindow("zhengtu_client",NULL);
        if( cWnd == NULL )
            return ;

        ::SetForegroundWindow(cWnd);

        ::SetActiveWindow(cWnd);

        ::keybd_event(iKey,0,0,0);
        ::keybd_event(iKey,0,KEYEVENTF_KEYUP,0);
    }
}

void CZhengTuDlg::OnButton5()
{
    // TODO: Add your control notification handler code here
        lCurLife = 0 ;
        lCurMag = 0;


        HANDLE Process=NULL;
        if( MyOpenProcess( &Process ) )
        {
            AfxMessageBox("征途未运行!");
            return;
        }
        if( ReadProcessMemory(Process,(LPVOID)(lBaseAddr),&lRenAdd,4,NULL) == TRUE )
        {
            lRenAdd = lRenAdd + 0x3C4;
            ShowAttrib();
            CString ccc;
            ccc.Format("角色属性正确吗?");
            if( AfxMessageBox(ccc,MB_YESNO) == IDYES )
            {
                    CloseHandle(Process);
                    SetTimer(2,1000,NULL);
                    return;
            }
        }

声明:本站所有资源均来自网络,版权归原公司及个人所有。如有版权问题,请及时与我们联系,我们在第一时间予以删除,谢谢!
ucbug游戏网
关于我们 | 下载帮助 | 广告&合作 | 下载声明 | 版权声明
Copyright © 2010-2016 ucbug.com. All Rights Reserved ucbug游戏网
皖ICP备15003425号 适度游戏娱乐,沉迷游戏伤身。