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 GetLastError.
The HostNameToUnicode method will convert the encoded
ASCII version of a host name to its Unicode version. Although any
valid host name is accepted by this method, it is intended to
convert a Punycode encoded host name to its original Unicode character
encoding.
If the application is compiled using the Unicode character set, the value returned
in lpszUnicodeName will be a Unicode string using UTF-16
encoding. If the ANSI character set is used, the value returned
will be a Unicode string using UTF-8 encoding. To display a UTF-8
encoded host name, your application will need to convert it to UTF-16
using the MultiByteToWideChar function.
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
GetHostAddress method.