mirror of
https://github.com/Print3M/Anti-VM
synced 2026-06-21 16:41:58 +00:00
init
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#include "utils.hpp"
|
||||
#include "detectors.hpp"
|
||||
#include <string>
|
||||
#include <codecvt>
|
||||
#include <vector>
|
||||
|
||||
std::string utils::bstr_to_str(BSTR bstr) {
|
||||
if (!bstr) return std::string("");
|
||||
|
||||
std::wstring ws(bstr, SysStringLen(bstr));
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::string narrow = converter.to_bytes(ws);
|
||||
|
||||
return narrow;
|
||||
}
|
||||
|
||||
std::string utils::lowercase(std::string str) {
|
||||
std::string result = "";
|
||||
|
||||
for (auto c : str) {
|
||||
result += std::tolower(c);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
bool utils::str_includes(std::string str, std::vector<std::string> includes) {
|
||||
for (auto i : includes) {
|
||||
if (str.find(i) != std::string::npos) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user