Add P7 management-control tools behind a single McpManage flag (plus
McpReadonly=0): kill_process, operate_window, control_service and
power_action. The write tools run a ready->confirm lifecycle on their
sub-connection, using a new followUp/followUpSent field to tell the two
arrivals of the same TOKEN_*LIST apart; the write command and the follow-up
refresh command go out as two separate Send2Client calls, with a new
WaitSendIdle() (context.h / Server.h) draining the outbound buffer in between
so the same buffer is never WSASend'd concurrently.
McpSettingsDlg gains a "management operations" checkbox (IDC_MCP_MANAGE), the
main toolbar gains an MCP entry button, and en/de/zh-TW strings are synced.
power_action is fire-and-forget over the main connection (no confirmation).
Verified end-to-end against a real Windows 10/VMware client: kill_process
returns remaining:[] and operate_window/control_service return ok:true with
their confirm packet arriving after an HTTP split. Verification surfaced a
prerequisite parser bug, fixed separately in a72e6eb, where HeaderParser
latched m_bShouldUnmask FALSE on HTTP continuation chunks and dropped the
confirm packet.
Co-Authored-By: deepseek-v4-pro
53 lines
1.9 KiB
C++
53 lines
1.9 KiB
C++
#pragma once
|
||
|
||
#include <afxwin.h>
|
||
#include <afxcmn.h>
|
||
#include <vector>
|
||
|
||
// 「MCP设置」配置对话框:启用 MCP / 端口 / 绑定地址 / Token。
|
||
// 因 2015Remote.rc 为 UTF-16 编码、不宜手工编辑,参照 ZstaPickerDlg 用
|
||
// InitModalIndirect + 内存 DLGTEMPLATE 程序化创建(见 docs/Mcp_Design.md §3.8)。
|
||
class CMcpSettingsDlg : public CDialog
|
||
{
|
||
public:
|
||
explicit CMcpSettingsDlg(CWnd* parent = nullptr);
|
||
|
||
virtual INT_PTR DoModal();
|
||
|
||
protected:
|
||
virtual BOOL OnInitDialog();
|
||
virtual void OnOK();
|
||
|
||
DECLARE_MESSAGE_MAP()
|
||
|
||
private:
|
||
enum CtrlId {
|
||
IDC_MCP_ENABLE = 1001, // 「启用 MCP」复选框
|
||
IDC_MCP_PORT = 1002, // 端口编辑框
|
||
IDC_MCP_BIND = 1003, // 绑定地址编辑框
|
||
IDC_MCP_TOKEN = 1004, // Token 编辑框
|
||
IDC_MCP_READONLY = 1005, // 「只读模式」复选框(默认勾选,禁 exec_command)
|
||
IDC_MCP_WHITELIST = 1006, // 命令白名单编辑框(多行,逗号/换行分隔,空 = 内置只读前缀)
|
||
IDC_MCP_TERMINAL = 1007, // 「启用持久终端」复选框(全命令,无白名单,要求只读关)
|
||
IDC_MCP_REMOTECONTROL = 1008, // 「启用远程控制」复选框(AI 操控桌面,要求只读关)
|
||
IDC_MCP_FILETRANSFER = 1009, // 「启用文件传输」复选框(download_file,不要求只读关)
|
||
IDC_MCP_MANAGE = 1010, // 「启用管理操作」复选框(kill/窗口/服务/电源,要求只读关)
|
||
};
|
||
|
||
CButton m_btnEnable;
|
||
CStatic m_lblPort, m_lblBind, m_lblToken;
|
||
CEdit m_editPort, m_editBind, m_editToken;
|
||
CButton m_btnReadonly;
|
||
CButton m_btnTerminal;
|
||
CButton m_btnRemoteControl;
|
||
CButton m_btnFileTransfer;
|
||
CButton m_btnManage;
|
||
CStatic m_lblWhitelist;
|
||
CEdit m_editWhitelist;
|
||
CButton m_btnOK, m_btnCancel;
|
||
|
||
std::vector<BYTE> m_Template; // 内存 DLGTEMPLATE 字节
|
||
|
||
void LayoutControls(int cx, int cy);
|
||
};
|