How to edit keyboard registry settings for keys with 3-character scan-codes?

3

I have an Apple mini-USB keyboard I am using with Windows 7. My ultimate goal is to permanently remap the F12 key to be "Delete" so I can log in with Control+Alt+Delete (apple's keyboard only has backspace).

I have identified the keyboard scan codes for the keys I want to remap using AutoHotKey.

  • Delete - 153
  • F12 - 058

I have some experience with using the registry to remap keys such as caps to control, in this example:

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

The registry code for Control as per this example is 3a,00 and its scancode is 03a. It seems you need to just remove the leading 0 in this case to remap the key.

How does this work when your scancode has a value on this leading digit? Am I suppose to just use 53 as the code?

enderland

Posted 2013-08-12T14:56:46.857

Reputation: 1 788

Could you not have used something like AutoHotKey to remap it. – Dave – 2013-08-12T15:03:53.987

1@DaveRook AHK only works once the script is launched, which unfortunately does not happen when I restart the machine as I have not logged in the first time yet. Trust me, if I could use AHK for this I would have :) – enderland – 2013-08-12T15:27:28.337

Answers

3

The scancodes in the registry are in hexadecimal (base 16), and include two bytes. The first byte is sometimes used as an escape code (0xE0), as for the delete key:

Control's scancode is 58 or 0x003A
F12's scancode is 88 or 0x0058
Delete's scancode is escaped 83 or 0xE053

This results in the following registry edits to make this change (note you have to increase 02,00,00,00 to 03,00,00,00 to indicate the additional key):

53,e0,58,00    

What you want to do though, is get a utility called SharpKeys, which will provide a GUI interface to modify the registry key map. You can then compare and examine the registry key before and after to see how it changed the entry.

Darth Android

Posted 2013-08-12T14:56:46.857

Reputation: 35 133

So to be clear - you are saying the .reg format would be 53,00 for delete and 58,00 for F12? – enderland – 2013-08-12T15:29:42.703