[WIN32K:NTUSER] Do not pass NULL keyboard layout to IntToUnicodeEx

There's an ASSERT on that
This commit is contained in:
Jérôme Gardou 2021-06-18 12:43:53 +02:00 committed by Jérôme Gardou
parent 8d665f8959
commit 813d9cd2cc

View file

@ -1105,7 +1105,7 @@ UserProcessKeyboardInput(
if (wVk & KBDEXT) if (wVk & KBDEXT)
KbdInput.dwFlags |= KEYEVENTF_EXTENDEDKEY; KbdInput.dwFlags |= KEYEVENTF_EXTENDEDKEY;
// //
// Based on wine input:test_Input_blackbox this is okay. It seems the // Based on wine input:test_Input_blackbox this is okay. It seems the
// bit did not get set and more research is needed. Now the right // bit did not get set and more research is needed. Now the right
// shift works. // shift works.
// //
@ -1341,6 +1341,7 @@ NtUserToUnicodeEx(
PWCHAR pwszBuff = NULL; PWCHAR pwszBuff = NULL;
INT i, iRet = 0; INT i, iRet = 0;
PKL pKl = NULL; PKL pKl = NULL;
NTSTATUS Status;
TRACE("Enter NtUserSetKeyboardState\n"); TRACE("Enter NtUserSetKeyboardState\n");
@ -1390,17 +1391,35 @@ NtUserToUnicodeEx(
pKl = pti->KeyboardLayout; pKl = pti->KeyboardLayout;
} }
iRet = IntToUnicodeEx(wVirtKey, if (pKl)
wScanCode, {
afKeyState, iRet = IntToUnicodeEx(wVirtKey,
pwszBuff, wScanCode,
cchBuff, afKeyState,
wFlags, pwszBuff,
pKl ? pKl->spkf->pKbdTbl : NULL); cchBuff,
wFlags,
pKl->spkf->pKbdTbl);
if (iRet)
{
Status = MmCopyToCaller(pwszBuffUnsafe, pwszBuff, cchBuff * sizeof(WCHAR));
}
}
else
{
ERR("No keyboard layout ?!\n");
Status = STATUS_INVALID_HANDLE;
}
MmCopyToCaller(pwszBuffUnsafe, pwszBuff, cchBuff * sizeof(WCHAR));
ExFreePoolWithTag(pwszBuff, TAG_STRING); ExFreePoolWithTag(pwszBuff, TAG_STRING);
if (!NT_SUCCESS(Status))
{
iRet = 0;
SetLastNtError(Status);
}
UserLeave(); UserLeave();
TRACE("Leave NtUserSetKeyboardState, ret=%i\n", iRet); TRACE("Leave NtUserSetKeyboardState, ret=%i\n", iRet);
return iRet; return iRet;