user32: Handle NULL argument in GetKeyboardLayoutNameW().

oldstable
Nikolay Sivov 2015-01-12 01:24:20 +03:00 committed by Alexandre Julliard
parent ab1eee505b
commit 151694a0bc
2 changed files with 13 additions and 0 deletions

View File

@ -966,6 +966,11 @@ BOOL WINAPI GetKeyboardLayoutNameA(LPSTR pszKLID)
*/
BOOL WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
{
if (!pwszKLID)
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
return USER_Driver->pGetKeyboardLayoutName(pwszKLID);
}

View File

@ -1595,6 +1595,14 @@ static void test_keyboard_layout_name(void)
BOOL ret;
char klid[KL_NAMELENGTH];
if (0) /* crashes on native system */
ret = GetKeyboardLayoutNameA(NULL);
SetLastError(0xdeadbeef);
ret = GetKeyboardLayoutNameW(NULL);
ok(!ret, "got %d\n", ret);
ok(GetLastError() == ERROR_NOACCESS, "got %d\n", GetLastError());
if (GetKeyboardLayout(0) != (HKL)(ULONG_PTR)0x04090409) return;
klid[0] = 0;