A test only of querying DNS. Currently works with windows dnsapi, and our

dnsapi on windows.  Almost works on reactos.

svn path=/trunk/; revision=7226
This commit is contained in:
Art Yerkes 2003-12-25 08:45:48 +00:00
parent 59eb01566e
commit 89222717af
2 changed files with 51 additions and 0 deletions

View file

@ -0,0 +1,29 @@
#include <windows.h>
#include <stdio.h>
#include <WinError.h>
#include <WinDNS.h>
#include <winsock2.h>
#include <assert.h>
int main( int argc, char **argv ) {
PDNS_RECORD QueryReply, AddrResponse;
DWORD Addr;
assert (DnsQuery ("www.reactos.com", DNS_TYPE_A, DNS_QUERY_STANDARD,
NULL, &QueryReply, NULL) == ERROR_SUCCESS);
AddrResponse = QueryReply;
while( AddrResponse ) {
if( AddrResponse->wType == DNS_TYPE_A ) {
Addr = ntohl( AddrResponse->Data.A.IpAddress );
printf( "www.reactos.com == %d.%d.%d.%d\n",
(int)(Addr >> 24) & 0xff,
(int)(Addr >> 16) & 0xff,
(int)(Addr >> 8) & 0xff,
(int)Addr & 0xff );
}
AddrResponse = AddrResponse->pNext;
}
DnsRecordListFree( QueryReply, DnsFreeRecordList );
return 0;
}

View file

@ -0,0 +1,22 @@
PATH_TO_TOP = ../../..
TARGET_NORC = yes
TARGET_TYPE = program
TARGET_APPTYPE = console
TARGET_NAME = dnsquery
TARGET_SDKLIBS = dnsapi.a ws2_32.a kernel32.a
TARGET_OBJECTS = $(TARGET_NAME).o
TARGET_CFLAGS = -Wall -Werror -g
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
# EOF