DnsGetHostServices Function  
 
INT WINAPI DnsGetHostServices(
  HCLIENT hClient,  
  LPCTSTR lpszHostName,  
  INT nProtocol,  
  LPTSTR lpszBuffer,  
  INT nMaxLength  
);

The DnsGetHostServices function returns the WKS (Well Known Services) record for the specified hostname and protocol. This information, if it is provided, typically specifies the names of those services supported on the host.

Parameters

hClient
Handle to the client session.
lpszHostName
Pointer to the string which specifies the host name that information will be returned for.
nProtocol
The protocol for those services that information should be returned about. The following protocols are recognized:
Value Constant Description
6 DNS_PROTOCOL_TCP Services that use the Transmission Control Protocol (TCP)
17 DNS_PROTOCOL_UDP Services that use the User Datagram Protocol (UDP)
lpszBuffer
Pointer to the buffer which will contain the host information returned by the nameserver.
nMaxLength
Maximum number of characters that may be copied into the specified buffer, including the null-byte terminator.

Return Value

If the function succeeds, the length of the host services buffer is returned. A return value of zero indicates that no information is available for the specified host. If the function fails, the return value is DNS_ERROR. To get extended error information, call DnsGetLastError.

Remarks

Many systems to do not maintain complete services records for a site since that information can potentially be used to compromise system security. An application should not depend on this information being available for any given record.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csdnsav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

DnsGetHostByAddress, DnsGetHostByName, DnsGetHostInfo, DnsGetMailExchange, DnsGetRecord, DnsGetResolverAddress, DnsRegisterServer