How the Port Driver Processes WMI Requests
Windows notifies a storage port driver of a WMI request by sending a I/O request packet (IRP) of type IRP_MJ_SYSTEM_CONTROL, as described in Windows Management Instrumentation. A system control IRP can contain any of the minor IRP numbers that represent WMI operations. For more information, see WMI Minor IRPs.
To use the Using the SCSI Port WMI Library to process WMI SRBs, your SCSI miniport driver must provide a series of callback routines that correspond to the WMI minor IRP numbers. The following table illustrates the relationship between the miniport driver callback routines and their corresponding WMI minor IRP numbers.
|WMI IRP Minor Number||Miniport Driver Callback Routine|
Each miniport driver callback routine should provide the functionality associated with the corresponding WMI minor IRP number or numbers. Some routines, such as HwScsiWmiFunctionControl, must be able to provide functionality that corresponds to several WMI minor IRP numbers.
Your miniport driver will call the SCSI Port WMI library dispatch routine, ScsiPortWmiDispatchFunction, and then the dispatch routine will call the appropriate miniport driver callback routine. The port driver transfers the WMI minor IRP number to the SRB so that the dispatch routine can consult the SRB to determine which callback routine to call.
The following diagram illustrates the changes that a WMI request undergoes from the moment that a storage port driver receives it until the storage miniport driver passes it to the SCSI Port WMI library dispatch routine.
The following steps explain how the storage stack repackages a WMI IRP as an SRB:
Windows notifies a storage port driver of a WMI request by sending an IRP of type IRP_MJ_SYSTEM_CONTROL.
The port driver repackages the WMI IRP as a WMI SRB of type SCSIWMI_REQUEST_CONTEXT and assigns a value of SRB_FUNCTION_WMI to the SRB's Function member. The port driver transfers the minor WMI IRP number to the SRB WMISubFunction member. and arranges for the I/O manager to call the miniport driver's start I/O routine HwScsiStartIo by means of a call to IoStartPacket.
The miniport driver calls the SCSI Port WMI library dispatch routine to process the SRB. For more information, see Using the SCSI Port WMI Library.