From 9c006bce1778569787f356c2c0ea7ba455abd0fc Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Wed, 12 Aug 2020 01:41:13 -0600 Subject: [PATCH] ignore default config file --- texthook/engine/match.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/texthook/engine/match.cc b/texthook/engine/match.cc index 8f18c1a..e7d49ad 100644 --- a/texthook/engine/match.cc +++ b/texthook/engine/match.cc @@ -13,7 +13,7 @@ namespace Engine WCHAR* processName, // cached processPath[MAX_PATH]; // cached - char configFileData[1000]; + char configFileData[1000]{}; bool UnsafeDetermineEngineType(); @@ -44,14 +44,15 @@ namespace Engine wcscpy_s(wcsrchr(configFilename, L'\\') + 1, std::size(GAME_CONFIG_FILE), GAME_CONFIG_FILE); if (AutoHandle<> configFile = CreateFileW(configFilename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) { - if (ReadFile(configFile, configFileData, sizeof(configFileData) - 1, DUMMY, nullptr)) ConsoleOutput("Textractor: game configuration loaded"); + ReadFile(configFile, configFileData, sizeof(configFileData) - 1, DUMMY, nullptr); if (strncmp(configFileData, "Engine:", 7) == 0) { if (loadedConfig = strchr(configFileData, '\n')) *(char*)loadedConfig++ = 0; ConsoleOutput("Textractor: Engine = %s", requestedEngine = configFileData + 7); } else loadedConfig = configFileData; - if (loadedConfig && !*loadedConfig) loadedConfig = nullptr; + if ((loadedConfig && !*loadedConfig) || strstr(configFileData, "https://")) loadedConfig = nullptr; + else ConsoleOutput("Textractor: game configuration loaded"); } processStartAddress = processStopAddress = (uintptr_t)GetModuleHandleW(nullptr);