DnsQuery_W (Windows Embedded CE 6.0)
1/6/2010
This function is the generic query interface to the DNS name space and provides application programmers with a DNS query resolution interface. Windows Embedded CE supports the Unicode encoding, as indicated by the *_W suffix.
Syntax
DNS_STATUS
WINAPI
DnsQuery_W(
IN PCWSTR pszName,
IN WORD wType,
IN DWORD Options,
IN PIP4_ARRAY aipServers OPTIONAL,
IN OUT PDNS_RECORD * ppQueryResults OPTIONAL,
IN OUT PVOID * pReserved OPTIONAL
);
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 allowable values:- DNS_TYPE_A
- DNS_TYPE_SRV
- DNS_TYPE_AAAA
- Options
[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 Embedded 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 that contain the response. This parameter is optional.
- pReserved
Not supported on Windows Embedded CE.
Return Value
Returns ERROR_SUCCESS 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.
Note
DNS server will try to resolve the SRV record name before responding to the client; if the name cannot be resolved, this may take longer than the default time for the DNS timeout. For this reason, the user may have to increase the configurable DNS timeout delay.
Requirements
Header | windns.h |
Library | dnsapi.lib |
Windows Embedded CE | Windows CE 5.0 and later |