Search code examples
windows-installerpatchtruetypemsp

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


We create a MSP patch that update a TrueType font (.TTF) file but it is causing 1603 (a reboot is required after installation.) Here is the MSI log:

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

I am sure the file is not in use. (rebooted the machine before applying this patch.)

Thanks!


Solution

  • The most likely cause is that the font is installed as a permanent font, i.e., it is listed in the registry. The relevant registry key is:

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

    As described in 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.

    You can resolve the problem by installing the font in the %windir%\fonts directory or by making it a temporary font.

    (Note that this behaviour is relatively recent, having been introduced in security update MS14-045.)