If your driver handles device interrupts, it must provide EvtInterruptEnable and EvtInterruptDisable callback functions that enable and disable the interrupts. Typically, these callback functions run at the device's DIRQL and must do whatever is necessary to enable and disable a device's interrupt mechanism. For passive-level interrupts, these callback functions run at IRQL = PASSIVE_LEVEL while holding the passive-level interrupt lock.
If your driver must perform additional operations that are related to enabling or disabling interrupts, and if these additional operations cannot be performed at IRQL = DIRQL, the driver can also provide EvtDeviceD0EntryPostInterruptsEnabled and EvtDeviceD0ExitPreInterruptsDisabled callback functions. These two callback functions run at IRQL = PASSIVE_LEVEL with no interrupt lock held, and can call framework object methods that are unavailable at IRQL = DIRQL.
The framework calls the driver's EvtInterruptEnable and EvtDeviceD0EntryPostInterruptsEnabled callback functions each time the device enters its working (D0) state, after the framework has called the driver's EvtDeviceD0Entry callback function.
The framework calls the driver's EvtDeviceD0ExitPreInterruptsDisabled and EvtInterruptDisable callback functions each time the device leaves its working state, before the framework calls the driver's EvtDeviceD0Exit callback function. For more information about when the framework calls a driver's callback functions, see PnP and Power Management Scenarios.
You must not assume that a device will use the same interrupt resources each time the framework calls your driver's EvtInterruptEnable callback function. Sometimes the PnP manager redistributes system resources, and it might assign new interrupt resources to your device.
The driver can call WdfInterruptGetInfo to determine a device's interrupt resources. The driver can call WdfInterruptGetDevice to determine the device that an interrupt object belongs to. (A few drivers might call WdfInterruptWdmGetInterrupt.)
To enable and disable interrupts directly, the driver can call the interrupt object's WdfInterruptEnable and WdfInterruptDisable methods, which call the driver's EvtInterruptEnable and EvtInterruptDisable event callback functions. However, most drivers should just allow the framework to call the EvtInterruptEnable and EvtInterruptDisable callback functions at the proper times.