You are not logged in.
Pages: 1
Hi ab,
i have a problem with the ExtractExecutableName for a cmd-line with many parameters (it is a combination for cmd with "&")
Not working:
ExtractExecutableName('"cmd.exe" 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30')=""
Working:
ExtractExecutableName('"cmd.exe" 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 29')="cmd.exe"
I didn't see the problem in the state machine - sorry, but i think you get the reason.
... oh wait...
TParseCommandsArgs = array[0..31] of PAnsiChar;
any reason for the limit?
I wish you a happy Easter.
Offline
Handling up to 32 parameters seemed fair enough for most use cases.
Since it is stack-allocated, I wanted to keep it small.
But you are right, 32 seems a bit too small.
I have enhanced TParseCommandsArgs size to 256 values:
https://github.com/synopse/mORMot2/commit/3a3b076a1
Note that my Debian Linux, "getconf ARG_MAX" returns around 2MB of text for the whole command line + environment variables, which could be quite huge, but has been used as such by some recursive scripts.
On Windows, there seem to be a limitation to 8KB - so I guess in a cross-platform way, 256 parameters seems fair enough.
https://learn.microsoft.com/en-us/troub … limitation
Offline
Perfect, thank you very much, i think 256 is fine for everyone.
Offline
Pages: 1