I am developing an NDIS KMDF miniport driver for a USB wifi adapter.
The initialization of the driver happens successfully but the driver fails to bind to any
filter driver like the Native wifi filter driver.
After miniport initialization routine suceeeds,Miniport restart function is called.
After that,I get a pnp event 5 NdisDevicePnPEventPowerProfileChanged.
ndisFilterAttachDriver returns c0010006, which decodes as NDIS_STATUS_ADAPTER_NOT_FOUND for all the filter drivers.
The adapter is powered up and I can send USB requests to the device.
Compare the output of !ndiskd.miniport from your driver with that of a working driver. The miniport is probably in a bad state, so pay particular attention to state fields like device state or power state.
Check that there’s no unusual NDIS LWFs on the system. A mandatory LWF that fails to load will block all higher drivers from attaching to the miniport.
I’m not sure what ndisFilterAttachDriver is - are you referring to ndis!ndisAttachFilterToMiniport?
I checked the output of !ndiskd.miniport. The adapter is in power state D0, started and media state connected.
The adapter also shows with other adapters in device manager and “change adapter settings”.
Are there any settings in the inf file that specify the bindings?Can Ndi keys play a role here?I have the Ndi keys in the inf file,but cannot locate them in the registry.
However,the ndis traces show the failure to bind with native wifi filter:
here is the output of ndiskd.miniport.Everything seems to be fine,still there is no binding:
: kd> !ndiskd.miniport fffffa8010f001a0
MINIPORT
PureLiFi Li-Fi-X
Ndis handle fffffa8010f001a0
Ndis API version v6.20
Adapter context fffffa801123fa40
Miniport driver fffffa801122c020 - purelifi_lifix v1.0
Network interface fffffa800d445870
Media type 802.11
Physical medium Native802.11
Device instance USB\VID_221A&PID_0100\04A3D2EEF9
Device object fffffa8010f00050 More information
MAC address 19-19-19-19-19-19
AUTOMATIC DIAGNOSTICS
This miniport will operate in a slow path until 1 more protocol(s) bind, or
until a 90-second timeout expires.
What does this mean?
STATE
Miniport Running
Device PnP Started
Datapath Normal
Interface Up
Media Connected
Power D0
References 8
Total resets 0
Pending OID None
Flags NOT_BUS_MASTER, DEFAULT_PORT_ACTIVATED,
SUPPORTS_MEDIA_SENSE, DOES_NOT_DO_LOOPBACK,
MEDIA_CONNECTED
PnP flags PM_SUPPORTED, DEVICE_POWER_ENABLED, RECEIVED_START,
HARDWARE_DEVICE, NDIS_WDM_DRIVER
BINDINGS
Protocol list Driver Open Context
No protocols have an open binding
Filter list Driver Module Context
No filters are attached
Nothing jumps out at me; the miniport state looks fine from here. You can try installing a different wireless adapter (e.g., a cheap USB dongle from your local electronics store) on the same PC, and see if it works. If it works, then the problem is probably with your driver.
Another very generic tip. NDIS’s binding engine was rewritten for Windows 8.1. So the set of OS bugs in Windows 8 and Windows 7 (which this appears to be?) is quite different from the OS bugs in Windows 8.1 and later. (Naturally I claim that there are fewer binding bugs in Windows 8.1.). Anyway if you try the same thing on a Windows 8.1 machine, and the problem doesn’t repro, then you might have hit some sort of OS bug.
Since NDIS *tried* to bind NWIFI to your miniport, I’m inclined to think that the INF is correct. I’m not guaranteeing it – INFs have some arcane stuff in them – but generally the INF’s job is done by the time NDIS tries to bind filters+protocols.
After the attach bindings fail, the adapter shows up in “change adapter settings” GUI in the network sharing center.
Some OIDs are being queried for general statistics.They complete successfully in my driver.
The output of netsh command shows the interface as “not ready”.
Also, it shows wlanqueryinterface returned error 5023.The ipconfig of course does not show the wireless adapter.
What entries do I need to bind to vwifibus? I have included vwifibus entries in the inf file and also set vwifi attributes during initialization.
I have not implemented send/receive handlers yet(They have dummy implementation).
But i don’t think that should make any difference to the binding filters.