Keyboard-Scancodes

Windows NT 4, 2000 and XP support the possibility to redefine all keys via the registry. The key for this is the scancode of the keyboard for every single key.


Key

Scancode (hex)

<^>

0029

<1>

0002

<2>

0003

<3>

0004

<4>

0005

<5>

0006

<6>

0007

<7>

0008

<8>

0009

<9>

000A

<0>

000B

<ß>

000C

<´>

000D

<Q>

0010

<W>

0011

<E>

0012

<R>

0013

<T>

0014

<Z>

0015

<U>

0016

<I>

0017

<O>

0018

<P>

0019

<Ü>

001A

<+>

001B

<< >

002B

<A>

001E

<S>

001F

<D>

0020

<F>

0021

<G>

0022

<H>

0023

<J>

0024

<K>

0025

<L>

0026

<Ö>

0027

<Ä>

0028

<Y>

002C

<X>

002D

<C>

002E

<V>

002F

<B>

0030

<N>

0031

<M>

0032

<,>

0033

<.>

0034

<->

0035

<Enter>

001C

<Shift (Left)>

002A

<Shift (Right)>

0036

<Strg (Left)>

001D

<Strg (Right)>

E01D

<Alt (Left)>

0038

<Alt (Rright)>

E038

<Space>

0039

<Num Lock>

0045

<Backspace>

000E

<Tabulator>

000F

<Scroll Lock>

0046

<CapsLock>

003A

<Keypad 7>

0047

<Keypad 4>

004B

<Keypad 1>

004F

<Keypad 8>

0048

<Keypad 5>

004C

<Keypad 2>

0050

<Keypad 0>

0052

<Keypad *>

0037

<Keypad 9>

0049

<Keypad 6>

004D

<Keypad 3>

0051

<Keypad .>

0053

<Keypad ->

004A

<Keypad +>

004E

<Keypad Enter>

E01C

<Esc>

0001

<F1>

003B

<F2>

003C

<F3>

003D

<F4>

003E

<F5>

003F

<F6>

0040

<F7>

0041

<F8>

0042

<F9>

0043

<F10>

0044

<F11>

0057

<F12>

0058

<Windows (Left)>

E05B

<Windows (Right)>

E05C

<Windows Context>

E05D



For redefining the keys via there scancodes, you have to add the binary key "Scancode Map" in the registry at:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout

This value contains a datastring (in binary), that informs the OS about every new scancode where to put it to what other scancode.

An example you can see as follows:

00 00 00 00  Headerinformation
00 00 00 00  Flags
02 00 00 00  number of definitions (including the Null-Terminator - in this example 2)
2A 00 3A 00  Left Shift-Key shall be availabe at the CapsLock as well
00 00 00 00  Null-Terminator

Get the AntiCapsLock.reg here

You should know that the scancodes hae to be entered in the "Little Endian" format. This means, that for the CapsLock key 003A, you have to enter 3A 00 instead.

It is interesting to keep in mind, that you have to count the null-terminators with in the numbe of fields!