From 5e73c7bce24553ba3238565781a1327664d4be8b Mon Sep 17 00:00:00 2001 From: Tixx <83774803+WiserTixx@users.noreply.github.com> Date: Wed, 17 Sep 2025 09:19:50 +0200 Subject: [PATCH] Check outdated registry entry for GameDir --- src/Security/BeamNG.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Security/BeamNG.cpp b/src/Security/BeamNG.cpp index 72910ca..58167b7 100644 --- a/src/Security/BeamNG.cpp +++ b/src/Security/BeamNG.cpp @@ -197,6 +197,29 @@ void LegitimacyCheck() { lowExit(5); } } + } else { + std::wstring Result; + + std::string K3 = R"(Software\BeamNG\BeamNG.drive)"; + + HKEY hKey; + + LONG dwRegOPenKey = OpenKey(HKEY_CURRENT_USER, K3.c_str(), &hKey); + if (dwRegOPenKey == ERROR_SUCCESS) { + Result = QueryKey(hKey, 3); + if (Result.empty()) { + debug("Failed to QUERY key HKEY_CURRENT_USER\\Software\\BeamNG\\BeamNG.drive"); + lowExit(6); + } + GameDir = Result; + debug(L"GameDir from registry: " + Result); + } else { + debug("Failed to OPEN key HKEY_CURRENT_USER\\Software\\BeamNG\\BeamNG.drive"); + lowExit(7); + } + K3.clear(); + Result.clear(); + RegCloseKey(hKey); } delete[] appDataPath;