Using IoConnectInterruptEx Prior to Windows Vista

A driver for Windows 2000, Windows XP, or Windows Server 2003 can link to the Iointex.lib library to use IoConnectInterruptEx on those versions of the operating system.

To use IoConnectInterruptEx in such a driver, include Iointex.h in the source code for your driver, immediately following Wdm.h or Ntddk.h. The Iointex.h header declares a prototype for the routine. When you build your driver, make sure that it is statically linked to Iointex.lib.

For operating systems prior to Windows Vista, the version of IoConnectInterruptEx provided by Iointex.lib only supports the CONNECT_FULLY_SPECIFIED version of the routine. If any other version is specified, the routine returns an NTSTATUS error code, and sets Parameters->Version to CONNECT_FULLY_SPECIFIED.

Using this behavior, you can write your driver so that it uses CONNECT_LINE_BASED or CONNECT_MESSAGE_BASED on Windows Vista, and CONNECT_FULLY_SPECIFIED on earlier operating systems. First call IoConnectInterruptEx with Parameters->Version equal to CONNECT_LINE_BASED or CONNECT_MESSAGE_BASED. If the return value is an error code and Parameters->Version != CONNECT_FULLY_SPECIFIED, then retry the operation with Parameters->Version set to CONNECT_FULLY_SPECIFIED.

The following code example illustrates the technique:


// deviceExtension is a pointer to the driver's device extension. 
//     deviceExtension->MessageUsed is a BOOLEAN.

RtlZeroMemory( &params, sizeof(IO_CONNECT_INTERRUPT_PARAMETERS) );

// Set members of params.MessageBased here.

status = IoConnectInterruptEx(&params);

if ( NT_SUCCESS(status) ) {
    // Operation succeeded. We are running on Windows Vista.
    devExt->MessageUsed = TRUE; // We save this for posterity.
} else {
    // Check to see if we are running on an operating system prior to Windows Vista.
    if (params.Version == CONNECT_FULLY_SPECIFIED) {
        devExt->MessageUsed = FALSE;  // We're not using message-signaled interrupts.
        // Set members of params.FullySpecified here.
        status = IoConnectInterruptEx(&params);
    } else {
        // Other error.



Send comments about this topic to Microsoft