//
// Link with iphlpapi. Lib
//
# Include <stdio. h>
# Include <windows. h>
# Include <iphlpapi. h>
# Pragma comment (Lib, "iphlpapi. lib ")
Int main ()
{
Fixed_info * fixedinfo;
Ulong uloutbuflen;
DWORD dwretval;
Ip_addr_string * pipaddr;
Fixedinfo = (fixed_info *) globalalloc (gptr, sizeof (fixed_info ));
Uloutbuflen = sizeof (fixed_info );
If (error_buffer_overflow =Getnetworkparams(Fixedinfo, & uloutbuflen )){
Globalfree (fixedinfo );
Fixedinfo = (fixed_info *) globalalloc (gptr, uloutbuflen );
}
If (dwretval =Getnetworkparams(Fixedinfo, & uloutbuflen )){
Printf ("call to getnetworkparams failed. Return Value: % 08x \ n", dwretval );
}
Else {
Printf ("Host Name: % s \ n", fixedinfo-> hostname );
Printf ("Domain Name: % s \ n", fixedinfo-> domainname );
Printf ("DNS servers: \ n ");
Printf ("\ t % s \ n", fixedinfo-> dnsserverlist. IPaddress. String );
Pipaddr = fixedinfo-> dnsserverlist. Next;
While (pipaddr ){
Printf ("\ t % s \ n", pipaddr-> IPaddress. String );
Pipaddr = pipaddr-> next;
}
}
Exit (0 );
}