2
0
mirror of https://github.com/Thracky/GlosSI.git synced 2024-11-03 09:40:18 +00:00

SteamTarget: Fix Unhooking

This commit is contained in:
Peter Repukat 2017-02-15 21:58:44 +01:00
parent 7d02ef4e6f
commit 31791049bf
2 changed files with 24 additions and 15 deletions

View File

@ -112,6 +112,7 @@ void SteamTargetRenderer::run()
void SteamTargetRenderer::stop()
{
bRunLoop = false;
unhookBindings();
QApplication::exit(0);
}
@ -368,22 +369,27 @@ LRESULT WINAPI SteamTargetRenderer::HookCallback(int nCode, WPARAM wParam, LPARA
return CallNextHookEx(hook, nCode, wParam, lParam);
}
void SteamTargetRenderer::unhookBindings()
{
if (bHookSteam)
{
QString dir = QDir::toNativeSeparators(QCoreApplication::applicationDirPath());
dir = dir.mid(0, dir.lastIndexOf("\\"));
QProcess proc;
proc.setNativeArguments(" --eject ");
proc.setWorkingDirectory(dir);
proc.start("..\\Injector.exe", QIODevice::ReadOnly);
proc.waitForStarted();
proc.waitForFinished();
}
}
BOOL SteamTargetRenderer::ConsoleCtrlCallback(DWORD dwCtrlType)
{
if (dwCtrlType == CTRL_CLOSE_EVENT || dwCtrlType == CTRL_BREAK_EVENT || dwCtrlType == CTRL_C_EVENT)
{
if (bHookSteam)
{
QString dir = QDir::toNativeSeparators(QCoreApplication::applicationDirPath());
dir = dir.mid(0, dir.lastIndexOf("\\"));
QProcess proc;
proc.setNativeArguments(" --eject ");
proc.setWorkingDirectory(dir);
proc.start("..\\Injector.exe", QIODevice::ReadOnly);
proc.waitForStarted();
proc.waitForFinished();
}
unhookBindings();
return true;
}

View File

@ -61,6 +61,12 @@ private:
void loadLogo();
static LRESULT WINAPI HookCallback(int nCode, WPARAM wParam, LPARAM lParam);
static void unhookBindings();
static BOOL WINAPI ConsoleCtrlCallback(_In_ DWORD dwCtrlType);
std::atomic<bool> bRunLoop = true;
bool bUseDesktopConfig = false;
@ -83,7 +89,6 @@ private:
#endif
static std::atomic<bool> overlayOpen;
static HHOOK hook;
static LRESULT WINAPI HookCallback(int nCode, WPARAM wParam, LPARAM lParam);
HWND hwForeGroundWindow = nullptr;
bool bNeedFocusSwitch = false;
@ -99,8 +104,6 @@ private:
std::unique_ptr<sf::Texture> spriteTexture;
sf::Sprite backgroundSprite;
static BOOL WINAPI ConsoleCtrlCallback(_In_ DWORD dwCtrlType);
const QString LaunchGame = "LaunchGame";
const QString LaunchedProcessFinished = "LaunchedProcessFinished";
const QString IsSteamHooked = "IsSteamHooked";