https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c6456603843c4397c0ca03...
commit c6456603843c4397c0ca0369dfae994f23995eb3 Author: Eric Kohl eric.kohl@reactos.org AuthorDate: Sun Jan 19 13:28:02 2020 +0100 Commit: Eric Kohl eric.kohl@reactos.org CommitDate: Sun Jan 19 13:34:31 2020 +0100
[KERNEL32] Improvements to Get/SetComputerNameExW
- The ComputerNamePhysicalDnsDomain name type gets or sets the 'NV Domain' registry value. - The ComputerNamePhysicalDnsHostname name type gets or sets the 'NV Hostname' registry value. - IsValidComputerName: Enforce name length restrictions according to the name type. --- dll/win32/kernel32/client/compname.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dll/win32/kernel32/client/compname.c b/dll/win32/kernel32/client/compname.c index c2efa30b929..46d05e78d32 100644 --- a/dll/win32/kernel32/client/compname.c +++ b/dll/win32/kernel32/client/compname.c @@ -335,21 +335,24 @@ GetComputerNameExW(COMPUTER_NAME_FORMAT NameType, case ComputerNamePhysicalDnsDomain: return GetComputerNameFromRegistry(L"\Registry\Machine\System\CurrentControlSet" L"\Services\Tcpip\Parameters", - L"Domain", + L"NV Domain", lpBuffer, nSize);
- /* XXX Redo these */ + /* XXX Redo this */ case ComputerNamePhysicalDnsFullyQualified: return GetComputerNameExW(ComputerNameDnsFullyQualified, lpBuffer, nSize);
case ComputerNamePhysicalDnsHostname: - return GetComputerNameExW(ComputerNameDnsHostname, - lpBuffer, - nSize); + return GetComputerNameFromRegistry(L"\Registry\Machine\System\CurrentControlSet" + L"\Services\Tcpip\Parameters", + L"NV Hostname", + lpBuffer, + nSize);
+ /* XXX Redo this */ case ComputerNamePhysicalNetBIOS: return GetComputerNameExW(ComputerNameNetBIOS, lpBuffer, @@ -477,7 +480,14 @@ IsValidComputerName(COMPUTER_NAME_FORMAT NameType, p++; }
- if (Length == 0 || Length > MAX_COMPUTERNAME_LENGTH) + if (NameType == ComputerNamePhysicalDnsDomain) + return TRUE; + + if (Length == 0) + return FALSE; + + if (NameType == ComputerNamePhysicalNetBIOS && + Length > MAX_COMPUTERNAME_LENGTH) return FALSE;
return TRUE; @@ -600,12 +610,12 @@ SetComputerNameExW(COMPUTER_NAME_FORMAT NameType, return FALSE; }
- switch( NameType ) + switch (NameType) { case ComputerNamePhysicalDnsDomain: return SetComputerNameToRegistry(L"\Registry\Machine\System\CurrentControlSet" L"\Services\Tcpip\Parameters", - L"Domain", + L"NV Domain", lpBuffer);
case ComputerNamePhysicalDnsHostname: