Getting PCI Device ID/Vendor ID through Windows API

Hello all,

Not sure if this is the correct place to post this but I’m looking for some info on accessing PCI Device ID/ Vendor ID information. Essentially what I want to do is use the Vendor ID/Device ID to identify a commercial PCI card.

The card is installed in a Compact PCI crate running Windows XP embedded. The usual method for our custom designed PCI cards is to use PLX API calls to access this information. However these aren?t compatible with the commercial card, which leaves me wading through the Windows API for a method to obtain the Device ID/Vendor ID.

That about sums things up, any help will be gratefully received.

Many thanks,
Robert Washington

The standard answer here is the DevCon sample is your friend. I guess I
am trying to understand what you will do with this once you have it?

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@gmail.com [mailto:xxxxx@gmail.com]
Posted At: Wednesday, March 17, 2010 1:52 PM
Posted To: ntdev
Conversation: Getting PCI Device ID/Vendor ID through Windows API
Subject: Getting PCI Device ID/Vendor ID through Windows API

Hello all,

Not sure if this is the correct place to post this but I’m looking for
some
info on accessing PCI Device ID/ Vendor ID information. Essentially
what I
want to do is use the Vendor ID/Device ID to identify a commercial PCI
card.

The card is installed in a Compact PCI crate running Windows XP
embedded. The
usual method for our custom designed PCI cards is to use PLX API calls
to
access this information. However these aren?t compatible with the
commercial
card, which leaves me wading through the Windows API for a method to
obtain
the Device ID/Vendor ID.

That about sums things up, any help will be gratefully received.

Many thanks,
Robert Washington

__________ Information from ESET Smart Security, version of virus
signature
database 4952 (20100317) __________

The message was checked by ESET Smart Security.

http://www.eset.com

If you’re trying to do something from user mode you can look at the devcon
sample from the WDK. It’s pre-built in tools\devcon and the source code is
in src\setup\devcon.

As an example, you can try this command to see the PCI devices in the system
and their hardware IDs:

devcon hwids PCI*

You could also look for a specific vendor and device ID:

devcon.exe hwids “PCI\VEN_8086&DEV_D158”

Though whether this is appropriate for what you’re trying to do or not it
unclear.

-scott


Scott Noone
Consulting Associate
OSR Open Systems Resources, Inc.
http://www.osronline.com

wrote in message news:xxxxx@ntdev…
> Hello all,
>
> Not sure if this is the correct place to post this but I’m looking for
> some info on accessing PCI Device ID/ Vendor ID information. Essentially
> what I want to do is use the Vendor ID/Device ID to identify a commercial
> PCI card.
>
> The card is installed in a Compact PCI crate running Windows XP embedded.
> The usual method for our custom designed PCI cards is to use PLX API calls
> to access this information. However these aren?t compatible with the
> commercial card, which leaves me wading through the Windows API for a
> method to obtain the Device ID/Vendor ID.
>
> That about sums things up, any help will be gratefully received.
>
> Many thanks,
> Robert Washington
>
>

Thanks for a quick response.

Ok maybe I wasn’t being too clear. A service runs on the Compact PCI crate that polls the status, checking that particular cards are in the correct slots. This is a preventative measure to ensure that the correct cards are present in the Compact PCI crate.

The getting of the Device ID/Vendor ID must be done within the service loop, so I don’t think DevCon will be suitable for this. Hopefully this makes things a bit clearer.

RobW

If you have a known configuration then getting the slot number will
work. What you cannot do is assume that the slots are in any known
order, for a given motherboard. They may be numbered in any random
order the manufacturer chooses, and if it is someone like DELL that has
a number of suppliers an order of 5 machines can have 5 different
orders.

You can get both the PCI id and the slot ID from DevCon and you can
incorporate parts of that source code into a service with no problem.

Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@gmail.com [mailto:xxxxx@gmail.com]
Posted At: Wednesday, March 17, 2010 2:16 PM
Posted To: ntdev
Conversation: Getting PCI Device ID/Vendor ID through Windows API
Subject: RE: Getting PCI Device ID/Vendor ID through Windows API

Thanks for a quick response.

Ok maybe I wasn’t being too clear. A service runs on the Compact PCI
crate
that polls the status, checking that particular cards are in the
correct
slots. This is a preventative measure to ensure that the correct
cards are
present in the Compact PCI crate.

The getting of the Device ID/Vendor ID must be done within the service
loop,
so I don’t think DevCon will be suitable for this. Hopefully this
makes
things a bit clearer.

RobW

__________ Information from ESET Smart Security, version of virus
signature
database 4952 (20100317) __________

The message was checked by ESET Smart Security.

http://www.eset.com

I think I am getting somewhere with this now. Looking through the source for Devcon I was able to find the SetupDiGetDeviceRegistryProperty() function which I think will do the job.

Cheers.

Right. Nobody was suggesting you USE the devcon utility, they were rather suggesting that you use the CODE in the devcon utility as a guide for how you can accomplish what you need to accomplish.

In other words, “Devcon is your friend” :slight_smile:

Peter
OSR