I would like to have the above. I found the IP Helper API, and it works. Only problem is that on systems older than Vista I can not identify whether the adapter is wireless or a regular Ethernet. I need to support WinXP and Server 2003 as well.
Here is the relevant quote from the documentation(IP Helper):
An IEEE 802.11 wireless network interface. Note This adapter type is returned on Windows Vista and later. On Windows Server 2003 and >Windows XP , an IEEE 802.11 wireless network interface returns an adapter type of >MIB_IF_TYPE_ETHERNET.
So what is a good way to identify wireless adapters and get their MAC addresses on WinXP/Server2003 and later?
GetAdapterAddresses is a part of the windows api, and should provide you with both information about mac addresses and NIC type.
The call return a structure pointing to a linked list of adapters.
Make sure that you do not hard code the size of the structure to maintain portability between windows versions, because the
IP_ADAPTER_ADDRESSES
structure have changed size between versions.Edit:
This obviously only give you the mac address, since it only reports correct type after Vista
But, GetIfTable returns a
MIB_IFTABLE
structure, from this you can read aMIB_IFROW
which has a dwType, which might be of the type IF_TYPE_IEEE80211 or not. This has no notes that this is spesific for Vista and should be valid for XP unless MS messed up their documentation.Both of these should have a physical address, so you should be able to match these two entries to identify one single card.