Commit 65f3b653 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserGetKeyNameText implementation from user32.

parent 563a2332
...@@ -243,11 +243,6 @@ static void CDECL loaderdrv_Beep(void) ...@@ -243,11 +243,6 @@ static void CDECL loaderdrv_Beep(void)
load_driver()->pBeep(); load_driver()->pBeep();
} }
static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
{
return load_driver()->pGetKeyNameText( lparam, buffer, size );
}
static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts ) static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts )
{ {
return load_driver()->pGetKeyboardLayoutList( size, layouts ); return load_driver()->pGetKeyboardLayoutList( size, layouts );
...@@ -358,7 +353,7 @@ static struct user_driver_funcs lazy_load_driver = ...@@ -358,7 +353,7 @@ static struct user_driver_funcs lazy_load_driver =
/* keyboard functions */ /* keyboard functions */
loaderdrv_ActivateKeyboardLayout, loaderdrv_ActivateKeyboardLayout,
loaderdrv_Beep, loaderdrv_Beep,
loaderdrv_GetKeyNameText, NULL,
loaderdrv_GetKeyboardLayoutList, loaderdrv_GetKeyboardLayoutList,
NULL, NULL,
loaderdrv_RegisterHotKey, loaderdrv_RegisterHotKey,
......
...@@ -739,99 +739,6 @@ UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl) ...@@ -739,99 +739,6 @@ UINT WINAPI MapVirtualKeyExA(UINT code, UINT maptype, HKL hkl)
return ret; return ret;
} }
/* English keyboard layout (0x0409) */
static const UINT kbd_en_vsc2vk[] =
{
0x00, 0x1b, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0xbd, 0xbb, 0x08, 0x09,
0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, 0x4f, 0x50, 0xdb, 0xdd, 0x0d, 0xa2, 0x41, 0x53,
0x44, 0x46, 0x47, 0x48, 0x4a, 0x4b, 0x4c, 0xba, 0xde, 0xc0, 0xa0, 0xdc, 0x5a, 0x58, 0x43, 0x56,
0x42, 0x4e, 0x4d, 0xbc, 0xbe, 0xbf, 0xa1, 0x6a, 0xa4, 0x20, 0x14, 0x70, 0x71, 0x72, 0x73, 0x74,
0x75, 0x76, 0x77, 0x78, 0x79, 0x90, 0x91, 0x24, 0x26, 0x21, 0x6d, 0x25, 0x0c, 0x27, 0x6b, 0x23,
0x28, 0x22, 0x2d, 0x2e, 0x2c, 0x00, 0xe2, 0x7a, 0x7b, 0x0c, 0xee, 0xf1, 0xea, 0xf9, 0xf5, 0xf3,
0x00, 0x00, 0xfb, 0x2f, 0x7c, 0x7d, 0x7e, 0x7f, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xed,
0x00, 0xe9, 0x00, 0xc1, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, 0x00, 0xeb, 0x09, 0x00, 0xc2, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0xe000 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x00, 0x00, 0x0d, 0xa3, 0x00, 0x00,
0xad, 0xb7, 0xb3, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00,
0xaf, 0x00, 0xac, 0x00, 0x00, 0x6f, 0x00, 0x2c, 0xa5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x24, 0x26, 0x21, 0x00, 0x25, 0x00, 0x27, 0x00, 0x23,
0x28, 0x22, 0x2d, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5b, 0x5c, 0x5d, 0x00, 0x5f,
0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xab, 0xa8, 0xa9, 0xa7, 0xa6, 0xb6, 0xb4, 0xb5, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* 0xe100 */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const WCHAR *kbd_en_vscname[] =
{
0, L"Esc", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Backspace", L"Tab",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Enter", L"Ctrl", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Shift", 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, L"Right Shift", L"Num *", L"Alt", L"Space", L"Caps Lock", L"F1", L"F2", L"F3", L"F4", L"F5",
L"F6", L"F7", L"F8", L"F9", L"F10", L"Pause", L"Scroll Lock", L"Num 7", L"Num 8", L"Num 9", L"Num -", L"Num 4", L"Num 5", L"Num 6", L"Num +", L"Num 1",
L"Num 2", L"Num 3", L"Num 0", L"Num Del", L"Sys Req", 0, 0, L"F11", L"F12", 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"F13", L"F14", L"F15", L"F16",
L"F17", L"F18", L"F19", L"F20", L"F21", L"F22", L"F23", L"F24", 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* extended */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, L"Num Enter", L"Right Ctrl", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, L"Num /", 0, L"Prnt Scrn", L"Right Alt", 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, L"Num Lock", L"Break", L"Home", L"Up", L"Page Up", 0, L"Left", 0, L"Right", 0, L"End",
L"Down", L"Page Down", L"Insert", L"Delete", L"<00>", 0, L"Help", 0, 0, 0, 0, L"Left Windows", L"Right Windows", L"Application", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
/**************************************************************************** /****************************************************************************
* GetKBCodePage (USER32.@) * GetKBCodePage (USER32.@)
*/ */
...@@ -915,7 +822,7 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize) ...@@ -915,7 +822,7 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
WCHAR buf[256]; WCHAR buf[256];
INT ret; INT ret;
if (!nSize || !GetKeyNameTextW(lParam, buf, 256)) if (!nSize || !NtUserGetKeyNameText( lParam, buf, ARRAYSIZE(buf) ))
{ {
lpBuffer[0] = 0; lpBuffer[0] = 0;
return 0; return 0;
...@@ -932,57 +839,6 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize) ...@@ -932,57 +839,6 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
} }
/**************************************************************************** /****************************************************************************
* GetKeyNameTextW (USER32.@)
*/
INT WINAPI GetKeyNameTextW( LONG lparam, LPWSTR buffer, INT size )
{
INT code = ((lparam >> 16) & 0x1ff), vkey, len;
UINT vsc2vk_size, vscname_size;
const WCHAR *const *vscname;
const UINT *vsc2vk;
WCHAR tmp[2];
TRACE_(keyboard)( "lparam %d, buffer %p, size %d.\n", lparam, buffer, size );
if (!buffer || !size) return 0;
if ((len = USER_Driver->pGetKeyNameText( lparam, buffer, size )) >= 0) return len;
/* FIXME: English keyboard layout specific */
vsc2vk = kbd_en_vsc2vk;
vsc2vk_size = ARRAYSIZE(kbd_en_vsc2vk);
vscname = kbd_en_vscname;
vscname_size = ARRAYSIZE(kbd_en_vscname);
if (lparam & 0x2000000)
{
switch ((vkey = vsc2vk[code]))
{
case VK_RSHIFT:
case VK_RCONTROL:
case VK_RMENU:
for (code = 0; code < vsc2vk_size; ++code)
if (vsc2vk[code] == (vkey - 1)) break;
break;
}
}
if (code >= vscname_size) buffer[0] = 0;
else if (vscname[code]) lstrcpynW( buffer, vscname[code], size );
else
{
vkey = MapVirtualKeyW( code & 0xff, MAPVK_VSC_TO_VK );
tmp[0] = MapVirtualKeyW( vkey, MAPVK_VK_TO_CHAR );
tmp[1] = 0;
lstrcpynW( buffer, tmp, size );
}
len = wcslen( buffer );
TRACE_(keyboard)( "ret %d, str %s.\n", len, debugstr_w(buffer) );
return len;
}
/****************************************************************************
* ToUnicode (USER32.@) * ToUnicode (USER32.@)
*/ */
INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, const BYTE *lpKeyState, INT WINAPI ToUnicode(UINT virtKey, UINT scanCode, const BYTE *lpKeyState,
......
...@@ -315,7 +315,7 @@ ...@@ -315,7 +315,7 @@
@ stdcall GetInternalWindowPos(long ptr ptr) @ stdcall GetInternalWindowPos(long ptr ptr)
@ stdcall GetKBCodePage() @ stdcall GetKBCodePage()
@ stdcall GetKeyNameTextA(long ptr long) @ stdcall GetKeyNameTextA(long ptr long)
@ stdcall GetKeyNameTextW(long ptr long) @ stdcall GetKeyNameTextW(long ptr long) NtUserGetKeyNameText
@ stdcall -import GetKeyState(long) NtUserGetKeyState @ stdcall -import GetKeyState(long) NtUserGetKeyState
@ stdcall GetKeyboardLayout(long) NtUserGetKeyboardLayout @ stdcall GetKeyboardLayout(long) NtUserGetKeyboardLayout
@ stdcall GetKeyboardLayoutList(long ptr) @ stdcall GetKeyboardLayoutList(long ptr)
......
...@@ -1003,6 +1003,11 @@ static const struct user_driver_funcs *load_driver(void) ...@@ -1003,6 +1003,11 @@ static const struct user_driver_funcs *load_driver(void)
return user_driver; return user_driver;
} }
static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
{
return load_driver()->pGetKeyNameText( lparam, buffer, size );
}
static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout ) static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
{ {
return load_driver()->pMapVirtualKeyEx( code, type, layout ); return load_driver()->pMapVirtualKeyEx( code, type, layout );
...@@ -1020,6 +1025,7 @@ static void CDECL loaderdrv_UpdateClipboard(void) ...@@ -1020,6 +1025,7 @@ static void CDECL loaderdrv_UpdateClipboard(void)
static const struct user_driver_funcs lazy_load_driver = static const struct user_driver_funcs lazy_load_driver =
{ {
.pGetKeyNameText = loaderdrv_GetKeyNameText,
.pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx, .pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx,
.pVkKeyScanEx = loaderdrv_VkKeyScanEx, .pVkKeyScanEx = loaderdrv_VkKeyScanEx,
.pUpdateClipboard = loaderdrv_UpdateClipboard, .pUpdateClipboard = loaderdrv_UpdateClipboard,
......
...@@ -1168,6 +1168,7 @@ static struct unix_funcs unix_funcs = ...@@ -1168,6 +1168,7 @@ static struct unix_funcs unix_funcs =
NtGdiUpdateColors, NtGdiUpdateColors,
NtGdiWidenPath, NtGdiWidenPath,
NtUserCountClipboardFormats, NtUserCountClipboardFormats,
NtUserGetKeyNameText,
NtUserGetPriorityClipboardFormat, NtUserGetPriorityClipboardFormat,
NtUserGetUpdatedClipboardFormats, NtUserGetUpdatedClipboardFormats,
NtUserIsClipboardFormatAvailable, NtUserIsClipboardFormatAvailable,
......
...@@ -305,6 +305,43 @@ static const UINT kbd_en_vk2char[] = ...@@ -305,6 +305,43 @@ static const UINT kbd_en_vk2char[] =
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
}; };
static const char *kbd_en_vscname[] =
{
0, "Esc", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Backspace", "Tab",
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Enter", "Ctrl", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Shift", 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, "Right Shift", "Num *", "Alt", "Space", "Caps Lock", "F1", "F2", "F3", "F4", "F5",
"F6", "F7", "F8", "F9", "F10", "Pause", "Scroll Lock", "Num 7", "Num 8", "Num 9", "Num -", "Num 4", "Num 5", "Num 6", "Num +", "Num 1",
"Num 2", "Num 3", "Num 0", "Num Del", "Sys Req", 0, 0, "F11", "F12", 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "F13", "F14", "F15", "F16",
"F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* extended */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Num Enter", "Right Ctrl", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, "Num /", 0, "Prnt Scrn", "Right Alt", 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, "Num Lock", "Break", "Home", "Up", "Page Up", 0, "Left", 0, "Right", 0, "End",
"Down", "Page Down", "Insert", "Delete", "<00>", 0, "Help", 0, 0, 0, 0, "Left Windows", "Right Windows", "Application", 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
/****************************************************************************** /******************************************************************************
* NtUserMapVirtualKeyEx (win32u.@) * NtUserMapVirtualKeyEx (win32u.@)
*/ */
...@@ -385,3 +422,59 @@ UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout ) ...@@ -385,3 +422,59 @@ UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout )
TRACE_(keyboard)( "returning 0x%04x\n", ret ); TRACE_(keyboard)( "returning 0x%04x\n", ret );
return ret; return ret;
} }
/****************************************************************************
* NtUserGetKeyNameText (win32u.@)
*/
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size )
{
INT code = ((lparam >> 16) & 0x1ff), vkey, len;
UINT vsc2vk_size, vscname_size;
const char *const *vscname;
const UINT *vsc2vk;
TRACE_(keyboard)( "lparam %d, buffer %p, size %d.\n", lparam, buffer, size );
if (!buffer || !size) return 0;
if ((len = user_driver->pGetKeyNameText( lparam, buffer, size )) >= 0) return len;
/* FIXME: English keyboard layout specific */
vsc2vk = kbd_en_vsc2vk;
vsc2vk_size = ARRAYSIZE(kbd_en_vsc2vk);
vscname = kbd_en_vscname;
vscname_size = ARRAYSIZE(kbd_en_vscname);
if (lparam & 0x2000000)
{
switch ((vkey = vsc2vk[code]))
{
case VK_RSHIFT:
case VK_RCONTROL:
case VK_RMENU:
for (code = 0; code < vsc2vk_size; ++code)
if (vsc2vk[code] == (vkey - 1)) break;
break;
}
}
if (code < vscname_size)
{
if (vscname[code])
{
len = min( size - 1, strlen(vscname[code]) );
ascii_to_unicode( buffer, vscname[code], len );
}
else if (size > 1)
{
HKL hkl = NtUserGetKeyboardLayout( 0 );
vkey = NtUserMapVirtualKeyEx( code & 0xff, MAPVK_VSC_TO_VK, hkl );
buffer[0] = NtUserMapVirtualKeyEx( vkey, MAPVK_VK_TO_CHAR, hkl );
len = 1;
}
}
buffer[len] = 0;
TRACE_(keyboard)( "ret %d, str %s.\n", len, debugstr_w(buffer) );
return len;
}
...@@ -944,7 +944,7 @@ ...@@ -944,7 +944,7 @@
@ stub NtUserGetInteractiveControlInfo @ stub NtUserGetInteractiveControlInfo
@ stub NtUserGetInteractiveCtrlSupportedWaveforms @ stub NtUserGetInteractiveCtrlSupportedWaveforms
@ stub NtUserGetInternalWindowPos @ stub NtUserGetInternalWindowPos
@ stub NtUserGetKeyNameText @ stdcall NtUserGetKeyNameText(long ptr long)
@ stdcall -syscall NtUserGetKeyState(long) @ stdcall -syscall NtUserGetKeyState(long)
@ stdcall -syscall NtUserGetKeyboardLayout(long) @ stdcall -syscall NtUserGetKeyboardLayout(long)
@ stub NtUserGetKeyboardLayoutList @ stub NtUserGetKeyboardLayoutList
......
...@@ -195,6 +195,7 @@ struct unix_funcs ...@@ -195,6 +195,7 @@ struct unix_funcs
BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc ); BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc ); BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
INT (WINAPI *pNtUserCountClipboardFormats)(void); INT (WINAPI *pNtUserCountClipboardFormats)(void);
INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size );
INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count ); INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count );
BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size ); BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size );
BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format ); BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format );
......
...@@ -601,6 +601,11 @@ INT WINAPI NtUserCountClipboardFormats(void) ...@@ -601,6 +601,11 @@ INT WINAPI NtUserCountClipboardFormats(void)
return unix_funcs->pNtUserCountClipboardFormats(); return unix_funcs->pNtUserCountClipboardFormats();
} }
INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size )
{
return unix_funcs->pNtUserGetKeyNameText( lparam, buffer, size );
}
INT WINAPI NtUserGetPriorityClipboardFormat( UINT *list, INT count ) INT WINAPI NtUserGetPriorityClipboardFormat( UINT *list, INT count )
{ {
return unix_funcs->pNtUserGetPriorityClipboardFormat( list, count ); return unix_funcs->pNtUserGetPriorityClipboardFormat( list, count );
......
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