mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[KERNEL32] SetComputerNameExW: Truncate the computer name
This fixes the SetComputerNameExW api test.
This commit is contained in:
parent
067c08c23f
commit
cf8380100e
1 changed files with 5 additions and 2 deletions
|
@ -648,6 +648,7 @@ WINAPI
|
|||
SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,
|
||||
LPCWSTR lpBuffer)
|
||||
{
|
||||
WCHAR szShortName[MAX_COMPUTERNAME_LENGTH + 1];
|
||||
BOOL ret1, ret2;
|
||||
|
||||
if (!IsValidComputerName(NameType, lpBuffer))
|
||||
|
@ -670,17 +671,19 @@ SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,
|
|||
L"NV Hostname",
|
||||
lpBuffer);
|
||||
|
||||
RtlStringCchCopyNW(szShortName, ARRAYSIZE(szShortName), lpBuffer, MAX_COMPUTERNAME_LENGTH);
|
||||
ret2 = SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
|
||||
L"\\Control\\ComputerName\\ComputerName",
|
||||
L"ComputerName",
|
||||
lpBuffer);
|
||||
szShortName);
|
||||
return (ret1 && ret2);
|
||||
|
||||
case ComputerNamePhysicalNetBIOS:
|
||||
RtlStringCchCopyNW(szShortName, ARRAYSIZE(szShortName), lpBuffer, MAX_COMPUTERNAME_LENGTH);
|
||||
return SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
|
||||
L"\\Control\\ComputerName\\ComputerName",
|
||||
L"ComputerName",
|
||||
lpBuffer);
|
||||
szShortName);
|
||||
|
||||
default:
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
|
|
Loading…
Reference in a new issue