A miniport driver's HwStorWmiFunctionControl routine is called to enable or disable notification of events, or to enable or disable data collection for data blocks that the miniport driver designated as expensive to collect.
UCHAR HwStorWmiFunctionControl( IN PVOID DeviceContext, IN PSCSIWMI_REQUEST_CONTEXT RequestContext, IN ULONG GuidIndex, IN SCSIWMI_ENABLE_DISABLE_CONTROL Function, IN BOOLEAN Enable );
A pointer to the miniport driver-defined context value passed to ScsiPortWmiDispatchFunction.
A pointer to the SCSIWMI_REQUEST_CONTEXT structure that the miniport driver passed to ScsiPortWmiDispatchFunction.
Specifies the block by its index into the list of GUIDs in the SCSI_WMILIB_CONTEXT structure that the miniport driver passed to ScsiPortWmiDispatchFunction.
Specifies ScsiWmiEventControl to enable or disable an event, or ScsiWmiDataBlockControl to enable or disable data collection for a block that was registered as expensive to collect (that is, a block for which the miniport driver set WMIREG_FLAG_EXPENSIVE in Flags of the SCSIWMIGUIDREGINFO structure used to register the block).
Specifies TRUE to enable the event or data collection, or FALSE to disable it.
HwStorWmiFunctionControl returns SRB_STATUS_PENDING if the request is pending, or a nonzero SRB status value if the request was completed. The SRB status value returned by this routine is the same as what was passed in to ScsiPortWmiPostProcess.
This routine is identical in both definition and function to its SCSI port equivalent, HwScsiWmiFunctionControl.
When a miniport driver receives an SRB in which the Function member is set to SRB_FUNCTION_WMI, it calls ScsiPortWmiDispatchFunction with a pointer to an initialized SCSI_WMILIB_CONTEXT structure and MinorFunction set to Srb->WmiSubFunction. The SCSI port driver calls a miniport driver's HwStorWmiFunctionControl routine if MinorFunction indicates a request to enable or disable an event, or to enable or disable collection for a data block that the miniport driver registered as expensive to collect.
If a miniport driver does not implement a HwStorWmiFunctionControl routine, it must set WmiFunctionControl to NULL in the SCSI_WMILIB_CONTEXT the miniport driver passes to ScsiPortWmiDispatchFunction. The port driver returns SRB_STATUS_SUCCESS to the caller.
It is unnecessary for the miniport driver to check whether events or data collection are already enabled for a block because the port driver sends a single enable request when the first data consumer enables the block, and sends a single disable request when the last data consumer disables the block. The port driver will not call HwStorWmiFunctionControl more than once to enable a block without an intervening call to disable it.
If the SRB is completed in the HwStorWmiFunctionControl callback, then the miniport driver calls ScsiPortWmiPostProcess with an appropriate SrbStatus. If the miniport driver pends this SRB, then it should call ScsiPortWmiPostProcess when the SRB is done and before completing the SRB.