DnsServiceConstructInstance function (windns.h)

Used to build a DNS_SERVICE_INSTANCE structure from data that describes it.

Syntax

PDNS_SERVICE_INSTANCE DnsServiceConstructInstance(
  PCWSTR       pServiceName,
  PCWSTR       pHostName,
  PIP4_ADDRESS pIp4,
  PIP6_ADDRESS pIp6,
  WORD         wPort,
  WORD         wPriority,
  WORD         wWeight,
  DWORD        dwPropertiesCount,
  PCWSTR       *keys,
  PCWSTR       *values
);

Parameters

pServiceName

A string that represents the name of the service.

pHostName

A string that represents the name of the host of the service.

pIp4

A pointer to an IP4_ADDRESS structure that represents the service-associated IPv4 address.

pIp6

A pointer to an IP6_ADDRESS structure that represents the service-associated IPv6 address.

wPort

A value that represents the port on which the service is running.

wPriority

A value that represents the service priority.

wWeight

A value that represents the service weight.

dwPropertiesCount

The number of properties—defines the number of elements in the arrays of the keys and values parameters.

keys

A pointer to an array of string values that represent the property keys.

values

A pointer to an array of string values that represent the corresponding property values.

Return value

A pointer to a newly allocated DNS_SERVICE_INSTANCE structure, built from the passed-in parameters. Your application is responsible for freeing the associated memory by calling DnsServiceFreeInstance.

Remarks

The dwInterfaceIndex field of the returned structure is set to 0.

Requirements

Requirement Value
Minimum supported client Windows 10 [desktop apps only]
Target Platform Windows
Header windns.h
Library dnsapi.lib
DLL dnsapi.dll