From 5789a6e29794d4fe38b413fa23c62468bc724b5e Mon Sep 17 00:00:00 2001 From: The Tumultuous Unicorn Of Darkness Date: Sun, 7 May 2023 12:41:25 +0200 Subject: [PATCH] Support another variant of AIDA64 dumps in cpuid_deserialize_raw_data_internal() It support lines like 'CPU#000 AffMask: 0x0000000000000001' --- libcpuid/cpuid_main.c | 10 +++++++--- tests/create_test.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libcpuid/cpuid_main.c b/libcpuid/cpuid_main.c index 15c41df..3c7d604 100644 --- a/libcpuid/cpuid_main.c +++ b/libcpuid/cpuid_main.c @@ -637,7 +637,10 @@ static int cpuid_deserialize_raw_data_internal(struct cpu_raw_data_t* single_raw raw_array->with_affinity = false; } } - else if (!strcmp(line, "------[ Versions ]------") || !strcmp(line, "------[ Logical CPU #0 ]------") || !strcmp(line, "------[ CPUID Registers / Logical CPU #0 ]------")) { + else if (!strcmp(line, "------[ Versions ]------") || + !strcmp(line, "------[ Logical CPU #0 ]------") || + !strcmp(line, "------[ CPUID Registers / Logical CPU #0 ]------") || + strstr(line, "CPU#000 AffMask: 0x")) { debugf(2, "Recognized AIDA64 raw dump\n"); is_header = false; is_libcpuid_dump = false; @@ -679,8 +682,9 @@ static int cpuid_deserialize_raw_data_internal(struct cpu_raw_data_t* single_raw } } else if (is_aida64_dump) { - if (use_raw_array && ((sscanf(line, "------[ Logical CPU #%hi ]------", &logical_cpu) >= 1) || \ - (sscanf(line, "------[ CPUID Registers / Logical CPU #%hi ]------", &logical_cpu) >= 1))) { + if (use_raw_array && ((sscanf(line, "------[ Logical CPU #%hi ]------", &logical_cpu) >= 1) || + (sscanf(line, "------[ CPUID Registers / Logical CPU #%hi ]------", &logical_cpu) >= 1) || + (sscanf(line, "CPU#%hi AffMask: 0x%*x", &logical_cpu) >= 1))) { debugf(2, "Parsing AIDA64 raw dump for logical CPU %i\n", logical_cpu); cpuid_grow_raw_data_array(raw_array, logical_cpu + 1); raw_ptr = &raw_array->raw[logical_cpu]; diff --git a/tests/create_test.py b/tests/create_test.py index 28d2ff5..ba1332f 100755 --- a/tests/create_test.py +++ b/tests/create_test.py @@ -12,7 +12,7 @@ if len(args) != 3: def readRawFile(): rawdata = [] for line in open(args[1], "rt").readlines(): - lookfor = ["basic_cpuid", "ext_cpuid", "intel_fn4", "intel_fn11", "amd_fn8000001dh", "Logical CPU", "CPUID"] + lookfor = ["basic_cpuid", "ext_cpuid", "intel_fn4", "intel_fn11", "amd_fn8000001dh", "Logical CPU", "CPUID", "CPU#"] ignore = ["MSR Register"] good = False for match in lookfor: