DnsQuery_W (Windows CE 5.0)
This function is the generic query interface to the DNS name space and provides application programmers with a DNS query resolution interface. Windows CE supports the Unicode encoding, as indicated by the *_W suffix.
DNS_STATUS WINAPI DnsQuery_W( PCWSTR pszName, WORD wType, DWORD fOptions, PIP4_ARRAY aipServers, PDNS_RECORD* ppQueryResultsSet, PVOID* pReserved);
Parameters
- pszName
[in] Name of the owner of the record set being queried. - wType
[in] Numeric representation of the type of record set queried in host byte order, such as a value of 1 (0x0001) for an A record (DNS_TYPE_A). The following are the permissible values:- DNS_TYPE_A
- DNS_TYPE_NS
- DNS_TYPE_MD
- DNS_TYPE_MF
- DNS_TYPE_CNAME
- DNS_TYPE_SOA
- DNS_TYPE_MB
- DNS_TYPE_MG
- DNS_TYPE_MR
- DNS_TYPE_NULL
- DNS_TYPE_WKS
- DNS_TYPE_PTR
- DNS_TYPE_HINFO
- DNS_TYPE_MINFO
- DNS_TYPE_MX
- DNS_TYPE_TEXT
- DNS_TYPE_SRV
- DNS_TYPE_AAAA
- fOptions
[in] Query option. The DNS_QUERY_BYPASS_CACHE option bypasses the resolver cache on the lookup. - aipServers
[in] Specifies the DNS servers to which the query should be sent. If this is NULL, default DNS servers for the local computer are used. This parameter is optional. Windows CE supports a maximum of one server listed in this parameter. Attempts to specify multiple DNS servers result in failure. - ppQueryResultsSet
[in, out] Pointer to the pointer to the list of resource records comprising the response. This parameter is optional. - pReserved
Not supported on Windows CE.
Return Values
Returns success confirmation upon successful completion. Otherwise, it returns the appropriate DNS-specific error code as defined in Winerror.h.
Remarks
Callers of this function build a query using a fully qualified DNS name and resource record type, and set query options depending on the type of service desired.
Callers are responsible for freeing any returned resource record sets with DnsRecordListFree.
A DNS server may return multiple records in response to a query. A computer that is multihomed, for example, receives multiple A records for the same IP address. It is the caller's responsibility to use as many of the returned records as necessary.
Consider the following scenario, in which multiple returned records require additional activity on behalf of the application. A DnsQuery_W function call is made for a multihomed computer and the application finds that the address associated with the first A record is not responding. The application should then attempt to use other IP addresses specified in the (additional) A records returned from the DnsQuery_W function call.
Requirements
OS Versions: Windows CE 5.0 and later.
Header: Windns.h.
Link Library: Dnsapi.lib.
See Also
DNS Functions | TCP/IP and the DNS Client
Send Feedback on this topic to the authors