ReactOS  0.4.15-dev-488-gc7a1924
nameserverlist.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <winsock2.h>
#include <iphlpapi.h>
Include dependency graph for nameserverlist.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 6 of file nameserverlist.c.

6  {
7  ULONG OutBufLen = 0;
8  PFIXED_INFO pFixedInfo;
9  PIP_ADDR_STRING Addr;
10 
11  GetNetworkParams(NULL, &OutBufLen);
12  pFixedInfo = malloc(OutBufLen);
13  if (!pFixedInfo) {
14  printf( "Failed to alloc %d bytes.\n", (int)OutBufLen );
15  return 1;
16  }
17 
18  printf( "%d Bytes allocated\n", (int)OutBufLen );
19 
20  GetNetworkParams(pFixedInfo,&OutBufLen);
21 
22  for( Addr = &pFixedInfo->DnsServerList;
23  Addr;
24  Addr = Addr->Next ) {
25  printf( "%c%s\n",
26  Addr == pFixedInfo->CurrentDnsServer ? '*' : ' ',
27  Addr->IpAddress.String );
28  }
29 
30  free( pFixedInfo );
31  return 0;
32 }
#define free
Definition: debug_ros.c:5
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
char String[4 *4]
Definition: iptypes.h:42
PIP_ADDR_STRING CurrentDnsServer
Definition: iptypes.h:83
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
smooth NULL
Definition: ftsmooth.c:416
unsigned int ULONG
Definition: retypes.h:1
#define malloc
Definition: debug_ros.c:4
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:84
#define printf
Definition: config.h:203