From: Elizabeth Figura <zfigura@codeweavers.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58963 --- dlls/gdi32/text.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c index 000878ccf6a..3a9a7c7a627 100644 --- a/dlls/gdi32/text.c +++ b/dlls/gdi32/text.c @@ -2512,6 +2512,24 @@ fail: return name; } +static void redirect_path( UNICODE_STRING *path ) +{ +#ifndef _WIN64 + static const WCHAR nt_sysdir[] = L"\\??\\C:\\windows\\system32\\"; +#ifdef __arm__ + const WCHAR *dir = L"C:\\windows\\sysarm32"; +#else + const WCHAR *dir = L"C:\\windows\\syswow64"; +#endif + + if (!NtCurrentTeb()->GdiBatchCount) return; /* not wow64 */ + if (((TEB64 *)NtCurrentTeb()->GdiBatchCount)->TlsSlots[WOW64_TLS_FILESYSREDIR]) return; /* disabled */ + if (path->Length <= sizeof(nt_sysdir)) return; + if (wcsnicmp( path->Buffer, nt_sysdir, wcslen(nt_sysdir))) return; + memcpy( path->Buffer + 4, dir, wcslen(dir) * sizeof(WCHAR) ); +#endif +} + static int add_font_resource( const WCHAR *str, DWORD flags, void *dv ) { UNICODE_STRING nt_name; @@ -2808,6 +2826,11 @@ BOOL WINAPI CreateScalableFontResourceW( DWORD hidden, const WCHAR *resource_fil } else if (!RtlDosPathNameToNtPathName_U( font_file, &nt_name, NULL, NULL )) goto done; + /* Windows does not redirect the path here, which is presumably a bug. + * Stratego (1997) tries to create a font resource in system32 + * and fails on 64-bit Windows. */ + redirect_path( &nt_name ); + ret = NtGdiMakeFontDir( hidden, (BYTE *)&fontdir, sizeof(fontdir), nt_name.Buffer, nt_name.Length + sizeof(WCHAR) ); RtlFreeUnicodeString( &nt_name ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10075