Skip to content

Commit

Permalink
msvc false positive fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelwernel committed Nov 2, 2023
1 parent 33a3d6d commit d242642
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ enable_testing()
# add executable
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin")
add_executable(${TARGET} "src/cli.cpp")
set_property(TARGET ${TARGET} PROPERTY CXX_STANDARD 11)
set_property(TARGET ${TARGET} PROPERTY CXX_STANDARD 20)
set_property(TARGET ${TARGET} PROPERTY CXX_STANDARD_REQUIRED ON)
add_test(Test_1, "${CMAKE_SOURCE_DIR}/bin/${TARGET}")

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ This project also provides a tiny, but handy CLI tool utilising the full potenti


## Installation 📥
To install the library, simply download or copy and paste the [vmaware.hpp](src/vmaware.hpp) file to your project. No CMake or build frameworks are necessary, it's literally that simple.
To install the library, download or copy and paste the [vmaware.hpp](src/vmaware.hpp) file to your project. No CMake or shared object linkages are necessary, it's literally that simple.

However, if you want the full project (globally accessible headers with <vmaware.hpp> and the CLI tool), follow these commands:
```bash
Expand Down
19 changes: 13 additions & 6 deletions src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1085,7 +1085,8 @@ struct VM {
#endif

if (is_vm) {
scoreboard[VMWARE] += 2; // extra point bc it's incredibly VMware-specific
scoreboard[VMWARE]++;
//scoreboard[VMWARE]++; // extra point bc it's incredibly VMware-specific, also it's not += 2 since that causes a linker error for some reason?
return true;
}

Expand Down Expand Up @@ -2394,12 +2395,16 @@ struct VM {
GetComputerNameA((LPSTR)comp_name.data(), (LPDWORD)&out_length);

auto compare = [&](const std::string &s) -> bool {
return !lstrcmpiA((LPCSTR)comp_name.data(), s.c_str());
return (std::strcmp((LPCSTR)comp_name.data(), s.c_str()) == 0);
};

#ifdef __VMAWARE_DEBUG__
debug("COMPUTER_NAME: fetched = ", (LPCSTR)comp_name.data());
#endif

if (compare("InsideTm") || compare("TU-4NH09SMCG1HC")) { // anubis
#ifdef __VMAWARE_DEBUG__
debug("COMPUTER_NAME: detected Anubis";);
debug("COMPUTER_NAME: detected Anubis");
#endif

return add(ANUBIS);
Expand Down Expand Up @@ -2729,7 +2734,7 @@ struct VM {

for (auto it = table.cbegin(); it != table.cend(); ++it) {
const technique &pair = it->second;
if (pair.ptr()) {
if (pair.ptr()) { // equivalent to std::invoke, not used bc of C++11 compatibility
points += pair.points;
};
}
Expand Down Expand Up @@ -2831,6 +2836,8 @@ struct VM {

VM::u64 VM::flags = 0;
std::map<bool, std::pair<bool, const char*>> VM::memo;


bool VM::cpuid_supported = []() -> bool {
#if \
( \
Expand Down Expand Up @@ -2884,12 +2891,12 @@ const std::map<VM::u64, VM::technique> VM::table = {
{ VM::SUNBELT, { 10, VM::sunbelt_check }},
{ VM::WINE_CHECK, { 85, VM::wine }},
{ VM::BOOT, { 5, VM::boot_time }},
{ VM::VM_FILES, { 80, VM::vm_files }},
{ VM::VM_FILES, { 20, VM::vm_files }},
{ VM::HWMODEL, { 75, VM::hwmodel }},
{ VM::DISK_SIZE, { 60, VM::disk_size }},
{ VM::VBOX_DEFAULT, { 55, VM::vbox_default_specs }},
{ VM::VBOX_NETWORK, { 70, VM::vbox_network_share }},
{ VM::COMPUTER_NAME, { 40, VM::computer_name_match }},
{ VM::COMPUTER_NAME, { 15, VM::computer_name_match }},
{ VM::HOSTNAME, { 25, VM::hostname_match }},
{ VM::MEMORY, { 35, VM::low_memory_space }},
{ VM::VM_PROCESSES, { 30, VM::vm_processes }},
Expand Down

0 comments on commit d242642

Please sign in to comment.