Modifying Storage Miniport Driver Routines to Support WMI SRBs
Before the miniport driver can support WMI SRBs, you must ensure that the miniport driver contains the required HwScsiWmiQueryReginfo routine and that it performs the indicated actions for the following routines:
The DriverEntry of SCSI Miniport Driver routine:
Indicate to the port driver whether it should allocate memory for SRB extensions. The miniport driver indicates that SRB extensions should be allocated by setting the SrbExtensionSize member of the HW_INITIALIZATION_DATA (SCSI) structure to a nonzero value.
The HwScsiFindAdapter routine:
- Set the WmiDataProvider member of the PORT_CONFIGURATION_INFORMATION (SCSI) structure equal to TRUE.
The HwScsiStartIo routine:
Test Function member of the SRB to see if it is equal to SRB_FUNCTION_WMI. If this condition is TRUE, the miniport driver must process an SRB of type SCSI_WMI_REQUEST_BLOCK rather than an SRB of type SCSI_REQUEST_BLOCK.
Allocate memory for an SCSIWMI_REQUEST_CONTEXT structure to hold SRB context. If the miniport driver might pend WMI requests, allocate memory from the SRB extension so that the miniport driver can maintain request context throughout the processing of an SRB. Otherwise, if there is no chance that the request will ever pend, allocate the memory for the context from the stack.
Check Srb->WMIFlags to determine whether the request is for the adapter or for a logical unit.
Call ScsiPortWmiPostProcess after processing the request if it was pended by the driver. If the driver did not pend the request, then ScsiPortWmiPostProcess should be called in the miniport driver callback routine, rather than the miniport driver's start I/O routine.
Call ScsiPortNotification with RequestComplete and again with NextRequest or (NextLuRequest).