[Winpcap-users] How to get local MAC address ?
wentaoshang at gmail.com
Mon Sep 12 02:27:18 PDT 2011
David is correct.
GetAdaptersInfo is obsolete since Windows XP and people should use
The field 'PhysicalAddress' and 'PhysicalAddressLength' in the
'IP_ADAPTER_ADDRESSES' struct correspond to the MAC address of the
device. The 'PhysicalAddressLength' value should equal to 6 for
See http://msdn.microsoft.com/en-us/library/aa366058(v=VS.85).aspx for
2011/9/12 "Fish" (David B. Trout) <fish at infidels.org>:
> 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.
> You're wrong.
> The "GetAdaptersAddresses" API most certainly *is* the correct API to use
> and is the correct answer.
> "Fish" (David B. Trout)
> fish at softdevlabs.com
> Winpcap-users mailing list
> Winpcap-users at winpcap.org
Master Candidate and Research Assistant at CERNET Center & EE
Department, Tsinghua University,
Email: wentaoshang at gmail.com, mundou at qq.com,
Mobile: +86-13466605118, +86-18952150939,
More information about the Winpcap-users