DNS_CUSTOM_SERVER structure (windns.h)

Represents a DNS custom server. A DNS_CUSTOM_SERVER object is passed to DnsQueryEx via the DNS_QUERY_REQUEST3 structure.

To use DNS_CUSTOM_SERVER together with ServerAddr, include ws2ipdef.h before windns.h.

Syntax

typedef struct _DNS_CUSTOM_SERVER {
  DWORD   dwServerType;
  ULONG64 ullFlags;
  union {
    PWSTR pwszTemplate;
    PWSTR pwszHostname;
  };
  CHAR    MaxSa[DNS_ADDR_MAX_SOCKADDR_LENGTH];
} DNS_CUSTOM_SERVER;

Members

dwServerType

Type: DWORD

The server type. Must be one of the following.

Value Description
DNS_CUSTOM_SERVER_TYPE_UDP 0x1 Perform unsecure name resolution
DNS_CUSTOM_SERVER_TYPE_DOH 0x2 Perform DNS-over-HTTPS name resolution

ullFlags

Type: ULONG64

A value that contains a bitmap of the following options.

Value Description
DNS_CUSTOM_SERVER_UDP_FALLBACK 0x1 Server might fall back to unsecure resolution

pwszTemplate

Type: PWSTR

A NULL-terminated wide string representing the DNS-over-HTTPS template.

If dwServerType is set to DNS_CUSTOM_SERVER_TYPE_UDP, then this field must be NULL.

If dwServerType is set to DNS_CUSTOM_SERVER_TYPE_DOH, then this field must point to a valid NULL-terminated string.

pwszHostname

MaxSa[DNS_ADDR_MAX_SOCKADDR_LENGTH]

Type: CHAR[DNS_ADDR_MAX_SOCKADDR_LENGTH]

A byte array, which designates storage for a SOCKADDR_INET. MaxSa is a union with ServerAddr.

To use DNS_CUSTOM_SERVER together with ServerAddr, you must include ws2ipdef.h before windns.h.

Besides storage for the SOCKADDR_INET, MaxSa avoids compile errors caused by not including ws2ipdef.h. This allows you to use any functionality from windns.h except for the DNS_CUSTOM_SERVER.

Requirements

Requirement Value
Minimum supported client Windows Build 22000
Minimum supported server Windows Build 22000
Header windns.h

See also