[KBSWITCH][IMM32][USER32] Consider keyboard layout corner cases

Considering invalid Keyboard Layout registry entries.
CORE-11700
This commit is contained in:
Katayama Hirofumi MZ 2022-10-13 16:01:02 +09:00
parent fb86db15bb
commit bbef618032
3 changed files with 6 additions and 4 deletions

View file

@ -341,7 +341,7 @@ BuildLeftPopupMenu(VOID)
}
if (!GetLayoutName(szLayoutNum, szName, ARRAYSIZE(szName)))
break;
continue;
AppendMenu(hMenu, MF_STRING, _ttoi(szLayoutNum), szName);
}

View file

@ -898,7 +898,7 @@ UINT APIENTRY Imm32GetImeLayout(PREG_IME pLayouts, UINT cLayouts)
lError = RegOpenKeyW(hkeyLayouts, szImeKey, &hkeyIME); /* Open the IME key */
if (lError != ERROR_SUCCESS)
break;
continue;
/* Load the "Ime File" value */
szImeFileName[0] = 0;
@ -910,12 +910,12 @@ UINT APIENTRY Imm32GetImeLayout(PREG_IME pLayouts, UINT cLayouts)
/* We don't allow the invalid "IME File" values for security reason */
if (!szImeFileName[0] || wcscspn(szImeFileName, L":\\/") != wcslen(szImeFileName))
break;
continue;
Imm32StrToUInt(szImeKey, &Value, 16);
hKL = (HKL)(DWORD_PTR)Value;
if (!IS_IME_HKL(hKL))
break;
continue;
/* Store the IME key and the IME filename */
pLayouts[nCount].hKL = hKL;

View file

@ -796,6 +796,7 @@ IntLoadKeyboardLayout(
{
bIsIME = FALSE;
wHigh = 0;
ERR("0x%X\n", dwKLID);
}
else
{
@ -810,6 +811,7 @@ IntLoadKeyboardLayout(
{
bIsIME = FALSE;
wHigh = 0;
ERR("'%s'\n", debugstr_w(szPath));
}
}
}