SteamTarget: Fix Unhooking

experimental
Peter Repukat 7 years ago
parent 7d02ef4e6f
commit 31791049bf

@ -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;
}

@ -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";

Loading…
Cancel
Save