Hi All,
I am implementing some event notification for the ndis miniport driver and
try to use the WMI custom event. But I am not able to receive my event with
Wbemtest tool. Here is my simple code snippet. Hope somebody can shed some light
on it.
- Mof event definition:
[WMI, Dynamic, Provider(“WMIProv”),
guid(“{CF1EC291-DFDA-4d5f-829B-7AAD6B44B90C}”),
localeid(0x409),
WmiExpense(1),
Description(“Event”)]
class My_Event : WMIEvent
{
// Required items
[key, read]
string InstanceName;
[read]
boolean Active;
[read, Description(“Event Data”),
WmiDataId(1)] uint32 EventData;
};
- Event posting code
NDIS_STATUS_INDICATION statusIndication;
My_Event myEvent;
GUID guid = My_EventGuid;
NdisZeroMemory(&statusIndication, sizeof(statusIndication));
qlEvent.EventData = 0xCAFECAFE;
statusIndication.Header.Type = NDIS_OBJECT_TYPE_STATUS_INDICATION;
statusIndication.Header.Revision = NDIS_STATUS_INDICATION_REVISION_1;
statusIndication.Header.Size = NDIS_SIZEOF_STATUS_INDICATION_REVISION_1;
statusIndication.SourceHandle = Handle;
statusIndication.PortNumber = 0;
statusIndication.StatusCode = NDIS_STATUS_MEDIA_SPECIFIC_INDICATION_EX;
statusIndication.StatusBuffer = &myEvent;
statusIndication.StatusBufferSize = sizeof(My_Event);
statusIndication.Guid = guid;
NdisMIndicateStatusEx(Handle, &statusIndication);
- In Wbemtest, use “SELECT * FROM My_Event” in Query Notificaiton and the
tool takes my query and shows opertion in progress. That means my event class
is recognized by the tool and is registered in the system. But I never the
got any event when my driver call NdisMIndicateStatusEx with above code
snippet.
According to NDIS 6.0 document:
http://msdn.microsoft.com/en-us/library/aa504019.aspx and
http://msdn.microsoft.com/en-us/library/aa504021.aspx, NDIS 6.0 does not map
custom status indications to WMI GUIDs and miniport should not set this flag
fNDIS_GUID_TO_STATUS and use NDIS_STATUS_MEDIA_SPECIFIC_INDICATION_EX status
indication for WMI event. So my understanding is we don’t need fill the
NDIS_GUID Structure for status indication(event class) and just use
NDIS_STATUS_MEDIA_SPECIFIC_INDICATION_EX status indication with custom event
GUID set to Guid member of NDIS_STATUS_INDICATION structure.
Was my understanding corrrect and did I miss anything here?
Thanks,
William