为什么 MSI 修补 TTF 字体文件总是导致重新启动?

Why MSI Patching a TTF font file always cause a reboot?

我们创建了一个更新 TrueType 字体 (.TTF) 文件的 MSP 补丁,但它导致了 1603(安装后需要重新启动。) 这是 MSI 日志:

MSI (s) (5C:48) [23:33:56:432]: Executing op: FileCopy(SourceName=TestFont.ttf,SourceCabKey=testfont.ttf,DestName=TestFont.ttf,Attributes=20480,FileSize=34880,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,Version=1.3.0.0,,InstallMode=58982400,HashOptions=0,HashPart1=1022639218,HashPart2=1170530421,HashPart3=1359995143,HashPart4=-948212544,,)
MSI (s) (5C:48) [23:33:56:432]: File: C:\Program Files (x86)\TESTDIR\TestFont.ttf;  Overwrite;  Won't patch;    Existing file is a lower version
MSI (s) (5C:48) [23:33:56:433]: Source for file 'passtrue.ttf' is compressed
InstallFiles: File: TestFont.ttf,  Directory: C:\Program Files (x86)\TESTDIR\,  Size: 34880
MSI (s) (5C:48) [23:33:56:434]: Re-applying security from existing file.
Info 1603. The file C:\Program Files (x86)\TESTDIR\TestFont.ttf is being held in use.  Close that application and retry.
MSI (s) (5C:48) [23:33:57:765]: Verifying accessibility of file: TestFont.ttf

我确定该文件未在使用中。 (在应用此补丁之前重新启动机器。)

谢谢!

最可能的原因是该字体是作为永久字体安装的,即它列在注册表中。相关的注册表项是:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts

Font Installation and Deletion所述:

A font installed from a location other than the %windir%\fonts folder cannot be modified when loaded in any active session, including session 0. Any attempt to change, replace, or delete will, therefore, be blocked. [...] Permanent fonts remain installed after reboot and are loaded by all created sessions.

您可以通过在 %windir%\fonts 目录中安装该字体或将其设为临时字体来解决该问题。

(请注意,此行为相对较新,已在 security update MS14-045 中引入。)