Skip to content

Commit

Permalink
memoization fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelwernel committed Oct 8, 2024
1 parent 0cc0f67 commit c2519b5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ struct VM {
#endif

// specifically for util::hyper_x() and memo::hyperv
enum hyperx_state : u8 {
enum class hyperx_state : u8 {
HYPERV_REAL_VM = 1,
HYPERV_ARTIFACT_VM,
UNKNOWN
Expand Down Expand Up @@ -1151,7 +1151,7 @@ struct VM {
}

static bool is_cached() {
return (state == hyperx_state::UNKNOWN);
return (state != hyperx_state::UNKNOWN);
}
};
};
Expand Down Expand Up @@ -1713,9 +1713,9 @@ struct VM {
#if (!MSVC)
return false;
#else
if (memo::hyperv::is_cached()) {
if (memo::hyperx::is_cached()) {
core_debug("HYPER_X: returned from cache");
return (memo::hyperv::fetch() == hyperx_state::HYPERV_ARTIFACT_VM);
return (memo::hyperx::fetch() == hyperx_state::HYPERV_ARTIFACT_VM);
}


Expand Down Expand Up @@ -1768,7 +1768,7 @@ struct VM {

// neither an artifact nor a real VM
if (!eax_result) {
memo::hyperv::store(hyperx_state::UNKNOWN);
memo::hyperx::store(hyperx_state::UNKNOWN);
return false;
}

Expand All @@ -1791,7 +1791,7 @@ struct VM {
core::add(HYPERV_ARTIFACT_VM);
}

memo::hyperv::store(state);
memo::hyperx::store(state);

// false means it's an artifact, which is what the
// point of this whole function is supposed to do
Expand Down Expand Up @@ -10350,13 +10350,13 @@ struct VM {


struct vmaware {
std::string brand;
std::string type;
std::string conclusion;
bool is_vm;
u8 percentage;
u8 detected_count;
u8 technique_count;
std::string brand;
std::string type;
std::string conclusion;

template <typename ...Args>
vmaware(Args ...args) {
Expand Down

0 comments on commit c2519b5

Please sign in to comment.