Microsoft KB Archive/214408

= Problems with Real-Mode Keyboard Driver and International Code Page =

PSS ID Number: 214408

Article Last Modified on 5/8/2002

-

The information in this article applies to:


 * Microsoft Windows 98

-



This article was previously published under Q214408



SYMPTOMS
If an international code page is installed in conjunction with a real-mode keyboard driver (such as Keyboard.sys), console programs may not detect extended character keystrokes (such as the INSERT, DELETE, and HOME keys and so on).



CAUSE
When a real-mode keyboard driver is installed, the current character from the "MS-DOS" keyboard buffer is sent to the console program. With an international code page loaded, this value is xe0 instead of x0 when an extended key is pressed. The data returned through the console API is therefore slightly different than that in Microsoft Windows 95. Console programs that do not work directly with the console API may not recognize extended keystrokes.



RESOLUTION
A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to computers that are experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS

NOTE: In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.



STATUS
Microsoft has confirmed this to be a problem in Microsoft Windows 98.

This problem was corrected in Windows 98 Second Edition.



Steps to Reproduce the Behavior
  Enter the following lines in the Autoexec.bat file (the example given is for German):

  mode con codepage prepare=((850) c:\windows\command\ega.cpi) mode con codepage select=850 keyb gr,,c:\windows\command\keyboard.sys  Run a program in an MS-DOS window that uses the _getch function. Note that the _getch function is assumed to be from the standard Visual C libraries or any code library that uses GetConsoleInput to service _getch. Extended key codes are not returned properly.

The Win32 console API function "ReadConsoleInput" returns the value xe0in the INPUT_RECORD 'KEY_EVENT_RECORD' structure AsciiChar field instead of the expected x0 value. Note that the ENHANCED_KEY bit is set in the 'dwControlKeyState' field. Some code libraries assume that the 'AsciiChar' field will always be zero when an extended keystroke occurs, and may not check the 'dwCOntrolKeyState' field bits, rendering them vulnerable to misinterpreting the returned keystroke. INPUT_RECORD.Event.KeyEvent.bKeyDown         x1   INPUT_RECORD.Event.KeyEvent.wRepeatCount      x1   INPUT_RECORD.Event.KeyEvent.wVirtualKeyCode   x2d INPUT_RECORD.Event.KeyEvent.wVirtualScanCode x52 -->INPUT_RECORD.Event.KeyEvent.uChar.AsciiChar  x0  (CORRECT) -->INPUT_RECORD.Event.KeyEvent.uChar.AsciiChar  xe0 (INCORRECT) INPUT_RECORD.Event.KeyEvent.dwControlKeyState x120 Note that the Interrupt 16h (BIOS Keyboard Services) and the Interrupt 21h (System Calls) character input functions for reading keyboard input are unaffected. The C source code shown below is a minimal example that demonstrates the problem:
 * 1) include 
 * 2) include 

void main {  int ch = 0;

while ( 27 != ch ) {     ch = _getch; printf( "%i: %x\n", ch, ch ); } }

For additional information about Windows 98 and Windows 98 Second Edition hotfixes, click the article number below to view the article in the Microsoft Knowledge Base:

206071 General Information About Windows 98 and Windows 98 Second Edition Hotfixes

Keywords: kbenv kbprb KB214408

Technology: kbWin98 kbWin98search

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.