mirror of
https://github.com/reactos/reactos.git
synced 2025-05-07 02:41:22 +00:00
[USER32] Fix HKL keyboard list values (Retrial)
CORE-18338
This commit is contained in:
parent
5d123ce5f1
commit
0aa9d9fdb7
2 changed files with 25 additions and 9 deletions
|
@ -999,6 +999,8 @@ cleanup:
|
||||||
* NtUserLoadKeyboardLayoutEx
|
* NtUserLoadKeyboardLayoutEx
|
||||||
*
|
*
|
||||||
* Loads keyboard layout with given locale id
|
* Loads keyboard layout with given locale id
|
||||||
|
*
|
||||||
|
* NOTE: We adopt a different design from Microsoft's one for security reason.
|
||||||
*/
|
*/
|
||||||
HKL
|
HKL
|
||||||
APIENTRY
|
APIENTRY
|
||||||
|
|
|
@ -640,6 +640,8 @@ LoadKeyboardLayoutA(LPCSTR pszKLID,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @unimplemented
|
||||||
|
*
|
||||||
|
* NOTE: We adopt a different design from Microsoft's one for security reason.
|
||||||
*/
|
*/
|
||||||
/* Win: LoadKeyboardLayoutWorker */
|
/* Win: LoadKeyboardLayoutWorker */
|
||||||
HKL APIENTRY
|
HKL APIENTRY
|
||||||
|
@ -654,12 +656,27 @@ IntLoadKeyboardLayout(
|
||||||
UNICODE_STRING ustrKbdName;
|
UNICODE_STRING ustrKbdName;
|
||||||
UNICODE_STRING ustrKLID;
|
UNICODE_STRING ustrKLID;
|
||||||
WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
|
WCHAR wszRegKey[256] = L"SYSTEM\\CurrentControlSet\\Control\\Keyboard Layouts\\";
|
||||||
WCHAR wszLayoutId[10], wszNewKLID[10];
|
WCHAR wszLayoutId[10], wszNewKLID[10], szImeFileName[80];
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
HKL hNewKL;
|
HKL hNewKL;
|
||||||
|
BOOL bIsIME;
|
||||||
|
|
||||||
/* LOWORD of dwhkl is Locale Identifier */
|
dwhkl = wcstoul(pwszKLID, NULL, 16);
|
||||||
dwhkl = LOWORD(wcstoul(pwszKLID, NULL, 16));
|
bIsIME = IS_IME_HKL(UlongToHandle(dwhkl));
|
||||||
|
if (bIsIME) /* IME? */
|
||||||
|
{
|
||||||
|
/* Check "IME File" value */
|
||||||
|
dwSize = sizeof(szImeFileName);
|
||||||
|
if (RegQueryValueExW(hKey, L"IME File", NULL, &dwType, (LPBYTE)szImeFileName,
|
||||||
|
&dwSize) != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
dwhkl = LOWORD(dwhkl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dwhkl = LOWORD(dwhkl); /* LOWORD of dwhkl is language identifier */
|
||||||
|
}
|
||||||
|
|
||||||
if (Flags & KLF_SUBSTITUTE_OK)
|
if (Flags & KLF_SUBSTITUTE_OK)
|
||||||
{
|
{
|
||||||
|
@ -692,9 +709,8 @@ IntLoadKeyboardLayout(
|
||||||
/* If Layout Id is specified, use this value | f000 as HIWORD */
|
/* If Layout Id is specified, use this value | f000 as HIWORD */
|
||||||
/* FIXME: Microsoft Office expects this value to be something specific
|
/* FIXME: Microsoft Office expects this value to be something specific
|
||||||
* for Japanese and Korean Windows with an IME the value is 0xe001
|
* for Japanese and Korean Windows with an IME the value is 0xe001
|
||||||
* We should probably check to see if an IME exists and if so then
|
|
||||||
* set this word properly.
|
|
||||||
*/
|
*/
|
||||||
|
if (!bIsIME)
|
||||||
dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16;
|
dwhkl |= (0xf000 | wcstol(wszLayoutId, NULL, 16)) << 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,9 +729,7 @@ IntLoadKeyboardLayout(
|
||||||
|
|
||||||
ZeroMemory(&ustrKbdName, sizeof(ustrKbdName));
|
ZeroMemory(&ustrKbdName, sizeof(ustrKbdName));
|
||||||
RtlInitUnicodeString(&ustrKLID, pwszKLID);
|
RtlInitUnicodeString(&ustrKLID, pwszKLID);
|
||||||
hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName,
|
hNewKL = NtUserLoadKeyboardLayoutEx(NULL, 0, &ustrKbdName, NULL, &ustrKLID, dwhkl, Flags);
|
||||||
NULL, &ustrKLID,
|
|
||||||
dwhkl, Flags);
|
|
||||||
CliImmInitializeHotKeys(SETIMEHOTKEY_ADD, hNewKL);
|
CliImmInitializeHotKeys(SETIMEHOTKEY_ADD, hNewKL);
|
||||||
return hNewKL;
|
return hNewKL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue