mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 13:46:10 +00:00
Update Windows CPU name lookup
This commit is contained in:
@@ -148,10 +148,21 @@ def current_system_cpu_brand():
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
elif sys.platform.startswith('win'): # Windows
|
elif sys.platform.startswith('win'): # Windows
|
||||||
|
from winreg import HKEY_LOCAL_MACHINE, OpenKey, QueryValueEx
|
||||||
try:
|
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:
|
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'):
|
elif sys.platform.startswith('linux'):
|
||||||
try:
|
try:
|
||||||
with open('/proc/cpuinfo') as f:
|
with open('/proc/cpuinfo') as f:
|
||||||
|
|||||||
Reference in New Issue
Block a user