Author: khornicek
Date: Sun Feb 5 15:42:23 2017
New Revision: 73708
URL:
http://svn.reactos.org/svn/reactos?rev=73708&view=rev
Log:
[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.
Modified:
trunk/reactos/base/applications/kbswitch/kbswitch.c
trunk/reactos/win32ss/user/ntuser/kbdlayout.c
trunk/reactos/win32ss/user/user32/windows/input.c
Modified: trunk/reactos/base/applications/kbswitch/kbswitch.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/kbswitch…
==============================================================================
--- trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/kbswitch/kbswitch.c [iso-8859-1] Sun Feb 5 15:42:23
2017
@@ -492,6 +492,8 @@
if (!ShellExecuteEx(&shInputDll))
MessageBox(hwnd, _T("Can't start input.dll"), NULL,
MB_OK | MB_ICONERROR);
+
+ return 0;
}
default:
Modified: trunk/reactos/win32ss/user/ntuser/kbdlayout.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/kbdlay…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/kbdlayout.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/kbdlayout.c [iso-8859-1] Sun Feb 5 15:42:23 2017
@@ -722,7 +722,7 @@
{
/* Get previous keyboard layout starting with current */
if (pti->KeyboardLayout)
- pKl = pti->KeyboardLayout->pklNext;
+ pKl = pti->KeyboardLayout->pklPrev;
}
else
pKl = UserHklToKbl(hKl);
Modified: trunk/reactos/win32ss/user/user32/windows/input.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/input.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/input.c [iso-8859-1] Sun Feb 5 15:42:23
2017
@@ -281,7 +281,7 @@
HKEY hKey;
/* LOWORD of dwhkl is Locale Identifier */
- dwhkl = wcstol(pwszKLID, NULL, 16);
+ dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16));
if (Flags & KLF_SUBSTITUTE_OK)
{
@@ -305,7 +305,7 @@
StringCbCatW(wszRegKey, sizeof(wszRegKey), pwszKLID);
/* Open layout registry key for read */
- if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0,
+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszRegKey, 0,
KEY_READ, &hKey) == ERROR_SUCCESS)
{
dwSize = sizeof(wszLayoutId);
@@ -324,10 +324,13 @@
RegCloseKey(hKey);
}
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 (!HIWORD(dwhkl))
+ if (!HIWORD(dwhkl))
dwhkl |= dwhkl << 16;
ZeroMemory(&ustrKbdName, sizeof(ustrKbdName));