changed error message on case of change user password error

This commit is contained in:
Adolfo Gómez García 2018-10-05 12:41:23 +02:00
parent 4c30e9d45e
commit 73be005f6a

View File

@ -91,6 +91,7 @@ def getDomainName():
def getWindowsVersion():
return win32api.GetVersionEx()
EWX_LOGOFF = 0x00000000
EWX_SHUTDOWN = 0x00000001
EWX_REBOOT = 0x00000002
@ -121,6 +122,7 @@ def renameComputer(newName):
computerName = win32api.GetComputerNameEx(win32con.ComputerNamePhysicalDnsHostname)
raise Exception('Error renaming computer from {} to {}: {}'.format(computerName, newName, error))
NETSETUP_JOIN_DOMAIN = 0x00000001
NETSETUP_ACCT_CREATE = 0x00000002
NETSETUP_ACCT_DELETE = 0x00000004
@ -187,8 +189,8 @@ def changeUserPassword(user, oldPassword, newPassword):
if res != 0:
# Log the error, and raise exception to parent
error = getErrorMessage()
raise Exception('Error changing password for user {}: {}'.format(user.value, error))
error = getErrorMessage(res)
raise Exception('Error changing password for user {}: {} {}'.format(user.value, res, error))
class LASTINPUTINFO(ctypes.Structure):