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 );
- [in] Name of the owner of the record set being queried.
- [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:
- [in] Query option. The DNS_QUERY_BYPASS_CACHE option bypasses the resolver cache on the lookup.
- [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.
- [in, out] Pointer to the pointer to the list of resource records comprising the response. This parameter is optional.
- Not supported on Windows CE.
Returns success confirmation upon successful completion. Otherwise, it returns the appropriate DNS-specific error code as defined in Winerror.h.
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.
OS Versions: Windows CE 5.0 and later.
Link Library: Dnsapi.lib.
Send Feedback on this topic to the authors