- Do not look outside VkToWcharTable[].

- Check for WCH_NONE.

svn path=/trunk/; revision=26940
This commit is contained in:
Dmitry Gorbachev 2007-05-30 09:35:41 +00:00
parent 90342114af
commit eb8e07f1a2

View file

@ -248,6 +248,7 @@ static BOOL TryToTranslateChar(WORD wVirtKey,
{ {
return FALSE; return FALSE;
} }
for (nMod = 0; keyLayout->pVkToWcharTable[nMod].nModifications; nMod++) for (nMod = 0; keyLayout->pVkToWcharTable[nMod].nModifications; nMod++)
{ {
vtwTbl = &keyLayout->pVkToWcharTable[nMod]; vtwTbl = &keyLayout->pVkToWcharTable[nMod];
@ -263,13 +264,12 @@ static BOOL TryToTranslateChar(WORD wVirtKey,
if( CapsMod >= keyLayout->pVkToWcharTable[nMod].nModifications ) if( CapsMod >= keyLayout->pVkToWcharTable[nMod].nModifications )
{ {
DWORD MaxBit = 1; return FALSE;
while( MaxBit < }
keyLayout->pVkToWcharTable[nMod].nModifications )
MaxBit <<= 1;
CapsMod &= MaxBit - 1; /* Guarantee that CapsMod lies if( vkPtr->wch[CapsMod] == WCH_NONE )
in bounds. */ {
return FALSE;
} }
*pbDead = vkPtr->wch[CapsMod] == WCH_DEAD; *pbDead = vkPtr->wch[CapsMod] == WCH_DEAD;