Commit c91d9f0c authored by Yoshiro Takeno's avatar Yoshiro Takeno Committed by Alexandre Julliard

In Windows, the leading byte for multibyte characters are set to upper

byte. If single byte character is used, the upper byte is set to 0.
parent b9e56b9b
......@@ -772,7 +772,8 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
strng[0] = wParam >> 8;
strng[1] = wParam & 0xff;
MultiByteToWideChar(CP_ACP, 0, strng, 2, &charW, 1);
if (strng[0]) MultiByteToWideChar(CP_ACP, 0, strng, 2, &charW, 1);
else MultiByteToWideChar(CP_ACP, 0, &strng[1], 1, &charW, 1);
EDIT_WM_Char(es, charW);
break;
}
......
......@@ -347,7 +347,8 @@ static WPARAM map_wparam_AtoW( UINT message, WPARAM wparam )
WCHAR wch;
ch[0] = (wparam >> 8);
ch[1] = (wparam & 0xff);
MultiByteToWideChar(CP_ACP, 0, ch, 2, &wch, 1);
if (ch[0]) MultiByteToWideChar(CP_ACP, 0, ch, 2, &wch, 1);
else MultiByteToWideChar(CP_ACP, 0, &ch[1], 1, &wch, 1);
wparam = MAKEWPARAM( wch, HIWORD(wparam) );
}
break;
......@@ -384,9 +385,10 @@ static WPARAM map_wparam_WtoA( UINT message, WPARAM wparam )
WCHAR wch = LOWORD(wparam);
BYTE ch[2];
ch[1] = 0;
WideCharToMultiByte( CP_ACP, 0, &wch, 1, ch, 2, NULL, NULL );
wparam = MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(wparam) );
if (WideCharToMultiByte( CP_ACP, 0, &wch, 1, ch, 2, NULL, NULL ) == 2)
wparam = MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(wparam) );
else
wparam = MAKEWPARAM( ch[0], HIWORD(wparam) );
}
break;
}
......
......@@ -871,9 +871,9 @@ LRESULT WINAPI DefWindowProcA( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
CHAR chChar1 = (CHAR)( (wParam>>8) & 0xff );
CHAR chChar2 = (CHAR)( wParam & 0xff );
SendMessageA( hwnd, WM_CHAR, (WPARAM)chChar1, lParam );
if ( IsDBCSLeadByte( chChar1 ) )
SendMessageA( hwnd, WM_CHAR, (WPARAM)chChar2, lParam );
if (chChar1)
SendMessageA( hwnd, WM_CHAR, (WPARAM)chChar1, lParam );
SendMessageA( hwnd, WM_CHAR, (WPARAM)chChar2, lParam );
}
break;
case WM_IME_KEYDOWN:
......
......@@ -797,7 +797,10 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
WCHAR wch;
ch[0] = (*pwparam >> 8);
ch[1] = *pwparam & 0xff;
MultiByteToWideChar(CP_ACP, 0, ch, 2, &wch, 1);
if (ch[0])
MultiByteToWideChar(CP_ACP, 0, ch, 2, &wch, 1);
else
MultiByteToWideChar(CP_ACP, 0, &ch[1], 1, &wch, 1);
*pwparam = MAKEWPARAM( wch, HIWORD(*pwparam) );
}
return 0;
......@@ -1092,9 +1095,10 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM *pwparam, LPARAM *plpara
WCHAR wch = LOWORD(*pwparam);
BYTE ch[2];
ch[1] = 0;
WideCharToMultiByte( CP_ACP, 0, &wch, 1, ch, 2, NULL, NULL );
*pwparam = MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(*pwparam) );
if (WideCharToMultiByte( CP_ACP, 0, &wch, 1, ch, 2, NULL, NULL ) == 2)
*pwparam = MAKEWPARAM( (ch[0] << 8) | ch[1], HIWORD(*pwparam) );
else
*pwparam = MAKEWPARAM( ch[0], HIWORD(*pwparam) );
}
return 0;
......
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