[Home] [Purchase] [Download] [Manual] [Acknowledgements] [Sitemap] [Release Notes] [FAQ]

Up ] Editing VK Mappings ] Modifiers ] [ Special NLS functions ] Special NLS Functions Editor ] Mouse keys ] List of Virtual Key Codes ]

Special NLS Functions

The special NLS functions are present in certain Far Eastern (FE) keyboards, which generally function in conjunction with a special IME (Input Method Editor) application for the entry of complex ideographic characters. These functions are assigned to individual virtual key codes (VKs) in combination with a specific combination of the Shift, Ctrl and Alt modifier keys. Any such combination overrides the usual Unicode character-producing functions that may be otherwise defined for the same VK / modifier position.

Since version 19.5.0, KbdEdit's Low-level editor fully supports editing of all available NLS functions. This, as will be shown shortly, can provide useful customisations even to non-FE layouts.

NLS functions in the UI

Keys with NLS functions are visually denoted by a small red mark in the upper right corner:

KbdEdit NLS function key marker

The "Special NLS functions" dropdown indicates the type of NLS function for the current key: None, Alternative VK code or Advanced.

Simple NLS function: Alternative VK code

The "Alternative VK code" function allows the key to produce a different VK code for the chosen combinations of the Shift, Ctrl and Alt modifier keys. Activating this function changes the UI to reveal additional two widgets:

  • Alternative virtual code dropdown is where the alternative VK code is chosen. The choice must be different from the key's original VK code, and cannot include any of the Shift, Alt or Ctrl codes.
     
  • For modfiier combinations check-list box defines the modifier combination(s) that trigger the alternative code.
    Note that all combinations of Shift / Ctrl / Alt are available, ie the choice is not restricted to the active modifier combinations used for high-level Unicode mappings.
KbdEdit Special NLS function dropdown Alternative VK code KbdEdit Alternative VK code dropdown KbdEdit Alternative VK code modifier combinations check-list box

A non-empty choice has to be made in both widgets for the "Alternative VK code" function to "stick". Leaving the dropdown empty and/or clearing all check-boxes has the same effect as reverting the Special NLS functions dropdown to None.

The alternative VK codes function is useful for laptops and other keyboards with a limited number of physical keys. It allows the missing keys to be simulated via an unused modifier combination of another key. This example shows how to simulate a missing VK_APPS (ie "context menu") key.

The function can also be used to suppress or modify the function of a standard key. A good example is Caps Lock, which is often pressed by accident. By using Alternative VK codes, Caps Lock can instead be assigned to a multi-key combination, reducing the incidence of its accidental activation. An added bonus is that the "plain" position remains free for other uses. This example shows how the "plain" Caps Lock can be used as a general-purpose Kana modifier key, while still retaining the "Caps Lock" function in conjunction with Ctrl.

Note that the "Alternative VK code" function is merely a special combination of the more general advanced NLS functions settings, relying on the "param VK" NLS function type. You can easily reveal the lower level settings used to emulate an "alternative VK" by switching to the Special NLS functions dialog.

Limitations of Alternative VK code customisations

Keys simulated via the Alternative VK code function have a few limitations over the use of plain, "unmutable" keys.

Shift, Ctrl and Alt cannot be modified/produced

The Shift, Ctrl and Alt VK codes are reserved for the modifier function, and hence cannot be modified nor produced as an "alternative" VK.

The "down" state of Shift, Ctrl and/or Alt cannot be suppressed

It is not possible to suppress the "down" state of the Shift/Ctrl/Alt modifiers used to trigger the alternative VK. If you have defined Ctrl + <base VK> to produce an <alternative VK>, the latter will always be seen as Ctrl + <alternative VK>, rather than <alternative VK> alone.

Depending on the alternative VK simulated, this may or may not be an issue. When simulating the VK_APPS key ("context menu", see the example), the fact that the Ctrl key is down is immaterial, because both Ctrl+VK_APPS and VK_APPS have the same effect - displaying the context menu.

The "Caps Lock" function is similarly unaffected by the state of Shift/Ctrl/Alt.

On the other hand, cursor movement keys (Home/End/arrows), function keys and letter-producing keys are usually quite sensitive to the state of Shift/Ctrl/Alt. In most text editors, VK_HOME alone moves the cursor to the beginning of the line, while Shift-VK_HOME selects text between the cursor and the beginning of the line, and Ctrl+VK_HOME goes to the beginning of the file. Keys like this are generally not good candidates for alternative VKs.

The original VK can accidentally remain stuck in the "down" state

Depending on the order in which the original key and the Shift/Ctrl/Alt keys are pressed, it is possible for the original VK code to accidentally remain stuck in the "down" state.

Taking this example, which assigns Caps Lock as an alternative VK to Ctrl+Kana, this sequence will result in a stuck Kana key:

  1. press (and hold) the Kana key
  2. press (and hold) the Ctrl key
  3. release the Kana key
  4. release the Ctrl key

This happens because pressing the Ctrl down (step 2) temporarily turns Kana into Caps Lock, causing the step 3 to be interpreted as releasing Caps Lock instead of Kana. Without a matching "key up" event, the OS continues to see Kana as being in the "down" state, until it is re-synced by a clean key down/up sequence.

In most cases, this is just a harmless artifact, and the stuck base key can be easily "unstuck" by simply pressing/releasing it alone. Accidental sticking can be easily avoided by being disciplined about the order of key presses/releases, ie ensuring that the Ctrl/Shift/Alt modifiers are always first to be pressed, and last to be released.

