Not receiving WMI events

Hi,

I am trying to issue WMI events from a miniport driver using scsiwmi APIs. But somehow cannot see event instances being received by the user mode applications.

Here is how I try to achieve this in my driver.

  1. Event GUID declaration
    SCSIWMIGUIDREGINFO xxxxGuidList =
    {
    {&ErrorEventGuid, 1, WMIREG_FLAG_INSTANCE_PDO},
    {&SmartEventGuid, 1, WMIREG_FLAG_INSTANCE_PDO}
    };

  2. WMI lib context initialization
    xxxxWmiInitialize(
    IN Pxxxx_DEVICE_EXTENSION DeviceExtension,
    MINIPORT_DRIVER_THREAD mdt
    )
    {
    PSCSI_WMILIB_CONTEXT wmiLibContext;

wmiLibContext = &DeviceExtension->WmiLibContext;

wmiLibContext->GuidList = xxxxGuidList;
wmiLibContext->GuidCount = 2;
wmiLibContext->QueryWmiRegInfo = xxxxQueryWmiRegInfo;
wmiLibContext->QueryWmiDataBlock = xxxxQueryWmiDataBlock;
wmiLibContext->SetWmiDataBlock = NULL;
wmiLibContext->SetWmiDataItem = NULL;
wmiLibContext->ExecuteWmiMethod = NULL;
wmiLibContext->WmiFunctionControl = xxxxFunctionControl;
}

  1. Firing an event
    ScsiPortWmiFireAdapterEvent( DeviceExtension, &SmartEventGuid,
    0, sizeof(SMART_Event),
    &DeviceExtension->WmiSmartEventData);

In between all these, I have code to handle SRB_FUNCTION_WMI requests and event enable/disable handling code which I think is working fine.

I can browse my registered mof classes - so that registration is also fine.

What else can be wrong?

Here is my mof file snippet.

[WMI, dynamic, provider(“WmiProv”), Locale(“MS\0x409”), guid(“94E0321B-49E8-04DB-FFDF-15AD5A22609C”), Description(“SMART / Health Event Warning”)]
class SMART_Event : WMIEvent
{
[key, read] string InstanceName;
[read] boolean Active;
[read, WmiDataId(1)] uint32 ctrlId;
[read, WmiDataId(2)] uint32 EventType;
[read, WmiDataId(3)] uint8 SmartLogData[512];
};

Anybody ??

I have used the scsiwmi’s successfully albeit based on the StorRam sample miniport so I had working code to start from. If WMI communication isn’t working, it can be extremely difficult to find out why. I think that is why, despite the powerful capabilities of WMI, you often see people still using old-fashioned inverted calls. For this problem I recommend using the wbemtest tool to receive the events that way you can rule out any issue with the app code. Once that is working then work on receiving them in your app.

>why. I think that is why, despite the powerful capabilities of WMI, you often see people still using old-

fashioned inverted calls.

I think WMI events are also slow.


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

xxxxx@gmail.com wrote:

I have used the scsiwmi’s successfully albeit based on the StorRam sample miniport so I had working code to start from. If WMI communication isn’t working, it can be extremely difficult to find out why. I think that is why, despite the powerful capabilities of WMI, you often see people still using old-fashioned inverted calls.

And that is such a shame. WMI is an incredibly powerful tool,
essentially the equivalent of the immensely useful /proc and /sys
filesystems on Linux. But except for those few languages that have a
runtime to hide the complexity, the entry barrier for WMI in both user
mode and kernel mode is so high that almost no one wants to go to the
trouble.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.