mirror of
https://github.com/reactos/reactos.git
synced 2024-11-28 05:53:31 +08:00
[SYSSETUP] Set registry hostname in WriteComputerSettings (#1589)
Based on @Doug-Lyons's patch. CORE-16067
This commit is contained in:
parent
d0d7c5f045
commit
9a39315d46
@ -534,6 +534,8 @@ WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
||||
{
|
||||
WCHAR Title[64];
|
||||
WCHAR ErrorComputerName[256];
|
||||
LONG lError;
|
||||
HKEY hKey = NULL;
|
||||
|
||||
if (!SetComputerNameW(ComputerName))
|
||||
{
|
||||
@ -560,6 +562,31 @@ WriteComputerSettings(WCHAR * ComputerName, HWND hwndDlg)
|
||||
/* Set the accounts domain name */
|
||||
SetAccountsDomainSid(NULL, ComputerName);
|
||||
|
||||
/* Now we need to set the Hostname */
|
||||
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters",
|
||||
0,
|
||||
KEY_SET_VALUE,
|
||||
&hKey);
|
||||
if (lError != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT1("RegOpenKeyExW for Tcpip\\Parameters failed (%08lX)\n", lError);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
lError = RegSetValueEx(hKey,
|
||||
L"Hostname",
|
||||
0,
|
||||
REG_SZ,
|
||||
(LPBYTE)ComputerName,
|
||||
(wcslen(ComputerName) + 1) * sizeof(WCHAR));
|
||||
if (lError != ERROR_SUCCESS)
|
||||
{
|
||||
DPRINT1("RegSetValueEx(\"Hostname\") failed (%08lX)\n", lError);
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user