I want to retrieve the actual MAC address of currently installed Network Adapter Cards (ie. MAC address provided by manufacturer). For that we are currently using GetAdaptersInfo API.
But the problem is that GetAdaptersInfo does not retrieve actual MAC address. Is there any IOCTL or API (user/kernel mode) to do so?
wrote in message news:xxxxx@ntdev… > Hi All, > > I want to retrieve the actual MAC address of currently installed Network Adapter Cards (ie. MAC address provided by manufacturer). For that we are currently using GetAdaptersInfo API. > > But the problem is that GetAdaptersInfo does not retrieve actual MAC address. Is there any IOCTL or API (user/kernel mode) to do so? > > Thanks & Regards, > Amit. > >
I want to retrieve the actual MAC address of currently installed Network
Adapter Cards (ie. MAC address provided by manufacturer). For that we are
currently using GetAdaptersInfo API.
But the problem is that GetAdaptersInfo does not retrieve actual MAC
address. Is there any IOCTL or API (user/kernel mode) to do so?
I have used MSNdis_EthernetPermanentAddress class with NdisPermanentAddress property, CIM_NetworkAdapter & Win32_NetworkAdapter class with PermanentAddress property but none of them worked for me.
MSDN states that PermanentAddress in case of CIM_NetworkAdapter & Win32_NetworkAdapter is not implemented yet.
Not sure what you mean by “none of them worked for me” given that you did
not really say what you tried.
But when I use CIM Studio from the WMI Tools to go and enumerate all
instances of MSNdis_EthernetPermanentAddress on my XP system it surely works
just fine and returns every Adapter’s reported permanent address in the
system.
I would guess that Scriptomatic would do the same as well as powershell and
other quick & dirty ways to get at WMI (CIM Studio happened to be handy).
Not working for you does not mean that they don’t work. So maybe you be a
bit more specific?
I have used MSNdis_EthernetPermanentAddress class with NdisPermanentAddress
property, CIM_NetworkAdapter & Win32_NetworkAdapter class with
PermanentAddress property but none of them worked for me.
MSDN states that PermanentAddress in case of CIM_NetworkAdapter &
Win32_NetworkAdapter is not implemented yet.
I want to retrieve the actual MAC address of currently installed Network Adapter Cards (ie. MAC address provided by manufacturer). For that we are currently using GetAdaptersInfo API.
But the problem is that GetAdaptersInfo does not retrieve actual MAC address. Is there any IOCTL or API (user/kernel mode) to do so?
What does it retrieve?
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
I wrote up a little guide on how to query NDIS via WMI and PowerShell. You are lucky: the example that I had used happens to be querying the current MAC address. All you have to do is substitute the word “Permanent” for “Current” in a couple places, and you’re good to go:
GetAdaptersInfo retrives “Current” not “Permanent” MAC address. You can change your system MAC address but not the Adapter Card’s.
That is strictly an implementation detail of some particular board. A
“system” does not have a MAC address. Only adapter cards have MAC
addresses. If you change a board’s MAC address, that’s the address that
it’s going to respond to. It won’t respond to the original address any
more. I know of boards that keep the MAC address in an EEPROM; when you
change the MAC address, you change the EEPROM, and the
factory-programmed MAC address is gone.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.
> Is it the case that I can not do it from user mode VC++ code?
Yes, you absolutely can. Take the PowerShell I posted, and port it to the COM API. E.g., go to the example here: http://msdn.microsoft.com/en-us/library/aa390423(v=VS.85).aspx and change the namespace, WQL query, and the datatype of the resulting VARIANT. But gosh, is that a lot of work, when PowerShell is so easy.
If you know the IP address, which is available via GetAdaptersInfo, could you not try the IP Helper API SendARP() function? This may be simpler if you’re in user mode