NDIS miniport not recognized in Win 7

I have inherited a project at my new job. I have written none of the code, but have been building the driver written by someone else and slightly tweaking the XP inf file to get the driver loading and working under Windows 7 as a 32-bit driver. Once that works, I will start with the 64-bit version.

The driver is an NDIS miniport that is being updated from NDIS 5.1 to NDIS 6.2. The driver builds fine. The following definitions are used along with many others:

C_DEFINES=$(C_DEFINES) -DNDIS620_MINIPORT=1 -DNDIS61_MINIPORT=1

My DriverEntry routine fills the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure and calls NdisMRegisterMiniportDriver with a status of NDIS_STATUS_SUCCESS. NdisGetVersion returns 0x60014, which makes sense.

Soon, my InitializeHandlerEx (the miniport’s AddDevice routine) is called and completes with success. I have walked through the InitializeHandlerEx routine many times in WinDbg and everything that happens makes sense. The routine has many steps and I won’t list them all, but a device object is successfully created and inserted in the stack.

Device Manager is happy with the NIC. Everything mentioned in the Properties window is good news about the driver.

It is a wireless device and so when I bring up the Network and Sharing Center to connect to a wireless Acess Point, my adapter is not mentioned. If I then go to the Change adapter settings screen it is absent there, too. If I select Set Up a Connection or Network followed by Manually connect to a wireless network, the adapter is available in a drop down list. Selecting it leads to An unexpected error ocurred. Nothing is logged by my driver that I can see. I am kernel debugging the driver during the attempt to connect and no trace messages are recorded. Also, I can’t find anything in the Event Viewer.

So I have a wireless NIC. Code to convert from NDIS 5.x to NDIS 6.x was written by someone else. I have the code and can build the driver. The driver completes DriverEntry with success. It calls NdisMRegisterMiniportDriver with a successful result. The AddDevice routine is called (InitializeHandlerEx) and completes successfully. Device Manager is happy with the driver. I don’t see the adapter in the Network and Sharing Center.

Caveat - the INF file was for NDIS 5.x. *IfType, *MediaType and *PhysicalMediaType were missing and so the AddDevice routine was not called. Once these were included in the INF file the AddDevice routine was called and things appeared to be working until I tried to connect to a missing adapter. My guess is I am omitting something in the INF file since it was never updated to NDIS 6.x.

Any comments or ideas?

Thanks
Paul

There are some substantial architectural differences between a 5.x wireless NIC and a 6.x wireless NIC. In addition to all the usual NDIS changes to go from 5 to 6 (completely different datapath, pause support, different registration APIs, etc) you need to change all the wifi stuff to use the native wifi stack. Without seeing any specifics of your driver, it’s hard to know which bit is missing :).

Can you share the output of !ndiskd.miniport on your miniport’s instance? We expect to see your miniport in a Running/Started/green-colored state, and the nwifi filter bound above your miniport. (Compare the output of !ndiskd.miniport on *your* miniport to that of a known-working NDIS 6.20 wireless NIC).

Does your INF have the right entries for native wifi (stolen from the netawifi.inx sample):

*IfType = 71 ; IF_TYPE_IEEE80211
*MediaType = 16 ; NdisMediumNative802_11
*PhysicalMediaType = 9 ; NdisPhysicalMediumNative802_11

HKR, Ndi\Interfaces, UpperRange, 0, “ndis5”
HKR, Ndi\Interfaces, LowerRange, 0, “wlan,ethernet,vwifi”

(Note that the OS will still work if you do not have the ‘vwifi’ entry [i.e., you don’t support virtual wifi], but I think that might be a logo requirement…)

MSDN has a pretty decent checklist of things to change when porting to NDIS6 – you should be able to breeze through those to make sure nothing silly happened:
http://msdn.microsoft.com/en-us/library/ff570898(v=VS.85).aspx
http://msdn.microsoft.com/en-us/library/ff570025(v=VS.85).aspx
But if NdisMRegisterMiniportDriver succeeds, it’s unlikely that this part is profoundly broken; it’s more likely on the native wifi side. For the WIFI, I don’t know of any comprehensive checklist (the changes are quite substantial), but as a quick litmus test, make sure that GeneralAttributes.MediaType is NdisMediumNative802_11, and that you’re handling OID_DOT11_DESIRED_BSSID_LIST and not the legacy OID_802_11_BSSID.

my InitializeHandlerEx (the miniport’s AddDevice routine) is called
MiniportAddDevice and MiniportInitializeEx are separate calls. If you have a WDM background, you can think of them as IRP_MN_ADD_DEVICE and IRP_MN_START_DEVICE. (And MiniportHaltEx is the reciprocal of initialize, i.e., IRP_MN_STOP_DEVICE).

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@praxiseng.com
Sent: Wednesday, February 23, 2011 2:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] NDIS miniport not recognized in Win 7

I have inherited a project at my new job. I have written none of the code, but have been building the driver written by someone else and slightly tweaking the XP inf file to get the driver loading and working under Windows 7 as a 32-bit driver. Once that works, I will start with the 64-bit version.

The driver is an NDIS miniport that is being updated from NDIS 5.1 to NDIS 6.2. The driver builds fine. The following definitions are used along with many others:

C_DEFINES=$(C_DEFINES) -DNDIS620_MINIPORT=1 -DNDIS61_MINIPORT=1

My DriverEntry routine fills the NDIS_MINIPORT_DRIVER_CHARACTERISTICS structure and calls NdisMRegisterMiniportDriver with a status of NDIS_STATUS_SUCCESS. NdisGetVersion returns 0x60014, which makes sense.

Soon, my InitializeHandlerEx (the miniport’s AddDevice routine) is called and completes with success. I have walked through the InitializeHandlerEx routine many times in WinDbg and everything that happens makes sense. The routine has many steps and I won’t list them all, but a device object is successfully created and inserted in the stack.

Device Manager is happy with the NIC. Everything mentioned in the Properties window is good news about the driver.

It is a wireless device and so when I bring up the Network and Sharing Center to connect to a wireless Acess Point, my adapter is not mentioned. If I then go to the Change adapter settings screen it is absent there, too. If I select Set Up a Connection or Network followed by Manually connect to a wireless network, the adapter is available in a drop down list. Selecting it leads to An unexpected error ocurred. Nothing is logged by my driver that I can see. I am kernel debugging the driver during the attempt to connect and no trace messages are recorded. Also, I can’t find anything in the Event Viewer.

So I have a wireless NIC. Code to convert from NDIS 5.x to NDIS 6.x was written by someone else. I have the code and can build the driver. The driver completes DriverEntry with success. It calls NdisMRegisterMiniportDriver with a successful result. The AddDevice routine is called (InitializeHandlerEx) and completes successfully. Device Manager is happy with the driver. I don’t see the adapter in the Network and Sharing Center.

Caveat - the INF file was for NDIS 5.x. *IfType, *MediaType and *PhysicalMediaType were missing and so the AddDevice routine was not called. Once these were included in the INF file the AddDevice routine was called and things appeared to be working until I tried to connect to a missing adapter. My guess is I am omitting something in the INF file since it was never updated to NDIS 6.x.

Any comments or ideas?

Thanks
Paul


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

Jeffrey,
Thanks, I fixed it. A few days ago I had set
HKR, Ndi\Interfaces, UpperRange, 0, “ndis5”
to
HKR, Ndi\Interfaces, UpperRange, 0, “ndis6”
as a test, but forgot to change it back. It was supposed to be a one install test, but I let it bite me.

I now have an adapter to test.
Thanks again,
Paul

PS - tell Eric Hanson I said hello.