Pass commandline arguments to the game process

Closes #4
This commit is contained in:
mkrsym1
2023-06-11 18:04:24 +03:00
parent 4c0c35ba43
commit 0b0216e41e
4 changed files with 50 additions and 15 deletions

View File

@ -16,6 +16,9 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
// Get the path of the DLL to inject
char *injectDll = getenv(ENV_DLL_PATH);
// Get game commandline
char *cmdline = getenv(ENV_PROC_CMD);
// Compute the working directory path
char workdir[MAX_PATH];
strcpy(workdir, targetExe);
@ -30,8 +33,8 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) {
ZeroMemory(&pi, sizeof(pi));
if (!CreateProcessA(
targetExe,
NULL,
cmdline,
NULL,
NULL,
FALSE,