122-key keyboards on NT-based Windows
Introduction
With the standard keyboard drivers built into Windows, the extra keys on an IBM Host Connected Keyboard (or similar Unicomp 122-key terminal emulator keyboards) will return scancodes. However, the virtual key codes they produce will not be correct.
If you're using the extra keys in a macro program like
AutoHotKey, this isn't a problem. But if you want them to return
correct VK_ codes as well, or you need GetKeyNameText()
to
return proper key names, then the keyboard layout DLL needs to be
replaced.
The first half of this page provides the new DLLs. The second half explains how to create your own, using the Microsoft Keyboard Layout Creator.
Download
This file contains recompiled US and UK layouts that should support 122-key keyboards.
layouts.zip (508k)
Installing the new layouts
I haven't written instructions for anything later than Windows 2000. The help file supplied with Microsoft Keyboard Layout Creator provides installation instructions for versions of Windows from NT4 up to Vista.
Windows 2000 / NT 4
Install the layout by double-clicking the supplied .MSI file (the one ending in _i386.msi). On NT4, you may have to install the Windows Installer service, using InstMsiW. Once the layout is installed, go to the 'Keyboard' control panel. Under "Input Locales", click "Properties" and select your newly-installed keyboard layout.
Windows NT 3.x
According to the MSKLC documentation, the keyboard layouts it generates cannot be installed on Windows NT 3.x. However, it is possible to install them by hand:
- Copy the DLL you want from the i386 directory to the Windows SYSTEM32 directory, for example C:\WINNT35\SYSTEM32.
- Launch REGEDT32.EXE, for example by using File | Run... within Program Manager.
- Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Keyboard Layout.
- On the right-hand side, there should be one REG_SZ value, containing something like KBDUS.DLL or KBDUK.DLL. Change this to the name of the DLL you just installed (US122.DLL or UK122.DLL).
- Log off and log back on.
History
In Windows NT 3.1, there is no support at all for the extra keys on a Host Connected Keyboard; they all register as F19.
In Windows NT 3.5, support was added for function keys F13-F24 on a "KB 3270" keyboard (maybe the Keytronic KB 3270?). Whatever keyboard it is, it doesn't use the same scancodes as the IBM Host Connected Keyboard and its derivatives. If you want to get technical, the Windows layout appears to be expecting keyboards where F13-F24 send Set 3 scancodes, not Set 2.
Windows NT 4.0 adds support for a few more 3270-esque keys (such as PA1-PA3), but again using Set 3 scancodes rather than Set 2.
Windows 2000 and later appear to support the same range of keys as NT 4. Since these Windows versions now support scancode remapping through the Registry, it would be possible to reassign the scancodes returned by the function keys at this level. However, it would not be possible to do this with the other 3270 keys such as CrSel, because there are no scancodes in the default table corresponding to these keys.
Creating Keyboard Layout DLLs
The Download section on this page includes new US and UK layout files generated using this process. To replicate the procedure for other keyboard layouts, follow these instructions.
Keyboard layout DLLs are generated by the Microsoft Keyboard Layout Creator, so download and install it.
- In order to generate layouts with the correct
scancode mappings for a 122-key keyboard, you have to go to the directory
where MSKLC is installed, and edit the inc\kbd.h file. The section
to replace is between the lines beginning
#define T5A
and#define T7F
. Replace them with this:#define T5A _EQ( PA1 ) // PA1 #define T5B _EQ( F13 ) // F13 #define T5C _EQ( F14 ) // F14 #define T5D _EQ( F15 ) // F15 #define T5E _EQ( OEM_BACKTAB ) // KB3270 <= 7E #define T5F _EQ( OEM_AUTO ) // KB3270 #define T60 _EQ( _none_ ) #define T61 _EQ( _none_ ) #define T62 _EQ( ZOOM ) // KB3270 <= 57 #define T63 _EQ( F16 ) // KB3270 <= 58 #define T64 _EQ( F17 ) #define T65 _EQ( F18 ) #define T66 _EQ( F19 ) #define T67 _EQ( F20 ) #define T68 _EQ( F21 ) #define T69 _EQ( F22 ) #define T6A _EQ( F23 ) #define T6B _EQ( F24 ) #define T6C _EQ( NONAME ) // Right Blank #define T6D _EQ( EREOF ) // ErEOF #define T6E _EQ( _none_ ) #define T6F _EQ( PLAY ) // Copy / Play #define T70 _EQ( _none_ ) #define T71 _EQ( ATTN ) // Attn #define T72 _EQ( CRSEL ) // CrSel #define T73 _EQ( ABNT_C1 ) // Under right Shift #define T74 _EQ( EXSEL ) // ExSel #define T75 _EQ( ZOOM ) // Left Blank (Zoom on 6110344) #define T76 _EQ( OEM_CLEAR ) #define T77 _EQ( _none_ ) // KB3270 => HOME #define T78 _EQ( _none_ ) // KB3270 => UP #define T79 _EQ( _none_ ) // KB3270 => DELETE #define T7A _EQ( _none_ ) // KB3270 => INSERT #define T7B _EQ( OEM_PA1 ) // KB3270 #define T7C _EQ( TAB ) // KB3270 => TAB #define T7D _EQ( _none_ ) // KB3270 => RIGHT #define T7E _EQ( ABNT_C2 ) // KB3270 => BACKTAB #define T7F _EQ( OEM_PA2 ) // KB3270
(If you have a diff utility installed, here's a unified diff file to do the job.)
- Launch MSKLC.
- Select File | Load Existing Keyboard....
- Choose the system keyboard layout to use as a basis for your 122-key layout.
- Select Project | Properties. Under 'Name' enter something like US122, and under 'Description' United States (122-key).
- Save the project to a .KLC file (File | Save Source File).
- Edit the source file. In the
KEYNAME
section, remove the entries for F13-F24, and replace them with this:5A PA1 5B F13 5C F14 5D F15 63 F16 64 F17 65 F18 66 F19 67 F20 68 F21 69 F22 6A F23 6B F24 6C Noname 6D ErEOF 6F Play 71 Attn 72 CrSel 74 ExSel 75 Zoom 76 Clear
- Reload the .KLC file into MSKLC (File | Load Source File).
- Select Project | Build DLL and Setup Package.
The setup package can then be installed as described under Installing above.
Known Issues
Unlike the Windows 3.0 driver supplied with the Host Connected
Keyboard by IBM, these layouts do not replace the keyboard driver
itself. Consequently, trying to get the count of function keys with
GetKeyboardType(2)
will return 12, not 24.
John Elliott 24 July 2011.