Fixed bug 167.

svn path=/trunk/; revision=8254
This commit is contained in:
Art Yerkes 2004-02-19 03:45:44 +00:00
parent 839f724098
commit aa83ce6cde

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: keyboard.c,v 1.21 2003/12/28 14:21:03 weiden Exp $
/* $Id: keyboard.c,v 1.22 2004/02/19 03:45:44 arty Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -40,6 +40,7 @@
#include <include/error.h>
#include <include/object.h>
#include <include/winsta.h>
#include <rosrtl/string.h>
#define NDEBUG
#include <debug.h>
@ -62,7 +63,6 @@
#define KNUMP 0x400
/* Lock the keyboard state to prevent unusual concurrent access */
/* This really should be a mutex. */
FAST_MUTEX QueueStateLock;
BYTE QueueKeyStateTable[256];
@ -78,6 +78,9 @@ NTSTATUS FASTCALL InitKeyboardImpl(VOID) {
/*** Statics used by TranslateMessage ***/
/*** Shift state code needs to be cleaned up here. Sorry, I let it get out
* of hand. */
static UINT DontDistinguishShifts( UINT ret ) {
if( ret == VK_LSHIFT || ret == VK_RSHIFT ) ret = VK_SHIFT;
if( ret == VK_LCONTROL || ret == VK_RCONTROL ) ret = VK_CONTROL;
@ -352,7 +355,7 @@ int STDCALL ToUnicode( UINT wVirtKey,
* Returns NTSTATUS.
*/
static NTSTATUS ReallyAppendUnicodeString(PUNICODE_STRING ResultFirst,
NTSTATUS NTAPI AppendUnicodeString(PUNICODE_STRING ResultFirst,
PUNICODE_STRING Second,
BOOL Deallocate) {
NTSTATUS Status;
@ -387,7 +390,7 @@ static NTSTATUS ReallyAppendUnicodeString(PUNICODE_STRING ResultFirst,
* Returns NTSTATUS
*/
static NTSTATUS ReadRegistryValue( PUNICODE_STRING KeyName,
static NTSTATUS NTAPI ReadRegistryValue( PUNICODE_STRING KeyName,
PUNICODE_STRING ValueName,
PUNICODE_STRING ReturnedValue ) {
NTSTATUS Status;
@ -441,7 +444,7 @@ static NTSTATUS ReadRegistryValue( PUNICODE_STRING KeyName,
/* At this point, KeyValuePartialInfo->Data contains the key data */
RtlInitUnicodeString(ReturnedValue,L"");
ReallyAppendUnicodeString(ReturnedValue,&Temp,FALSE);
AppendUnicodeString(ReturnedValue,&Temp,FALSE);
ExFreePool(KeyValuePartialInfo);
NtClose(KeyHandle);
@ -491,7 +494,7 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
L"\\REGISTRY\\Machine\\SYSTEM\\CurrentControlSet"
L"\\Control\\KeyboardLayouts\\");
ReallyAppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE);
AppendUnicodeString(&LayoutKeyName,&DefaultLocale,FALSE);
RtlFreeUnicodeString(&DefaultLocale);
RtlInitUnicodeString(&LayoutValueName,L"Layout File");
@ -508,7 +511,7 @@ void InitKbdLayout( PVOID *pkKeyboardLayout ) {
RtlFreeUnicodeString(&LayoutKeyName);
ReallyAppendUnicodeString(&FullLayoutPath,&LayoutFile,FALSE);
AppendUnicodeString(&FullLayoutPath,&LayoutFile,FALSE);
DPRINT("Loading Keyboard DLL %wZ\n", &FullLayoutPath);
@ -963,7 +966,9 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
ModifierBits = ModBits(KeyboardLayout,QueueKeyStateTable);
/* Get the raw scan code, so we can look up whether the key is a numpad
* key */
* key
*
* Shift and the LP_EXT_BIT cancel. */
ScanCode = (Msg->lParam >> 16) & 0xff;
BaseMapping = Msg->wParam =
IntMapVirtualKeyEx( ScanCode, 1, KeyboardLayout );
@ -971,12 +976,13 @@ VOID FASTCALL W32kKeyProcessMessage(LPMSG Msg, PKBDTABLES KeyboardLayout) {
if ((ModifierBits & NUMLOCK_BIT) &&
!(ModifierBits & GetShiftBit(KeyboardLayout)) &&
(RawVk & KNUMP))
(RawVk & KNUMP) &&
!(Msg->lParam & LP_EXT_BIT))
{
/* The key in question is a numpad key. Search for a translation. */
for (i = 0; NumpadConversion[i][0]; i++)
{
if ((RawVk & 0xff) == NumpadConversion[i][0])
if ((BaseMapping & 0xff) == NumpadConversion[i][0]) /* RawVk? */
{
Msg->wParam = NumpadConversion[i][1];
break;