ReactOS 0.4.15-dev-7196-g0fe0b40
nameserverlist.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <stdlib.h>
3#include <winsock2.h>
4#include <iphlpapi.h>
5
6int main( int argc, char **argv ) {
7 ULONG OutBufLen = 0;
8 PFIXED_INFO pFixedInfo;
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}
static int argc
Definition: ServiceArgs.c:12
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
int main()
Definition: test.c:6
#define printf
Definition: freeldr.h:94
DWORD WINAPI GetNetworkParams(PFIXED_INFO pFixedInfo, PULONG pOutBufLen)
#define argv
Definition: mplay32.c:18
PIP_ADDR_STRING CurrentDnsServer
Definition: iptypes.h:83
IP_ADDR_STRING DnsServerList
Definition: iptypes.h:84
char String[4 *4]
Definition: iptypes.h:42
struct _IP_ADDR_STRING * Next
Definition: iptypes.h:46
IP_ADDRESS_STRING IpAddress
Definition: iptypes.h:47
uint32_t ULONG
Definition: typedefs.h:59