From: Paul Gofman Subject: [PATCH] kernelbase: Get language sort only when required in LCMapStringEx(). Message-Id: <20201019180605.1225175-1-pgofman@codeweavers.com> Date: Mon, 19 Oct 2020 21:06:05 +0300 Fixes very slow loading (a few minutes) of Warhammer 40000: Inquisitor - Martyr. Signed-off-by: Paul Gofman --- dlls/kernelbase/locale.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/kernelbase/locale.c b/dlls/kernelbase/locale.c index 9cfb9f129ee..7e6ac2829d2 100644 --- a/dlls/kernelbase/locale.c +++ b/dlls/kernelbase/locale.c @@ -5204,7 +5204,7 @@ INT WINAPI DECLSPEC_HOTPATCH LCMapStringEx( const WCHAR *locale, DWORD flags, co WCHAR *dst, int dstlen, NLSVERSIONINFO *version, void *reserved, LPARAM handle ) { - const struct sortguid *sortid; + const struct sortguid *sortid = NULL; LPWSTR dst_ptr; INT len; @@ -5235,7 +5235,7 @@ INT WINAPI DECLSPEC_HOTPATCH LCMapStringEx( const WCHAR *locale, DWORD flags, co if (!dstlen) dst = NULL; - if (!(sortid = get_language_sort( locale ))) + if (flags & LCMAP_LINGUISTIC_CASING && !(sortid = get_language_sort( locale ))) { FIXME( "unknown locale %s\n", debugstr_w(locale) ); SetLastError( ERROR_INVALID_PARAMETER ); -- 2.26.2