user32: Fix wsprintfW %C conversion.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2020-02-19 23:21:41 +09:00 committed by Alexandre Julliard
parent 20ff7ad9ee
commit e98dbf2e94
2 changed files with 12 additions and 5 deletions

View File

@ -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)
{

View File

@ -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;
{
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;