修复内存泄漏缺陷
详见ReadMe.txt
@@ -10,6 +10,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRun", "..\client\TestRu
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA} = {BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghost", "..\client\ghost.vcxproj", "{3F756E52-23C2-4EE4-A184-37CF788D50A7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -28,6 +30,10 @@ Global
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|Win32.Build.0 = Release|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -127,10 +127,10 @@
|
||||
<ClInclude Include="BuildDlg.h" />
|
||||
<ClInclude Include="CpuUseage.h" />
|
||||
<ClInclude Include="EditDialog.h" />
|
||||
<ClInclude Include="FileCompress.h" />
|
||||
<ClInclude Include="FileManagerDlg.h" />
|
||||
<ClInclude Include="FileTransferModeDlg.h" />
|
||||
<ClInclude Include="iniFile.h" />
|
||||
<ClInclude Include="InputDlg.h" />
|
||||
<ClInclude Include="IOCPServer.h" />
|
||||
<ClInclude Include="RegisterDlg.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
@@ -156,10 +156,10 @@
|
||||
<ClCompile Include="BuildDlg.cpp" />
|
||||
<ClCompile Include="CpuUseage.cpp" />
|
||||
<ClCompile Include="EditDialog.cpp" />
|
||||
<ClCompile Include="FileCompress.cpp" />
|
||||
<ClCompile Include="FileManagerDlg.cpp" />
|
||||
<ClCompile Include="FileTransferModeDlg.cpp" />
|
||||
<ClCompile Include="iniFile.cpp" />
|
||||
<ClCompile Include="InputDlg.cpp" />
|
||||
<ClCompile Include="IOCPServer.cpp" />
|
||||
<ClCompile Include="RegisterDlg.cpp" />
|
||||
<ClCompile Include="ScreenSpyDlg.cpp" />
|
||||
|
||||
@@ -165,9 +165,6 @@
|
||||
<ClInclude Include="FileTransferModeDlg.h">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileCompress.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TalkDlg.h">
|
||||
<Filter>即时消息</Filter>
|
||||
</ClInclude>
|
||||
@@ -195,6 +192,9 @@
|
||||
<ClInclude Include="Audio.h">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="InputDlg.h">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="2015Remote.cpp">
|
||||
@@ -245,9 +245,6 @@
|
||||
<ClCompile Include="SystemDlg.cpp">
|
||||
<Filter>远程系统管理</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileCompress.cpp">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AudioDlg.cpp">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClCompile>
|
||||
@@ -266,6 +263,9 @@
|
||||
<ClCompile Include="Audio.cpp">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputDlg.cpp">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="2015Remote.rc">
|
||||
|
||||
@@ -1104,7 +1104,7 @@ LRESULT CMy2015RemoteDlg::OnOpenFileManagerDialog(WPARAM wParam, LPARAM lParam)
|
||||
//ת<><D7AA>CFileManagerDlg <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
CFileManagerDlg *Dlg = new CFileManagerDlg(this,m_iocpServer, ContextObject);
|
||||
// <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD>Ϊ<CEAA><D7BF>
|
||||
Dlg->Create(IDD_DIALOG_FILE_MANAGER, GetDesktopWindow()); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dlg
|
||||
Dlg->Create(IDD_FILE, GetDesktopWindow()); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Dlg
|
||||
Dlg->ShowWindow(SW_SHOW);
|
||||
|
||||
ContextObject->v1 = FILEMANAGER_DLG;
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
// FileCompress.cpp : ʵ<><CAB5><EFBFBD>ļ<EFBFBD>
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "2015Remote.h"
|
||||
#include "FileCompress.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
// CFileCompress <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFileCompress, CDialog)
|
||||
|
||||
CFileCompress::CFileCompress(CWnd* pParent, ULONG n)
|
||||
: CDialog(CFileCompress::IDD, pParent)
|
||||
, m_EditRarName(_T(""))
|
||||
{
|
||||
m_ulType = n;
|
||||
}
|
||||
|
||||
CFileCompress::~CFileCompress()
|
||||
{
|
||||
}
|
||||
|
||||
void CFileCompress::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
DDX_Text(pDX, IDC_EDIT_RARNAME, m_EditRarName);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFileCompress, CDialog)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CFileCompress <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
|
||||
BOOL CFileCompress::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CString strTips;
|
||||
switch(m_ulType)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
strTips = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
SetDlgItemText(IDC_STATIC, strTips);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
strTips = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD>";
|
||||
SetDlgItemText(IDC_STATIC, strTips);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
strTips = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
||||
SetDlgItemText(IDC_STATIC, strTips);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
strTips = "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>̽<EFBFBD>ѹ<EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD>";
|
||||
SetDlgItemText(IDC_STATIC, strTips);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateData(TRUE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
// CFileCompress <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
class CFileCompress : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CFileCompress)
|
||||
|
||||
public:
|
||||
CFileCompress(CWnd* pParent = NULL,ULONG n = 0); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CFileCompress();
|
||||
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_DIALOG_FILE_COMPRESS };
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
CString m_EditRarName;
|
||||
ULONG m_ulType;
|
||||
virtual BOOL OnInitDialog();
|
||||
};
|
||||
@@ -1,190 +1,178 @@
|
||||
#if !defined(AFX_FILEMANAGERDLG_H__4918F922_13A4_4389_8027_5D4993A6DB91__INCLUDED_)
|
||||
#define AFX_FILEMANAGERDLG_H__4918F922_13A4_4389_8027_5D4993A6DB91__INCLUDED_
|
||||
#include "TrueColorToolBar.h" // Added by ClassView
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#include "afxcmn.h"
|
||||
#include "IOCPServer.h"
|
||||
#include "afxwin.h"
|
||||
#include "TrueColorToolBar.h"
|
||||
#endif // _MSC_VER > 1000
|
||||
#include "gh0st2Remote.h"
|
||||
|
||||
// CFileManagerDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
// FileManagerDlg.h : header file
|
||||
//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwSizeHigh;
|
||||
DWORD dwSizeLow;
|
||||
}FILE_SIZE;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFileManagerDlg dialog
|
||||
typedef CList<CString, CString&> strList;
|
||||
|
||||
typedef CList<CString, CString&> ListTemplate;
|
||||
class CFileManagerDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CFileManagerDlg)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CFileManagerDlg(CWnd* pParent = NULL, IOCPServer* IOCPServer = NULL, CONTEXT_OBJECT *ContextObject = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CFileManagerDlg();
|
||||
bool m_bIsStop;
|
||||
CString m_strReceiveLocalFile;
|
||||
CString m_strUploadRemoteFile;
|
||||
void ShowProgress();
|
||||
void SendStop();
|
||||
int m_nTransferMode;
|
||||
CString m_hCopyDestFolder;
|
||||
void SendContinue();
|
||||
void SendException();
|
||||
void EndLocalRecvFile();
|
||||
void EndRemoteDeleteFile();
|
||||
CString m_strOperatingFile; // <20>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
__int64 m_nOperatingFileLength; // <20>ļ<EFBFBD><C4BC>ܴ<EFBFBD>С
|
||||
__int64 m_nCounter;// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void WriteLocalRecvFile();
|
||||
void CreateLocalRecvFile();
|
||||
BOOL SendDownloadJob();
|
||||
BOOL SendUploadJob();
|
||||
BOOL SendDeleteJob();
|
||||
|
||||
VOID CFileManagerDlg::FixedClientDiskDriverList();
|
||||
VOID CFileManagerDlg::FixedServerDiskDriverList();
|
||||
strList m_Remote_Download_Job;
|
||||
strList m_Remote_Upload_Job;
|
||||
strList m_Remote_Delete_Job;
|
||||
CTrueColorToolBar m_wndToolBar_Local;
|
||||
CTrueColorToolBar m_wndToolBar_Remote;
|
||||
void ShowMessage(char *lpFmt, ...);
|
||||
CString m_Remote_Path;
|
||||
BYTE m_bRemoteDriveList[1024];
|
||||
CString GetParentDirectory(CString strPath);
|
||||
void OnReceiveComplete();
|
||||
|
||||
CONTEXT_OBJECT* m_ContextObject;
|
||||
IOCPServer* m_iocpServer;
|
||||
CString m_strClientIP;
|
||||
BYTE m_szClientDiskDriverList[0x1000];
|
||||
char m_szServerDiskDriverList[0x1000];
|
||||
CImageList* m_pImageList_Large;
|
||||
CImageList* m_pImageList_Small;
|
||||
|
||||
int GetServerIconIndex(LPCTSTR szVolume, DWORD dwFileAttributes)
|
||||
{
|
||||
SHFILEINFO sfi;
|
||||
if (dwFileAttributes == INVALID_FILE_ATTRIBUTES)
|
||||
dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
|
||||
else
|
||||
dwFileAttributes |= FILE_ATTRIBUTE_NORMAL;
|
||||
int m_nNewIconBaseIndex; // <20>¼ӵ<C2BC>ICON
|
||||
|
||||
SHGetFileInfo
|
||||
(
|
||||
szVolume,
|
||||
dwFileAttributes,
|
||||
&sfi,
|
||||
sizeof(SHFILEINFO),
|
||||
SHGFI_SYSICONINDEX | SHGFI_USEFILEATTRIBUTES
|
||||
);
|
||||
ClientContext* m_pContext;
|
||||
CIOCPServer* m_iocpServer;
|
||||
CString m_IPAddress;
|
||||
|
||||
return sfi.iIcon;
|
||||
}
|
||||
CProgressCtrl* m_ProgressCtrl;
|
||||
HCURSOR m_hCursor;
|
||||
CString m_Local_Path;
|
||||
bool FixedUploadDirectory(LPCTSTR lpPathName);
|
||||
void FixedLocalDriveList();
|
||||
void FixedRemoteDriveList();
|
||||
void FixedLocalFileList(CString directory = "");
|
||||
void GetRemoteFileList(CString directory = "");
|
||||
void FixedRemoteFileList(BYTE *pbBuffer, DWORD dwBufferLen);
|
||||
|
||||
CString CFileManagerDlg::GetParentDirectory(CString strPath)
|
||||
{
|
||||
CString strCurrentPath = strPath;
|
||||
int iIndex = strCurrentPath.ReverseFind('\\');
|
||||
if (iIndex == -1)
|
||||
{
|
||||
return strCurrentPath;
|
||||
}
|
||||
CString strCurrentSubPath = strCurrentPath.Left(iIndex);
|
||||
iIndex = strCurrentSubPath.ReverseFind('\\');
|
||||
if (iIndex == -1)
|
||||
{
|
||||
strCurrentPath = "";
|
||||
return strCurrentPath;
|
||||
}
|
||||
strCurrentPath = strCurrentSubPath.Left(iIndex);
|
||||
HICON m_hIcon;
|
||||
CStatusBar m_wndStatusBar;
|
||||
CFileManagerDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // standard constructor
|
||||
|
||||
if(strCurrentPath.Right(1) != "\\")
|
||||
strCurrentPath += "\\";
|
||||
return strCurrentPath;
|
||||
}
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFileManagerDlg)
|
||||
enum { IDD = IDD_FILE };
|
||||
CComboBox m_Remote_Directory_ComboBox;
|
||||
CComboBox m_Local_Directory_ComboBox;
|
||||
CListCtrl m_list_remote;
|
||||
CListCtrl m_list_local;
|
||||
//}}AFX_DATA
|
||||
|
||||
void CFileManagerDlg::EnableControl(BOOL bEnable)
|
||||
{
|
||||
m_ControlList_Client.EnableWindow(bEnable);
|
||||
m_ControlList_Server.EnableWindow(bEnable);
|
||||
m_ComboBox_Server.EnableWindow(bEnable);
|
||||
m_ComboBox_Client.EnableWindow(bEnable);
|
||||
}
|
||||
|
||||
CTrueColorToolBar m_ToolBar_File_Server; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// CTrueColorToolBar m_wndToolBar_Remote;
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFileManagerDlg)
|
||||
public:
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
virtual void PostNcDestroy();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// <EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_DIALOG_FILE_MANAGER };
|
||||
// Implementation
|
||||
protected:
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFileManagerDlg)
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnDblclkListLocal(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBegindragListLocal(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnBegindragListRemote(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnTimer(UINT nIDEvent);
|
||||
afx_msg void OnClose();
|
||||
afx_msg void OnDblclkListRemote(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnLocalPrev();
|
||||
afx_msg void OnRemotePrev();
|
||||
afx_msg void OnLocalView();
|
||||
afx_msg void OnLocalList();
|
||||
afx_msg void OnLocalReport();
|
||||
afx_msg void OnLocalBigicon();
|
||||
afx_msg void OnLocalSmallicon();
|
||||
afx_msg void OnRemoteBigicon();
|
||||
afx_msg void OnRemoteList();
|
||||
afx_msg void OnRemoteReport();
|
||||
afx_msg void OnRemoteSmallicon();
|
||||
afx_msg void OnRemoteView();
|
||||
afx_msg void OnUpdateLocalStop(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateRemoteStop(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateLocalPrev(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateRemotePrev(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateLocalCopy(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateRemoteCopy(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateRemoteDelete(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateRemoteNewfolder(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateLocalDelete(CCmdUI* pCmdUI);
|
||||
afx_msg void OnUpdateLocalNewfolder(CCmdUI* pCmdUI);
|
||||
afx_msg void OnRemoteCopy();
|
||||
afx_msg void OnLocalCopy();
|
||||
afx_msg void OnLocalDelete();
|
||||
afx_msg void OnRemoteDelete();
|
||||
afx_msg void OnRemoteStop();
|
||||
afx_msg void OnLocalStop();
|
||||
afx_msg void OnLocalNewfolder();
|
||||
afx_msg void OnRemoteNewfolder();
|
||||
afx_msg void OnTransfer();
|
||||
afx_msg void OnRename();
|
||||
afx_msg void OnEndlabeleditListLocal(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnEndlabeleditListRemote(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnDelete();
|
||||
afx_msg void OnNewfolder();
|
||||
afx_msg void OnRefresh();
|
||||
afx_msg void OnLocalOpen();
|
||||
afx_msg void OnRemoteOpenShow();
|
||||
afx_msg void OnRemoteOpenHide();
|
||||
afx_msg void OnRclickListLocal(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnRclickListRemote(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
CListCtrl* m_pDragList; //Which ListCtrl we are dragging FROM
|
||||
CListCtrl* m_pDropList; //Which ListCtrl we are dropping ON
|
||||
BOOL m_bDragging; //T during a drag operation
|
||||
int m_nDragIndex; //Index of selected item in the List we are dragging FROM
|
||||
int m_nDropIndex; //Index at which to drop item in the List we are dropping ON
|
||||
CWnd* m_pDropWnd; //Pointer to window we are dropping on (will be cast to CListCtrl* type)
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
CListCtrl m_ControlList_Client;
|
||||
CListCtrl m_ControlList_Server;
|
||||
|
||||
CImageList* m_ImageList_Large;
|
||||
CImageList* m_ImageList_Small;
|
||||
afx_msg void OnClose();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnNMDblclkListServer(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
VOID CFileManagerDlg::FixedServerFileList(CString strDirectory="");
|
||||
VOID CFileManagerDlg::FixedClientFileList(BYTE *szBuffer, ULONG ulLength);
|
||||
|
||||
CString m_Server_File_Path;
|
||||
CString m_Client_File_Path;
|
||||
CComboBox m_ComboBox_Server;
|
||||
CComboBox m_ComboBox_Client;
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
afx_msg void OnCbnSelchangeComboServer();
|
||||
afx_msg void OnCbnDblclkComboServer();
|
||||
CStatic m_FileServerBarPos;
|
||||
CStatic m_FileClientBarPos;
|
||||
|
||||
afx_msg void OnIdtServerPrev();
|
||||
afx_msg void OnIdtServerNewFolder();
|
||||
afx_msg void OnIdtServerDelete();
|
||||
afx_msg void OnIdtServerStop();
|
||||
BOOL m_bIsStop;
|
||||
BOOL CFileManagerDlg::MakeSureDirectoryPathExists(char* szDirectoryFullPath);
|
||||
BOOL CFileManagerDlg::DeleteDirectory(LPCTSTR strDirectoryFullPath) ;
|
||||
afx_msg void OnViewBigIcon();
|
||||
afx_msg void OnViewSmallIcon();
|
||||
afx_msg void OnViewDetail();
|
||||
afx_msg void OnViewList();
|
||||
afx_msg void OnNMDblclkListClient(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
VOID CFileManagerDlg::GetClientFileList(CString strDirectory="");
|
||||
VOID CFileManagerDlg::OnReceiveComplete();
|
||||
afx_msg void OnLvnBegindragListServer(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
|
||||
BOOL m_bDragging;
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
VOID CFileManagerDlg::DropItemOnList();
|
||||
|
||||
CListCtrl* m_DragControlList;
|
||||
CListCtrl* m_DropControlList;
|
||||
|
||||
HCURSOR m_hCursor;
|
||||
|
||||
ListTemplate m_Remote_Upload_Job;
|
||||
VOID CFileManagerDlg::OnCopyServerToClient();
|
||||
BOOL CFileManagerDlg::SendToClientJob();
|
||||
|
||||
CString m_strSourFileFullPath;
|
||||
CString m_strDestFileFullPath;
|
||||
__int64 m_OperatingFileLength; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>ܴ<EFBFBD>С
|
||||
VOID CFileManagerDlg::SendFileData();
|
||||
__int64 m_ulCounter;
|
||||
VOID CFileManagerDlg::EndCopyServerToClient();
|
||||
|
||||
BOOL CFileManagerDlg::FixedServerToClientDirectory(LPCTSTR szDircetoryFullPath) ;
|
||||
|
||||
CStatusBar m_StatusBar; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4><CCAC>
|
||||
CProgressCtrl* m_ProgressCtrl;
|
||||
|
||||
void CFileManagerDlg::ShowProgress()
|
||||
{
|
||||
if ((int)m_ulCounter == -1)
|
||||
{
|
||||
m_ulCounter = m_OperatingFileLength;
|
||||
}
|
||||
|
||||
int iProgress = (float)(m_ulCounter * 100) / m_OperatingFileLength;
|
||||
m_ProgressCtrl->SetPos(iProgress);
|
||||
|
||||
|
||||
if (m_ulCounter == m_OperatingFileLength)
|
||||
{
|
||||
m_ulCounter = m_OperatingFileLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
VOID CFileManagerDlg::SendTransferMode();
|
||||
|
||||
ULONG m_ulTransferMode;
|
||||
|
||||
afx_msg void OnNMRClickListServer(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnOperationServerRun();
|
||||
afx_msg void OnOperationRename();
|
||||
afx_msg void OnLvnEndlabeleditListServer(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnNMRClickListClient(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnOperationClientShowRun();
|
||||
afx_msg void OnOperationClientHideRun();
|
||||
afx_msg void OnLvnEndlabeleditListClient(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnOperationCompress();
|
||||
|
||||
VOID CFileManagerDlg::ServerCompress(ULONG ulType);
|
||||
BOOL CFileManagerDlg::CompressFiles(PCSTR strRARFileFullPath,PSTR strString,ULONG ulType);
|
||||
void DropItemOnList(CListCtrl* pDragList, CListCtrl* pDropList);
|
||||
private:
|
||||
bool m_bIsUpload; // <20>Ƿ<EFBFBD><C7B7>ǰѱ<C7B0><D1B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>λ
|
||||
bool MakeSureDirectoryPathExists(LPCTSTR pszDirPath);
|
||||
void SendTransferMode();
|
||||
void SendFileData();
|
||||
void EndLocalUploadFile();
|
||||
bool DeleteDirectory(LPCTSTR lpszDirectory);
|
||||
void EnableControl(BOOL bEnable = TRUE);
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_FILEMANAGERDLG_H__4918F922_13A4_4389_8027_5D4993A6DB91__INCLUDED_)
|
||||
|
||||
@@ -1,60 +1,69 @@
|
||||
// FileTransferModeDlg.cpp : ʵ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
// FileTransferModeDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "2015Remote.h"
|
||||
#include "FileTransferModeDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFileTransferModeDlg dialog
|
||||
|
||||
|
||||
// CFileTransferModeDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
IMPLEMENT_DYNAMIC(CFileTransferModeDlg, CDialog)
|
||||
|
||||
CFileTransferModeDlg::CFileTransferModeDlg(CWnd* pParent)
|
||||
CFileTransferModeDlg::CFileTransferModeDlg(CWnd* pParent /*=NULL*/)
|
||||
: CDialog(CFileTransferModeDlg::IDD, pParent)
|
||||
{
|
||||
|
||||
//{{AFX_DATA_INIT(CFileTransferModeDlg)
|
||||
// NOTE: the ClassWizard will add member initialization here
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
CFileTransferModeDlg::~CFileTransferModeDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CFileTransferModeDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CFileTransferModeDlg)
|
||||
// NOTE: the ClassWizard will add DDX and DDV calls here
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CFileTransferModeDlg, CDialog)
|
||||
ON_CONTROL_RANGE(BN_CLICKED, IDC_OVERWRITE, IDC_JUMP_ALL, OnEndDialog)
|
||||
//{{AFX_MSG_MAP(CFileTransferModeDlg)
|
||||
ON_CONTROL_RANGE(BN_CLICKED, IDC_OVERWRITE, IDC_CANCEL, OnEndDialog)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CFileTransferModeDlg <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFileTransferModeDlg message handlers
|
||||
|
||||
|
||||
VOID CFileTransferModeDlg::OnEndDialog(UINT id)
|
||||
void CFileTransferModeDlg::OnEndDialog(UINT id)
|
||||
{
|
||||
// TODO: Add your control notification handler code here
|
||||
EndDialog(id);
|
||||
}
|
||||
|
||||
BOOL CFileTransferModeDlg::OnInitDialog()
|
||||
BOOL CFileTransferModeDlg::OnInitDialog()
|
||||
{
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
// TODO: Add extra initialization here
|
||||
CString str;
|
||||
str.Format("<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѱ<EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>%s<><73><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>", m_strFileName);
|
||||
|
||||
CString strTips;
|
||||
strTips.Format("˥<EFBFBD><EFBFBD> զ<><D5A6>.... \" %s \" ", m_strFileName);
|
||||
|
||||
for (int i = 0; i < strTips.GetLength(); i += 120)
|
||||
for (int i = 0; i < str.GetLength(); i += 120)
|
||||
{
|
||||
strTips.Insert(i, "\n");
|
||||
str.Insert(i, "\n");
|
||||
i += 1;
|
||||
}
|
||||
|
||||
SetDlgItemText(IDC_TIP, strTips);
|
||||
SetDlgItemText(IDC_TIPS, str);
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// <20>쳣: OCX <20><><EFBFBD><EFBFBD>ҳӦ<D2B3><D3A6><EFBFBD><EFBFBD> FALSE
|
||||
// EXCEPTION: OCX Property Pages should return FALSE
|
||||
}
|
||||
|
||||
@@ -1,25 +1,48 @@
|
||||
#if !defined(AFX_FILETRANSFERMODEDLG_H__6EE95488_A679_4F78_AF95_B4D0F747455A__INCLUDED_)
|
||||
#define AFX_FILETRANSFERMODEDLG_H__6EE95488_A679_4F78_AF95_B4D0F747455A__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// FileTransferModeDlg.h : header file
|
||||
//
|
||||
|
||||
|
||||
// CFileTransferModeDlg <EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD>
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFileTransferModeDlg dialog
|
||||
|
||||
class CFileTransferModeDlg : public CDialog
|
||||
{
|
||||
DECLARE_DYNAMIC(CFileTransferModeDlg)
|
||||
|
||||
// Construction
|
||||
public:
|
||||
CFileTransferModeDlg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CFileTransferModeDlg();
|
||||
|
||||
CString m_strFileName;
|
||||
CFileTransferModeDlg(CWnd* pParent = NULL); // standard constructor
|
||||
|
||||
// <EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_DIALOG_TRANSMODE };
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CFileTransferModeDlg)
|
||||
enum { IDD = IDD_TRANSFERMODE_DLG };
|
||||
// NOTE: the ClassWizard will add data members here
|
||||
//}}AFX_DATA
|
||||
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CFileTransferModeDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<><D6A7>
|
||||
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(CFileTransferModeDlg)
|
||||
afx_msg void OnEndDialog(UINT id);
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
virtual BOOL OnInitDialog();
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_FILETRANSFERMODEDLG_H__6EE95488_A679_4F78_AF95_B4D0F747455A__INCLUDED_)
|
||||
|
||||
@@ -77,29 +77,29 @@ public:
|
||||
BOOL StartServer(pfnNotifyProc NotifyProc, pfnOfflineProc OffProc, USHORT uPort);
|
||||
|
||||
static DWORD WINAPI ListenThreadProc(LPVOID lParam);
|
||||
BOOL IOCPServer::InitializeIOCP(VOID);
|
||||
BOOL InitializeIOCP(VOID);
|
||||
static DWORD WINAPI WorkThreadProc(LPVOID lParam);
|
||||
ULONG m_ulWorkThreadCount;
|
||||
VOID IOCPServer::OnAccept();
|
||||
VOID OnAccept();
|
||||
static CRITICAL_SECTION m_cs;
|
||||
|
||||
/************************************************************************/
|
||||
//<2F><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD>Ķ<EFBFBD><C4B6><EFBFBD>
|
||||
ContextObjectList m_ContextConnectionList;
|
||||
ContextObjectList m_ContextFreePoolList;
|
||||
PCONTEXT_OBJECT IOCPServer::AllocateContext();
|
||||
PCONTEXT_OBJECT AllocateContext();
|
||||
VOID RemoveStaleContext(CONTEXT_OBJECT* ContextObject);
|
||||
VOID IOCPServer::MoveContextToFreePoolList(CONTEXT_OBJECT* ContextObject);
|
||||
VOID MoveContextToFreePoolList(CONTEXT_OBJECT* ContextObject);
|
||||
|
||||
VOID IOCPServer::PostRecv(CONTEXT_OBJECT* ContextObject);
|
||||
VOID PostRecv(CONTEXT_OBJECT* ContextObject);
|
||||
|
||||
/************************************************************************/
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
BOOL IOCPServer::HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
|
||||
BOOL IOCPServer::OnClientInitializing(PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
|
||||
BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
|
||||
VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer , ULONG ulOriginalLength);
|
||||
BOOL IOCPServer::OnClientPostSending(CONTEXT_OBJECT* ContextObject,ULONG ulCompressedLength);
|
||||
BOOL HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
|
||||
BOOL OnClientInitializing(PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
|
||||
BOOL OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans);
|
||||
VOID OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer , ULONG ulOriginalLength);
|
||||
BOOL OnClientPostSending(CONTEXT_OBJECT* ContextObject,ULONG ulCompressedLength);
|
||||
IOCPServer(void);
|
||||
~IOCPServer(void);
|
||||
|
||||
|
||||
227
server/2015Remote/InputDlg.cpp
Normal file
@@ -0,0 +1,227 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
// MSDN Magazine -- June 2005
|
||||
// If this code works, it was written by Paul DiLascia.
|
||||
// If not, I don't know who wrote it.
|
||||
// Compiles with Visual Studio .NET 2003 (V7.1) on Windows XP. Tab size=3.
|
||||
//
|
||||
#include "stdafx.h"
|
||||
#include "InputDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
//////////////////
|
||||
// Note: Make sure nBufLen is big enough to hold your entire dialog template!
|
||||
//
|
||||
CDlgTemplateBuilder::CDlgTemplateBuilder(UINT nBufLen)
|
||||
{
|
||||
m_pBuffer = new WORD[nBufLen];
|
||||
m_pNext = m_pBuffer;
|
||||
m_pEndBuf = m_pNext + nBufLen;
|
||||
}
|
||||
|
||||
CDlgTemplateBuilder::~CDlgTemplateBuilder()
|
||||
{
|
||||
delete [] m_pBuffer;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Create template (DLGTEMPLATE)
|
||||
//
|
||||
DLGTEMPLATE* CDlgTemplateBuilder::Begin(DWORD dwStyle, const CRect& rc,
|
||||
LPCTSTR text, DWORD dwStyleEx)
|
||||
{
|
||||
ASSERT(m_pBuffer==m_pNext); // call Begin first and only once!
|
||||
|
||||
DLGTEMPLATE* hdr = (DLGTEMPLATE*)m_pBuffer;
|
||||
hdr->style = dwStyle; // copy style..
|
||||
hdr->dwExtendedStyle = dwStyleEx; // ..and extended, too
|
||||
hdr->cdit = 0; // number of items: zero
|
||||
|
||||
// Set dialog rectangle.
|
||||
CRect rcDlg = rc;
|
||||
hdr->x = (short)rcDlg.left;
|
||||
hdr->y = (short)rcDlg.top;
|
||||
hdr->cx = (short)rcDlg.Width();
|
||||
hdr->cy = (short)rcDlg.Height();
|
||||
|
||||
// Append trailing items: menu, class, caption. I only use caption.
|
||||
m_pNext = (WORD*)(hdr+1);
|
||||
*m_pNext++ = 0; // menu (none)
|
||||
*m_pNext++ = 0; // dialog class (use standard)
|
||||
m_pNext = AddText(m_pNext, text); // append dialog caption
|
||||
|
||||
ASSERT(m_pNext < m_pEndBuf);
|
||||
return hdr;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Add dialog item (control).
|
||||
//
|
||||
void CDlgTemplateBuilder::AddItemTemplate(WORD wType, DWORD dwStyle,
|
||||
const CRect& rc, WORD nID, DWORD dwStyleEx)
|
||||
{
|
||||
ASSERT(m_pNext < m_pEndBuf);
|
||||
|
||||
// initialize DLGITEMTEMPLATE
|
||||
DLGITEMTEMPLATE& it = *((DLGITEMTEMPLATE*)AlignDWORD(m_pNext));
|
||||
it.style = dwStyle;
|
||||
it.dwExtendedStyle = dwStyleEx;
|
||||
|
||||
CRect rcDlg = rc;
|
||||
it.x = (short)rcDlg.left;
|
||||
it.y = (short)rcDlg.top;
|
||||
it.cx = (short)rcDlg.Width();
|
||||
it.cy = (short)rcDlg.Height();
|
||||
it.id = nID;
|
||||
|
||||
// add class (none)
|
||||
m_pNext = (WORD*)(&it+1);
|
||||
*m_pNext++ = 0xFFFF; // next WORD is atom
|
||||
*m_pNext++ = wType; // ..atom identifier
|
||||
ASSERT(m_pNext < m_pEndBuf); // check not out of range
|
||||
|
||||
// increment control/item count
|
||||
DLGTEMPLATE* hdr = (DLGTEMPLATE*)m_pBuffer;
|
||||
hdr->cdit++;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Add dialog item (control).
|
||||
//
|
||||
void CDlgTemplateBuilder::AddItem(WORD wType, DWORD dwStyle,
|
||||
const CRect& rc, LPCTSTR text, WORD nID, DWORD dwStyleEx)
|
||||
{
|
||||
AddItemTemplate(wType, dwStyle, rc, nID, dwStyleEx);
|
||||
m_pNext = AddText(m_pNext, text); // append title
|
||||
*m_pNext++ = 0; // no creation data
|
||||
ASSERT(m_pNext < m_pEndBuf);
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Add dialog item (control).
|
||||
//
|
||||
void CDlgTemplateBuilder::AddItem(WORD wType, DWORD dwStyle,
|
||||
const CRect& rc, WORD wResID, WORD nID, DWORD dwStyleEx)
|
||||
{
|
||||
AddItemTemplate(wType, dwStyle, rc, nID, dwStyleEx);
|
||||
*m_pNext++ = 0xFFFF; // next is resource id
|
||||
*m_pNext++ = wResID; // ..here it is
|
||||
*m_pNext++ = 0; // no extra stuff
|
||||
ASSERT(m_pNext < m_pEndBuf);
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Append text to buffer. Convert to Unicode if necessary.
|
||||
// Return pointer to next character after terminating NULL.
|
||||
//
|
||||
WORD* CDlgTemplateBuilder::AddText(WORD* buf, LPCTSTR text)
|
||||
{
|
||||
if (text) {
|
||||
USES_CONVERSION;
|
||||
wcscpy((WCHAR*)buf, T2W((LPTSTR)text));
|
||||
buf += wcslen((WCHAR*)buf)+1;
|
||||
} else {
|
||||
*buf++ = 0;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Create string dialog. If no icon specified, use IDI_QUESTION. Note that
|
||||
// the order in which the controls are added is the TAB order.
|
||||
//
|
||||
BOOL CInputDialog::Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent, WORD nIDIcon)
|
||||
{
|
||||
const int CXDIALOG = 200; // dialog width
|
||||
const int DLGMARGIN = 7; // margins all around
|
||||
const int CYSTATIC = 8; // height of static text
|
||||
const int CYEDIT = 12; // height of edit control
|
||||
const int CYSPACE = 5; // vertical space between controls
|
||||
const int CXBUTTON = 40; // button width...
|
||||
const int CYBUTTON = 15; // ..and height
|
||||
|
||||
CDlgTemplateBuilder& dtb = m_dtb;
|
||||
CRect rc(
|
||||
CPoint(0,0),
|
||||
CSize(CXDIALOG, CYSTATIC + CYEDIT + CYBUTTON + 2*DLGMARGIN + 2*CYSPACE));
|
||||
|
||||
// create dialog header
|
||||
DLGTEMPLATE* pTempl = dtb.Begin(WS_POPUPWINDOW|DS_MODALFRAME|WS_DLGFRAME,rc,caption);
|
||||
|
||||
// shrink main rect by margins
|
||||
rc.DeflateRect(CSize(DLGMARGIN,DLGMARGIN));
|
||||
|
||||
// create icon if needed
|
||||
if (nIDIcon) {
|
||||
if (nIDIcon >= (WORD)IDI_APPLICATION) {
|
||||
// if using a system icon, I load it here and set it in OnInitDialog
|
||||
// because can't specify system icon in template, only icons from
|
||||
// application resource file.
|
||||
m_hIcon = ::LoadIcon(NULL, MAKEINTRESOURCE(nIDIcon));
|
||||
nIDIcon = 0;
|
||||
} else {
|
||||
m_hIcon = NULL;
|
||||
}
|
||||
|
||||
// The size is calculated in pixels, but it seems to work OK--???
|
||||
CSize sz(GetSystemMetrics(SM_CXICON),GetSystemMetrics(SM_CYICON));
|
||||
CRect rcIcon(rc.TopLeft(), sz);
|
||||
dtb.AddItem(CDlgTemplateBuilder::STATIC, // add icon
|
||||
WS_VISIBLE|WS_CHILD|SS_LEFT|SS_ICON, rc, nIDIcon, IDICON);
|
||||
rc.left += sz.cx; // shrink main rect by width of icon
|
||||
}
|
||||
|
||||
// add prompt
|
||||
rc.bottom = rc.top + CYSTATIC; // height = height of static
|
||||
dtb.AddItem(CDlgTemplateBuilder::STATIC, // add it
|
||||
WS_VISIBLE|WS_CHILD|SS_LEFT, rc, prompt);
|
||||
|
||||
// add edit control
|
||||
rc += CPoint(0, rc.Height() + CYSPACE); // move below static
|
||||
rc.bottom = rc.top + CYEDIT; // height = height of edit control
|
||||
dtb.AddItem(CDlgTemplateBuilder::EDIT, // add it ES_AUTOHSCROLL must be add
|
||||
WS_VISIBLE|WS_CHILD|WS_BORDER|WS_TABSTOP|ES_AUTOHSCROLL, rc, m_str, IDEDIT);
|
||||
|
||||
// add OK button
|
||||
rc += CPoint(0, rc.Height() + CYSPACE); // move below edit control
|
||||
rc.bottom = rc.top + CYBUTTON; // height = button height
|
||||
rc.left = rc.right - CXBUTTON; // width = button width
|
||||
rc -= CPoint(CXBUTTON + DLGMARGIN,0); // move left one button width
|
||||
dtb.AddItem(CDlgTemplateBuilder::BUTTON, // add it
|
||||
WS_VISIBLE|WS_CHILD|WS_TABSTOP|BS_DEFPUSHBUTTON, rc, _T("&OK"), IDOK);
|
||||
|
||||
// add Cancel button
|
||||
rc += CPoint(CXBUTTON + DLGMARGIN,0); // move right again
|
||||
dtb.AddItem(CDlgTemplateBuilder::BUTTON, // add Cancel button
|
||||
WS_VISIBLE|WS_CHILD|WS_TABSTOP, rc, _T("&Cancel"), IDCANCEL);
|
||||
|
||||
return InitModalIndirect(pTempl, pParent);
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// Initialize dialog: if I loaded a system icon, set it in static control.
|
||||
//
|
||||
BOOL CInputDialog::OnInitDialog()
|
||||
{
|
||||
if (m_hIcon) {
|
||||
CStatic* pStatic = (CStatic*)GetDlgItem(IDICON);
|
||||
ASSERT(pStatic);
|
||||
pStatic->SetIcon(m_hIcon);
|
||||
}
|
||||
return CDialog::OnInitDialog();
|
||||
}
|
||||
|
||||
/////////////////
|
||||
// User pressed OK: check for empty string if required flag is set.
|
||||
//
|
||||
void CInputDialog::OnOK()
|
||||
{
|
||||
UpdateData(TRUE);
|
||||
if (m_bRequired && m_str.IsEmpty()) {
|
||||
MessageBeep(0);
|
||||
return; // don't quit dialog!
|
||||
}
|
||||
CDialog::OnOK();
|
||||
}
|
||||
83
server/2015Remote/InputDlg.h
Normal file
@@ -0,0 +1,83 @@
|
||||
////////////////////////////////////////////////////////////////
|
||||
// PixieLib(TM) Copyright 1997-2005 Paul DiLascia
|
||||
// If this code works, it was written by Paul DiLascia.
|
||||
// If not, I don't know who wrote it.
|
||||
// Compiles with Visual Studio.NET 7.1 or greater. Set tabsize=3.
|
||||
//
|
||||
|
||||
//////////////////
|
||||
// Helper class to build a dialog template in memory. Only supports what's
|
||||
// needed for CStringDialog.
|
||||
//
|
||||
class CDlgTemplateBuilder {
|
||||
protected:
|
||||
WORD* m_pBuffer; // internal buffer holds dialog template
|
||||
WORD* m_pNext; // next WORD to copy stuff
|
||||
WORD* m_pEndBuf; // end of buffer
|
||||
|
||||
// align ptr to nearest DWORD
|
||||
WORD* AlignDWORD(WORD* ptr) {
|
||||
ptr++; // round up to nearest DWORD
|
||||
LPARAM lp = (LPARAM)ptr; // convert to long
|
||||
lp &= 0xFFFFFFFC; // make sure on DWORD boundary
|
||||
return (WORD*)lp;
|
||||
}
|
||||
|
||||
void AddItemTemplate(WORD wType, DWORD dwStyle, const CRect& rc,
|
||||
WORD nID, DWORD dwStyleEx);
|
||||
|
||||
public:
|
||||
// Windows predefined atom names
|
||||
enum { BUTTON=0x0080, EDIT, STATIC, LISTBOX, SCROLLBAR, COMBOBOX };
|
||||
|
||||
CDlgTemplateBuilder(UINT nBufLen=1024);
|
||||
~CDlgTemplateBuilder();
|
||||
|
||||
DLGTEMPLATE* GetTemplate() { return (DLGTEMPLATE*)m_pBuffer; }
|
||||
|
||||
// functions to build the template
|
||||
DLGTEMPLATE* Begin(DWORD dwStyle, const CRect& rc, LPCTSTR caption, DWORD dwStyleEx=0);
|
||||
WORD* AddText(WORD* buf, LPCTSTR text);
|
||||
void AddItem(WORD wType, DWORD dwStyle, const CRect& rc,
|
||||
LPCTSTR text, WORD nID=-1, DWORD dwStyleEx=0);
|
||||
void AddItem(WORD wType, DWORD dwStyle, const CRect& rc,
|
||||
WORD nResID, WORD nID=-1, DWORD dwStyleEx=0);
|
||||
};
|
||||
|
||||
//////////////////
|
||||
// Class to implement a simple string input dialog. Kind of like MessageBox
|
||||
// but it accepts a single string input from user. You provide the prompt. To
|
||||
// use:
|
||||
//
|
||||
// CStringDialog dlg; // string dialog
|
||||
// dlg.m_bRequired = m_bRequired; // if string is required
|
||||
// dlg.Init(_T("Title"), _T("Enter a string:"), this, IDI_QUESTION);
|
||||
// dlg.DoModal(); // run dialog
|
||||
// CString result = dlg.m_str; // whatever the user typed
|
||||
//
|
||||
class CInputDialog : public CDialog {
|
||||
public:
|
||||
CString m_str; // the string returned [in,out]
|
||||
BOOL m_bRequired; // string required?
|
||||
HICON m_hIcon; // icon if not supplied
|
||||
|
||||
CInputDialog() { }
|
||||
~CInputDialog() { }
|
||||
|
||||
// Call this to create the template with given caption and prompt.
|
||||
BOOL Init(LPCTSTR caption, LPCTSTR prompt, CWnd* pParent=NULL,
|
||||
WORD nIDIcon=(WORD)IDI_QUESTION);
|
||||
|
||||
protected:
|
||||
CDlgTemplateBuilder m_dtb; // place to build/hold the dialog template
|
||||
enum { IDICON=1, IDEDIT }; // control IDs
|
||||
|
||||
// MFC virtual overrides
|
||||
virtual BOOL OnInitDialog();
|
||||
virtual void OnOK();
|
||||
virtual void DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
DDX_Text(pDX, IDEDIT, m_str);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTrueColorToolBar
|
||||
@@ -38,7 +38,9 @@ CTrueColorToolBar::~CTrueColorToolBar()
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTrueColorToolBar, CToolBar)
|
||||
//{{AFX_MSG_MAP(CTrueColorToolBar)
|
||||
ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnToolbarDropDown)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -50,7 +52,7 @@ BOOL CTrueColorToolBar::LoadTrueColorToolBar(int nBtnWidth,
|
||||
{
|
||||
if (!SetTrueColorToolBar(TB_SETIMAGELIST, uToolBar, nBtnWidth))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (uToolBarHot) {
|
||||
if (!SetTrueColorToolBar(TB_SETHOTIMAGELIST, uToolBarHot, nBtnWidth))
|
||||
return FALSE;
|
||||
@@ -66,34 +68,34 @@ BOOL CTrueColorToolBar::LoadTrueColorToolBar(int nBtnWidth,
|
||||
|
||||
|
||||
BOOL CTrueColorToolBar::SetTrueColorToolBar(UINT uToolBarType,
|
||||
UINT uToolBar,
|
||||
int nBtnWidth)
|
||||
UINT uToolBar,
|
||||
int nBtnWidth)
|
||||
{
|
||||
CImageList cImageList;
|
||||
CBitmap cBitmap;
|
||||
BITMAP bmBitmap;
|
||||
|
||||
|
||||
if (!cBitmap.Attach(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uToolBar),
|
||||
IMAGE_BITMAP, 0, 0,
|
||||
LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) ||
|
||||
!cBitmap.GetBitmap(&bmBitmap))
|
||||
IMAGE_BITMAP, 0, 0,
|
||||
LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) ||
|
||||
!cBitmap.GetBitmap(&bmBitmap))
|
||||
return FALSE;
|
||||
|
||||
CSize cSize(bmBitmap.bmWidth, bmBitmap.bmHeight);
|
||||
int nNbBtn = cSize.cx/nBtnWidth;
|
||||
RGBTRIPLE* rgb = (RGBTRIPLE*)(bmBitmap.bmBits);
|
||||
COLORREF rgbMask = RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue);
|
||||
|
||||
|
||||
if (!cImageList.Create(nBtnWidth, cSize.cy, ILC_COLOR24|ILC_MASK, nNbBtn, 0))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (cImageList.Add(&cBitmap, rgbMask) == -1)
|
||||
return FALSE;
|
||||
|
||||
SendMessage(uToolBarType, 0, (LPARAM)cImageList.m_hImageList);
|
||||
cImageList.Detach();
|
||||
cBitmap.Detach();
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -113,26 +115,26 @@ void CTrueColorToolBar::AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uM
|
||||
m_lstDropDownButton.Add(DropDownInfo);
|
||||
}
|
||||
|
||||
void CTrueColorToolBar::OnToolbarDropDown(NMHDR * pnmtb, LRESULT *plr)
|
||||
void CTrueColorToolBar::OnToolbarDropDown(NMHDR* pnmh, LRESULT *plr)
|
||||
{
|
||||
NMTOOLBARA * pnmtbb=(NMTOOLBARA *)pnmtb;
|
||||
NMTOOLBARA * pnmtb=(NMTOOLBARA *)pnmh;
|
||||
for (int i = 0; i < m_lstDropDownButton.GetSize(); i++) {
|
||||
|
||||
|
||||
stDropDownInfo DropDownInfo = m_lstDropDownButton.GetAt(i);
|
||||
|
||||
if (DropDownInfo.uButtonID == UINT(pnmtbb->iItem)) {
|
||||
if (DropDownInfo.uButtonID == UINT(pnmtb->iItem)) {
|
||||
|
||||
CMenu menu;
|
||||
menu.LoadMenu(DropDownInfo.uMenuID);
|
||||
CMenu* pPopup = menu.GetSubMenu(0);
|
||||
|
||||
|
||||
CRect rc;
|
||||
SendMessage(TB_GETRECT, (WPARAM)pnmtbb->iItem, (LPARAM)&rc);
|
||||
SendMessage(TB_GETRECT, (WPARAM)pnmtb->iItem, (LPARAM)&rc);
|
||||
ClientToScreen(&rc);
|
||||
|
||||
|
||||
pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
|
||||
rc.left, rc.bottom, DropDownInfo.pParent, &rc);
|
||||
rc.left, rc.bottom, DropDownInfo.pParent, &rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,11 @@
|
||||
|
||||
class CTrueColorToolBar : public CToolBar
|
||||
{
|
||||
// Construction
|
||||
// Construction
|
||||
public:
|
||||
CTrueColorToolBar();
|
||||
|
||||
// Attributes
|
||||
// Attributes
|
||||
private:
|
||||
BOOL m_bDropDown;
|
||||
|
||||
@@ -45,30 +45,37 @@ private:
|
||||
UINT uMenuID;
|
||||
CWnd* pParent;
|
||||
};
|
||||
|
||||
|
||||
CArray <stDropDownInfo, stDropDownInfo&> m_lstDropDownButton;
|
||||
|
||||
// Operations
|
||||
|
||||
// Operations
|
||||
public:
|
||||
BOOL LoadTrueColorToolBar(int nBtnWidth,
|
||||
UINT uToolBar,
|
||||
UINT uToolBarHot = 0,
|
||||
UINT uToolBarDisabled = 0);
|
||||
UINT uToolBar,
|
||||
UINT uToolBarHot = 0,
|
||||
UINT uToolBarDisabled = 0);
|
||||
|
||||
void AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID);
|
||||
|
||||
private:
|
||||
BOOL SetTrueColorToolBar(UINT uToolBarType,
|
||||
UINT uToolBar,
|
||||
int nBtnWidth);
|
||||
UINT uToolBar,
|
||||
int nBtnWidth);
|
||||
|
||||
// Implementation
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CTrueColorToolBar)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CTrueColorToolBar();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
afx_msg void OnToolbarDropDown(NMHDR * pnmh, LRESULT* plRes);
|
||||
//{{AFX_MSG(CTrueColorToolBar)
|
||||
afx_msg void OnToolbarDropDown(NMHDR* pnmh, LRESULT* plRes);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
35
server/2015Remote/gh0st2Remote.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/************************************************************************
|
||||
* @file gh0st2Remote.h
|
||||
* @brief 将FileManagerDlg、InputDlg、FileTransferModeDlg、TrueColorToolBar
|
||||
* 还原到gh0st最初版本。
|
||||
************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "IOCPServer.h"
|
||||
|
||||
typedef IOCPServer CIOCPServer;
|
||||
|
||||
typedef CONTEXT_OBJECT ClientContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD dwSizeHigh;
|
||||
DWORD dwSizeLow;
|
||||
}FILESIZE;
|
||||
|
||||
#define m_DeCompressionBuffer InDeCompressedBuffer
|
||||
|
||||
#define GetBufferLen GetBufferLength
|
||||
|
||||
#define m_Dialog hDlg
|
||||
|
||||
#define m_Socket sClientSocket
|
||||
|
||||
#define Send OnClientPreSending
|
||||
|
||||
#define MAKEINT64(low, high) ((unsigned __int64)(((DWORD)(low)) | ((unsigned __int64)((DWORD)(high))) << 32))
|
||||
|
||||
#define MAX_WRITE_RETRY 15 // 重试写入文件次数
|
||||
#define MAX_SEND_BUFFER 1024 * 8 // 最大发送数据长度
|
||||
#define MAX_RECV_BUFFER 1024 * 8 // 最大接收数据长度
|
||||
BIN
server/2015Remote/res/1.cur
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
server/2015Remote/res/2.cur
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
server/2015Remote/res/3.cur
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
server/2015Remote/res/4.cur
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
server/2015Remote/res/Bitmap_4.bmp
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
server/2015Remote/res/Bitmap_5.bmp
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
server/2015Remote/res/dot.cur
Normal file
|
After Width: | Height: | Size: 326 B |
BIN
server/2015Remote/res/gh0st.ico
Normal file
|
After Width: | Height: | Size: 766 B |
13
server/2015Remote/res/gh0st.rc2
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// GH0ST.RC2 - resources Microsoft Visual C++ does not edit directly
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#error this file is not editable by Microsoft Visual C++
|
||||
#endif //APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Add manually edited resources here...
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
BIN
server/2015Remote/res/keyboard.ico
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
server/2015Remote/res/system.ico
Normal file
|
After Width: | Height: | Size: 766 B |
BIN
server/2015Remote/res/toolbar1.bmp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
server/2015Remote/res/toolbar2.bmp
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
server/2015Remote/res/webcam.ico
Normal file
|
After Width: | Height: | Size: 24 KiB |