Fixed a bug where MSR MOD was not being enabled on Windows OS.

This commit is contained in:
justin committed 2025-11-20 16:26:20 -07:00
1 parent d7db6a94f8
commit 91ac5c0fd2
1 file changed
+32 -1
+32 -1
View File
@@ -320,6 +320,14 @@ class MoneroMiner:
return wallet return wallet
def check_windows_admin(self) -> bool:
"""Check if script is running with Administrator privileges on Windows"""
try:
import ctypes
return ctypes.windll.shell32.IsUserAnAdmin() != 0
except:
return False
def prompt_msr_mod(self, os_type: str) -> bool: def prompt_msr_mod(self, os_type: str) -> bool:
"""Prompt user to enable MSR MOD for performance optimization""" """Prompt user to enable MSR MOD for performance optimization"""
# MSR MOD is only supported on Windows and Linux # MSR MOD is only supported on Windows and Linux
@@ -338,6 +346,10 @@ class MoneroMiner:
print("\nOn Linux, MSR MOD requires:") print("\nOn Linux, MSR MOD requires:")
print(" 1. Loading the msr kernel module") print(" 1. Loading the msr kernel module")
print(" 2. Running the miner with sudo/root") print(" 2. Running the miner with sudo/root")
elif os_type == 'windows':
print("\nOn Windows, MSR MOD requires:")
print(" 1. Running as Administrator")
print(" 2. XMRig will automatically load WinRing0 driver")
while True: while True:
response = input("\nEnable MSR MOD? (Y/N) [N]: ").strip().upper() response = input("\nEnable MSR MOD? (Y/N) [N]: ").strip().upper()
@@ -350,7 +362,14 @@ class MoneroMiner:
if response == 'Y': if response == 'Y':
print("MSR MOD will be enabled.") print("MSR MOD will be enabled.")
if os_type == 'windows': if os_type == 'windows':
print("Make sure to run this script as Administrator!") if not self.check_windows_admin():
print("\n⚠ WARNING: Not running as Administrator!")
print(" Please restart this script by:")
print(" 1. Right-click on Command Prompt or PowerShell")
print(" 2. Select 'Run as Administrator'")
print(" 3. Run the script again")
else:
print("✓ Running with Administrator privileges")
else: else:
print("\nSetting up MSR support on Linux...") print("\nSetting up MSR support on Linux...")
self.setup_linux_msr() self.setup_linux_msr()
@@ -599,6 +618,18 @@ class MoneroMiner:
print("\nContinuing anyway (MSR features will be disabled)...") print("\nContinuing anyway (MSR features will be disabled)...")
print("="*60 + "\n") print("="*60 + "\n")
time.sleep(3) time.sleep(3)
elif os_type == 'windows' and not self.check_windows_admin():
print("\n" + "="*60)
print("⚠ WARNING: MSR MOD ENABLED BUT NOT RUNNING AS ADMINISTRATOR")
print("="*60)
print("MSR modifications require Administrator privileges on Windows.")
print("Please restart this script as Administrator:")
print(" 1. Right-click Command Prompt or PowerShell")
print(" 2. Select 'Run as Administrator'")
print(f" 3. Run: python {sys.argv[0]}")
print("\nContinuing anyway (MSR features will be disabled)...")
print("="*60 + "\n")
time.sleep(3)
print("\n" + "="*60) print("\n" + "="*60)
print("Monero Miner Starting") print("Monero Miner Starting")