You can filter keypresses with keyboard scancodes, it gives you the possibility to redefine keys via the registry. You can bind a key to another key or disable a specific key (CTRL-ALT-DEL combination in kiosk-mode for example).
The scancode mappings are stored in the following registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout\Scancode Map
If the “Scancode Map” value doesn’t exist it must be added as a REG_BINARY.
Below the layout of the “Scancode Map” values:
Offset | Bytes | Information |
0 | 4 | Header. Version information |
4 | 4 | Header. Flags |
8 | 4 | Header. Number of mappings, including the null terminator |
12 | 4 x | Individual mappings. 4 bytes for each mapping. DWORD. |
last | 4 | Null terminator (0,0,0,0) |
Example: Remap Left Shift to L-key
00 | 00 | 00 | 00 | Header |
00 | 00 | 00 | 00 | Header |
02 | 00 | 00 | 00 | Two definitions |
26 | 00 | 2A | 00 | 0026 = L-key. 002A = Left Shift. |
00 | 00 | 00 | 00 | Terminator |
Regedit:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
“Scancode Map”=hex:00,00,00,00,00,00,00,00,02,00,00,00,26,00,2A,00,00,00,00
Example: Disable CTRL-ALT(-DEL)
00 | 00 | 00 | 00 | Header |
00 | 00 | 00 | 00 | Header |
05 | 00 | 00 | 00 | 5 definitions |
00 | 00 | 1d | 00 | 0000 = Nothing. 001d = Left CTRL |
00 | 00 | 38 | 00 | 0000 = Nothing. 0038 = Left ALT |
00 | 00 | 1d | e0 | 0000 = Nothing. e01d = Right CTRL |
00 | 00 | 38 | e0 | 0000 = Nothing. e038 = Right ALT |
00 | 00 | 00 | 00 | Terminator |
There is a tool available to help you find the mappings : http://sharpkeys.codeplex.com/