Setting Up a Storage Class Driver's Device Extension
In the Device Extensions of each device object created by a storage class driver, that driver provides storage for whatever driver-determined data it uses to manage I/O requests for the device, such as the pointer to the PDO passed to AddDevice, the pointer to the device object returned by IoAttachDeviceToDeviceStack, a back pointer to its own device object, and so forth.
Most storage class drivers also provide storage for the following information:
A device-type-specific time-out value
The class driver can pass the time-out value in SRBs it sends to the port driver, which times SRB_FUNCTION_EXECUTE_SCSI requests (see SCSI_REQUEST_BLOCK) on behalf of each class driver. The port driver returns an SRB with its SrbStatus member set to SRB_STATUS_TIMEOUT if the interval between when the port driver sends the request to the underlying driver and when the request completes exceeds the specified time-out value.
A pointer to the class driver's error-handling routine
See Storage Class Driver's IoCompletion Routines for more information about error-handling in storage class drivers.
A count that the driver maintains of bus protocol errors on the device
A pointer to a driver-allocated buffer for sense data
A class driver must allocate memory for returned sense data from cache-aligned, nonpaged pool. For more information about allocating memory for driver buffers, see Allocating System-Space Memory.
A driver-determined default value for SrbFlags that the class driver sets in SRBs
A pointer to a lookaside list header if the driver sets up a lookaside list for the SRBs it allocates
See Using Lookaside Lists for more information.
Pointers to an IRP and an SRB allocated and held in reserve for requests that must succeed even in low memory conditions, for paging operations as well as error recovery operations (such as those performed by a Storage Class Driver's ReleaseQueue Routine)
For information about how class drivers get and use this data, see Storage Class Driver's GetDescriptor Routine.
Flags that indicate the previous and current PnP state, to manage transitions between states on the device
A flag that indicates the current device power state, to avoid extra work in handling redundant power requests
A count of system paging files, if any, on the device, based on paging-notification requests received by the driver (IRP_MJ_PNP with IRP_MN_DEVICE_USAGE_NOTIFICATION)
A storage class driver cannot send requests to its device through the storage port driver without using the device object pointer that was returned by IoAttachDeviceToDeviceStack and stored in the device extension by the driver's AddDevice routine.