Table of contents
TOC
Collapse the table of content
Expand the table of content

How the Port Driver Processes WMI Requests

Last Updated: 5/9/2016

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 NumberMiniport Driver Callback Routine

IRP_MN_REGINFO

HwScsiWmiQueryReginfo

IRP_MN_QUERY_ALL_DATA

HwScsiWmiQueryDataBlock

IRP_MN_QUERY_SINGLE_INSTANCE

HwScsiWmiQueryDataBlock

IRP_MN_CHANGE_SINGLE_INSTANCE

HwScsiWmiSetDataBlock

IRP_MN_CHANGE_SINGLE_ITEM

HwScsiWmiSetDataItem

IRP_MN_EXECUTE_METHOD

HwScsiWmiExecuteMethod

IRP_MN_ENABLE_EVENTS

HwScsiWmiFunctionControl

IRP_MN_DISABLE_EVENTS

HwScsiWmiFunctionControl

IRP_MN_ENABLE_COLLECTION

HwScsiWmiFunctionControl

IRP_MN_DISABLE_COLLECTION

HwScsiWmiFunctionControl

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.

how the storage stack handles a wmi irp

  1. The following steps explain how the storage stack repackages a WMI IRP as an SRB:

  2. Windows notifies a storage port driver of a WMI request by sending an IRP of type IRP_MJ_SYSTEM_CONTROL.

  3. 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.

  4. 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.


Send comments about this topic to Microsoft

© 2016 Microsoft