Advanced NLS functions

The NLS functions are capable of even more complex customisations, which are accessed by choosing "Advanced" in the "Special NLS functions" dropdown or, alternatively, choosing "NLS functions" in the context menu:

KbdEdit Special NLS function dropdown Advanced KbdEdit NLS functions popup menu item

This opens up the Special NLS functions dialog, in which the key's NLS functions can be tuned at a much finer level of detail.

For keys with advanced NLS functions, a detailed summary of all NLS functions is shown in a separate window:

KbdEdit Special NLS functions usmmary

Note however that most of the advanced NLS functions are highly specific to the narrow domain of Far Eastern IME layouts. Unless you are working on a Japanese or Korean layout, it is unlikely you will find them useful.

System layouts with NLS functions

A standard Windows installation contains several layout DLL files with special NLS functions. All these layouts target two FE languages: Japanese and Korean:

Language Layout DLL file Description Registered as
Japanese KBDJPN.DLL JP Japanese Keyboard Layout Stub driver 00000411 "Japanese"
kbd101.dll JP Japanese Keyboard Layout for 101 Not directly registered, see
further below
kbd106.dll JP Japanese Keyboard Layout for 106
kbd106n.dll JP Japanese Keyboard Layout for 106
kbdibm02.dll JP Japanese Keyboard Layout for IBM 5576-002/003
kbdlk41a.dll DEC LK411-AJ Keyboard Layout
kbdnec.dll JP Japanese Keyboard Layout for (NEC PC-9800) Not directly registered.
Not supported by KbdEdit
kbdnec95.dll JP Japanese Keyboard Layout for (NEC PC-9800 Windows 95)
kbdnecat.dll JP Japanese Keyboard Layout for (NEC PC-9800 on PC98-NX)
kbdnecnt.dll JP Japanese NEC PC-9800 Keyboard Layout
f3ahvoas.dll JP Japanese Keyboard Layout for Fujitsu FMV oyayubi-shift keyboard
Korean KBDKOR.DLL KO Hangeul Keyboard Layout Stub driver 00000412 "Korean"
kbd101a.dll KO Hangeul Keyboard Layout for 101 (Type A) Not directly registered, see
further below
kbd101b.dll KO Hangeul Keyboard Layout for 101(Type B)
kbd101c.dll KO Hangeul Keyboard Layout for 101(Type C)
kbd103.dll KO Hangeul Keyboard Layout for 103

These layouts offer some clues as to how the NLS functions are used internally to support the FE-specific functions. As an example, system layout KBDJPN.DLL (00000411 Japanese (Japan)) has special NLS functions defined for virtual keys VK_CAPITAL (Caps Lock) and VK_OEM_3 ( ` inverted quotation mark):

Virtual key Modifiers Function
VK_CAPITAL Shift Alpha Num
Ctrl Hiragana
Shift+Ctrl "param VK" VK_KANA
Alt Katakana
other normal function, ie
VK_CAPITAL
VK_OEM_3 Ctrl Sbcs-Dbcs
Alt "param VK" VK_KANJI
other normal function, ie
VK_OEM_3

Some of these functions rely on the "param VK" NLS function, which causes the original key to "mutate" into a different VK code for the chosen modifier combination - this same functionality is used to implement KbdEdit's alternative VK code feature.

Thanks to this function, the Japanese keyboard can toggle the KANA state for KANALOK mappings using Shift+Ctrl+CapsLock, which has the same effect as if VK_KANA was mapped to a hypothetical physical key of its own. Likewise, Alt+VK_OEM_3 produces the VK_KANJI code, removing the need for a dedicated Kanji key.

As mentioned above, the Shift / Ctrl / Alt combinations controlling the NLS functions are not restricted to the active modifier combinations. This is why NLS functions such as Alt+VK_CAPITAL (Katakana) and Alt+VK_OEM_3 (VK_KANJI) are possible, even though Alt alone is not an active (nor valid) high-level modifier combination.

Specifics of Japanese and Korean layout registration

Of the 16 Japanese/Korean layout DLL files listed above, only two are actually registered in the Windows list of installed layouts : KBDJPN.DLL (registered as 00000411 "Japanese") and KBDKOR.DLL (00000412 "Korean").

The remaining layout files are activated in a special indirect way: instead of being referenced directly by a unique KLID, they are selected and loaded through a rather convoluted and poorly documented process, which depends on certain registry values under HKLM\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters. These two blog posts have more details:

This special way of registering layout DLL files is currently not supported by KbdEdit, although there are plans to support it eventually.

To make any of these "shadow" DLL files visible to KbdEdit, you first have to import them via Register Layout DLL file, so that they are given a proper KLID of their own (note that this still won't allow you to edit the unsupported NEC/Fujitsu layout files kbdnec*.dll and f3ahvoas.dll).

Also note that, even though KbdEdit allows you to register any layout DLL under the Japanese or Korean locale, including modified versions of the manually registered "shadow" DLL files, they are unlikely to function properly with the Japanese/Korean IMEs. This is because they lack the special registration under HKLM\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters, as described in the above blog posts.

However, you may still be able to register your custom Japanese/Korean layout DLL files manually, by editting string values "LayerDriver JPN" and "LayerDriver KOR":

KbdEdit registry settings for Korean and Japanese layout DLL files

Manual index

Copyright KbdSoft 2007-2019