Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Home NTDEV
Before Posting...
Please check out the Community Guidelines in the Announcements and Administration Category.

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Problem mapping NDIS OID to WMI class

Shane_CorbinShane_Corbin Member Posts: 260

I have an NDIS miniport driver that I'm creating a couple custom WMI classes for. I have done the following:

  • Created a .mof to describe them
  • Compiled the .mof and referenced it in the .rc
  • Created the .h for my classes
  • Created 2 new OID definitions (starting with 0xFF)
  • Created NDIS_GUID entries that map my OID to the GUID defined in my .mof
  • Return my new NDIS_GUID entries from OID_GEN_SUPPORTED_GUIDS

When running !ndiskd.miniport ffffe605e3f1b1a0 -wmi I see my custom GUIDs like so:

    771a0e47-c82a-43bb-b54e-cccba588a4XX   OID 0xffXXXf01
                       OID, CUSTOM
    23588cf4-2a05-4e5e-9aa0-d005990fa8XX   OID 0xffXXXf02
                       OID, CUSTOM

I replaced a couple values with XX when posting so they don't get copy/pasted somewhere in the wild

Then I followed Jeffrey's handy write-up to try to find my WMI class by doing:

Get-WmiObject -Namespace root\wmi -List  |
    Where-Object {$_.Qualifiers['guid'].Value -eq '{771a0e47-c82a-43bb-b54e-cccba588a4XX}' }

However, nothing gets found. I double checked that this works by doing !ndiskd.help GUID_NDIS_GEN_VENDOR_ID which resulted in:

GUID
    GUID_NDIS_GEN_VENDOR_ID
    {5ec1035e-a61a-11d0-8dd4-00c04fc3358c}

When running the WMI query using that GUID as follows, everything works:

Get-WmiObject -Namespace root\wmi -List  |
    Where-Object {$_.Qualifiers['guid'].Value -eq '{5ec1035e-a61a-11d0-8dd4-00c04fc3358c}' }

What am I missing such that I can find and query my custom WMI classes?

Comments

  • Shane_CorbinShane_Corbin Member Posts: 260

    Found the issue. I had only made WMI classes for non-NDIS devices previously. Doing the OID-WMI bridging was new to me. The missing link was that the name of the MOF resource is a fixed string. Previously I could name it whatever I wanted and then make sure I reference it in my call to WdfDeviceAssignMofResourceName(). Looks like you must use NdisMofResource MOFDATA <your_mof>.bmf

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Internals & Software Drivers 30 Nov 2020 LIVE ONLINE
Writing WDF Drivers 7 Dec 2020 LIVE ONLINE
Developing Minifilters Early 2021 LIVE ONLINE