[MERGE/RFC] hostnames are not always ascii

Mark Hammond mhammond at skippinet.com.au
Sun Aug 17 05:30:28 BST 2008


> So I think this is better than what we have, but we should also change
> win32utils.get_host_name() to use GetComputerNameEx when we know it is
> available. (Basically, when we know the unicode api is available should
> be sufficient.)
> http://msdn.microsoft.com/en-us/library/ms724301(VS.85).aspx

The attached patch uses pywin32's win32api.GetComputerNameEx(), which uses
LoadLibrary to get the unicode version raising NotImplementedError if its
not found.  As noted in the comments, it passes
'ComputerNameDnsFullyQualified', which MSDN documents as:

"""The fully qualified DNS name that uniquely identifies the local computer.
This name is a combination of the DNS host name and the DNS domain name,
using the form HostName.DomainName. If the local computer is a node in a
cluster, lpBuffer receives the fully qualified DNS name of the cluster
virtual server."""

For me, this always is a lower-case name, and includes the dns name of the
Windows domain if the computer is a member of a domain.
 
Cheers,

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicode_hostname.patch
Type: application/octet-stream
Size: 7077 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080817/be4e2320/attachment.obj 


More information about the bazaar mailing list