Storage Class Driver's Dispatch Routines

Class driver DRIVER_DISPATCH and DispatchClose routines usually have no device-specific requirements. Most storage class drivers are intermediate drivers; their dispatch routines just return STATUS_SUCCESS to indicate that a given device object exists so that higher-level drivers and, indirectly, user-mode applications can open the device for I/O and close the device afterward.

Class driver DispatchDeviceControl and DispatchInternalDeviceControl routines must be resident; that is, they cannot be pageable nor part of a driver's pageable-image section. Depending on the IOCTL of a given request, such a dispatch routine might call a paged routine or wait for a call from a synchronization or notification object (thereby blocking the executing thread), but the dispatch routine must be able to pass an unknown IOCTL through at DISPATCH_LEVEL.

A storage class driver must have a DispatchPnP routine for requests to start, stop, and remove the device and respond to other PnP requests such as notification that the device is on the paging path. For details about handling a PnP start request, see Handling PnP Start in a Storage Class Driver. For details about handling other PnP requests, see Handling PnP Requests to Storage Peripherals.

A storage class driver must also have a DispatchPower routine for requests to set the power state of its device. For details, see Handling Power Requests to Storage Peripherals.

A storage class driver must have a DispatchShutdown routine and possibly a DispatchFlushBuffers routine if its device caches data internally, if its device might be attached to a bus driven by an HBA that caches data internally, or if a file system is layered above the class driver. To maintain data integrity, such a cache should be flushed to the device before the system is shut down.

See also Writing Dispatch Routines for more information about general requirements for dispatch routines.