[Winpcap-users] How to get local MAC address ?
Fish" (David B. Trout
fish at infidels.org
Sun Sep 11 23:41:58 PDT 2011
Mark Pizzolato wrote:
> Fish wrote:
> > http://msdn.microsoft.com/en-us/library/aa365915(v=vs.85).aspx
> That reference shows how to determine IP addresses not MAC addresses.
It shows how to retrieve a linked list of 'IP_ADAPTER_ADDRESSES' structures,
one field of which happens to be the hardware address. It most certainly is
not ONLY for determining protocol addresses.
The old "GetAdaptersInfo" API is what you previously had to use, which
returned 'IP_ADAPTER_INFO' structures. But it only returned information for
adapters which has an IPv4 IP address associated with them, and not any with
IPv6 addresses assigned.:
The "GetAdaptersAddresses" API was designed to replace the "GetAdaptersInfo"
API. It returns MUCH MORE information than GetAdaptersInfo ever did, and it
does so for ALL adapters, *regardless* of whether or not an IPv4 and/or IPv6
protocol address is assigned to it.
The "GetAdaptersAddresses" API most certainly *is* the correct API to use
and is the correct answer.
"Fish" (David B. Trout)
fish at softdevlabs.com
More information about the Winpcap-users