gdi: AddFontResource needs to support a second default directory

Dan Kegel dank06 at kegel.com
Tue Aug 21 08:40:05 CDT 2007


On 8/21/07, Alexandre Julliard <julliard at winehq.org> wrote:
> "Dan Kegel" <dank at kegel.com> writes:
>
> > @@ -1727,6 +1736,22 @@ INT WineEngAddFontResourceEx(LPCWSTR file, DWORD flags, PVOID pdv)
> >          {
> >              INT ret = AddFontFileToList(unixname, NULL, NULL, ADDFONT_FORCE_BITMAP);
> >              HeapFree(GetProcessHeap(), 0, unixname);
> > +            if (!ret && !strchrW(file, '\\')) {
> > +                /* http://support.installshield.com/kb/view.asp?pcode=ALL&articleid=Q100057
> > +                 * suggests that in older versions of Windows, AddFontResource
> > +                 * paths were relative to %WINDIR%/Fonts instead of %WINDIR%/System
> > +                 * Retry assuming that's what went wrong.
> > +                 */
>
> This comment is misleading, fonts are in WINDIR/fonts in all Windows
> versions, and we never look in WINDIR/system anyway.

It sure looks like we're looking in WINDIR/system32 in this case.  Without
my patch, the installer in bug 9382 fails with:

000e:Call KERNEL32.MoveFileA(0063459c
"C:\\windows\\Fonts\\is-S53BH.tmp",00609cd8
"C:\\windows\\Fonts\\4mylover.TTF") ret=00450c93
000e:Ret  KERNEL32.MoveFileA() retval=00000001 ret=00450c93
000e:Call gdi32.AddFontResourceA(00616934 "4mylover.TTF") ret=00468788
trace:file:RtlDosPathNameToNtPathName_U (L"4mylover.TTF",0x34ed74,(nil),(nil))
trace:file:RtlGetFullPathName_U (L"4mylover.TTF" 520 0x34eb34 (nil))
warn:file:wine_nt_to_unix_file_name
L"\\??\\C:\\windows\\system32\\4mylover.TTF" ->
"/home/dank/.wine/dosdevices/c:/windows/system32/4mylover.TTF"
required a case-insensitive search
trace:file:wine_nt_to_unix_file_name
L"\\??\\C:\\windows\\system32\\4mylover.TTF" ->
"/home/dank/.wine/dosdevices/c:/windows/system32/4mylover.TTF"
trace:font:AddFontFileToList Loading font file
"/home/dank/.wine/dosdevices/c:/windows/system32/4mylover.TTF" index 0
warn:font:AddFontFileToList Unable to load font file
"/home/dank/.wine/dosdevices/c:/windows/system32/4mylover.TTF" err = 1

My patch and its comment may be confused, but it does let the installer
find the fonts and complete successfully.
I guess I should write a test to see what the proper behavior is for
AddFontResource
for files without absolute names.
- Dan



More information about the wine-devel mailing list