Akihiro Sagawa : user32: Fix wsprintfW %C conversion.

Alexandre Julliard julliard at winehq.org
Wed Feb 19 15:35:48 CST 2020


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Wed Feb 19 23:21:41 2020 +0900

user32: Fix wsprintfW %C conversion.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/wsprintf.c |  6 +++---
 dlls/user32/wsprintf.c       | 11 +++++++++--
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/wsprintf.c b/dlls/user32/tests/wsprintf.c
index c1a8b0ad98..567ed2ff10 100644
--- a/dlls/user32/tests/wsprintf.c
+++ b/dlls/user32/tests/wsprintf.c
@@ -187,17 +187,17 @@ static void wsprintfWTest(void)
     wcA1 = my_btowc(0xA1);
     rc = wsprintfW(buf, L"%C", 0xA1);
     ok(rc == 1, "expected 1, got %d\n", rc);
-    todo_wine ok(buf[0] == wcA1, "expected \\x%04x, got \\x%04x\n", wcA1, buf[0]);
+    ok(buf[0] == wcA1, "expected \\x%04x, got \\x%04x\n", wcA1, buf[0]);
 
     rc = wsprintfW(buf, L"%C", 0x81A1);
     ok(rc == 1, "expected 1, got %d\n", rc);
-    todo_wine ok(buf[0] == wcA1, "expected \\x%04x, got \\x%04x\n", wcA1, buf[0]);
+    ok(buf[0] == wcA1, "expected \\x%04x, got \\x%04x\n", wcA1, buf[0]);
 
     wc99 = my_btowc(0x99);
     rc = wsprintfW(buf, L"%2C", 0xe199);
     ok(rc == 2, "expected 1, got %d\n", rc);
     ok(buf[0] == L' ', "expected \\x0020, got \\x%04x\n", buf[0]);
-    todo_wine ok(buf[1] == wc99, "expected \\x%04x, got \\x%04x\n", wc99, buf[1]);
+    ok(buf[1] == wc99, "expected \\x%04x, got \\x%04x\n", wc99, buf[1]);
 
     if (!GetCPInfoExW(CP_ACP, 0, &cpinfoex) || cpinfoex.MaxCharSize <= 1)
     {
diff --git a/dlls/user32/wsprintf.c b/dlls/user32/wsprintf.c
index b197b714f6..db02f06634 100644
--- a/dlls/user32/wsprintf.c
+++ b/dlls/user32/wsprintf.c
@@ -513,8 +513,15 @@ static INT wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, __ms_va_list a
             *p++ = argData.wchar_view;
             break;
         case WPR_CHAR:
-            *p++ = argData.char_view;
-            break;
+            {
+                WCHAR wc;
+                if (!IsDBCSLeadByte( (BYTE)argData.char_view )
+                    && MultiByteToWideChar( CP_ACP, 0, &argData.char_view, 1, &wc, 1 ) > 0)
+                    *p++ = wc;
+                else
+                    *p++ = 0;
+                break;
+            }
         case WPR_STRING:
             {
                 LPCSTR ptr = argData.lpcstr_view;




More information about the wine-cvs mailing list