8.1.3 Setting Up an ISR

An NT device driver’s DriverEntry routine must register the driver’s ISR(s) by calling IoConnectInterrupt when the driver is loaded.

An NT device driver must provide resident storage for at least one interrupt object pointer if it has an ISR. Usually, this pointer is stored in the device extension of the device object that represents the physical device that generates interrupts. The interrupt object pointer can be stored in a controller extension if the driver creates a controller object, or it can be stored in nonpaged pool allocated by the driver.

If an NT driver has a single ISR that handles interrupts for more than one device on different vectors or has more than one ISR, it must provide storage for an interrupt spin lock to be associated with every set of interrupt objects for all its devices. Its interrupt spin lock must be initialized with KeInitializeSpinLock before the driver registers its ISR(s) by calling IoConnectInterrupt. Such a driver also must provide storage for as many interrupt object pointers as the IRQs it handles.

For more information about registering ISRs and interrupt objects, see Chapter 3.