Why is GetComputerName() an init function, or in other words, why is it important that HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName be set at registry initialization time (in _allocate_default_keys())?
I am asking because GetComputerName() IMO returns the wrong value (FQDN rather than NETBIOS name). A real implementation of GetComputerName() would look for the above value in the Registry and use gethostname() only as a fallback, but currently it's the other way around - why ?
Martin
Martin Wilck Martin.Wilck@fujitsu-siemens.com writes:
I am asking because GetComputerName() IMO returns the wrong value (FQDN rather than NETBIOS name). A real implementation of GetComputerName() would look for the above value in the Registry and use gethostname() only as a fallback, but currently it's the other way around - why ?
Because users are not going to edit the registry if their Unix hostname changes so it will always be wrong. Now if the problem is the FQDN then it should be trivial to truncate it to just the hostname.
Am Mit, 2002-10-30 um 20.25 schrieb Alexandre Julliard:
Because users are not going to edit the registry if their Unix hostname changes so it will always be wrong. Now if the problem is the FQDN then it should be trivial to truncate it to just the hostname.
Sorry, how many machines are out there that change their host name on a regular basis, so that the registry name would "always" be wrong ?
The way Samba does this is IMO reasonable: "netbios name (G) - This sets the NetBIOS name by which a Samba server is known. By default it is the same as the first component of the host's DNS name."
I'd propose: If the registry contains an explicit ComputerName entry, use it as Netbios name; otherwise, use the Unix hostname. This would affect only the users that enter a Netbios name in their registry, and thus not those with changing host names that you're worried about.
Martin
Martin Wilck Martin.Wilck@Fujitsu-Siemens.com writes:
I'd propose: If the registry contains an explicit ComputerName entry, use it as Netbios name; otherwise, use the Unix hostname. This would affect only the users that enter a Netbios name in their registry, and thus not those with changing host names that you're worried about.
This works for GetComputerName(), but not for apps that look directly in the registry. This is why we need to put something in there. I'm still not sure what your problem is, apart from it being an FQDN. Why wouldn't it work to set the registry from the hostname on startup? Do you really need a NetBIOS name different from the hostname?
This works for GetComputerName(), but not for apps that look directly in the registry. This is why we need to put something in there.
Yes, but only if there is nothing in there yet. I am not against setting this registry value and I see why it's set. I was just saying that this init stuff makes me nervous when thinking about improving the function - obviously the "normal" registry functions aren't yet available. What I'd propose for init time is
- check the availability of the ComputerName entry in the registry, - if not there, set it directly from gethostname()
Then I'd implement proper ComputerNameEx(), ComputerName() in Kernel32 with all options, and remove it from the init code.
Do you really need a NetBIOS name different from the hostname?
I do not strictly need it. But without doubt the two name concepts are different. Users/administrators may need it. I like the idea that administrators can have consistent settings between Samba and Wine (btw I thought about parsing smb.conf for these entries to make additional registry editing superfluous, but this is a future issue).
Martin
Martin Wilck Martin.Wilck@Fujitsu-Siemens.com writes:
- check the availability of the ComputerName entry in the registry,
- if not there, set it directly from gethostname()
Then I'd implement proper ComputerNameEx(), ComputerName() in Kernel32 with all options, and remove it from the init code.
That sounds reasonable, yes.
Oops - just stumbled into this one:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/bas...
On Win2k and later DNS name and Netbios name are linked "by convention". That is, having them separate is discouraged, but not impossible.
I wonder what we should do about that.
Martin
Am Mit, 2002-10-30 um 20.25 schrieb Alexandre Julliard:
Because users are not going to edit the registry if their Unix hostname changes so it will always be wrong. Now if the problem is the FQDN then it should be trivial to truncate it to just the hostname.
You did not explain why this must happen at wine initializaiton time (why is this code in win32/init.c?).
Martin
Am Mit, 2002-10-30 um 20.25 schrieb Alexandre Julliard:
Because users are not going to edit the registry if their Unix hostname changes so it will always be wrong. Now if the problem is the FQDN then it should be trivial to truncate it to just the hostname.
I can't help myself - I think the current implementation in wine isn't correct, at least not as correct as it could be.
http://www.jsifaq.com/SUBH/tip3900/rh3982.htm
It wouldn't be hard to fix this, but the fact that this stuff happens during Wine initialization scares me off.
That's why I want to know why this is done so early.
Martin