From 17925506a9f70afddbfc7aae34b043c75be6f066 Mon Sep 17 00:00:00 2001 From: Harm Date: Fri, 7 Jan 2022 20:07:26 +0100 Subject: [PATCH] - Fixed loader arguments --- OpenParrotLoader/src/main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OpenParrotLoader/src/main.cpp b/OpenParrotLoader/src/main.cpp index 88e9f1b..c611e15 100644 --- a/OpenParrotLoader/src/main.cpp +++ b/OpenParrotLoader/src/main.cpp @@ -1,4 +1,4 @@ -#define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_WARNINGS #include #include #include @@ -204,11 +204,12 @@ int wmain(int argc, wchar_t* argv[]) // With arguments if (argc == 4) { - wchar_t args[MAX_PATH]; - swprintf(args, MAX_PATH, L"%ls", argv[3]); + size_t cmdSize = wcslen(gamePathW) + wcslen(argv[3]) + 4; + wchar_t* cmdW = new wchar_t[cmdSize]{ 0 }; + swprintf(cmdW, cmdSize, L"\"%ls\" %ls", gamePathW, argv[3]); if (!CreateProcess(gamePathW, // No module name (use command line). - args, // Command line. + cmdW, // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle not inheritable. FALSE, // Set handle inheritance to FALSE.