Refactor CLI argument parsing to use -- delimiter#18
Refactor CLI argument parsing to use -- delimiter#18frg2089 wants to merge 4 commits intoPhobos-developers:masterfrom
-- delimiter#18Conversation
Metadorius
left a comment
There was a problem hiding this comment.
One critical issue: you're parsing then un-parsing the arguments by concatenating them back, not necessarily with the same delimiters. Can you guarantee this won't fuck up anything? No. Should you be doing this? Also no. The arguments to be passed to the injected process must be passed as-is, without any intermediate processing. Treat everything past -- as a black box.
|
Then I am also not sure on the real benefit. While unconventional, what other drawbacks does passing --args="-args” have? |
Haven't heard from you on this. I've also seen both Current pre-parsing step is inelegant of a solution to be honest. Ideally you'd call some builtin function to get an offset of the |
Replace `--args="..."` flag with standard `--` delimiter for passing arguments to the target executable. This follows conventional CLI patterns where arguments after `--` are forwarded directly to the spawned process rather than being parsed by Syringe. Changes: - Update usage message to reflect new `--` syntax - Modify `parse_command_line` to recognize `--` as the delimiter - Append all arguments after `--` to the game arguments string - Remove deprecated `--args=` flag handling Signed-off-by: 舰队的偶像-岛风酱 <frg2089@outlook.com>
Handle quoted strings in command-line arguments to properly parse paths with spaces. Both executable names and injection DLL paths can now be wrapped in double quotes. Changes: - Strip surrounding quotes from executable name if present - Parse `-i="path with spaces.dll"` format by removing quotes - Preserve argument integrity when paths contain spaces Signed-off-by: 舰队的偶像-岛风酱 <frg2089@outlook.com>
Parse the raw command line string to properly detect the `--` separator before argument splitting. This ensures that quoted arguments containing the `--` delimiter are handled correctly and not mistakenly treated as separators. The previous approach used `CommandLineToArgvW` which splits arguments before parsing, making it impossible to distinguish between a quoted `--` in an argument and the actual separator. Changes: - Add `FindSeparator()` to locate `--` in raw command line with proper quote and escape handling - Modify `GetArguments()` to split raw command line at separator - Remove `--` handling from `parse_command_line()` since it's now done earlier - Return separate `syringe_args` and `game_args` from `GetArguments()` Signed-off-by: 舰队的偶像-岛风酱 <frg2089@outlook.com>
|
Yeah I've seen, verbatim argument passing is a good change my biggest complaint right now is the fact that you have to manually parse in order to get the position of the arg. and the C# example doesn't account for I think you can agree that the previous approach was much simpler, just parse a string argument and pass it to launched exe. |
Signed-off-by: 舰队的偶像-岛风酱! <frg2089@outlook.com>

The reason for this change is to improve the command-line argument parsing method by adopting the standard
--delimiter syntax commonly used in Unix/Linux systems.Why Change?
Old Approach
--args=flag to pass game argumentsNew Approach
--as delimiter, which is a standard convention in Unix/Linux--are passed directly to the target programTechnical Details
In the
parse_command_linefunction inSupport.h:--is encountered, theexe_argumentsflag is set to truegame_argumentsstringsubstr(1)removes the leading extra spaceAdvantages
git,docker, etc.)--args=flag handlingWhere is issues?