Retrieving NIC information using SNMP queries

Environment: VC6

For networking applications, the need to know what NICs are in a system is critical so that sockets can be bound to the proper device. Windows programming allows many ways to retrieve information about each NIC, but there is one way that seems to be the preferred method for Microsoft. The IPCONFIG program, which comes with Windows NT/2000, and the WINIPCFG program, which comes with Windows 9x/ME, both use a DLL called INETMIB1.DLL to retrieve information about each NIC using SNMP queries.

I created this program with the help of information I found in several places on Internet, mostly from posts on CodeGuru.com by Stas Khirman and Quinton Tormanen. The sample code didn't quite suit my needs, so I modified it. The source code and executable in the ZIP file allow all NIC information to be retrieved with two function calls: GetNICCount() and GetNICInfo().

Downloads

Download source - 24 Kb