Improved koalageddon mode detection

This commit is contained in:
acidicoala 2023-01-05 21:46:56 +03:00
parent 6f43e5ee9b
commit b04c96a36d
No known key found for this signature in database
GPG Key ID: D24C6065B49C645B
2 changed files with 22 additions and 3 deletions

View File

@ -51,8 +51,6 @@ namespace koalageddon {
}
void init() {
logger->info("🐨 Detected Koalageddon mode 💥");
std::thread([]() {
const auto kg_config_source = init_koalageddon_config();
logger->info("Loaded Koalageddon config from the {}", kg_config_source);

View File

@ -58,6 +58,25 @@ namespace smoke_api {
// the support for it has been dropped from this project.
}
bool is_valve_steam(const String& exe_name) {
if (not util::strings_are_equal(exe_name, "steam.exe")) {
return false;
}
const HMODULE steam_handle = win_util::get_module_handle_or_throw(nullptr);
const auto manifest = win_util::get_module_manifest(steam_handle);
// Verify that it's steam from valve, and not some other executable coincidentally named steam
if (!manifest.has_value()) {
// Steam.exe is expected to have a manifest
return false;
}
// Steam.exe manifest is expected to contain this string
return manifest.value().find("valvesoftware.steam.steam") != String::npos;
}
void init(HMODULE module_handle) {
try {
DisableThreadLibraryCalls(module_handle);
@ -89,7 +108,9 @@ namespace smoke_api {
init_hook_mode();
#else
// TODO: Check if it's steam from valve
if (util::strings_are_equal(exe_name, "steam.exe")) {
if (is_valve_steam(exe_name)) {
logger->info("🐨💥 Detected Koalageddon mode");
koalageddon::init();
} else {
init_hook_mode();