From 2b28365c4eea7a33c44858654d651ac4e484c075 Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Fri, 26 Dec 2003 23:59:49 +0000 Subject: [PATCH] test case for iphlpapi GetNetworkParams, dns server list. svn path=/trunk/; revision=7258 --- reactos/apps/tests/nameserverlist/makefile | 23 +++++++++++++ .../tests/nameserverlist/nameserverlist.c | 32 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 reactos/apps/tests/nameserverlist/makefile create mode 100644 reactos/apps/tests/nameserverlist/nameserverlist.c diff --git a/reactos/apps/tests/nameserverlist/makefile b/reactos/apps/tests/nameserverlist/makefile new file mode 100644 index 00000000000..ddba4c7a22d --- /dev/null +++ b/reactos/apps/tests/nameserverlist/makefile @@ -0,0 +1,23 @@ + +PATH_TO_TOP = ../../.. + +TARGET_NORC = yes + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = nameserverlist + +#TARGET_SDKLIBS = iphlpapi.a ws2_32.a kernel32.a +TARGET_SDKLIBS = ws2_32.a kernel32.a ntdll.a + +TARGET_OBJECTS = $(TARGET_NAME).o iphlpapi.o registry.o + +TARGET_CFLAGS = -Wall -Werror -g + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF diff --git a/reactos/apps/tests/nameserverlist/nameserverlist.c b/reactos/apps/tests/nameserverlist/nameserverlist.c new file mode 100644 index 00000000000..9faab029b49 --- /dev/null +++ b/reactos/apps/tests/nameserverlist/nameserverlist.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +int main( int argc, char **argv ) { + ULONG OutBufLen = 0; + PFIXED_INFO pFixedInfo; + PIP_ADDR_STRING Addr; + + GetNetworkParams(NULL, &OutBufLen); + pFixedInfo = malloc(OutBufLen); + if (!pFixedInfo) { + printf( "Failed to alloc %d bytes.\n", (int)OutBufLen ); + return 1; + } + + printf( "%d Bytes allocated\n", (int)OutBufLen ); + + GetNetworkParams(pFixedInfo,&OutBufLen); + + for( Addr = &pFixedInfo->DnsServerList; + Addr; + Addr = Addr->Next ) { + printf( "%c%s\n", + Addr == pFixedInfo->CurrentDnsServer ? '*' : ' ', + Addr->IpAddress.String ); + } + + free( pFixedInfo ); + return 0; +}