Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I get the MAC (a.k.a. hardware) address of the local Ethernet adapter?

0
Posted

How do I get the MAC (a.k.a. hardware) address of the local Ethernet adapter?

0

This FAQ has example code for two hackish methods and one complex but reliable method. The first method involves asking the NetBIOS API for the adapter addresses. This method will fail on systems where NetBIOS isn’t present, and it sometimes gives bogus answers. There is a second method that depends on a property of the RPC/OLE API. This property is documented but not guaranteed to do what we want, and in fact it fails in a number of situations. (Details in the example program’s commentary.) As a result, I have to recommend that you give this method a miss. The third method uses the sparsely-documented SNMP API to get MAC addresses. This method seems to work all the time, but it’s far more complex than the other two methods. There is one other method for which I don’t yet have an example: the IP Helper API has a function called GetIfTable() which returns a table containing MAC addresses, among many other tasty bits of info. This method only works on Windows 98 and its successors and on

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.