[PATCH 1/7] wineandroid: Use ntdll for UTF8 conversion.

Jacek Caban wine at gitlab.winehq.org
Mon Jun 6 06:13:09 CDT 2022


From: Jacek Caban <jacek at codeweavers.com>

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
---
 dlls/wineandroid.drv/keyboard.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/wineandroid.drv/keyboard.c b/dlls/wineandroid.drv/keyboard.c
index 20c6879de87..00a55c697c6 100644
--- a/dlls/wineandroid.drv/keyboard.c
+++ b/dlls/wineandroid.drv/keyboard.c
@@ -755,9 +755,10 @@ jboolean keyboard_event( JNIEnv *env, jobject obj, jint win, jint action, jint k
  */
 INT ANDROID_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
 {
-    int scancode, vkey, len;
+    int scancode, vkey;
     const char *name;
     char key[2];
+    DWORD len;
 
     scancode = (lparam >> 16) & 0x1FF;
     vkey = scancode_to_vkey( scancode );
@@ -795,7 +796,8 @@ INT ANDROID_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
         name = vkey_to_name( vkey );
     }
 
-    len = MultiByteToWideChar( CP_UTF8, 0, name, -1, buffer, size );
+    RtlUTF8ToUnicodeN( buffer, size * sizeof(WCHAR), &len, name, strlen( name ) + 1 );
+    len /= sizeof(WCHAR);
     if (len) len--;
 
     if (!len)
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/191



More information about the wine-devel mailing list