TdiDispatchDeviceControl routine

The TdiDispatchDeviceControl routine processes IRPs that are set with the major function code IRP_MJ_DEVICE_CONTROL.


NTSTATUS TdiDispatchDeviceControl(
  _In_ PDEVICE_OBJECT DeviceObject,
  _In_ PIRP           Irp,
  _In_ PIO_STACK      IrpSp


  • DeviceObject [in]
    Pointer to the device object created by the TDI driver.

  • Irp [in]
    Pointer to the IRP.

  • IrpSp [in]
    Pointer to the I/O stack location of the transport driver in the given IRP.

Return value

TdiDispatchDeviceControl returns STATUS_SUCCESS if it satisfied the given request. Otherwise, it returns a driver-determined error status, depending on the given IOCTL_XXX minor function code in the IRP.


Usually, TdiDispatchDeviceControl calls TdiMapUserRequest and, if it returns STATUS_SUCCESS, calls the transport's TdiDispatchInternalDeviceControl function with the input DeviceObject and Irp pointers. If TdiMapUserRequest returns an error indicating that the given IOCTL_XXX in the Irp did not match any of the system-defined IOCTL_TDI_XXX codes, most transports simply complete the IRP with a driver-determined error status, such as STATUS_INVALID_DEVICE_REQUEST or STATUS_NOT_SUPPORTED.

However, if a transport supports any driver-defined "private" IOCTLs that a transport-dedicated application uses to communicate with the transport, its TdiDispatchDeviceControl performs a switch operation on these IOCTL_XXX and calls internal driver functions to process them, as well as calling TdiDispatchInternalDeviceControl when TdiMapUserRequest returns STATUS_SUCCESS.

For more information about driver-defined IOCTL codes, see Using I/O Control Codes.

TdiDispatchDeviceControl runs at IRQL PASSIVE_LEVEL or IRQL DISPATCH_LEVEL.

Note The TDI feature is deprecated and will be removed in future versions of Microsoft Windows. Depending on how you use TDI, use either the Winsock Kernel (WSK) or Windows Filtering Platform (WFP). For more information about WFP and WSK, see Windows Filtering Platform and Winsock Kernel. For a Windows Core Networking blog entry about WSK and TDI, see Introduction to Winsock Kernel (WSK).


Target platform



Wdm.h (include Ntddk.h, Wdm.h, or Ntddk.h)



See also




Send comments about this topic to Microsoft