Remapping Keys

Description
In , add a binary key  with the following format: Start offset (in bytes) Size (in bytes) Data 0                      4               Header: Version Information (always 0) 4                      4               Header: Flags               (always 0) 8                      4               Header: Number of Mappings 12                      4               Mapping #1 ... Last 4 bytes            4               Null Terminator (0x00000000) Note that the bytes of each word are ordered least-to-most significant!

Example: Mapping Caps Lock to Escape
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00, 00,00,00,00, 02,00,00,00, 01,00,3a,00, 00,00,00,00 Breakdown of data: 00,00,00,00, Header: Version Information 00,00,00,00, Header: Flags 02,00,00,00, Header: Number of Mappings (2) 01,00,3a,00, Map KEY: caps lock (0x003a) to FUNCTION: Escape (0x0001) 00,00,00,00 Null Terminator

Example: Mapping Caps Lock to Control
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00, 00,00,00,00, 02,00,00,00, 1D,00,3a,00, 00,00,00,00

Example: Mapping Caps Lock to Play/Pause
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] "Scancode Map"=hex:00,00,00,00, 00,00,00,00, 02,00,00,00, 22,E0,3a,00, 00,00,00,00

User-level Remapping
From MSDN:Keyboard and mouse class drivers:

The mappings stored in the registry work at system level and apply to all users. These mappings cannot be set to work differently depending on the current user. The current implementation restricts the functionality of the map such that mappings always apply to all keyboards connected to the system. It is not currently possible to create a map on a per-keyboard basis.

Mac OS X
Easy: just go to 'System Preferences:Keyboard & Mouse:Modifier Keys...'