getmac Windows command to get the system MACs

Started by
4 comments, last by hplus0603 12 years, 7 months ago
Hello, I have been using for a while the "getmac" command to get the list of MACs in a Windows system and everything working Ok until I found recently a problem in some laptops where the command didn't work returning a message "Interface not compatible" (translation).

Before getmac I implemented the functionality through IPHLPAPI.DLL but later discovered it is not redistributable :D.

Thanks in advance,
Jorge R.
Advertisement

Before getmac I implemented the functionality through IPHLPAPI.DLL but later discovered it is not redistributable :D.



Why does it matter whether it is redistributable? It's not like you're targeting Windows 98 Original Edition with Internet Explorer 4 or anything, is it?
I would just link against IPHLPAPI.DLL and assume that it's present on the target system, just like COMDLG32.DLL or USER32.DLL or whatever.
enum Bool { True, False, FileNotFound };
However, since you don't distribute the dll you can't be 100% sure it is present and you may have also the problem of the dll version the user has installed (DLL hell). Anyway (after your suggestion), Im thinking to implement both together, if getmac fails, go through IPHLPAPI.DLL.

Thanks for help ;)
If you don't like getmac, you can try parsing output of ipconfig /all

If you don't like getmac, you can try parsing output of ipconfig /all

Looks like that way it would become OS language dependent.

However, since you don't distribute the dll you can't be 100% sure it is present and you may have also the problem of the dll version the user has installed (DLL hell). Anyway (after your suggestion), Im thinking to implement both together, if getmac fails, go through IPHLPAPI.DLL.


These days, people tend to require version 6 of the common controls library, which shiped with Windows XP, and is not redistributable. On Windows 2000, or Windows ME, it is not there. However, in reality this is not a problem, because you simply say "windows xp or better required" and you're done. Nobody who is likely to download and use your program uses Windows ME or Windows 2000 anymore. Windows XP shipped more than 10 years ago!

You might as well worry about the system not having MMX available, or there not being more than 2 MB of VRAM, or not being more than 8 MB of system RAM...
enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement