diff --git a/src/detection/cpu/cpu_windows.c b/src/detection/cpu/cpu_windows.c index 4b814ca2f..8c9246d2f 100644 --- a/src/detection/cpu/cpu_windows.c +++ b/src/detection/cpu/cpu_windows.c @@ -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 diff --git a/src/modules/cpu/cpu.c b/src/modules/cpu/cpu.c index 6fc3104bb..c8cc7a452 100644 --- a/src/modules/cpu/cpu.c +++ b/src/modules/cpu/cpu.c @@ -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"); }