在高 DPI 显示器上使用远程桌面连接(mstsc)时,可能会遇到远程桌面内文字和图标过小的问题,且无法通过常规方式调整分辨率或缩放比例。本文提供一种通过修改注册表和添加应用程序清单(manifest)文件来禁用 mstsc DPI 感知(dpiAware)的方法,从而让系统自动缩放,改善显示效果。
步骤一:设置注册表
- 创建一个文本文件,粘贴以下内容:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SideBySide]
"PreferExternalManifest"=dword:00000001
2. 将文件保存为任意名称,但后缀必须为 `.reg`,例如:`123.reg`。
3. 双击运行该 `.reg` 文件,将条目写入注册表。
> **说明**:此注册表项的作用是允许程序优先使用外部的 manifest 文件(即我们后续要创建的 `mstsc.exe.manifest`),而不是内置的清单信息。
---
## 步骤二:为 mstsc 添加元数据(Manifest 文件)
1. 创建一个 XML 文件,内容如下:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.VC90.CRT"
version="9.0.21022.8"
processorArchitecture="amd64"
publicKeyToken="1fc8b3b9a1e18e3b">
</assemblyIdentity>
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="asInvoker"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
<asmv3:application>
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
<ms_windowsSettings:dpiAware xmlns:ms_windowsSettings="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</ms_windowsSettings:dpiAware>
</asmv3:windowsSettings>
</asmv3:application>
</assembly>
- 将文件命名为
mstsc.exe.manifest
。 - 将该文件复制到
C:\Windows\System32\
目录下。
⚠️ 注意:需要管理员权限才能将文件复制到
System32
目录。建议使用管理员身份运行文本编辑器或文件资源管理器进行操作。
元数据说明
-
依赖项(dependency):
Microsoft.Windows.Common-Controls
:Windows 通用控件库(版本 6.0),支持视觉样式(如现代按钮、进度条等),适用于所有语言和架构。Microsoft.VC90.CRT
:Visual C++ 2008 运行时库,适用于 64 位系统(amd64 架构)。
-
安全权限(trustInfo):
requestedExecutionLevel level="asInvoker"
:以调用者权限运行,不请求提权,安全性高。uiAccess="false"
:不访问高权限 UI 层,防止界面劫持或欺骗攻击。
-
DPI 设置(dpiAware):
<ms_windowsSettings:dpiAware>false</ms_windowsSettings:dpiAware>
:明确声明 mstsc 不感知 DPI,由系统进行缩放处理,解决高 DPI 下界面过小问题。
安全影响分析
组件 | 说明 |
---|---|
Common Controls & VC++ CRT | 微软官方组件,广泛使用,无已知安全风险。保持系统更新即可确保安全。 |
执行级别 (asInvoker ) |
不提升权限,运行安全,不会造成系统级危害。 |
uiAccess=false |
防止程序模拟用户操作其他应用,避免 UI 欺骗攻击。 |
✅ 总体安全风险极低,属于标准配置调整。
步骤三:重启 mstsc
完成上述操作后,请执行以下步骤使更改生效:
- 打开任务管理器。
- 找到正在运行的
mstsc.exe
进程(远程桌面连接)。 - 结束该进程。
- 重新启动“远程桌面连接”(可在开始菜单搜索
mstsc
并打开)。
✅ 此时远程桌面窗口应会受到系统 DPI 缩放影响,文字和图标大小恢复正常。
评论