Keyboard Scancodes

Windows 2000 and XP offer the possibility to change keys via the registry. The key for this are the keyboard scancodes which identify each key functionality. Here, only the make code is given for the scancode, the break codes are irrelevant for the registry setting.

 

Key

Scancode (hex)

Key

Scancode (hex)

Key

Scancode (hex)

<`>

0029

<J>

0024

<Num 5>

004C

<1>

0002

<K>

0025

<Num 2>

0050

<2>

0003

<L>

0026

<Num 0>

0052

<3>

0004

<:>

0027

<Num *>

0037

<4>

0005

<“>

0028

<Num 9>

0049

<5>

0006

<Z>

002C

<Num 6>

004D

<6>

0007

<X>

002D

<Num 3>

0051

<7>

0008

<C>

002E

<Num .>

0053

<8>

0009

<V>

002F

<Num ->

004A

<9>

000A

<B>

0030

<Num +>

004E

<0>

000B

<N>

0031

<Num Enter>

E01C

<->

000C

<M>

0032

<Esc>

0001

<=>

000D

<,>

0033

<F1>

003B

<Q>

0010

<.>

0034

<F2>

003C

<W>

0011

</>

0035

<F3>

003D

<E>

0012

<Enter>

001C

<F4>

003E

<R>

0013

<Shift (Left)>

002A

<F5>

003F

<T>

0014

<Shift (Right)>

0036

<F6>

0040

<Y>

0015

<Ctrl (Left)>

001D

<F7>

0041

<U>

0016

<Ctrl (Right)>

E01D

<F8>

0042

<I>

0017

<Alt (Left)>

0038

<F9>

0043

<O>

0018

<Alt (Right)>

E038

<F10>

0044

<P>

0019

<Space>

0039

<F11>

0057

<{>

001A

<Num Lock>

0045

<F12>

0058

<]>

001B

<Backspace>

000E

<Win Left>

E05B

<\ >

002B

<Tab>

000F

<Win Right>

E05C

<A>

001E

<ScrlLk>

0046

<Win Contextmenu>

E05D

<S>

001F

<CapsLk>

003A

<Vol up>

E030

<D>

0020

<Num 7>

0047

<Vol down>

E02E

<F>

0021

<Num 4>

004B

<Vol mute>

E020

<G>

0022

<Num 1>

004F

<Stop>

E024

<H>

0023

<Num 8>

0048

<Play/Pause>

E022


To reallocate single keys by their scancodes, the new binary value „Scancode Map“ has to be entered in the registry key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

This value contains the data string that contains the information fort he keys you want to reallocate. For example, to change the left Windows Key to the key ScrlLk, and ScrlLk to the Windows Keys, set this string to “Scancode Map”:

0000000000000000040000005BE0460046005CE046005BE000000000

The string format ought to be read like this:

00 00 00 00

Header information

00 00 00 00

Flags

04 00 00 00

No. of definitions (inclusive Null Terminator)

5B E0 46 00

First Definition: Left Windows Key to ScrlLk Key

46 00 5C E0

Second Definition: ScrlLk Key to left Windows Key

46 00 5B E0

Third Definition: ScrlLk Key to right Windows Key

00 00 00 00

Null Terminator


Remember to count the terminating Null Terminator in the number of definitions.
The scancodes are set in the registry in Little Endian Format. Little Endian (Little End First) means, the lower end of the value comes first. The scancode of the left Windows Key „E05B“ gets therefore „5BE0“.


Translated by mynetx from http://www.pcwelt.de/