[WIN32K] Work around GCC builds inventing dead keys.
authorMark Jansen <mark.jansen@reactos.org>
Sun, 23 Sep 2018 17:28:09 +0000 (19:28 +0200)
committerMark Jansen <mark.jansen@reactos.org>
Sun, 23 Sep 2018 18:03:14 +0000 (20:03 +0200)
CORE-14948

win32ss/user/ntuser/keyboard.c

index 6167f9d..f72e275 100644 (file)
@@ -467,17 +467,30 @@ IntToUnicodeEx(UINT wVirtKey,
         WCHAR wchFirst, wchSecond;
         TRACE("Previous dead char: %lc (%x)\n", wchDead, wchDead);
 
         WCHAR wchFirst, wchSecond;
         TRACE("Previous dead char: %lc (%x)\n", wchDead, wchDead);
 
-        for (i = 0; pKbdTbl->pDeadKey[i].dwBoth; i++)
+        if (pKbdTbl->pDeadKey)
         {
         {
-            wchFirst = pKbdTbl->pDeadKey[i].dwBoth >> 16;
-            wchSecond = pKbdTbl->pDeadKey[i].dwBoth & 0xFFFF;
-            if (wchFirst == wchDead && wchSecond == wchTranslatedChar)
+            for (i = 0; pKbdTbl->pDeadKey[i].dwBoth; i++)
             {
             {
-                wchTranslatedChar = pKbdTbl->pDeadKey[i].wchComposed;
+                wchFirst = pKbdTbl->pDeadKey[i].dwBoth >> 16;
+                wchSecond = pKbdTbl->pDeadKey[i].dwBoth & 0xFFFF;
+                if (wchFirst == wchDead && wchSecond == wchTranslatedChar)
+                {
+                    wchTranslatedChar = pKbdTbl->pDeadKey[i].wchComposed;
+                    wchDead = 0;
+                    bDead = FALSE;
+                    break;
+                }
+            }
+        }
+        else
+        {
+#if defined(__GNUC__)
+            if (wchDead == 0x8000)
+            {
+                ERR("GCC is inventing bits, ignoring fake dead key\n");
                 wchDead = 0;
                 wchDead = 0;
-                bDead = FALSE;
-                break;
             }
             }
+#endif
         }
 
         TRACE("Final char: %lc (%x)\n", wchTranslatedChar, wchTranslatedChar);
         }
 
         TRACE("Final char: %lc (%x)\n", wchTranslatedChar, wchTranslatedChar);