fix(rdp): disable HW graphics adapter (software rendering) in enable step — DisplayLink/multi-GPU WDDM init conflict is a top cause of 'stuck at configuring'

This commit is contained in:
hmo
2026-08-26 02:58:22 +08:00
parent 345abd782e
commit 9b53ba6872
+11
View File
@@ -350,6 +350,17 @@ def _rdp_enable_run():
mark('registry', 'ok', 'NLA已关闭(UserAuthentication=0,隧道场景)') mark('registry', 'ok', 'NLA已关闭(UserAuthentication=0,隧道场景)')
except Exception as e: except Exception as e:
mark('registry', 'warn', '关NLA失败: ' + str(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 用户组 # Step 2: 加入 RDP 用户组
try: try: