Files
SimpleRemoter/server/2015Remote/BuildDlg.h
T
yuanyuanxianganddeepseek-flash 381a7f85a0 Feature: add tooltips to the build-server dialog
Every edit box, combo box, checkbox and the padding slider on the
"build server" dialog now explains itself on hover, using the same MFC
built-in tooltip mechanism as the settings dialog (EnableToolTips +
OnToolHitTest + TTN_NEEDTEXT, with a max tip width so the explicit
line breaks survive).

The program-name tip leads with advice to pick a new name for every
test: leaving the name and folder empty installs to the default
location, and repeated installs on one machine collide with a leftover
process or old file, which shows up as a client that never comes online.

Two details: hidden controls are skipped for the rectangle hit test (the
payload/download row is often hidden), and the runtime-created TLS
anchor checkbox is lifted to the top of the z-order so the relay's
child-window lookup finds it instead of the group box. The padding
slider keeps its live size readout by formatting into a member string
rather than the tooltip's 80-character buffer.

All 18 texts are translated in the en_US, de_DE and zh_TW packs.

Co-Authored-By: deepseek-flash
2026-11-30 12:49:54 +01:00

137 lines
5.1 KiB
C++

#pragma once
#include "Buffer.h"
#include "LangManager.h"
#include <map>
// 读取资源:优先从 res 目录读取外部文件,如果不存在则使用内嵌资源
// resName: 外部文件名(如 "ghost_x64.exe"),为空时直接使用内嵌资源
LPBYTE ReadResource(int resourceId, DWORD& dwSize, const char* resName = nullptr);
std::string ReleaseEXE(int resID, const char* name, const char* resName = nullptr);
// ========== res 目录外部资源文件名定义 ==========
// 命名规范:<模块名>_<架构>.exe/.dll/.bin
// 架构:x86 / x64 / linux / macos
namespace ResFileName {
// Ghost 主程序
extern const char* GHOST_X86;
extern const char* GHOST_X64;
extern const char* GHOST_LINUX;
extern const char* GHOST_MACOS;
extern const char* GHOST_ANDROID;
// TestRun 加载器
extern const char* TESTRUN_X86;
extern const char* TESTRUN_X64;
// ServerDll
extern const char* SERVERDLL_X86;
extern const char* SERVERDLL_X64;
// TinyRun
extern const char* TINYRUN_X86;
extern const char* TINYRUN_X64;
// SCLoader (Shellcode加载器)
extern const char* SCLOADER_X86;
extern const char* SCLOADER_X64;
extern const char* SCLOADER_X86_OLD;
extern const char* SCLOADER_X64_OLD;
// FRP 相关 (无架构区分,64位DLL)
extern const char* FRPC_DLL;
extern const char* FRPS_DLL;
// 工具
extern const char* UPX_EXE;
extern const char* RCEDIT_EXE;
}
CString BuildPayloadUrl(const char* ip, const char* name);
// CBuildDlg 对话框
class CBuildDlg : public CDialogLang
{
DECLARE_DYNAMIC(CBuildDlg)
public:
CBuildDlg(CWnd* pParent = NULL); // 标准构造函数
virtual ~CBuildDlg();
// 对话框数据
enum { IDD = IDD_DIALOG_BUILD };
CMenu m_MainMenu;
BOOL m_runasAdmin;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
CString GetFilePath(CString type, CString filter, BOOL isOpen = TRUE);
BOOL OnToolTipNotify(UINT id, NMHDR* pNMHDR, LRESULT* pResult);
// 生成对话框各输入控件的悬浮提示(MFC 内建工具提示,与设置对话框一致):
// OnToolHitTest 按控件矩形命中,TTN_NEEDTEXT 按控件 ID 提供多行文本。
std::map<UINT, CString> m_tips; // 控件 ID -> 提示文本
CString m_sliderTip; // 滑块提示(按当前位置动态生成)
virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
DECLARE_MESSAGE_MAP()
public:
CString m_strIP;
CString m_strPort;
afx_msg void OnBnClickedOk();
virtual BOOL OnInitDialog();
CComboBox m_ComboExe;
afx_msg void OnCbnSelchangeComboExe();
CStatic m_OtherItem;
CComboBox m_ComboBits;
CComboBox m_ComboRunType;
CComboBox m_ComboProto;
CComboBox m_ComboEncrypt;
afx_msg void OnHelpParameters();
CComboBox m_ComboCompress;
CString m_strFindden;
afx_msg void OnHelpFindden();
CEdit m_EditGroup;
CString m_sGroupName;
CString m_strEncryptIP;
afx_msg void OnMenuEncryptIp();
afx_msg void OnClientRunasAdmin();
CComboBox m_ComboPayload;
afx_msg void OnCbnSelchangeComboCompress();
CStatic m_StaticPayload;
CSliderCtrl m_SliderClientSize;
CEdit m_EditInstallDir;
CEdit m_EditInstallName;
CString m_sInstallDir;
CString m_sInstallName;
afx_msg void OnEnChangeEditInstallDir();
afx_msg void OnEnChangeEditInstallName();
afx_msg void OnEnKillfocusEditInstallDir();
afx_msg void OnEnKillfocusEditInstallName();
afx_msg void OnRandomName();
CButton m_BtnFileServer;
CStatic m_StaticDownload;
CEdit m_EditDownloadUrl;
CString m_sDownloadUrl;
afx_msg void OnBnClickedCheckFileserver();
afx_msg void OnCbnSelchangeComboPayload();
// 选 Linux / macOS 客户端时禁用 Windows-only 选项(架构 / 加壳 / 高级 group)
void EnableWindowsOnlyControls(BOOL enable);
CComboBox m_ComboLocation;
// 载荷/下载服务几行的可见性(由「目标是否 Windows」+「加壳方式」+「载荷类型」共同决定)
void UpdatePayloadControls();
// 菜单项联动:随机名称 / 以管理员权限运行只对 Windows 目标有意义
void UpdateTargetMenuState(BOOL windowsTarget);
// 非 Windows 目标期间暂存的加壳选择:控件置灰后仍显示旧值会让人误以为会按它生成,
// 所以切到 Linux/macOS/Android 时先切到「无」,切回 Windows 时恢复。
int m_nWindowsCompress;
// 内嵌服务端 TLS 信任锚(动态创建:不改 .rc,避免 GBK 资源文件的字节级编辑)。
// 可用性三条件见 UpdateTlsAnchorState;生成时由 OnBnClickedOk 调用 EmbedTlsAnchorInto。
CButton m_ChkTlsAnchor;
// 用户对复选框的表态:-1 = 没表过态(默认勾选),0/1 = 用户最后一次手动选择。
// 记下来是为了让「取消勾选」这件事在切目标/切协议来回之后依然算数。
int m_nAnchorUserCheck;
void UpdateTlsAnchorState();
afx_msg void OnBnClickedCheckTlsAnchor();
afx_msg void OnCbnSelchangeComboProto();
};