From b298b5e3adf2582dad6f3726a795b0608ebdf09b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adolfo=20G=C3=B3mez?= Date: Mon, 26 Nov 2012 11:50:49 +0000 Subject: [PATCH] Added current computer name to NetUserChangePasswor. Now it seems to work (has to do more tests anyway) --- udsService/rpc/Operation.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/udsService/rpc/Operation.cs b/udsService/rpc/Operation.cs index 8367a563c..fa75cdb38 100644 --- a/udsService/rpc/Operation.cs +++ b/udsService/rpc/Operation.cs @@ -80,6 +80,8 @@ namespace uds internal const int TOKEN_QUERY = 0x00000008; internal const int TOKEN_ADJUST_PRIVILEGES = 0x00000020; internal const string SE_SHUTDOWN_NAME = "SeShutdownPrivilege"; + internal const string SE_SECURITY_NAME = "SeSecurityPrivilege"; + internal const string SE_TCB_NAME = "SeTcbPrivilege"; public const int EWX_LOGOFF = 0x00000000; public const int EWX_SHUTDOWN = 0x00000001; @@ -154,12 +156,16 @@ namespace uds public static bool ChangeUserPassword(string user, string oldPass, string newPass) { try { + logger.Debug("Setting new password for user " + user + " to " + newPass); - uint res = NetUserChangePassword(null, user, oldPass, newPass); + + Info.DomainInfo info = Info.Computer.GetDomainInfo(); + + uint res = NetUserChangePassword(info.ComputerName, user, oldPass, newPass); logger.Debug("Result of changeUserPassword: " + res); if( res != 0 ) - logger.Error("Could not change password for user \"" + user + "\" (using password \"" + newPass + "\"), result: " + res); + logger.Error("Could not change password for user \"" + user + "\" (using password \"" + newPass + "\") at \"" + info.ComputerName + "\", result: " + res); return res == 0; }