mirror of
https://github.com/reactos/reactos.git
synced 2025-01-02 20:43:18 +00:00
[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.
This commit is contained in:
parent
0f4827edde
commit
c645660384
1 changed files with 18 additions and 8 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue