Problems with Real-Mode Keyboard Driver and International Code Page (214408)



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 hotfix is now available from Microsoft, but it is only intended to correct the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site: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.

File nameDateTimeSize
Conagent.exe12/14/9811:03pm14,696

STATUS

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

This problem was corrected in Windows 98 Second Edition.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. 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
  2. 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:
#include <stdio.h>
#include <conio.h>

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


Modification Type:MinorLast Reviewed:10/19/2005
Keywords:kbHotfixServer kbQFE kbenv kbprb KB214408