DnsSetApplicationSettings function (windns.h)

Configures per-application DNS settings. This includes the ability to set per-application DNS servers either as fallback to the system configured servers, or exclusively.

Syntax

DWORD DnsSetApplicationSettings(
  DWORD                          cServers,
  const DNS_CUSTOM_SERVER        *pServers,
  const DNS_APPLICATION_SETTINGS *pSettings
);

Parameters

cServers

Type: _In_ DWORD

The number of custom DNS servers present in the pServers parameter.

pServers

Type: _In_reads_(cServers) DNS_CUSTOM_SERVER*

An array of DNS_CUSTOM_SERVER that contains cServers elements. If cServers is 0, then this must be NULL.

pSettings

Type: _In_opt_ DNS_APPLICATION_SETTINGS*

A pointer to a DNS_APPLICATION_SETTINGS object describing additional settings for custom DNS servers.

If this is NULL, then the custom DNS servers passed to the API will be used as fallback to the system-configured ones.

If this points to a DNS_APPLICATION_SETTINGS object that has the DNS_APP_SETTINGS_EXCLUSIVE_SERVERS flag set in its Flags member, then it means use the custom DNS servers exclusively.

Return value

A DWORD containing ERROR_SUCCESS on success, or an error code on failure.

Requirements

Requirement Value
Minimum supported client Windows Build 22000
Minimum supported server Windows Build 22000
Target Platform Windows
Header windns.h
Library Dnsapi.lib
DLL Dnsapi.dll