HwScsiWmiSetDataItem routine

A miniport driver's HwScsiWmiSetDataItem routine is called to change a single data item in an instance of a data block. This routine is optional.

Note  The SCSI port driver and SCSI miniport driver models may be altered or unavailable in the future. Instead, we recommend using the Storport driver and Storport miniport driver models.


BOOLEAN HwScsiWmiSetDataItem(
  _In_ PVOID                    DeviceContext,
  _In_ ULONG                    GuidIndex,
  _In_ ULONG                    InstanceIndex,
  _In_ ULONG                    DataItemId,
  _In_ ULONG                    BufferSize,
  _In_ PUCHAR                   Buffer


DeviceContext [in]

Points to the miniport driver-defined context value passed to ScsiPortWmiDispatchFunction.

RequestContext [in]

Points to the SCSIWMI_REQUEST_CONTEXT structure that the miniport driver passed to ScsiPortWmiDispatchFunction.

GuidIndex [in]

Specifies the data block by its index into the list of GUIDs in the SCSI_WMILIB_CONTEXT structure that the miniport driver passed to ScsiPortWmiDispatchFunction.

InstanceIndex [in]

If the block specified by GuidIndex has multiple instances, InstanceIndex specifies the instance.

DataItemId [in]

Specifies the ID of the data item to set.

BufferSize [in]

Specifies the size in bytes of the buffer at Buffer.

Buffer [in]

Points to a buffer that contains the new value for the data item.

Return value

HwScsiWmiSetDataItem 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 HwScsiWmiSetDataItem. Although the return value data type is BOOLEAN, the HwScsiWmiSetDataItem routine actually returns an SRB status value.


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 the miniport driver's HwScsiWmiSetDataItem routine if MinorFunction indicates a request to change an item in an instance of a data block.

If a miniport driver does not implement a HwScsiWmiSetDataItem routine, it must set SetWmiDataItem to NULL in the SCSI_WMILIB_CONTEXT the miniport driver passes to ScsiPortWmiDispatchFunction. In this circumstance, the port driver will return SRB_STATUS_ERROR to the caller.

If the request does not pend, the miniport driver should call ScsiPortWmiPostProcess in its HwScsiWmiSetDataItem callback. Otherwise, the miniport driver should call ScsiPortWmiPostProcess when the request is actually completed. The miniport driver should call ScsiPortWmiPostProcess with the appropriate SrbStatus value.

If the item is read-only, the miniport driver calls ScsiPortWmiPostProcess with SRB_STATUS_ERROR. Otherwise, the miniport driver changes the item and calls ScsiPortWmiPostProcess with SRB_STATUS_SUCCESS.


Target platform



Miniport.h (include Scsi.h)

See also




Send comments about this topic to Microsoft