diff --git a/bazaar/SysExecGui/SysExecGui.cpp b/bazaar/SysExecGui/SysExecGui.cpp index a53032415..8eca4f5f3 100644 --- a/bazaar/SysExecGui/SysExecGui.cpp +++ b/bazaar/SysExecGui/SysExecGui.cpp @@ -58,7 +58,7 @@ bool PasswordDlg::Run(String const &u) while(true) { pwd.Clear(); - PopUp(NULL, false, true, true, true); + PopUp(NULL, false, false, true, true); pwd.SetFocus(); switch(Execute()) { @@ -90,6 +90,7 @@ static PasswordDlg &pDlg() // return true on success, false otherwise bool SysStartAdmin(String const &command, String const &args, const VectorMap &Environ) { + PasswordDlg *pp = &(pDlg()); if(!pDlg().Run()) return false; return SysStartAdmin(pDlg().GetPassword(), command, args, Environ); @@ -161,6 +162,70 @@ bool SysExecUser(String const &user, String const &command, String const &args) return SysExecUser(user, pDlg().GetPassword(), command, args); } +#else + +/////////////////////////////////////////////////////////////////////////////////////////////// +// executes an external command as Admin user, passing a command line to it without waiting for its termination +// it WILL prompt for user intervention on windows secure systems (Vista+ OSes), on which the password is useless +// on linux, will return an error if password is wrong +// return true on success, false otherwise +bool SysStartAdmin(String const &command, String const &args, const VectorMap &Environ) +{ + return SysStartAdmin("", command, args, Environ); +} + +bool SysStartAdmin(String const &command, String const &args) +{ + return SysStartAdmin("", command, args); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// +// executes an external command as required user, passing a command line to it without waiting for its termination +// on linux, will return an error if password is required AND wrong +// on windows, by now... it just spawn the process without changing security level +// I still shall find a way to go back to user mode on windows +// return true on success, false otherwise +bool SysStartUser(String const &user, String const &command, String const &args, const VectorMap &Environ) +{ + return SysStartUser(user, "", command, args, Environ); +} + +bool SysStartUser(String const &user, String const &command, String const &args) +{ + return SysStartUser(user, "", command, args); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// +// executes an external command as Admin user, passing a command line to it waiting for its termination +// it WILL prompt for user intervention on windows secure systems (Vista+ OSes), on which the password is useless +// on linux, will return an error if password is wrong +// return true on success, false otherwise +bool SysExecAdmin(String const &command, String const &args, const VectorMap &Environ) +{ + return SysExecAdmin("", command, args, Environ); +} + +bool SysExecAdmin(String const &command, String const &args) +{ + return SysExecAdmin("", command, args); +} + +/////////////////////////////////////////////////////////////////////////////////////////////// +// executes an external command as required user, passing a command line to it waiting for its termination +// on linux, will return an error if password is required AND wrong +// on windows, by now... it just spawn the process without changing security level +// I still shall find a way to go back to user mode on windows +// return true on success, false otherwise +bool SysExecUser(String const &user, String const &command, String const &args, const VectorMap &Environ) +{ + return SysExecUser(user, "", command, args, Environ); +} + +bool SysExecUser(String const &user, String const &command, String const &args) +{ + return SysExecUser(user, "", command, args); +} + #endif END_UPP_NAMESPACE diff --git a/bazaar/SysExecGui/SysExecGui.h b/bazaar/SysExecGui/SysExecGui.h index 23f33c1b2..ba9d072be 100644 --- a/bazaar/SysExecGui/SysExecGui.h +++ b/bazaar/SysExecGui/SysExecGui.h @@ -5,10 +5,10 @@ NAMESPACE_UPP -#ifdef PLATFORM_POSIX - /////////////////////////////////////////////////////////////////////////////////////////////// -// SysXXXAdmin and SysXXXUser function with gui password frontend +// SysXXXAdmin and SysXXXUser function with gui password frontend (for POSIX) +// For windows you don't have the password dialog, but do have uniform interface +// we propose them too -- they just don't show the interface prompt but the UAC one /////////////////////////////////////////////////////////////////////////////////////////////// // executes an external command as Admin user, passing a command line to it without waiting for its termination @@ -44,8 +44,6 @@ bool SysExecAdmin(String const &command, String const &args); bool SysExecUser(String const &user, String const &command, String const &args, const VectorMap &Environ); bool SysExecUser(String const &user, String const &command, String const &args); -#endif - END_UPP_NAMESPACE #endif