[KBSWITCH]

- Don't fall through to the default label. CID 515166

[NTUSER]
- Fix a copypasta.

[USER32]
- Fix computing of HKL for layouts with Layout id.
- Don't call NtUserLoadKeyboardLayoutEx with bogus keyboard layout id.
- Ideally LoadKeyboardLayout should return the default system layout on failure - to be continued.

svn path=/trunk/; revision=73708
This commit is contained in:
Kamil Hornicek 2017-02-05 15:42:23 +00:00
parent 66a30f987b
commit 73bb103c3c
3 changed files with 10 additions and 5 deletions

View file

@ -492,6 +492,8 @@ WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
if (!ShellExecuteEx(&shInputDll)) if (!ShellExecuteEx(&shInputDll))
MessageBox(hwnd, _T("Can't start input.dll"), NULL, MB_OK | MB_ICONERROR); MessageBox(hwnd, _T("Can't start input.dll"), NULL, MB_OK | MB_ICONERROR);
return 0;
} }
default: default:

View file

@ -722,7 +722,7 @@ NtUserActivateKeyboardLayout(
{ {
/* Get previous keyboard layout starting with current */ /* Get previous keyboard layout starting with current */
if (pti->KeyboardLayout) if (pti->KeyboardLayout)
pKl = pti->KeyboardLayout->pklNext; pKl = pti->KeyboardLayout->pklPrev;
} }
else else
pKl = UserHklToKbl(hKl); pKl = UserHklToKbl(hKl);

View file

@ -281,7 +281,7 @@ LoadKeyboardLayoutW(LPCWSTR pwszKLID,
HKEY hKey; HKEY hKey;
/* LOWORD of dwhkl is Locale Identifier */ /* LOWORD of dwhkl is Locale Identifier */
dwhkl = wcstol(pwszKLID, NULL, 16); dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16));
if (Flags & KLF_SUBSTITUTE_OK) if (Flags & KLF_SUBSTITUTE_OK)
{ {
@ -324,7 +324,10 @@ LoadKeyboardLayoutW(LPCWSTR pwszKLID,
RegCloseKey(hKey); RegCloseKey(hKey);
} }
else else
ERR("RegOpenKeyExW failed!\n"); {
ERR("Could not find keyboard layout %S.\n", pwszKLID);
return NULL;
}
/* If Layout Id is not given HIWORD == LOWORD (for dwhkl) */ /* If Layout Id is not given HIWORD == LOWORD (for dwhkl) */
if (!HIWORD(dwhkl)) if (!HIWORD(dwhkl))