ignore default config file

This commit is contained in:
Akash Mozumdar 2020-08-12 01:41:13 -06:00
parent c3c73d2ac2
commit 9c006bce17

View File

@ -13,7 +13,7 @@ namespace Engine
WCHAR* processName, // cached WCHAR* processName, // cached
processPath[MAX_PATH]; // cached processPath[MAX_PATH]; // cached
char configFileData[1000]; char configFileData[1000]{};
bool UnsafeDetermineEngineType(); bool UnsafeDetermineEngineType();
@ -44,14 +44,15 @@ namespace Engine
wcscpy_s(wcsrchr(configFilename, L'\\') + 1, std::size(GAME_CONFIG_FILE), GAME_CONFIG_FILE); 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 (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 (strncmp(configFileData, "Engine:", 7) == 0)
{ {
if (loadedConfig = strchr(configFileData, '\n')) *(char*)loadedConfig++ = 0; if (loadedConfig = strchr(configFileData, '\n')) *(char*)loadedConfig++ = 0;
ConsoleOutput("Textractor: Engine = %s", requestedEngine = configFileData + 7); ConsoleOutput("Textractor: Engine = %s", requestedEngine = configFileData + 7);
} }
else loadedConfig = configFileData; 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); processStartAddress = processStopAddress = (uintptr_t)GetModuleHandleW(nullptr);