views:

20

answers:

2

We have a Windows application that can use multiple PCI adapters. These adapters all have external physical connections to other hardware or cables. Our software is configured to know what the physical connection on each card is connected to. Imagine audio software that supports multiple sound inputs and outputs. The audio software is configured to know that the microphone on adapter 1 is the lead singer, while the microphone on adapter 2 is the guitar.

As it happens, this software is often run on laptops with ExpressCard and/or PC Card adapters. As such, the user may routinely remove the adapters. Additionally, our customers may have many more adapters than fit in one laptop. So, you can imagine that someone installs adapters A (PC Card) and B (ExpressCard) in the laptop and configures our software. They now expect that the singer's mic is attached to the PC card adapter and the guitar mic is attached to the ExpressCard adapter. They then go back to the office, take the adapters out and put them in the pile with all the other adapters. The next day when they go to use the software they grab adapters C (PC Card) and D (ExpressCard). When they plug these cards in to the system we'd like to be able to know that adapter C is in the same spot as adapter A was and therefore is hooked up to the singer's mic and that D is in the same spot as B was and is therefore hooked up to the guitar.

Without this feature the user will have to reconfigure our software every time they change cards, which is not especially user friendly.

Is there any way to determine the location in the PCI chain of a hardware adapter in Windows? Is there any other way to accomplish this goal?

I'd like this to work on Windows XP and later. Note that we do control the hardware drivers, so we can make changes there if necessary.

+1  A: 

I think this KB article is what you need.

This article describes how you can get the configuration and location information (such as BusNumber, DeviceNumber, and Function Number) of a Peripheral Component Interconnect (PCI) device in a driver that is part of the target device's driver stack either as a function or filter driver.

Steve Townsend
A: 

As it turns out, PCI location information is available under

HKLM\SYSTEM\CurrentControlSet\Enum\<PnP ID>\LocationInformation

Where for PCI Devices is something like PCI\\

Under Windows XP this will tell you the Bus Number, Device Number and Function Number. This is likely the same information from http://support.microsoft.com/kb/253232 as mentioned by Steve. The advantage of using this registry location is that driver modifications (including API changes) are not needed.

Tom