mirror of
https://github.com/reactos/reactos.git
synced 2024-10-19 23:50:05 +00:00
test case for iphlpapi GetNetworkParams, dns server list.
svn path=/trunk/; revision=7258
This commit is contained in:
parent
c359123664
commit
2b28365c4e
23
reactos/apps/tests/nameserverlist/makefile
Normal file
23
reactos/apps/tests/nameserverlist/makefile
Normal file
|
@ -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
|
32
reactos/apps/tests/nameserverlist/nameserverlist.c
Normal file
32
reactos/apps/tests/nameserverlist/nameserverlist.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <winsock2.h>
|
||||
#include <iphlpapi.h>
|
||||
|
||||
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;
|
||||
}
|
Loading…
Reference in a new issue