From 09b99f1097d565d66aa42c65df626a4bc9e925e0 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Sat, 8 May 1999 18:09:37 +0000 Subject: [PATCH] Fixed KEY_EVENT_RECORD. svn path=/trunk/; revision=438 --- reactos/apps/utils/cmd/cmdinput.c | 9 ++------- reactos/apps/utils/cmd/misc.c | 4 ---- reactos/drivers/dd/keyboard/keyboard.c | 5 +++-- reactos/include/structs.h | 8 ++++---- reactos/lib/kernel32/misc/console.c | 4 ++-- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/reactos/apps/utils/cmd/cmdinput.c b/reactos/apps/utils/cmd/cmdinput.c index 9f087ef0378..24ff4b9307e 100644 --- a/reactos/apps/utils/cmd/cmdinput.c +++ b/reactos/apps/utils/cmd/cmdinput.c @@ -360,19 +360,14 @@ VOID ReadCommand (LPTSTR str, INT maxlen) break; default: -#ifdef __REACTOS__ - ch = ir.Event.KeyEvent.AsciiChar; - if ((ch >= 32) && (charcount != (maxlen - 2))) - { -#else #ifdef _UNICODE ch = ir.Event.KeyEvent.uChar.UnicodeChar; + if ((ch >= 32 && ch <= 255) && (charcount != (maxlen - 2))) #else ch = ir.Event.KeyEvent.uChar.AsciiChar; + if ((ch >= 32) && (charcount != (maxlen - 2))) #endif /* _UNICODE */ - if ((ch >= 32 && ch <= 255) && (charcount != (maxlen - 2))) { -#endif /* __REACTOS__ */ /* insert character into string... */ if (bInsert && current != charcount) { diff --git a/reactos/apps/utils/cmd/misc.c b/reactos/apps/utils/cmd/misc.c index d863ac762e4..26c6b14b45b 100644 --- a/reactos/apps/utils/cmd/misc.c +++ b/reactos/apps/utils/cmd/misc.c @@ -62,15 +62,11 @@ TCHAR cgetchar (VOID) } while (TRUE); -#ifdef __REACTOS__ - return irBuffer.Event.KeyEvent.AsciiChar; -#else #ifndef _UNICODE return irBuffer.Event.KeyEvent.uChar.AsciiChar; #else return irBuffer.Event.KeyEvent.uChar.UnicodeChar; #endif /* _UNICODE */ -#endif /* __REACTOS__ */ } diff --git a/reactos/drivers/dd/keyboard/keyboard.c b/reactos/drivers/dd/keyboard/keyboard.c index 44ecec829e1..f23e320a320 100644 --- a/reactos/drivers/dd/keyboard/keyboard.c +++ b/reactos/drivers/dd/keyboard/keyboard.c @@ -498,7 +498,7 @@ static unsigned int KeyboardHandler(unsigned int irq) rec[KeysRead].wRepeatCount=1; rec[KeysRead].wVirtualKeyCode=ScanToVirtual(thisKey); rec[KeysRead].wVirtualScanCode=thisKey; - rec[KeysRead].AsciiChar=VirtualToAscii(rec->wVirtualKeyCode,isDown); + rec[KeysRead].uChar.AsciiChar=VirtualToAscii(rec->wVirtualKeyCode,isDown); rec[KeysRead].dwControlKeyState=ctrlKeyState; if (extKey) { @@ -525,8 +525,9 @@ static unsigned int KeyboardHandler(unsigned int irq) kbdBuffer[bufHead].wRepeatCount=1; kbdBuffer[bufHead].wVirtualKeyCode=ScanToVirtual(thisKey); kbdBuffer[bufHead].wVirtualScanCode=thisKey; + kbdBuffer[bufHead].uChar.UnicodeChar=0; // kbdBuffer[bufHead].uChar.AsciiChar=TranslateScanCode(thisKey); - kbdBuffer[bufHead].AsciiChar=VirtualToAscii(kbdBuffer[bufHead].wVirtualKeyCode,isDown); + kbdBuffer[bufHead].uChar.AsciiChar=VirtualToAscii(kbdBuffer[bufHead].wVirtualKeyCode,isDown); kbdBuffer[bufHead].dwControlKeyState=ctrlKeyState; if (extKey) kbdBuffer[bufHead].dwControlKeyState|=ENHANCED_KEY; diff --git a/reactos/include/structs.h b/reactos/include/structs.h index 881cdb29619..1ba89e9bfdc 100644 --- a/reactos/include/structs.h +++ b/reactos/include/structs.h @@ -340,14 +340,14 @@ typedef struct _KEY_EVENT_RECORD { WORD wVirtualKeyCode; WORD wVirtualScanCode; - char AsciiChar; - char pad; -#if 0 +// char AsciiChar; +// char pad; +//#if 0 union { WCHAR UnicodeChar; CHAR AsciiChar; } uChar; -#endif +//#endif DWORD dwControlKeyState; } KEY_EVENT_RECORD PACKED; diff --git a/reactos/lib/kernel32/misc/console.c b/reactos/lib/kernel32/misc/console.c index 4e320222918..682730767c4 100644 --- a/reactos/lib/kernel32/misc/console.c +++ b/reactos/lib/kernel32/misc/console.c @@ -141,9 +141,9 @@ ReadConsoleA(HANDLE hConsoleInput, sizeof(KEY_EVENT_RECORD), &Result, NULL); - if (stat && KeyEventRecord.bKeyDown && KeyEventRecord.AsciiChar != 0) + if (stat && KeyEventRecord.bKeyDown && KeyEventRecord.uChar.AsciiChar != 0) { - Buffer[i] = KeyEventRecord.AsciiChar; + Buffer[i] = KeyEventRecord.uChar.AsciiChar; i++; } }