6.1.6 Translations

The keyboard driver carries out the following translations:

Scan codes to virtual-key codes (keyboard-interrupt handler)

Virtual-key codes to ANSI characters (ToAscii)

ANSI characters to OEM characters (AnsiToOem and AnsiToOemBuff)

OEM characters to ANSI characters (OemToAnsi and OemToAnsiBuff)

OEM or ANSI characters to virtual-key codes (OemKeyScan, VkKeyScan, and MapVirtualKey)

Virtual-key codes to scan codes (MapVirtualKey)

The keyboard-interrupt handler converts scan codes to virtual-key codes before sending keystrokes to Windows. Windows calls the ToAscii function to convert virtual-key codes to ANSI characters when generating WM_CHAR messages. Windows applications call the AnsiToOem and OemToAnsi functions to convert ANSI characters to OEM-specific characters, and OEM-specific characters to ANSI characters. Windows and Windows applications call OemKeyScan and VkKeyScan to generate scan and virtual-key codes for given OEM or ANSI characters.