From 7b07ba9fe691a5b069c961ff1f8d871c0fac947f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=B6ller?= Date: Wed, 3 Feb 2010 18:10:11 +0000 Subject: [PATCH] Fixed Intel CPU coreCount in case CPUID 0x0B is supported but returns only 0. --- Hardware/CPU/IntelCPU.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Hardware/CPU/IntelCPU.cs b/Hardware/CPU/IntelCPU.cs index 047d90f..7491e82 100644 --- a/Hardware/CPU/IntelCPU.cs +++ b/Hardware/CPU/IntelCPU.cs @@ -63,17 +63,21 @@ namespace OpenHardwareMonitor.Hardware.CPU { this.name = name; this.icon = Utilities.EmbeddedResources.GetImage("cpu.png"); - logicalProcessorsPerCore = 1; + logicalProcessors = 0; if (cpuidData.GetLength(0) > 0x0B) { uint eax, ebx, ecx, edx; WinRing0.CpuidEx(0x0B, 0, out eax, out ebx, out ecx, out edx); - logicalProcessorsPerCore = ebx & 0xFF; - WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx); - logicalProcessors = ebx & 0xFF; - } else if (cpuidData.GetLength(0) > 0x04) { + logicalProcessorsPerCore = ebx & 0xFF; + if (logicalProcessorsPerCore > 0) { + WinRing0.CpuidEx(0x0B, 1, out eax, out ebx, out ecx, out edx); + logicalProcessors = ebx & 0xFF; + } + } + if (logicalProcessors <= 0 && cpuidData.GetLength(0) > 0x04) { logicalProcessors = ((cpuidData[4, 0] >> 26) & 0x3F) + 1; logicalProcessorsPerCore = 1; - } else { + } + if (logicalProcessors <= 0) { logicalProcessors = 1; logicalProcessorsPerCore = 1; }