Skip to content

Commit 428dff1

Browse files
committed
[WIN32K]
- Check the supplied scancode instead of the state buffer whether a key is up - Fixes the calculator keyboard input regression introduced with r35117 - Ref: http://www.osronline.com/ddkx/w98ddk/keycnt_4ilz.htm and wine implementation See issue reactos#3727 for more details. svn path=/trunk/; revision=47138
1 parent 1bd675f commit 428dff1

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

reactos/subsystems/win32/win32k/ntuser/keyboard.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
/* Key States */
4343
#define KS_DOWN_MASK 0xc0
4444
#define KS_DOWN_BIT 0x80
45-
#define KS_LOCK_BIT 0x01
45+
#define KS_LOCK_BIT 0x01
46+
/* Scan Codes */
47+
#define SC_KEY_UP 0x8000
4648
/* lParam bits */
4749
#define LP_EXT_BIT (1<<24)
4850
/* From kbdxx.c -- Key changes with numlock */
@@ -720,6 +722,11 @@ NtUserToUnicodeEx(
720722
DPRINT("Enter NtUserSetKeyboardState\n");
721723
UserEnterShared();//fixme: this syscall doesnt seem to need any locking...
722724

725+
/* Key up? */
726+
if (wScanCode & SC_KEY_UP)
727+
{
728+
RETURN(0);
729+
}
723730

724731
if( !NT_SUCCESS(MmCopyFromCaller(KeyStateBuf,
725732
lpKeyState,
@@ -729,8 +736,8 @@ NtUserToUnicodeEx(
729736
RETURN(0);
730737
}
731738

732-
/* Virtual code is correct and key is pressed currently? */
733-
if (wVirtKey < 0x100 && KeyStateBuf[wVirtKey] & KS_DOWN_BIT)
739+
/* Virtual code is correct? */
740+
if (wVirtKey < 0x100)
734741
{
735742
OutPwszBuff = ExAllocatePoolWithTag(NonPagedPool,sizeof(WCHAR) * cchBuff, TAG_STRING);
736743
if( !OutPwszBuff )
@@ -752,8 +759,6 @@ NtUserToUnicodeEx(
752759
MmCopyToCaller(pwszBuff,OutPwszBuff,sizeof(WCHAR)*cchBuff);
753760
ExFreePoolWithTag(OutPwszBuff, TAG_STRING);
754761
}
755-
else
756-
ret = 0;
757762

758763
RETURN(ret);
759764

0 commit comments

Comments
 (0)