Windows Mobile 6.5
A version of this page is also available for

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.

    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


[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 allowable 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 Embedded 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 that contain the response. This parameter is optional.


Not supported on Windows Embedded CE.

Returns ERROR_SUCCESS 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.

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.

Windows Embedded CEWindows CE 5.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions