From experience, I can say that it isn’t easy getting WMI to work properly
with SCSI miniports, especially if it is a virtual SCSI miniport [which,
many would agree, is difficult to get working in the first place even
without WMI :)].
Ours is a virtual SCSI Miniport driver that is WMI enabled. We get WMI SRBs
( SCSI_WMI_REQUEST_BLOCK ) as input in HwScsiStartIo routine.
As per MSDN documentation for “Srb->WMIFlags”,
************************************
WMIFlags
Indicates that the WMI request is for the adapter if
SRB_WMI_FLAGS_ADAPTER_REQUEST is set and that PathId, TargetId, and Lun are
reserved. Otherwise, WMIFlags will be NULL, indicating that the request is
for the device specified by PathId, TargetId, and Lun.
************************************
We are interested in responding to only the WMI SRBs that are for the
adapter and not for any particular device. We are relying on WMIFlags to
differentiate the adapter SRBs from the device SRBs. For that we have a
check like this in our code:
if (Srb->WMIFlags & SRB_WMI_FLAGS_ADAPTER_REQUEST) {
// Adapter specific, respond to it
ScsiPortWmiDispatchFunction (…)
} else {
// Device specific, complete it here itself
Srb->DataTransferLength = 0;
Srb->SrbStatus = SRB_STATUS_SUCCESS;
ScsiPortNotification(RequestComplete, AdapterExtension, Srb);
ScsiPortNotification(NextRequest, AdapterExtension, NULL);
}
The SRB_WMI_FLAGS_ADAPTER_REQUEST is defined in srb.h (Win2K DDK) as
#define SRB_WMI_FLAGS_ADAPTER_REQUEST 0x01
However, at runtime, the value passed for “Srb->WMIFlags” is different in
Windows Server 2003, Windows XP and in Windows 2000. I am getting
“Srb->WMIFlags” as 0x1 in Windows Server 2003, 0x2 in Windows XP with SP1,
0x1 in Windows 2000 with SP4. Anyone has any idea why this distinction?
Also, when there are no targets, on Windows 2000 with SP4, the WMI requests
for the adapter are missing. We get only device specific WMI requests in
this case. Any idea as to why is that happening?
Can someone please better interpret the Srb->WMIFlags?
TIA,
Bandeep