Skip to content

Commit

Permalink
hyper-x test
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelwernel committed Oct 11, 2024
1 parent 8edc0ae commit e1b893e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ struct VM {
auto is_event_log_hyperv = []() -> bool {
std::wstring logName = L"Microsoft-Windows-Kernel-PnP/Configuration";
std::vector<std::wstring> searchStrings = { L"Virtual_Machine", L"VMBUS" };

return (util::query_event_logs(logName, searchStrings));
};

Expand All @@ -1748,7 +1748,11 @@ struct VM {
auto is_root_partition = []() -> bool {
u32 ebx, unused = 0;
cpu::cpuid(unused, ebx, unused, unused, 0x40000003);
return (ebx & 1);
const bool result = (ebx & 1);

if (result) {
core_debug("HYPER_X: root partition returned true");
}
};


Expand All @@ -1768,6 +1772,7 @@ struct VM {

// neither an artifact nor a real VM
if (!eax_result) {
core_debug("HYPER_X: none detected");
memo::hyperx::store(hyperx_state::UNKNOWN);
return false;
}
Expand All @@ -1786,11 +1791,14 @@ struct VM {
if (is_real_hyperv_vm) {
state = hyperx_state::HYPERV_REAL_VM;
core::add(HYPERV);
core_debug("HYPER_X: added Hyper-V real VM");
} else {
state = hyperx_state::HYPERV_ARTIFACT_VM;
core::add(HYPERV_ARTIFACT);
core_debug("HYPER_X: added Hyper-V artifact VM");
}

core_debug("HYPER_X: cached");
memo::hyperx::store(state);

// false means it's an artifact, which is what the
Expand Down

0 comments on commit e1b893e

Please sign in to comment.