ReactOS 0.4.16-dev-136-g52192f1
dnsapi.c File Reference
#include <windows.h>
#include <stdio.h>
#include <winerror.h>
#include <windns.h>
#include <winsock2.h>
#include <assert.h>
Include dependency graph for dnsapi.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 8 of file dnsapi.c.

8 {
9 PDNS_RECORD QueryReply, AddrResponse;
10 DWORD Addr;
11
16 assert (DnsQuery ("www.reactos.com", DNS_TYPE_A, DNS_QUERY_STANDARD,
17 NULL, &QueryReply, NULL) == ERROR_SUCCESS);
18 AddrResponse = QueryReply;
19 while( AddrResponse ) {
20 if( AddrResponse->wType == DNS_TYPE_A ) {
21 Addr = ntohl( AddrResponse->Data.A.IpAddress );
22 printf( "www.reactos.com == %d.%d.%d.%d\n",
23 (int)(Addr >> 24) & 0xff,
24 (int)(Addr >> 16) & 0xff,
25 (int)(Addr >> 8) & 0xff,
26 (int)Addr & 0xff );
27 }
28 AddrResponse = AddrResponse->pNext;
29 }
31
32 return 0;
33}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
VOID WINAPI DnsRecordListFree(PDNS_RECORD list, DNS_FREE_TYPE type)
Definition: record.c:526
#define assert(x)
Definition: debug.h:53
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:97
#define ntohl(x)
Definition: module.h:205
#define DnsQuery
Definition: windns.h:938
#define DNS_QUERY_STANDARD
Definition: windns.h:8
@ DnsNameDomainLabel
Definition: windns.h:145
@ DnsNameDomain
Definition: windns.h:144
@ DnsFreeRecordList
Definition: windns.h:139
#define DnsValidateName
Definition: windns.h:940
#define PDNS_RECORD
Definition: windns.h:636
#define DNS_TYPE_A
Definition: windns.h:41
#define DNS_ERROR_INVALID_NAME_CHAR
Definition: winerror.h:1877
#define DNS_ERROR_INVALID_NAME
Definition: winerror.h:1876