mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 05:36:09 +00:00
Update Windows CPU name lookup
This commit is contained in:
@@ -148,10 +148,21 @@ def current_system_cpu_brand():
|
||||
except Exception:
|
||||
pass
|
||||
elif sys.platform.startswith('win'): # Windows
|
||||
from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
|
||||
try:
|
||||
return platform.processor() # Often sufficient, or fallback to env var
|
||||
# Open the registry key where Windows stores the CPU name
|
||||
key = OpenKey(HKEY_LOCAL_MACHINE, r"HARDWARE\DESCRIPTION\System\CentralProcessor\0")
|
||||
# The value name is "ProcessorNameString"
|
||||
value, _ = QueryValueEx(key, "ProcessorNameString")
|
||||
return value.strip() # Usually perfect, with full marketing name
|
||||
except Exception:
|
||||
pass
|
||||
# Fallback: sometimes the key is under a different index, try 1
|
||||
try:
|
||||
key = OpenKey(HKEY_LOCAL_MACHINE, r"HARDWARE\DESCRIPTION\System\CentralProcessor\1")
|
||||
value, _ = QueryValueEx(key, "ProcessorNameString")
|
||||
return value.strip()
|
||||
except Exception:
|
||||
return "Unknown CPU"
|
||||
elif sys.platform.startswith('linux'):
|
||||
try:
|
||||
with open('/proc/cpuinfo') as f:
|
||||
|
||||
Reference in New Issue
Block a user