CPU (Windows): fix detection bug

This commit is contained in:
李通洲
2023-06-17 15:23:05 +08:00
committed by Carter Li
parent 40ae2fb1da
commit 5678019204
2 changed files with 8 additions and 3 deletions
+2 -1
View File
@@ -7,7 +7,8 @@ const char* ffDetectCPUImpl(FF_MAYBE_UNUSED const FFinstance* instance, const FF
{
{
DWORD length = 0;
if (GetLogicalProcessorInformationEx(RelationAll, NULL, &length) != ERROR_INSUFFICIENT_BUFFER)
GetLogicalProcessorInformationEx(RelationAll, NULL, &length);
if (length == 0)
return "GetLogicalProcessorInformationEx(RelationAll, NULL, &length) failed";
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* FF_AUTO_FREE
+6 -2
View File
@@ -14,9 +14,13 @@ void ffPrintCPU(FFinstance* instance, FFCPUOptions* options)
ffStrbufInit(&cpu.name);
ffStrbufInit(&cpu.vendor);
ffDetectCPU(instance, options, &cpu);
const char* error = ffDetectCPU(instance, options, &cpu);
if(cpu.vendor.length == 0 && cpu.name.length == 0 && cpu.coresOnline <= 1)
if(error)
{
ffPrintError(instance, FF_CPU_MODULE_NAME, 0, &options->moduleArgs, "%s", error);
}
else if(cpu.vendor.length == 0 && cpu.name.length == 0 && cpu.coresOnline <= 1)
{
ffPrintError(instance, FF_CPU_MODULE_NAME, 0, &options->moduleArgs, "No CPU detected");
}