How do I get the TCP/IP subnet mask?
Posted on 1997-06-23
I am writing a Winsocks program in "C" using the MS Visual C++ compiler and I need to get the subnet mask of the network that the program is executed on.
This program is to be run on many different Win95/WINNT systems. Each system's networking may be configured differently (i.e. some may be using Microsoft's tcp/ip stack, others may use a third party tcp/ip stack, or
some systems may be configured for DHCP).
I am aware that Microsoft's stack stores the subnet mask under:
I assume third party tcp/ip stack vendors may store the subnet mask else where. Another assumption is, systems configured for DHCP do not store the subnet mask in the registry. Are these assumptions correct?
There must be an API call to get this information (I find it hard to believe that developers at MicroSoft write registry searches when they need this information). Does anyone know of an API call to get the subnet mask?