bansaldeep
asked on
Differentiating dummy adaptor from actual NIC
Is it possible to identify from MAC address whether it is address of physical NIC on machine or address of a dummy adaptor installed by modem installation/RAS adaptor on NT or something like that. I've noticed that the RAS adaptor always has xx-xx-xx-00-00-00 address where x is different on every reboot.
If not possible from MAC address, how can we identify this programatically?
If not possible from MAC address, how can we identify this programatically?
ASKER
Couldn't get SetupDiGetDriverInfoDetail to work. It requires DeviceInfoData and DriverInfoData.
DeviceInfoData is retrieved from SetupDiEnumDeviceInfo().
Trying to get DriverInfoData from SetupDiEnumDriverInfo() which always returns error 257 (i.e. no more items) even with index 0.
Code snippet:
========================== ======
for(i=0;SetupDiEnumDeviceI nfo(hDevIn fo,i,
&DeviceInfoData);i++)
{
SetupDiEnumDriverInfo(hDev Info,&Devi ceInfoData ,
SPDIT_COMPATDRIVER ,i,
&DriverInfoData);
SetupDiGetDriverInfoDetail (
hDevInfo,
&DeviceInfoData,
&DriverInfoData,
DriverInfoDetailData,
buffersize,
&buffersize);
========================== =======
DeviceInfoData is retrieved from SetupDiEnumDeviceInfo().
Trying to get DriverInfoData from SetupDiEnumDriverInfo() which always returns error 257 (i.e. no more items) even with index 0.
Code snippet:
==========================
for(i=0;SetupDiEnumDeviceI
&DeviceInfoData);i++)
{
SetupDiEnumDriverInfo(hDev
SPDIT_COMPATDRIVER ,i,
&DriverInfoData);
SetupDiGetDriverInfoDetail
hDevInfo,
&DeviceInfoData,
&DriverInfoData,
DriverInfoDetailData,
buffersize,
&buffersize);
==========================
Hmm, odd. Did you try the SetupDiGetDeviceRegistryPr operty? That matches the code in the MS link exactly. You just need to change the SPDRP_DEVICEDESC to SPDRP_BUSNUMBER. You can also get the driver name to identify the driver, a physical device object name (which may be valid even if the device is virtual) and a bunch of other data on the device. Here's Microsoft's list of properties: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/install/hh/install/di-rtns_a60fa017-1c15-45bf-a178-37516bc0aea1.xml.asp
Also, you could try using SetupDiGetSelectedDriver to get the DriverInfoData. That should return the driver actually used for the device, rather than a list of compatible drivers. Unfortunately this is a rather touchy area of the windows API, and much of what Microsoft says needs to be taken with a big grain of salt. Short of experimentation, there's no way to be sure what is going to be returned.
Also, you could try using SetupDiGetSelectedDriver to get the DriverInfoData. That should return the driver actually used for the device, rather than a list of compatible drivers. Unfortunately this is a rather touchy area of the windows API, and much of what Microsoft says needs to be taken with a big grain of salt. Short of experimentation, there's no way to be sure what is going to be returned.
ASKER
It doesn't work. After changing SPDRP_DEVICEDESC to SPDRP_BUSNUMBER it doesn't put anything in buffer, just null.
1st 3 bytes of NIC MAC address are vendor code. Is there any standard using which vendors assign last 3 bytes? e.g. could they start with 00-00-00 and 00-00-01 and so on?
Could we just safely test last 3 byte values with some minimum value to verify whether it is actual NIC or wage?
1st 3 bytes of NIC MAC address are vendor code. Is there any standard using which vendors assign last 3 bytes? e.g. could they start with 00-00-00 and 00-00-01 and so on?
Could we just safely test last 3 byte values with some minimum value to verify whether it is actual NIC or wage?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If that fails (a false HardwareID) then see if the PCI bus location exists using SetupDiGetDeviceRegistryPr
Hope this helps.