DNS_QUERY_RAW_RESULT structure (windns.h)

Important

Some information relates to a prerelease product which may be substantially modified before it's commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Represents a DNS raw query result (see DNS_QUERY_RAW_COMPLETION_ROUTINE).

Syntax

typedef struct _DNS_QUERY_RAW_RESULT {
  ULONG       version;
  DNS_STATUS  queryStatus;
  ULONG64     queryOptions;
  ULONG64     queryRawOptions;
  ULONG64     responseFlags;
  ULONG       queryRawResponseSize;
  BYTE        *queryRawResponse;
  PDNS_RECORD queryRecords;
  ULONG       protocol;
  union {
    SOCKADDR_INET sourceAddr;
    CHAR          maxSa[DNS_ADDR_MAX_SOCKADDR_LENGTH];
  };
} DNS_QUERY_RAW_RESULT;

Members

version

Type: ULONG

The version of this structure. This matches what was set in DNS_QUERY_RAW_REQUEST::resultsVersion. Currently only DNS_QUERY_RAW_RESULT_VERSION1 (0x1) exists.

queryStatus

Type: DNS_STATUS

The status of the query.

queryOptions

Type: ULONG64

Query options that were used in this query. Due to system configuration, these might be different from the query options that you provided in the request. The current options are defined in DNS query options.

queryRawOptions

Type: ULONG64

Additional options that were applied to the raw query. Also see DNS_QUERY_RAW_REQUEST::queryRawOptions.

responseFlags

Type: ULONG64

Additional flags about the query response. Currently none are specified.

queryRawResponseSize

Type: ULONG

Count of bytes in the DNS raw response buffer pointed to by queryRawResponse.

queryRawResponse

Type: BYTE*

Pointer to a buffer containing the wire representation of the DNS query response—a 12-byte header followed by a variable number of records. This buffer is of size queryRawResponseSize bytes.

The pointer might or might not be valid depending on queryStatus. Internal DNS errors would produce an error status and a NULL pointer, but negative responses from the server could produce error status and a valid pointer. If the queryStatus is ERROR_SUCCESS, then the pointer is valid.

queryRecords

Type: PDNS_RECORD

Pointer to a DNS_RECORD structure. This contains the same records as in queryRawResponse, but parsed out into a structure format.

This pointer is valid in the same ways as queryRawResponse, where it's dependent on the queryStatus value.

queryRecords contains the same records as in queryRawResponse, but parsed out into a structure format. However, if there's a new type of DNS record in the response that's not known by the implementation, then that won't be present in queryRecords; but it will be present in queryRawResponse.

protocol

Type: ULONG

The DNS protocol used for the query response. This doesn't necessarily match the protocol in DNS_QUERY_RAW_REQUEST because the DNS system might have changed the outgoing query protocol based on configuration. The query response will be modified, if needed, to match the protocol in the request so that the behavior seen by the caller is seamless. A value of DNS_PROTOCOL_NO_WIRE indicates that the result records and data were produced internally and the DNS system didn't send a query on the wire.

Possible values include:

  • DNS_PROTOCOL_UNSPECIFIED (0x0). The query completed without receiving a response; such as in a cancellation.
  • DNS_PROTOCOL_UDP (0x1).
  • DNS_PROTOCOL_TCP (0x2).
  • DNS_PROTOCOL_DOH (0x3).
  • DNS_PROTOCOL_DOT (0x4).
  • DNS_PROTOCOL_NO_WIRE (0x5). The query completed inline; such as with records from the cache.

sourceAddr

Type: SOCKADDR_INET

The address of the source of the DNS raw response.

maxSa[DNS_ADDR_MAX_SOCKADDR_LENGTH]

Type: CHAR[]

The address of the source of the DNS raw response. You can use the maxSa array in code that doesn't have the SOCKADDR_INET type defined.

Requirements

Requirement Value
Header windns.h