INF: What CVW Assumes About the Keyboard Interrupt Vector

ID Number: Q76060

3.00

WINDOWS

Summary:

In the Microsoft Windows graphical environment, when the Windows

keyboard driver initializes, it saves the original keyboard interrupt

vector at offset 0 in the code segment containing the Windows keyboard

interrupt handler. (The TRAP.ASM file in the keyboard driver source

code distributed in the Microsoft Windows Device Development Kit (DDK)

contains code that performs this task.) The original keyboard

interrupt vector value (a DWORD) is the address of the interrupt

service routine (ISR) installed either by the BIOS or by a terminate-

and-stay-resident program (TSR) loaded before Windows. This article

refers to the ISR as the pre-Windows keyboard ISR.

CodeView for Windows (CVW) version 3.0, requires the pre-Windows

keyboard ISR address to be stored at offset 0 of the code segment for

the new keyboard interrupt routine. CVW accesses the pre-Windows

keyboard ISR using the following two steps:

1. Use Interrupt 21h Function 25h to retrieve the current keyboard

interrupt vector value (selector:offset)

2. Use the DWORD at offset 0 of the returned selector as the pre-

Windows keyboard ISR

To support CVW, any modification of the keyboard driver must maintain

this convention; any driver or dynamic-link library (DLL) that hooks

the keyboard interrupt must make sure that the pre-Windows keyboard

ISR is stored at offset 0 of the segment for the new keyboard ISR.

In Windows version 3.1, the keyboard driver supports the

GetBIOSKeyProc function to provide the address of the pre-Windows

keyboard ISR.

Additional reference words: 3.00 DDKKBD