Add a "高级 → DLL内嵌TLS证书" toggle (off by default, persisted as
[settings] EmbedTlsInDll). When it is on, ReadKernelDll patches the server's
current TLS anchor into the ServerDll and ShellCode payloads, so clients that
come online through the loaders start their own session over TLS without
waiting for an online push. The plaintext DLL loader in client/main.c is
untouched; only the DLL's fresh connection is protected. The write happens
after SetServer and before CalcMD5FromBytes, and the anchor records the host
part of the master address rather than "ip:port" because the client matches
the anchor against its configured address set. TinyRun has no anchor block and
keeps working as before.
Toggling the switch, and confirming the certificate dialog, rebuild the six
payloads in place, so no server restart is needed after a certificate change.
The payload pointers are replaced as a whole, and the network threads that read
them (SendServerDll and TOKEN_GETVERSION) now take a dedicated critical section
for the full duration of use.
COMMAND_UPDATE no longer clears the tls_disabled marker on the client. Now that
any delivered DLL may carry the anchor, "the payload has an anchor" no longer
means the operator opted this host into TLS, and clearing the marker would
silently flip a host that was explicitly set to plaintext onto TLS against a
plaintext path. Re-enabling TLS stays an explicit action through
COMMAND_TLS_ENABLE and COMMAND_SET_PROTO, which still clear the marker.
Menu and notice strings were added to en_US, zh_TW and de_DE, and the embedded
TLS design document records the new switch and the revised update semantics.
The new menu entry also takes a feature-limits slot so a subordinate master
can hide it like every other 高级 item (see 8807321):
HIDE_MENU_EMBED_TLS_ANCHOR in UIBranding.h, MF_EMBED_TLS_ANCHOR at bit 57
in FeatureFlags.h (the first free one after MF_FILE_SPEED), a row in the
主菜单 tab of CFeatureLimitsDlg, and the matching DeleteMenu on the 高级
menu. The entry still has no bitmap of its own, so it renders without an
icon next to its three siblings.
Co-Authored-By: deepseek-flash
The "feature limits" dialog offered by 主控生成 had drifted well behind the
UI: a whole 高级 menu, five toolbar buttons and a couple of dozen context
menu entries could not be restricted at all, and several items were listed
under names that no longer appear anywhere.
The three tabs now follow the real resources. Menu items are listed in the
order of IDR_MENU_MAIN and carry the same text minus accelerators; the
toolbar covers all 19 IDR_TOOLBAR_MAIN buttons; the context menu lists the
nested 实验功能 / 客户管理 / 远程控制 / 机器管理 / 客户代理 / 执行程序 entries
individually and the two runtime-built ones (协议切换, 执行代码) as groups.
That makes 57 / 19 / 46 items, each with its own bit; new bits were added
at the end of each field so the existing positions stay put.
Enforcement was extended to match, and while wiring it up one long-standing
bug surfaced: DeleteMenu(MF_BYCOMMAND) only reaches items of the menu it is
called on, so hiding an entry of a nested popup had always been a no-op.
Nested items are now deleted through their own submenu handle, and a popup
whose items are all hidden is removed together with its parent entry, so
no empty popup is left behind. 协议切换 is inserted relative to where
实验功能 ended up, which keeps it next to it either way; 执行代码 is simply
skipped when restricted.
The missing labels were added to en_US, zh_TW and de_DE.
Co-Authored-By: deepseek-flash