From 435f1b0355deb290a8ea124944636c753e22b0a2 Mon Sep 17 00:00:00 2001 From: mkrsym1 Date: Wed, 7 Jun 2023 20:09:02 +0300 Subject: [PATCH] Allow launching the injector from a different directory --- injector/src/injector.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/injector/src/injector.c b/injector/src/injector.c index 4dfdd1b..c2c0937 100644 --- a/injector/src/injector.c +++ b/injector/src/injector.c @@ -30,6 +30,15 @@ int main(int argc, char **argv) { return 1; } + // cd into the injector directory + char injectorPath[MAX_PATH]; + GetModuleFileNameA(GetModuleHandleA(NULL), injectorPath, sizeof(injectorPath)); + + char *lastSep = strrchr(injectorPath, '\\'); + *lastSep = '\0'; + + SetCurrentDirectoryA(injectorPath); + // Compute absolute paths char gameExePath[MAX_PATH]; GetFullPathNameA(gamePath, sizeof(gameExePath), gameExePath, NULL);