From: Jacek Caban jacek@codeweavers.com
Also fixes null termination tests in test_key_names.
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/winemac.drv/keyboard.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/winemac.drv/keyboard.c b/dlls/winemac.drv/keyboard.c index d3e9dca9055..08c76eb1389 100644 --- a/dlls/winemac.drv/keyboard.c +++ b/dlls/winemac.drv/keyboard.c @@ -1257,8 +1257,9 @@ INT macdrv_GetKeyNameText(LONG lparam, LPWSTR buffer, INT size) { if (vkey_names[i].vkey == vkey) { - len = MultiByteToWideChar(CP_UTF8, 0, vkey_names[i].name, -1, buffer, size); - if (len) len--; + len = min(strlen(vkey_names[i].name) + 1, size); + ascii_to_unicode(buffer, vkey_names[i].name, len); + if (len) buffer[--len] = 0; break; } }