Fixed problem with system.set_computer_name

The previous function didn't fully change the name in windows
Fixes #28173
This commit is contained in:
twangboy 2015-11-03 14:33:21 -07:00
parent ea3bf972c4
commit 7edf5ce370

View file

@ -17,6 +17,7 @@ from datetime import datetime
try:
import win32net
import win32api
import win32con
import pywintypes
from ctypes import windll
HAS_WIN32NET_MODS = True
@ -244,7 +245,8 @@ def set_computer_name(name):
if name:
name = name.decode('utf-8')
if windll.kernel32.SetComputerNameW(name):
if windll.kernel32.SetComputerNameExW(win32con.ComputerNamePhysicalDnsHostname,
name):
ret = {'Computer Name': {'Current': get_system_info()['name']}}
pending = get_pending_computer_name()
if pending not in (None, False):