DnsQueryConfig function (windns.h)

The DnsQueryConfig function enables application programmers to query for the configuration of the local computer or a specific adapter.

Syntax

DNS_STATUS DnsQueryConfig(
  [in]           DNS_CONFIG_TYPE Config,
  [in]           DWORD           Flag,
  [in, optional] PCWSTR          pwsAdapterName,
  [in, optional] PVOID           pReserved,
  [out]          PVOID           pBuffer,
  [in, out]      PDWORD          pBufLen
);

Parameters

[in] Config

A DNS_CONFIG_TYPE value that specifies the configuration type of the information to be queried.

[in] Flag

A value that specifies whether to allocate memory for the configuration information. Set Flag to DNS_CONFIG_FLAG_ALLOC to allocate memory; otherwise, set it to 0.

Note  Free the allocated memory with LocalFree.
 

[in, optional] pwsAdapterName

A pointer to a string that represents the adapter name against which the query is run.

[in, optional] pReserved

Reserved for future use.

[out] pBuffer

A pointer to a buffer that receives the query response. The following table shows the data type of the buffer for each of the Config parameter values.

Config parameter Data type of buffer
DnsConfigPrimaryDomainName_W PWCHAR
DnsConfigPrimaryDomainName_A PCHAR
DnsConfigPrimaryDomainName_UTF8 PCHAR
DnsConfigAdapterDomainName_W Not implemented
DnsConfigAdapterDomainName_A Not implemented
DnsConfigAdapterDomainName_UTF8 Not implemented
DnsConfigDnsServerList IP4_ARRAY
DnsConfigSearchList Not implemented
DnsConfigAdapterInfo Not implemented
DnsConfigPrimaryHostNameRegistrationEnabled DWORD
DnsConfigAdapterHostNameRegistrationEnabled DWORD
DnsConfigAddressRegistrationMaxCount DWORD
DnsConfigHostName_W PWCHAR
DnsConfigHostName_A PCHAR
DnsConfigHostName_UTF8 PCHAR
DnsConfigFullHostName_W PWCHAR
DnsConfigFullHostName_A PCHAR
DnsConfigFullHostName_UTF8 PCHAR

[in, out] pBufLen

The length of the buffer, in bytes. If the buffer provided is not sufficient, an error is returned and pBufferLength contains the minimum necessary buffer size. Ignored on input if Flag is set to TRUE.

Return value

Returns success confirmation upon successful completion. Otherwise, returns the appropriate DNS-specific error code as defined in Winerror.h.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header windns.h
Library Dnsapi.lib
DLL Dnsapi.dll

See also

DNS_CONFIG_TYPE

DNS_RECORD

DnsQuery