Remapping keys in Windows 2000 and XP

How to change the function of keyboard keys.

Windows 2000, XP and 2003 Server have the ability to remap incoming keystrokes through a registry entry. "Remapping" keystrokes means to reassign what key refers to what character or function, allowing (for instance) the left Shift key to be treated as the left Ctrl key.

Windows interprets keystrokes through keyboard scan codes. Each keypress sends a particular code to the keyboard controller in the computer, which is in turn passed on to Windows. When a user places key-remap entries in the registry for specific scan codes, they can be reinterpreted as another scan code, and thus be changed into another keystroke.

On some laptop keyboards, the presence of Alt or Shift keys next to other commonly-used keys can be distracting and problematic for some users who keep hitting the Shift key by mistake. With key remapping, the Shift key could be remapped to represent nothing at all to keep it from interfering with user input.

Aside from user comfort, some of the other possible applications for this is to hard-disable certain keys from ever being pressed (for kiosks or other applications), or to correct problems with firmware errors or aftermarket keyboards.

Scan code mappings are stored in the Registry under the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout, and are stored as sets of REG_BINARY keys. Once scan code mappings have been updated, they take effect after the current user logs off or after the system is rebooted. Key mappings affect all users and cannot be changed on a user-by-user basis.

Editing them is not easy, unfortunately, since the scan codes are stored in a not-so-user-friendly way. To aid in creating and modifying keyboard scan codes, a number of third-party utilities have been written. One of the best and most useful is Sharpkeys 1.1, which can be used to interpret scan codes from any keyboard by simply pressing the keys. The resulting scan codes can then be saved to the registry (and then copied out of the registry and re-used on other machines if needed). The program requires the .NET framework to run.

If you want to learn how to edit your own key mappings, Microsoft has a document that describes the exact syntax for key mapping.


Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter. Check out his Windows 2000 blog for his latest advice and musings on the world of Windows network administrators – please share your thoughts as well!


This was first published in May 2004

Dig deeper on Microsoft Windows 2000 Server Administration

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchServerVirtualization

SearchCloudComputing

SearchExchange

SearchSQLServer

SearchWinIT

SearchEnterpriseDesktop

SearchVirtualDesktop

Close