aboutsummaryrefslogtreecommitdiff
path: root/GameInjector
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-08-26 02:13:08 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-08-26 02:13:08 +0100
commitf8cdd53561dc5bb37b5387f9ad3b966de8aa2a58 (patch)
treeb85eb0d6ed98a8359bc352f9e29f34010abce613 /GameInjector
parent9c9afa37b9a410ea14b960c203a91bd8d8c767ca (diff)
downloadNorthstarLauncher-f8cdd53561dc5bb37b5387f9ad3b966de8aa2a58.tar.gz
NorthstarLauncher-f8cdd53561dc5bb37b5387f9ad3b966de8aa2a58.zip
fix cleanup after injection
Diffstat (limited to 'GameInjector')
-rw-r--r--GameInjector/dllmain.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/GameInjector/dllmain.cpp b/GameInjector/dllmain.cpp
index 38e262cc..69ea748a 100644
--- a/GameInjector/dllmain.cpp
+++ b/GameInjector/dllmain.cpp
@@ -81,10 +81,14 @@ BOOL WINAPI CreateProcessWHook(
CreateProcessA((tf2DirPath / "InjectionProxy64.exe").string().c_str(), (LPSTR)(argStr.str().c_str()), 0, 0, false, 0, 0, tf2DirPath.string().c_str(), (LPSTARTUPINFOA)&si, &pi);
WaitForSingleObject(pi.hThread, INFINITE);
- if (!alreadySuspended)
- ResumeThread(lpProcessInformation->hThread);
+ // this doesn't seem to work super well
+ //if (!alreadySuspended)
+ ResumeThread(lpProcessInformation->hThread);
+ MH_DisableHook(&CreateProcessW);
MH_RemoveHook(&CreateProcessW);
+ MH_Uninitialize();
+
FreeLibrary(ownHModule);
}
@@ -101,14 +105,14 @@ BOOL APIENTRY DllMain(HMODULE hModule,
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
- //DisableThreadLibraryCalls(hModule);
+ DisableThreadLibraryCalls(hModule);
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
- //AllocConsole();
- //freopen("CONOUT$", "w", stdout);
+ AllocConsole();
+ freopen("CONOUT$", "w", stdout);
ownHModule = hModule;
char ownDllPath[MAX_PATH];
@@ -116,9 +120,6 @@ BOOL APIENTRY DllMain(HMODULE hModule,
tf2DirPath = std::filesystem::path(ownDllPath).parent_path();
- //AllocConsole();
- //freopen("CONOUT$", "w", stdout);
-
// hook CreateProcessW
if (MH_Initialize() > MH_ERROR_ALREADY_INITIALIZED) // MH_ERROR_ALREADY_INITIALIZED = 1, MH_OK = 0, these are the only results we should expect
return TRUE;