From d22f44d37db347a13163b7b9692017627801c395 Mon Sep 17 00:00:00 2001 From: Peter Repukat Date: Tue, 11 Oct 2022 19:55:45 +0200 Subject: [PATCH] =?UTF-8?q?GlosSITarget:=20Add=20somewhat=20of=20epic=20ga?= =?UTF-8?q?mes=20launcher=20process=20detection=20workaround=20?= =?UTF-8?q?=F0=9F=A4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GlosSITarget/AppLauncher.cpp | 27 +++++++++++++++++++++++++++ GlosSITarget/AppLauncher.h | 5 +++++ 2 files changed, 32 insertions(+) diff --git a/GlosSITarget/AppLauncher.cpp b/GlosSITarget/AppLauncher.cpp index b2350c7..0b174a8 100644 --- a/GlosSITarget/AppLauncher.cpp +++ b/GlosSITarget/AppLauncher.cpp @@ -33,6 +33,7 @@ limitations under the License. #include #include "UnhookUtil.h" +#include "util.h" AppLauncher::AppLauncher( std::vector& process_hwnds, @@ -71,6 +72,9 @@ void AppLauncher::update() if (process_check_clock_.getElapsedTime().asMilliseconds() > 250) { pid_mutex_.lock(); #ifdef _WIN32 + if (was_egs_launch_ && pids_.empty()) { + findEgsPid(); + } if (!pids_.empty() && pids_[0] > 0) { if (Settings::launch.waitForChildProcs) { getChildPids(pids_[0]); @@ -191,6 +195,16 @@ void AppLauncher::getProcessHwnds() #endif #ifdef _WIN32 +bool AppLauncher::findEgsPid() +{ + if (const auto pid = glossi_util::PidByName(L"EpicGamesLauncher.exe")) { + spdlog::debug("Found EGS-Launcher running"); + pids_.push_back(pid); + return true; + } + return false; +} + void AppLauncher::UnPatchValveHooks() { // need to load addresses that way.. Otherwise we may land before some jumps... @@ -323,6 +337,19 @@ void AppLauncher::launchURL(const std::wstring& url, const std::wstring& args, c return; } } + + if (url.find(L"epicgames.launcher") != std::wstring::npos) { + was_egs_launch_ = true; + spdlog::debug("Epic Games launch; Couldn't find egs launcher PID"); + pid_mutex_.lock(); + + const auto pid = glossi_util::PidByName(L"EpicGamesLauncher.exe"); + if (!findEgsPid()) { + spdlog::debug("Did not find EGS-Launcher not running, retrying later..."); + } + pid_mutex_.unlock(); + return; + } spdlog::warn("Couldn't get PID of launched URL process"); } #endif diff --git a/GlosSITarget/AppLauncher.h b/GlosSITarget/AppLauncher.h index 7203028..4b1472f 100644 --- a/GlosSITarget/AppLauncher.h +++ b/GlosSITarget/AppLauncher.h @@ -49,6 +49,11 @@ class AppLauncher { void getProcessHwnds(); std::vector& process_hwnds_; + + bool was_egs_launch_ = false; + bool findEgsPid(); + + std::wstring launched_uwp_path_; static void UnPatchValveHooks();