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) --- .appveyor.yml | 2 +- CMakeLists.txt | 6 ------ doc/compile.md | 5 ----- doc/tuning.md | 6 ++++++ doc/usage.md | 22 +--------------------- xmrstak/cli/cli-miner.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 53 insertions(+), 33 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index efa65bf..b463d0d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -22,7 +22,7 @@ build_script: - mkdir build - cd build - set CMAKE_PREFIX_PATH=C:\xmr-stak-dep\hwloc;C:\xmr-stak-dep\libmicrohttpd;C:\xmr-stak-dep\openssl; - - cmake -G "Visual Studio 14 2015 Win64" -T v140,host=x64 .. -DWIN_UAC=OFF -DCUDA_ARCH=30 + - cmake -G "Visual Studio 14 2015 Win64" -T v140,host=x64 .. -DCUDA_ARCH=30 - cmake --build . --config Release --target install test_script: diff --git a/CMakeLists.txt b/CMakeLists.txt index a444085..9540d7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -521,12 +521,6 @@ set(LIBRARY_OUTPUT_PATH "bin") target_link_libraries(xmr-stak ${LIBS} xmr-stak-c xmr-stak-backend) -option(WIN_UAC "Add UAC manifest on Windows" ON) - -if(WIN_UAC AND CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - set_property(TARGET xmr-stak PROPERTY LINK_FLAGS "/level='requireAdministrator' /uiAccess='false'") -endif() - ################################################################################ # Install ################################################################################ diff --git a/doc/compile.md b/doc/compile.md index 4fa940f..e97affa 100644 --- a/doc/compile.md +++ b/doc/compile.md @@ -52,11 +52,6 @@ After the configuration you need to compile the miner, follow the guide for your - native means the miner binary can be used only on the system where it is compiled but will archive the highest hash rate - use `cmake .. -DXMR-STAK_COMPILE=generic` to run the miner on all CPU's with sse2 -### only available for Windows -- `WIN_UAC` will enable or disable the "Run As Administrator" prompt on Windows. - - UAC confirmation is needed to use large pages on Windows 7. - - On Windows 10 it is only needed once to set up the account to use them. - ## CPU Build Options - `CPU_ENABLE` allow to disable/enable the CPU backend of the miner diff --git a/doc/tuning.md b/doc/tuning.md index 8eeefcb..8b28a43 100644 --- a/doc/tuning.md +++ b/doc/tuning.md @@ -1,6 +1,7 @@ # Tuning Guide ## Content Overview +* [Windows](windows) * [NVIDIA Backend](#nvidia-backend) * [Choose Value for `threads` and `blocks`](#choose-value-for-threads-and-blocks) * [Add more GPUs](#add-more-gpus) @@ -10,6 +11,11 @@ * [Increase Memory Pool](#increase-memory-pool) * [Scratchpad Indexing](#scratchpad-indexing) +## Windows +"Run As Administrator" prompt (UAC) confirmation is needed to use large pages on Windows 7. +On Windows 10 it is only needed once to set up the account to use them. +Disable the dialog with the command line option `--noUAC` + ## NVIDIA Backend By default the NVIDIA backend can be tuned in the config file `nvidia.txt` diff --git a/doc/usage.md b/doc/usage.md index edd5c89..a0421ac 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -30,27 +30,7 @@ The number of files depends on the available backends. ## Command Line Options The miner allow to overwrite some of the settings via command line options. - -``` -Usage: xmr-stak [OPTION]... - - -h, --help show this help - -v, --version show version number - -V, --version-long show long version number - -c, --config FILE common miner configuration file - --currency NAME currency to mine: monero or aeon - --noCPU disable the CPU miner backend - --cpu FILE CPU backend miner config file - --noAMD disable the AMD miner backend - --amd FILE AMD backend miner config file - --noNVIDIA disable the NVIDIA miner backend - --nvidia FILE NVIDIA backend miner config file - -The Following options temporary overwrites the config file settings: - -o, --url URL pool url and port, e.g. pool.usxmrpool.com:3333 - -u, --user USERNAME pool user name or wallet address - -p, --pass PASSWD pool password, in the most cases x or empty "" -``` +Run `xmr-stak --help` to show all available command line options. ## Docker image usage 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(-) 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(-) 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(+) 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