https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2db0e159a472aca5d1e713271a62853728b41930

commit 2db0e159a472aca5d1e713271a62853728b41930
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Mon May 27 16:18:38 2019 +0900
Commit:     GitHub <[email protected]>
CommitDate: Mon May 27 16:18:38 2019 +0900

    [KERNEL32] Fix SetComputerNameExW (#1583)
    
    Based on @Doug-Lyons's patch. CORE-16058
---
 dll/win32/kernel32/client/compname.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/dll/win32/kernel32/client/compname.c 
b/dll/win32/kernel32/client/compname.c
index cfe9df5137..c2efa30b92 100644
--- a/dll/win32/kernel32/client/compname.c
+++ b/dll/win32/kernel32/client/compname.c
@@ -592,6 +592,8 @@ WINAPI
 SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,
                    LPCWSTR lpBuffer)
 {
+    BOOL ret1, ret2;
+
     if (!IsValidComputerName(NameType, lpBuffer))
     {
         SetLastError(ERROR_INVALID_PARAMETER);
@@ -607,10 +609,16 @@ SetComputerNameExW(COMPUTER_NAME_FORMAT NameType,
                                              lpBuffer);
 
         case ComputerNamePhysicalDnsHostname:
-            return 
SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
+            ret1 = 
SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
                                              L"\\Services\\Tcpip\\Parameters",
-                                             L"Hostname",
+                                             L"NV Hostname",
+                                             lpBuffer);
+
+            ret2 = 
SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"
+                                             
L"\\Control\\ComputerName\\ComputerName",
+                                             L"ComputerName",
                                              lpBuffer);
+            return (ret1 && ret2);
 
         case ComputerNamePhysicalNetBIOS:
             return 
SetComputerNameToRegistry(L"\\Registry\\Machine\\System\\CurrentControlSet"

Reply via email to