Allow launching the injector from a different directory

This commit is contained in:
mkrsym1 2023-06-07 20:09:02 +03:00
parent f965bb79a3
commit 435f1b0355

View File

@ -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);