[resend PATCH] kernelbase: Get language sort only when required in LCMapStringEx().

Paul Gofman pgofman at codeweavers.com
Tue Dec 8 04:07:19 CST 2020


Fixes very slow loading (a few minutes) of Warhammer 40000: Inquisitor - Martyr
after b780e5f5b1bd018629bfa31431e216c7579fe9aa.

Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
    The 'todo_wine' test in kernel32/tests/locale.c shows that LCMapStringEx should fail for
    invalid locale but this should happen regardless of LCMAP_LINGUISTIC_CASING flag
    and should probably be checked separately.

 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 7218a159844..c60b796aa48 100644
--- a/dlls/kernelbase/locale.c
+++ b/dlls/kernelbase/locale.c
@@ -5205,7 +5205,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;
 
@@ -5236,7 +5236,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.28.0




More information about the wine-devel mailing list