mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 19:26:32 +00:00
test case for iphlpapi GetNetworkParams, dns server list.
svn path=/trunk/; revision=7258
This commit is contained in:
@@ -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
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user