@@ -4508,19 +4508,18 @@ struct VM {
45084508 // run all the techniques
45094509 const u16 score = core::run_all(flags);
45104510
4511- brand_array_t active_brands = {};
4512- brand_list_t brand_return = {};
4513- brand_return.reserve(MAX_BRANDS);
4511+ brand_list_t active_brands = {};
4512+ active_brands.reserve(MAX_BRANDS);
45144513
45154514 size_t active_count = 0;
45164515
45174516 for (size_t i = 0; i < MAX_BRANDS; ++i) {
45184517 if (core::brand_scoreboard.at(i).score > 0) {
4519- active_brands.at(i) = std::make_pair(core::brand_scoreboard.at(i).name, core::brand_scoreboard.at(i).score);
4518+ active_brands.push_back( std::make_pair(core::brand_scoreboard.at(i).name, core::brand_scoreboard.at(i).score) );
45204519 active_count++;
45214520 }
45224521 }
4523-
4522+
45244523 #ifdef __VMAWARE_DEBUG__
45254524 for (const auto brand : active_brands) {
45264525 debug("pre-processed scoreboard: ", int(brand.second), " : ", brands::brand_enum_to_string(brand.first));
@@ -4539,36 +4538,25 @@ struct VM {
45394538
45404539 // if all brands have a point of 0, return "Unknown"
45414540 if (active_count == 0) {
4542- brand_return .push_back({brand_enum::NULL_BRAND, 1});
4543- memo::brand_list::store(brand_return );
4544- return brand_return ;
4541+ active_brands .push_back({brand_enum::NULL_BRAND, 1});
4542+ memo::brand_list::store(active_brands );
4543+ return active_brands ;
45454544 }
45464545
45474546 // if there's only a single brand, return it immediately
45484547 // We skip this early return if the single brand is HYPERV_ARTIFACT,
45494548 // but we must also nullify the result if the score is above 0,
45504549 // which would most likely indicate a hardened VM instead and return "Unknown".
45514550 if (active_count == 1) {
4552- enum brand_enum initial_brand = brand_enum::INVALID;
4553-
4554- for (const auto brand : active_brands) {
4555- if (brand.second == 0) {
4556- continue;
4557- }
4551+ const enum brand_enum brand = active_brands.front().first;
45584552
4559- if (brand.first == brand_enum::HYPERV_ROOT && score > 0) {
4560- brand_return.push_back({brand_enum::NULL_BRAND, 1});
4561- memo::brand_list::store(brand_return);
4562- return brand_return;
4563- }
4564-
4565- initial_brand = brand.first;
4566- break;
4553+ if (brand == brand_enum::HYPERV_ROOT && score > 0) {
4554+ active_brands.push_back({brand_enum::NULL_BRAND, 1});
4555+ remove(brand_enum::HYPERV_ROOT);
45674556 }
45684557
4569- brand_return.push_back({initial_brand, 1});
4570- memo::brand_list::store(brand_return);
4571- return brand_return;
4558+ memo::brand_list::store(active_brands);
4559+ return active_brands;
45724560 }
45734561
45744562 // remove Hyper-V artifacts and Unknown if found with other brands
@@ -4662,18 +4650,18 @@ struct VM {
46624650
46634651 for (const auto brand : active_brands) {
46644652 if (brand.second > 0) {
4665- brand_return .push_back({brand.first, brand.second});
4653+ active_brands .push_back({brand.first, brand.second});
46664654 }
46674655 }
46684656
46694657 #ifdef __VMAWARE_DEBUG__
4670- for (const auto brand : brand_return ) {
4658+ for (const auto brand : active_brands ) {
46714659 debug("post-processed scoreboard: ", brand.second, " : ", brands::brand_enum_to_string(brand.first));
46724660 }
46734661 #endif
46744662
4675- memo::brand_list::store(brand_return );
4676- return brand_return ;
4663+ memo::brand_list::store(active_brands );
4664+ return active_brands ;
46774665 }
46784666
46794667 static const char* brand_enum_to_string(const brand_enum brand) {
0 commit comments