[KBSWITCH][IMM32][USER32] Consider keyboard layout corner cases
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Thu, 13 Oct 2022 07:01:02 +0000 (16:01 +0900)
committerKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Thu, 13 Oct 2022 07:01:02 +0000 (16:01 +0900)
Considering invalid Keyboard Layout registry entries.
CORE-11700

base/applications/kbswitch/kbswitch.c
dll/win32/imm32/utils.c
win32ss/user/user32/windows/input.c

index 356209d..6e301ee 100644 (file)
@@ -341,7 +341,7 @@ BuildLeftPopupMenu(VOID)
             }
 
             if (!GetLayoutName(szLayoutNum, szName, ARRAYSIZE(szName)))
-                break;
+                continue;
 
             AppendMenu(hMenu, MF_STRING, _ttoi(szLayoutNum), szName);
         }
index 90fa7d6..cde837e 100644 (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;
index 092a92e..a15e9b5 100644 (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));
                 }
             }
         }