As mentioned above, the DnsQueryEx () request requires three parameters. DNS_QUERY_REQUEST is the first parameter used for request information, such as the DNS server to be requested and the domain name to be requested. the DNS_QUERY_REQUESTstructureDNS_QUERY_REQUEST structure contains the parameter language used by DnsQueryEx () for DNS requests.
As mentioned above, the DnsQueryEx () request requires three parameters. DNS_QUERY_REQUEST is the first parameter used for request information, such as the DNS server to be requested and the domain name to be requested. DNS_QUERY_REQUEST structure the DNS_QUERY_REQUEST structure contains the parameter language used by DnsQueryEx () for DNS requests.
As mentioned above, the DnsQueryEx () request requires three parameters. DNS_QUERY_REQUEST is the first parameter used for request information, such as the DNS server to be requested and the domain name to be requested.
DNS_QUERY_REQUEST structure
The DNS_QUERY_REQUEST structure contains the parameters used by DnsQueryEx () for DNS requests.
Syntax
typedef struct _DNS_QUERY_REQUEST { ULONG Version; PCWSTR QueryName; WORD QueryType; ULONG64 QueryOptions; PDNS_ADDR_ARRAY pDnsServerList; ULONG InterfaceIndex; PDNS_QUERY_COMPLETION_ROUTINE pQueryCompletionCallback; PVOID pQueryContext;} DNS_QUERY_REQUEST, *PDNS_QUERY_REQUEST;
Member
Version
The structure version number must be one of the following:
DNS_QUERY_REQUEST_VERSION1(1)
QueryName
A pointer to the string of the DNS name to be queried,
Note:IfQueryNameIf it is null, use the local DNS for query.
QueryType
Resource Record (RR)DNS_Record_TypeIndicates whether the request is sent.
QueryTypeDecidedDNS_QUERY_RESULTReturnedPQueryRecordData format.
For example, ifWTypeYesDNS_TYPE_A,PQueryRecordsThe data format isDNS_A_DATA.
QueryOptions
ContainsDNS_Query_OptionsBitmap ).
DNS_Query_OptionsOptions can be combined, and all options OverwriteDNS_QUERY_STANDARD
PDnsServerList
One pointDNS_ADDR_ARRAYContainsDNS_ServersList.
InterfaceIndex
Interface index. If the InterfaceIndex value is 0, all interfaces will be considered.
PQueryCompletionCallback
PointDNS_QUERY_COMPLETION_ROUTINEPointer to the callback function,DNS_QUERY_COMPLETION_ROUTINEReturns the asynchronous query result.
Note:If the value isNULL, DnsQueryEx isSynchronizationMechanism.
PQueryContext
Pointer to user-defined data.
Note:
Some definitions, suchQueryTypeAnd so on,Please refer to the official website of Microsoft.