Windows 3.11 Keyboard Layout Translation Driver

In Microsoft Windows 3.11, the system driver responsible for handling keyboard layout translation and mapping hardware keystrokes to usable characters was KEYBOARD.DRV. This article explores the role of KEYBOARD.DRV, how it managed scan code conversion, its configuration within the system initialization files, and how it interfaced with low-level virtualization components in the 16-bit Windows environment.

The Role of KEYBOARD.DRV

The primary keyboard driver in Windows 3.11 was KEYBOARD.DRV. Located in the SYSTEM directory, this 16-bit dynamic link library served as the translation layer between raw hardware input and the graphical Windows environment.

When a user pressed a key, the keyboard controller generated a hardware scan code. KEYBOARD.DRV intercepted these scan codes and translated them into Windows virtual-key codes (such as VK_SPACE or VK_RETURN) and character codes (ANSI characters). It provided essential API export functions, most notably ToAscii, which performed the actual conversion of virtual-key codes and shift-state flags into final character values suitable for applications.

Configuration in SYSTEM.INI

Windows 3.11 configured hardware drivers through the SYSTEM.INI file. The keyboard driver was defined under the [boot] section:

[boot]
keyboard.drv=keyboard.drv

For international keyboard configurations, Microsoft supplied localized versions of the driver or supporting layout tables. In some configurations or OEM releases, dedicated driver files tailored to specific hardware or language layouts (such as KBDUS.DRV, KBDGR.DRV, or KBDUK.DRV) were specified directly on this line to ensure proper regional key mapping.

Interaction with the Virtual Keyboard Device (VKD)

In 386 Enhanced Mode, Windows 3.11 ran on top of a virtualized architecture managed by virtual device drivers (VxDs). The hardware interrupts from the physical keyboard (IRQ 1) were initially caught by the Virtual Keyboard Device, VKD.386.

VKD.386 managed hardware access across multiple virtual machines, such as background MS-DOS sessions and the System Virtual Machine running the Windows graphical shell. Once VKD.386 determined that the keystroke belonged to the Windows environment, it passed the scan code to KEYBOARD.DRV. KEYBOARD.DRV then executed the character set translation and posted the resulting messages (WM_KEYDOWN, WM_KEYUP, and WM_CHAR) to the Windows event queue.