NDIS 6.0 miniport driver custom WMI event issue

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.

  1. 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;
};

  1. 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);

  1. 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

it seems WMI for NDIS is not popular topic here… I posted another WMI related question awhile back but got no response either. In fact ddk document is sparse in this area. I am wondering if the NIC driver people use WMI or just use the traditional device IO interface to communicate with user app? I know there were quite some debates about which is better in this list but I also got impression that WMI should be used for new design from Microsoft’s standpoint.

Why haven’t you mentioned looking at the one NDIS miniport in the WDK that
implements a simple WMI command set? It is for the old Intel 10/100 NIC,
but you can find them on ebay. I used that sample to implement WMI
interfaces to my driver as did someone else in our group. I did the NDIS5
implementation and he did the NDIS6 version earlier.

wrote in message news:xxxxx@ntdev…
> it seems WMI for NDIS is not popular topic here… I posted another WMI
> related question awhile back but got no response either. In fact ddk
> document is sparse in this area. I am wondering if the NIC driver people
> use WMI or just use the traditional device IO interface to communicate
> with user app? I know there were quite some debates about which is better
> in this list but I also got impression that WMI should be used for new
> design from Microsoft’s standpoint.
>

Yes I looked into that sample before I started the project. It implemented fairly simple cases: class with property only and class with method only for ndis 6.0 which I don’t have any issue in my driver. But it does not have event sample and a class with both method and property. I have issues with both of them. For the second case, I contacted MS support and they have not had an answer for me yet. The WMI custom event implementation is different in ndis 6.0 and ndis 5.x. I think I followed the document but it just does not work for me. Did your people worked on ndis 6 also implement the custom WMI event?

xxxxx@gmail.com wrote:

it seems WMI for NDIS is not popular topic here… I posted another WMI related question awhile back but got no response either. In fact ddk document is sparse in this area. I am wondering if the NIC driver people use WMI or just use the traditional device IO interface to communicate with user app? I know there were quite some debates about which is better in this list but I also got impression that WMI should be used for new design from Microsoft’s standpoint.

Correct, WMI with NDIS is not a popular topic.
If you are MSDN subscriber, you may try also
microsoft.public.win32.programmer.kernel newsgroup - it is monitored by
MSDN support. Also, you can try the Product support.

I’ve used WMI when I did NDIS drivers, but with simpler objects, like in
the WDK sample. Also, instead of wbemtest, we used
ExecNotificationQueryasync, like in the following vbscript code:


Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
WScript.Echo “Received event” & vbCrLf & _
wmiObject.GetObjectText_()
End Sub

Set objWMIServices =
GetObject("winmgmts:{impersonationLevel=impersonate}!root/wmi
")

strQuery = “Select * from MSNdis_StatusMediaConnect”

set objSink = WScript.CreateObject(“WbemScripting.SWbemSink”,“SINK_”)

objWMIServices.ExecNotificationQueryasync objSink, strQuery


Good luck.
– pa

I don’t remember if I ever get wmi event working with wbemtest. I used VBS to test my WMI stuff instead.

There is a full VBScript in the following thread demonstrating how to listen/react to wmi event signaled by kmd. Copyright is granted to everyone:)
http://groups.google.com/group/microsoft.public.development.device.drivers/browse_thread/thread/3e6b8959278f921b

Calvin Guan
Broadcom Corp.
Connecting Everything(r)

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel A.
Sent: Tuesday, January 27, 2009 2:33 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] NDIS 6.0 miniport driver custom WMI event issue

xxxxx@gmail.com wrote:

it seems WMI for NDIS is not popular topic here… I posted another WMI related question awhile back but got no response either. In fact ddk document is sparse in this area. I am wondering if the NIC driver people use WMI or just use the traditional device IO interface to communicate with user app? I know there were quite some debates about which is better in this list but I also got impression that WMI should be used for new design from Microsoft’s standpoint.

Correct, WMI with NDIS is not a popular topic.
If you are MSDN subscriber, you may try also
microsoft.public.win32.programmer.kernel newsgroup - it is monitored by
MSDN support. Also, you can try the Product support.

I’ve used WMI when I did NDIS drivers, but with simpler objects, like in
the WDK sample. Also, instead of wbemtest, we used
ExecNotificationQueryasync, like in the following vbscript code:


Sub SINK_OnObjectReady(wmiObject, wmiAsyncContext)
WScript.Echo “Received event” & vbCrLf & _
wmiObject.GetObjectText_()
End Sub

Set objWMIServices =
GetObject("winmgmts:{impersonationLevel=impersonate}!root/wmi
")

strQuery = “Select * from MSNdis_StatusMediaConnect”

set objSink = WScript.CreateObject(“WbemScripting.SWbemSink”,“SINK_”)

objWMIServices.ExecNotificationQueryasync objSink, strQuery


Good luck.
– pa


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Thanks guys! Yes the vbscript and Wbemtest works for the standard NDIS event StatusMediaConnect but not my custom event:( Anybody ever make the ndis 6.0 miniport custom event work? I probably have to contact the MS product support.