mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 10:52:08 +02:00
CPU: support Windows 7
This commit is contained in:
@@ -17,11 +17,21 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached)
|
||||
ffStrbufInit(&cpu->name);
|
||||
ffStrbufInit(&cpu->vendor);
|
||||
|
||||
FFWmiQuery query(L"SELECT Name, Manufacturer, NumberOfCores, NumberOfLogicalProcessors, ThreadCount, CurrentClockSpeed, MaxClockSpeed FROM Win32_Processor WHERE ProcessorType = 3");
|
||||
FFWmiQuery query(L"SELECT Name, Manufacturer, NumberOfCores, NumberOfLogicalProcessors, NumberOfEnabledCore, CurrentClockSpeed, MaxClockSpeed FROM Win32_Processor WHERE ProcessorType = 3");
|
||||
if(!query)
|
||||
return;
|
||||
|
||||
if(FFWmiRecord record = query.next())
|
||||
FFWmiRecord record = query.next();
|
||||
if(!record)
|
||||
{
|
||||
//NumberOfEnabledCore is not supported on Windows 10-
|
||||
query = FFWmiQuery(L"SELECT Name, Manufacturer, NumberOfCores, NumberOfLogicalProcessors, CurrentClockSpeed, MaxClockSpeed FROM Win32_Processor WHERE ProcessorType = 3");
|
||||
if(!query)
|
||||
return;
|
||||
record = query.next();
|
||||
}
|
||||
|
||||
if(record)
|
||||
{
|
||||
record.getString(L"Name", &cpu->name);
|
||||
record.getString(L"Manufacturer", &cpu->vendor);
|
||||
@@ -32,8 +42,7 @@ void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached)
|
||||
cpu->coresPhysical = (uint16_t)value;
|
||||
record.getUnsigned(L"NumberOfLogicalProcessors", &value);
|
||||
cpu->coresLogical = (uint16_t)value;
|
||||
record.getUnsigned(L"ThreadCount", &value);
|
||||
cpu->coresOnline = (uint16_t)value;
|
||||
cpu->coresOnline = record.getUnsigned(L"NumberOfEnabledCore", &value) ? (uint16_t)value : cpu->coresPhysical;
|
||||
record.getUnsigned(L"CurrentClockSpeed", &value); //There's no MinClockSpeed in Win32_Processor
|
||||
cpu->frequencyMin = (double)value / 1000.0;
|
||||
record.getUnsigned(L"MaxClockSpeed", &value);
|
||||
|
||||
Reference in New Issue
Block a user