Discussion:
Detecting physical adapter
(too old to reply)
tr265
2010-07-12 16:55:09 UTC
Permalink
On Vista and Win7 I have code that tries to detect if an adapter is
physical or virtual. Since there were problems with the info from
GetIfTable, and GetAdaptersInfo, I ended up using WMI and associators,
and checking if a given adapter had an association with a physical
address range, i/o port, or irq.

This worked until I started testing with USB adapters. These adapters
do not use the above memory, port, and irq resources. After looking
at a lot of logs and trying some test code, it appears I can detect
the physical attribute of the USB adapters by looking at the
PNPDeviceId. If it contains the string ROOT at the beginning of the
ID (for root enumerated devices) or is the string is empty, it is not
a physical device.

Anyone see an obvious problem with this ?

The only thing I can think of is that old, non-PnP, root enumerated
hardware might fail.

Thanks !
Pavel A.
2010-07-13 00:10:14 UTC
Permalink
Post by tr265
On Vista and Win7 I have code that tries to detect if an adapter is
physical or virtual. Since there were problems with the info from
GetIfTable, and GetAdaptersInfo, I ended up using WMI and associators,
and checking if a given adapter had an association with a physical
address range, i/o port, or irq.
This worked until I started testing with USB adapters. These adapters
do not use the above memory, port, and irq resources. After looking
at a lot of logs and trying some test code, it appears I can detect
the physical attribute of the USB adapters by looking at the
PNPDeviceId. If it contains the string ROOT at the beginning of the
ID (for root enumerated devices) or is the string is empty, it is not
a physical device.
Anyone see an obvious problem with this ?
Yes. There are many strange custom buses that nevertheless map to
physical hardware devices.

The only documented way to tell a virtual netcard is presence
of NCF_VIRTUAL bit (or absence of NCF_PHYSICAL)
in its Characteristics property.

-- pa
Post by tr265
The only thing I can think of is that old, non-PnP, root enumerated
hardware might fail.
Thanks !
Loading...