Port numbers can be assigned human readable service names to make
them easier to reference. This method will return the port number
assigned to the specified service name. If the service name does not
exist, this method will return DNS_ERROR and the last error code
will be set to ST_ERROR_INVALID_SERVICE_NAME.
Most applications should use DNS_SERVICE_ANY to return the port
number assigned to a service. Services typically use the same name
and port number regardless of the protocol used to establish a
connection with them. However, specifying a protocol can enable your
application to determine if the service supports the protocol. For
example, calling this method with the service name "ftp"
and DNS_SERVICE_UDP would result in an error because FTP only supports
TCP connections.
Service names are assigned by the Internet Assigned Numbers
Authority (IANA) and the database of recognized service names can be
returned by calling the GetDefaultServicesFile
method. The default location for this file is in a protected area of
the Windows operating system and can only be modified by a process
with administrative privileges.