Piotr Caban : msvcrt: Reject UTF-8 locales in setlocale function.

Alexandre Julliard julliard at winehq.org
Thu May 12 15:55:51 CDT 2022


Module: wine
Branch: master
Commit: b35faeb5035a8ed1480577a34603170fc0e2f901
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=b35faeb5035a8ed1480577a34603170fc0e2f901

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu May 12 16:54:03 2022 +0200

msvcrt: Reject UTF-8 locales in setlocale function.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcr110/tests/msvcr110.c | 2 +-
 dlls/msvcrt/locale.c           | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/dlls/msvcr110/tests/msvcr110.c b/dlls/msvcr110/tests/msvcr110.c
index 55d077c6de9..d6502b0f0fa 100644
--- a/dlls/msvcr110/tests/msvcr110.c
+++ b/dlls/msvcr110/tests/msvcr110.c
@@ -134,7 +134,7 @@ static void test_setlocale(void)
         ok(ret != NULL, "expected success, but got NULL\n");
         if(!strcmp(names[i], "syr-SY") && GetACP() == CP_UTF8)
         {
-            todo_wine ok(!strcmp(ret, "LC_COLLATE=syr-SY;LC_CTYPE=EN-US;LC_MONETARY=syr-SY;"
+            ok(!strcmp(ret, "LC_COLLATE=syr-SY;LC_CTYPE=EN-US;LC_MONETARY=syr-SY;"
                         "LC_NUMERIC=syr-SY;LC_TIME=syr-SY"), "got %s\n", ret);
         }
         else
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 0fd99a40c86..16ed68cdebd 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -1334,6 +1334,14 @@ static pthreadlocinfo create_locinfo(int category,
     }
 
     for(i=1; i<6; i++) {
+#if _MSVCR_VER < 140
+        if(i==LC_CTYPE && cp[i]==CP_UTF8) {
+            locale_name[i] = NULL;
+            locale_len[i] = 0;
+            lcid[i] = old_locinfo ? old_locinfo->lc_handle[i] : 0;
+            cp[i] = old_locinfo ? old_locinfo->lc_id[i].wCodePage : 0;
+        }
+#endif
         if(category!=LC_ALL && category!=i) {
             if(old_locinfo) {
                 lcid[i] = old_locinfo->lc_handle[i];




More information about the wine-cvs mailing list