aboutsummaryrefslogtreecommitdiff
path: root/GameInjector
diff options
context:
space:
mode:
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;