If the method succeeds, the return value is the number of
characters copied into the string buffer. If the method fails,
the return value is INET_ERROR. To get extended error information,
call InetGetLastError.
The NormalizeHostName method will remove all leading
and trailing whitespace characters from the host name and fold all
upper-case characters to lower-case. If an internationalized domain
name (IDN) containing Unicode characters is passed to this method,
it will be converted to an ASCII compatible format for domain names.
The lpszHostName parameter should only specify a host name
or IP address. If you want to support the use of URLs to establish a
connection, use the GetUrlHostName method which has
extended support for extracting the host name and port number
specified in a URL.
If the Unicode version of this method is used, the host name will
be converted from UTF-16 to UTF-8 and then processed. If you are
unsure if an internationalized domain name will be specified as the
host name, it is recommended you use the Unicode version.
Although this method performs checks to ensure that the lpszHostName
parameter is in the correct format and does not contain any illegal
characters or malformed encoding, it does not validate the existence
of the domain name. To check if the host name exists and has a valid
IP address, use the ValidateHostName method.
It is recommended that you use this method if your application
needs to store the host name, and if accepts a host name as user input.
It is not necessary to call this method prior to calling the other
SocketWrench methods which accept a host name as a parameter. Those
methods already normalize the host name and perform checks to ensure
it is in the correct format.
If the lpszHostName parameter specifies a valid IPv4 or
IPv6 address string instead of a host name, this method will return
a copy of that IP address in the buffer provided by the caller. This
allows the method to be used in cases where a user may input either
a host name or IP address. To determine if the IP address has a
corresponding host name, use the GetHostName method.