From 9b53ba68724bbd6fe932eb8b158e4f5e234166cc Mon Sep 17 00:00:00 2001 From: hmo Date: Wed, 26 Aug 2026 02:58:22 +0800 Subject: [PATCH] =?UTF-8?q?fix(rdp):=20disable=20HW=20graphics=20adapter?= =?UTF-8?q?=20(software=20rendering)=20in=20enable=20step=20=E2=80=94=20Di?= =?UTF-8?q?splayLink/multi-GPU=20WDDM=20init=20conflict=20is=20a=20top=20c?= =?UTF-8?q?ause=20of=20'stuck=20at=20configuring'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xmpp_agent_core.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xmpp_agent_core.py b/xmpp_agent_core.py index 53a2f8d..615080b 100644 --- a/xmpp_agent_core.py +++ b/xmpp_agent_core.py @@ -350,6 +350,17 @@ def _rdp_enable_run(): mark('registry', 'ok', 'NLA已关闭(UserAuthentication=0,隧道场景)') except Exception as e: mark('registry', 'warn', '关NLA失败: ' + str(e)) + # 隧道/多GPU/DisplayLink 环境统一禁用硬件图形适配器(软件渲染): + # DisplayLink USB 显示扩展坞/NVIDIA 多GPU 与 RDP WDDM 图形初始化冲突, + # 是"卡正在配置远程电脑"(WDDM启用后挂起)的高频根因。软件渲染绕开它。 + try: + import subprocess as _sp2 + _sp2.run(['powershell', '-NoProfile', '-Command', + "New-Item -Path 'HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services' -Force | Out-Null; Set-ItemProperty -Path 'HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows NT\\Terminal Services' -Name 'bEnumerateHWBeforeSW' -Value 0 -Type DWord"], + capture_output=True, timeout=10) + mark('registry', 'ok', '已禁用硬件图形适配器(软件渲染,绕开DisplayLink/多GPU冲突)') + except Exception as e: + mark('registry', 'warn', '禁用硬件图形失败: ' + str(e)) # Step 2: 加入 RDP 用户组 try: