Commit 4a929eaf authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Support utf-8 in WM_CHAR W->A conversion.

parent bd693d67
......@@ -183,9 +183,9 @@ BOOL map_wparam_AtoW( UINT message, WPARAM *wparam, enum wm_char_mapping mapping
*/
static void map_wparam_WtoA( MSG *msg, BOOL remove )
{
BYTE ch[4];
BYTE ch[4] = { 0 };
WCHAR wch[2];
DWORD len;
DWORD i, len;
DWORD cp;
switch(msg->message)
......@@ -195,7 +195,6 @@ static void map_wparam_WtoA( MSG *msg, BOOL remove )
{
cp = get_input_codepage();
wch[0] = LOWORD(msg->wParam);
ch[0] = ch[1] = 0;
len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL );
if (len == 2) /* DBCS char */
{
......@@ -224,14 +223,12 @@ static void map_wparam_WtoA( MSG *msg, BOOL remove )
cp = get_input_codepage();
wch[0] = LOWORD(msg->wParam);
wch[1] = HIWORD(msg->wParam);
ch[0] = ch[1] = 0;
WideCharToMultiByte( cp, 0, wch, 2, (LPSTR)ch, 4, NULL, NULL );
msg->wParam = MAKEWPARAM( ch[0] | (ch[1] << 8), 0 );
len = WideCharToMultiByte( cp, 0, wch, 2, (LPSTR)ch, 4, NULL, NULL );
for (msg->wParam = i = 0; i < len; i++) msg->wParam |= ch[i] << (8 * i);
break;
case WM_IME_CHAR:
cp = get_input_codepage();
wch[0] = LOWORD(msg->wParam);
ch[0] = ch[1] = 0;
len = WideCharToMultiByte( cp, 0, wch, 1, (LPSTR)ch, 2, NULL, NULL );
if (len == 2)
msg->wParam = MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(msg->wParam) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment