only warn the user once

This commit is contained in:
m 2022-08-14 17:01:02 -05:00
parent 53f053a2e9
commit 9026a325f2

View File

@ -81,26 +81,6 @@ void get_aslr_patched_binary(std::string* binary, std::string* data)
*binary = patched_binary;
}
bool is_steam_registry_found()
{
static bool is_steam_installed = false;
static bool is_steam_installed_set = false;
if (!is_steam_installed_set)
{
HKEY key = nullptr;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS)
{
is_steam_installed = true;
RegCloseKey(key);
}
is_steam_installed_set = true;
}
return is_steam_installed;
}
FARPROC load_binary(const launcher::mode mode, uint64_t* base_address)
{
loader loader;
@ -111,9 +91,20 @@ FARPROC load_binary(const launcher::mode mode, uint64_t* base_address)
if (library == "steam_api64.dll"
&& function != "SteamAPI_GetSteamInstallPath") // Arxan requires one valid steam api import - maybe SteamAPI_Shutdown is better?
{
if (!is_steam_registry_found())
static bool check_for_steam_install = false;
if (!check_for_steam_install)
{
MSG_BOX_WARN("Could not find Steam in the registry. If Steam is not installed, you must install it for H1-Mod to work.");
HKEY key;
if (RegOpenKeyExA(HKEY_CURRENT_USER, "Software\\Valve\\Steam", 0, KEY_ALL_ACCESS, &key) == ERROR_SUCCESS)
{
RegCloseKey(key);
}
else
{
MSG_BOX_WARN("Could not find Steam in the registry. If Steam is not installed, you must install it for H1-Mod to work.");
}
check_for_steam_install = true;
}
return self.get_proc<FARPROC>(function);