
Scan code: Remapping keyboard keys
Background
All my life I was a fan of silent, thin, and beautiful keyboards and, to my surprise, I found that there are not so many of those available on the free market - there are only a few of them. I had to use Genius SlimStar Pro, and still it depressed me, as did the thought that I would never find a keyboard that would satisfy me 100%. I found this and, on the recommendation of Comrade Boomburum , acquired the “ Illuminated Keyboard ”, which became a worthy friend of my “ MX Revolution, ” and I finally broke off relations with Genius, and the latest stories about user support from Logitech convinced me that the attached (not small money) will justify itself for 3 warranty years.

But there is a small trouble in the keyboards of this company, - " Not standard, not convenient, or not needed layout of some buttons ." In the case of Illuminated , these are two identical "\" buttons , the left of which went to the detriment of the "LShift" key. By the way, in the picture you can see that earlier these keyboards had the standard size "LShift". Under the cut, I’ll tell you how to return the “standard length” of this button, because in touch typing and because of habit, I press / instead of the shift. And at the same time I’ll tell you how without additional installed software, for example, you can change the assignment of any keys of your keyboards (including functional / media) using the Registry and Scan-code of keys.
What is a scan code?
Specification for Windows.
When any key is pressed, the keyboard controller generates a scan code corresponding to the position of the key, which is transmitted to the computer. Service codes that the keyboard controller can generate are passed to the BIOS routines for processing. In the keyboard buffer, 2 bytes are allocated for the key code, i.e. it is designed for 16 characters.
How to determine the scan code of a key
You can find out the Scan code of the key necessary for remapping here , and if you have a super new keyboard with buttons of space origin, then you can catch the scan code using the program " KeyboardTest " from the developer Passmark Software. The program is paid, but with a free trial. Or the OpenSource SharpKeys Program . It was required to determine the scan code of the left "\", since many naively believed that the signals were the same for both, and therefore not subject to remapping. In fact, it was not so.
The right "\" has a scan code: 2b.00 The
lower left "\" has a scan code: 56.00
And so, we determined the scan code of our unlucky button, now we need to find the scan code “LShift”. It can be found at the above link and it is equal: 2A.00
Key Remapping
There are a lot of applications that do this remapping, many accept existing scan codes as a base, many do not have a scanner to determine the scan code of a key that is not in the database. And I really did not want to install the extra application. Googling, I settled on the capabilities of Windows. or rather, the registry editor (Start-Run: regedit). Or the aforementioned SharpKeys program, which has a GUI and performs the same replacement in registry
1. In the
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Control \ Keyboard Layout branch,
create a binary parameter named " Scancode Map "
2. In the "Scancode Map" parameter, write the following values:
00.00.00.00.00.00.00.00.00.02 - the ninth byte (02) in this record means the number of keys that we will change (and equal to the number of keys +1) in our case it is 02, since we change the values of one key. After that, we enter three more “empty” bytes, and now our parameter looks like this:
00.00.00.00.00.00.00.00. 02 .00.00.00 .
Since we have already determined all Scan codes, continuing with our parameter, we should indicate the scan code of the value of the new button (in our case, 2A.00 ), and then the scan code of the old (replaceable) button 56.00 . Now it is necessary to close this function with four "empty" bytes, that is 00.00.00.00:

3. Restart the computer and use our new buttons.
PS:If you need to remap not on the whole PC, but only in your session, then the values must be changed in HKEY_CURRENT_USER \ SYSTEM \ CurrentControlSet \ Control \ Keyboard Layout
UPD: If you are afraid to work in the registry, create a text file with the extension * .reg, and write the following there: then save, run, and restart the PC. UPD2: Transferring Screenshots to 1. The left Win-key looks like this: The right Win-key looks like this:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,2a,00,56,00,00,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,37,E0,5B,E0,00,00,00,00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,37,E0,5C,E0,00,00,00,00