From 7ca6f6e2e9bd5f7a68c878a60a296af1a3636c6f Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Thu, 30 Nov 2017 22:46:00 +0100 Subject: allow to diable UAC dialog - remove CMake option `WIN_UAC` - spawn UAC dialog via restarting xmr-miner with administrator right - allow to disable UAC with `--noUAC` - update documentation - remove usage section with help message (output depends on OS) --- xmrstak/cli/cli-miner.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'xmrstak/cli/cli-miner.cpp') diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index e32733b..087d3b6 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -66,6 +66,9 @@ void help() cout<<" -v, --version show version number"<print_msg(L0, "Parameter unknown '%s'",argv[i]); @@ -432,6 +472,11 @@ int main(int argc, char *argv[]) } } +#ifdef _WIN32 + if(uacDialog) + UACDialog(argv[0]); +#endif + // check if we need a guided start if(!configEditor::file_exist(params::inst().configFile)) do_guided_config(userSetPasswd); -- cgit v1.1 From 350cfbc461fc6023b3232537cbf71bc18a85d07f Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Sun, 3 Dec 2017 21:12:43 +0100 Subject: fix missing arguments pass arguments to the restarted miner with high privileges --- xmrstak/cli/cli-miner.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'xmrstak/cli/cli-miner.cpp') diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 087d3b6..1298b60 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -280,7 +280,7 @@ void do_guided_config(bool userSetPasswd) * - author: Cody Gray * - date: Feb 4 '11 */ -void UACDialog(std::string binaryName) +void UACDialog(const std::string& binaryName, const std::string& args) { SHELLEXECUTEINFO shExInfo = {0}; shExInfo.cbSize = sizeof(shExInfo); @@ -289,7 +289,7 @@ void UACDialog(std::string binaryName) shExInfo.lpVerb = "runas"; shExInfo.lpFile = binaryName.c_str(); // disable UAC dialog (else the miner will go into a infinite loop) - shExInfo.lpParameters = "--noUAC"; + shExInfo.lpParameters = (args + " --noUAC").c_str(); shExInfo.lpDirectory = 0; shExInfo.nShow = SW_SHOW; shExInfo.hInstApp = 0; @@ -474,7 +474,12 @@ int main(int argc, char *argv[]) #ifdef _WIN32 if(uacDialog) - UACDialog(argv[0]); + { + std::string minerArgs; + for(int i = 1; i < argc; i++) + minerArgs += std::string(" ") + argv[i]; + UACDialog(argv[0], minerArgs); + } #endif // check if we need a guided start -- cgit v1.1 From 56c84e942ad369d5bcd297ccaa130742b5562c33 Mon Sep 17 00:00:00 2001 From: fireice-uk Date: Wed, 6 Dec 2017 21:07:35 +0000 Subject: Fix const bug --- xmrstak/cli/cli-miner.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'xmrstak/cli/cli-miner.cpp') diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 1298b60..031b1b1 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -280,8 +280,9 @@ void do_guided_config(bool userSetPasswd) * - author: Cody Gray * - date: Feb 4 '11 */ -void UACDialog(const std::string& binaryName, const std::string& args) +void UACDialog(const std::string& binaryName, std::string& args) { + args += " --noUAC"; SHELLEXECUTEINFO shExInfo = {0}; shExInfo.cbSize = sizeof(shExInfo); shExInfo.fMask = SEE_MASK_NOCLOSEPROCESS; @@ -289,11 +290,11 @@ void UACDialog(const std::string& binaryName, const std::string& args) shExInfo.lpVerb = "runas"; shExInfo.lpFile = binaryName.c_str(); // disable UAC dialog (else the miner will go into a infinite loop) - shExInfo.lpParameters = (args + " --noUAC").c_str(); + shExInfo.lpParameters = args.c_str(); shExInfo.lpDirectory = 0; shExInfo.nShow = SW_SHOW; shExInfo.hInstApp = 0; - + if(ShellExecuteEx(&shExInfo)) { WaitForSingleObject(shExInfo.hProcess, INFINITE); @@ -477,7 +478,11 @@ int main(int argc, char *argv[]) { std::string minerArgs; for(int i = 1; i < argc; i++) - minerArgs += std::string(" ") + argv[i]; + { + minerArgs += " "; + minerArgs += argv[i]; + } + UACDialog(argv[0], minerArgs); } #endif -- cgit v1.1 From 62a13f03d4dfcab48ce153f733001dc796b96dcb Mon Sep 17 00:00:00 2001 From: psychocrypt Date: Thu, 7 Dec 2017 21:42:00 +0100 Subject: cmd message after privileged cmd closed add message that he not closed cmd can be safly closed --- xmrstak/cli/cli-miner.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'xmrstak/cli/cli-miner.cpp') diff --git a/xmrstak/cli/cli-miner.cpp b/xmrstak/cli/cli-miner.cpp index 031b1b1..bc52923 100644 --- a/xmrstak/cli/cli-miner.cpp +++ b/xmrstak/cli/cli-miner.cpp @@ -297,6 +297,8 @@ void UACDialog(const std::string& binaryName, std::string& args) if(ShellExecuteEx(&shExInfo)) { + printer::inst()->print_msg(L0, + "This window has been opened because xmr-stak needed to run as administrator. It can be safely closed now."); WaitForSingleObject(shExInfo.hProcess, INFINITE); CloseHandle(shExInfo.hProcess); // do not start the miner twice -- cgit v1.1