Uniquely identifying a device with a twin

I am trying to figure out a fool proof way of identifying a specific device on our hardware.

We have 2 wireless Mini PCI Express cards that are the same Vendor, Dev, Subsystem.

I need to save some registry settings for an NDIS IM driver. One of the wireless cards is attached to an external antenna connector and I need to prevent that card from transmitting if the external antenna is switched in. Or more like, I need to switch out the external antenna if the wireless card is in normal transmit mode. For the other wireless card I need to flash an onboard LED for link and traffic.

Bus Number
I have tried using the “Bus” number assigned by Windows, but if the customer disables either card in the BIOS, windows renumbers the Bus’s so I can’t tell which card was disabled.

GUID
I can’t use the GUID because if the customer or windows update installs new drivers, we get a new GUID.

If I look through Device Manager - View by connection, I can see that Windows know all 5 PCIe buses on the system, and puts the 2 wireless cards under their respective PCIe bus # correctly, even if one or the other is disabled.

But how as an IM driver, can I run back up the chain from a device to the PCIe bus it’s attached to, and then get the real bus# of that parent device?

Or is there a much better way of doing all of this?

Don’t do it in the driver. Do it in a NotifyObject association with your
NetService (IM driver). At the time your IM driver is bound to the adapter,
you can much more easily query the *real* hardware NIC PnP information to
assess its parentage and make a decision on which attachment path you have.

Good Luck,
Dave Cattley

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@email.com
Sent: Friday, November 06, 2009 4:12 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] Uniquely identifying a device with a twin

I am trying to figure out a fool proof way of identifying a specific device
on our hardware.

We have 2 wireless Mini PCI Express cards that are the same Vendor, Dev,
Subsystem.

I need to save some registry settings for an NDIS IM driver. One of the
wireless cards is attached to an external antenna connector and I need to
prevent that card from transmitting if the external antenna is switched in.
Or more like, I need to switch out the external antenna if the wireless card
is in normal transmit mode. For the other wireless card I need to flash an
onboard LED for link and traffic.

Bus Number
I have tried using the “Bus” number assigned by Windows, but if the customer
disables either card in the BIOS, windows renumbers the Bus’s so I can’t
tell which card was disabled.

GUID
I can’t use the GUID because if the customer or windows update installs new
drivers, we get a new GUID.

If I look through Device Manager - View by connection, I can see that
Windows know all 5 PCIe buses on the system, and puts the 2 wireless cards
under their respective PCIe bus # correctly, even if one or the other is
disabled.

But how as an IM driver, can I run back up the chain from a device to the
PCIe bus it’s attached to, and then get the real bus# of that parent device?

Or is there a much better way of doing all of this?


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

>Don’t do it in the driver. Do it in a NotifyObject association with your

NetService (IM driver). At the time your IM driver is bound to the adapter,
you can much more easily query the *real* hardware NIC PnP information to
assess its parentage and make a decision on which attachment path you have.

Good Luck,
Dave Cattley

Sorry, I wasn’t clear. I don’t own the wireless driver, it’s the default driver provided with Win7 and updated at times via Windows Update, so I can’t do anything in the wireless driver (and wouldn’t to if I could).

In the IM driver, I’m unsure how to query the NIC PnP information as you put it, to figure out the parentage of the device. I don’t know what calls are available to me to query that sort of thing.

There are no such calls available in KM to walk up a device’s tree. You need to do that in user mode.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@email.com
Sent: Friday, November 06, 2009 1:50 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Uniquely identifying a device with a twin

Don’t do it in the driver. Do it in a NotifyObject association with
your NetService (IM driver). At the time your IM driver is bound to
the adapter, you can much more easily query the *real* hardware NIC PnP
information to assess its parentage and make a decision on which attachment path you have.

Good Luck,
Dave Cattley

Sorry, I wasn’t clear. I don’t own the wireless driver, it’s the default driver provided with Win7 and updated at times via Windows Update, so I can’t do anything in the wireless driver (and wouldn’t to if I could).

In the IM driver, I’m unsure how to query the NIC PnP information as you put it, to figure out the parentage of the device. I don’t know what calls are available to me to query that sort of thing.


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

You were clear. I was not.

“Don’t do it in your IM driver. Do it in a Notify Object associated with
your IM driver”.

Your IM driver has a relationship to the NIC only through the ‘binding’ path
created by NDIS. It does not have a PnP relationship to it. That is why
you should do this work in a NotifyObject. Here, you are given the NDIS
binding path information that includes the ability to traverse easily to the
PnP DevNode of the NIC - from which you can then use SetupDI APIs to grok
the bus relationships necessary (I presume) to divine the decision criteria
you need per NIC. You then just put that information into the registry
where you IM driver can find it as either (virtual) adapter configuration or
more appropriately as binding specific protocol configuration.

Forget about traversing these relationships in kernel mode. Yes, it can be
done. Don’t bother. That is what the NotifyObject extension to the NetCfg
class installer is all about. The NIC cannot ‘move’ in the PnP tree without
the Class Installer knowing (actually, it cannot move period - it would be a
new NIC then).

Good Luck,
Dave Cattley

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@email.com
Sent: Friday, November 06, 2009 4:50 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Uniquely identifying a device with a twin

Don’t do it in the driver. Do it in a NotifyObject association with your
NetService (IM driver). At the time your IM driver is bound to the
adapter,
you can much more easily query the *real* hardware NIC PnP information to
assess its parentage and make a decision on which attachment path you have.

Good Luck,
Dave Cattley

Sorry, I wasn’t clear. I don’t own the wireless driver, it’s the default
driver provided with Win7 and updated at times via Windows Update, so I
can’t do anything in the wireless driver (and wouldn’t to if I could).

In the IM driver, I’m unsure how to query the NIC PnP information as you put
it, to figure out the parentage of the device. I don’t know what calls are
available to me to query that sort of thing.


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