You can use the iphlpapi.dll library in Windows to enumerate all network interfaces and their IP addresses. Here's an example code snippet in C++ that lists all interfaces' names and their IPv4 and IPv6 addresses:
This code first defines a helper function getIPAddresses that retrieves all IP addresses of a specified family (AF_INET for IPv4 and AF_INET6 for IPv6) using the GetAdaptersAddresses function.
The main function then retrieves the interface information using the GetAdaptersInfo function and iterates over each interface. For each interface, it checks if there's a matching IP address in the IPv4 and IPv6 address lists and prints the interface name and its IP addresses. The interface name is obtained from the Description field of the IP_ADAPTER_INFO structure.
Note that you need to link the iphlpapi.lib library to your project to use the above functions. You can do this by adding the following line to your project settings: