Adding rostests as part of the tree restructure
[reactos.git] / rostests / tests / nameserverlist / nameserverlist.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <winsock2.h>
4 #include <iphlpapi.h>
5
6 int main( int argc, char **argv ) {
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 }