aboutsummaryrefslogtreecommitdiff
path: root/GameInjector/dllmain.cpp
diff options
context:
space:
mode:
authorBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-08-21 23:43:20 +0100
committerBobTheBob <32057864+BobTheBob9@users.noreply.github.com>2021-08-21 23:43:20 +0100
commitcd727a453a7d42a61bd161ea0c9947aee644e4f1 (patch)
tree9edff3d29292be84d4a7d76df993fdc96aeb082a /GameInjector/dllmain.cpp
parent125f53aaa690e4870af88aa3a8947ac5ac0b435d (diff)
downloadNorthstarLauncher-cd727a453a7d42a61bd161ea0c9947aee644e4f1.tar.gz
NorthstarLauncher-cd727a453a7d42a61bd161ea0c9947aee644e4f1.zip
more work on dedicated and launcher
Diffstat (limited to 'GameInjector/dllmain.cpp')
-rw-r--r--GameInjector/dllmain.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/GameInjector/dllmain.cpp b/GameInjector/dllmain.cpp
index c18495be..38e262cc 100644
--- a/GameInjector/dllmain.cpp
+++ b/GameInjector/dllmain.cpp
@@ -44,14 +44,21 @@ BOOL WINAPI CreateProcessWHook(
// origin doesn't use lpApplicationName
if (lpApplicationName)
+ {
+ std::wcout << lpApplicationName << std::endl;
isTitanfallProcess = wcsstr(lpApplicationName, L"Titanfall2\\Titanfall2.exe");
+ }
else
+ {
+ std::wcout << lpCommandLine << std::endl;
isTitanfallProcess = wcsstr(lpCommandLine, L"Titanfall2\\Titanfall2.exe");
+ }
- std::wcout << lpCommandLine << std::endl;
+ // steam will start processes suspended
+ bool alreadySuspended = dwCreationFlags & CREATE_SUSPENDED;
// suspend process on creation so we can hook
- if (isTitanfallProcess)
+ if (isTitanfallProcess && !alreadySuspended)
dwCreationFlags |= CREATE_SUSPENDED;
BOOL ret = CreateProcessWOriginal(lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, lpProcessInformation);
@@ -73,7 +80,9 @@ 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);
- ResumeThread(lpProcessInformation->hProcess);
+
+ if (!alreadySuspended)
+ ResumeThread(lpProcessInformation->hThread);
MH_RemoveHook(&CreateProcessW);
FreeLibrary(ownHModule);
@@ -98,6 +107,9 @@ BOOL APIENTRY DllMain(HMODULE hModule,
break;
}
+ //AllocConsole();
+ //freopen("CONOUT$", "w", stdout);
+
ownHModule = hModule;
char ownDllPath[MAX_PATH];
GetModuleFileNameA(hModule, ownDllPath, MAX_PATH);