DRIVER_STARTIO callback function (wdm.h)

The StartIo routine starts the I/O operation described by an IRP.



void DriverStartio(
  [in, out] _DEVICE_OBJECT *DeviceObject,
  [in, out] _IRP *Irp


[in, out] DeviceObject

Caller-supplied pointer to a DEVICE_OBJECT structure. This is the device object for the target device, previously created by the driver's AddDevice routine.

[in, out] Irp

Caller-supplied pointer to an IRP structure that describes the requested I/O operation.

Return value



A driver's StartIo routine executes in an arbitrary thread context at IRQL = DISPATCH_LEVEL.

The StartIo routine is optional. A driver's StartIo routine, if supplied, should be named XxxStartIo, where Xxx is a driver-specific prefix. The driver's DriverEntry routine must store the StartIo routine's address in DriverObject->DriverStartIo. (If no routine is supplied, this pointer must be NULL.)

A driver can use IoSetStartIoAttributes to set attributes on when its StartIo routine is called.

For detailed information about implementing a driver's StartIo routine, see Writing a StartIo Routine.


To define a StartIo callback routine, you must first provide a function declaration that identifies the type of callback routine you're defining. Windows provides a set of callback function types for drivers. Declaring a function using the callback function types helps Code Analysis for Drivers, Static Driver Verifier (SDV), and other verification tools find errors, and it's a requirement for writing drivers for the Windows operating system.

For example, to define a StartIo callback routine that is named MyStartIo, use the DRIVER_STARTIO type as shown in this code example:


Then, implement your callback routine as follows:

    struct _DEVICE_OBJECT  *DeviceObject,
    struct _IRP  *Irp 
      // Function body

The DRIVER_STARTIO function type is defined in the Wdm.h header file. To more accurately identify errors when you run the code analysis tools, be sure to add the _Use_decl_annotations_ annotation to your function definition. The _Use_decl_annotations_ annotation ensures that the annotations that are applied to the DRIVER_STARTIO function type in the header file are used. For more information about the requirements for function declarations, see Declaring Functions by Using Function Role Types for WDM Drivers. For information about _Use_decl_annotations_, see Annotating Function Behavior.


Requirement Value
Target Platform Desktop
Header wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)