DnsGetApplicationSettings function (windns.h)

Retrieves the per-application DNS settings.

Syntax

DWORD DnsGetApplicationSettings(
  DWORD                    *pcServers,
  DNS_CUSTOM_SERVER        **ppDefaultServers,
  DNS_APPLICATION_SETTINGS *pSettings
);

Parameters

pcServers

Type: _Out_ DWORD*

After the function call, this will point to the number of custom DNS servers that the application has configured. If there are no custom servers configured, or if the function fails, then this will be set to 0.

ppDefaultServers

Type: _Outptr_result_buffer_(*pcServers) DNS_CUSTOM_SERVER**

After the function call, this will point to the array of DNS custom servers that are configured for the application. If the application has no servers configured, or if the function fails, then this will be set to NULL.

pSettings

Type: _Out_opt_ DNS_APPLICATION_SETTINGS*

A pointer to a DNS_APPLICATION_SETTINGS object, populated with the application settings.

Return value

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

Remarks

To avoid memory leaks, you must call DnsFreeCustomServers on the servers returned by DnsGetApplicationSettings via its pSettings parameter.

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

See also