From 2b9bcc2dfd835d3c0a6a7de3f5f224c9afd5434b Mon Sep 17 00:00:00 2001 From: fireice-uk Date: Wed, 4 Oct 2017 19:04:40 +0100 Subject: Add a suggestion to reboot in cases where it might help --- xmrstak/backend/cpu/crypto/cryptonight_common.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'xmrstak/backend') diff --git a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp index 1cff5bb..aeb5a83 100644 --- a/xmrstak/backend/cpu/crypto/cryptonight_common.cpp +++ b/xmrstak/backend/cpu/crypto/cryptonight_common.cpp @@ -164,6 +164,7 @@ BOOL AddLargePageRights() } #endif +BOOL bRebootDesirable = FALSE; //If VirtualAlloc fails, suggest a reboot size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg) { #ifdef _WIN32 @@ -173,12 +174,17 @@ size_t cryptonight_init(size_t use_fast_mem, size_t use_mlock, alloc_msg* msg) if(AddPrivilege(TEXT("SeLockMemoryPrivilege")) == 0) { if(AddLargePageRights()) + { msg->warning = "Added SeLockMemoryPrivilege to the current account. You need to reboot for it to work"; + bRebootDesirable = TRUE; + } else msg->warning = "Obtaning SeLockMemoryPrivilege failed."; return 0; } + + bRebootDesirable = TRUE; return 1; #else return 1; @@ -210,7 +216,10 @@ cryptonight_ctx* cryptonight_alloc_ctx(size_t use_fast_mem, size_t use_mlock, al if(ptr->long_state == NULL) { _mm_free(ptr); - msg->warning = "VirtualAlloc failed."; + if(bRebootDesirable) + msg->warning = "VirtualAlloc failed. Reboot might help."; + else + msg->warning = "VirtualAlloc failed."; return NULL; } else -- cgit v1.1