On Thu, 10 Jan 2002, Uwe Bonnes wrote:
Hallo,
some application builds a commandline with arguments enclosed by quotes '"', starts a daughter process with this commandline and relies on the quotes being intact in the daughter process. Wine happily removed the quotes and so the daughter process failed. Appended patch keeps quotes intact, tested via CreateProcess and calling a programm from the shell. When invoking wine from the shell, quotes need to be escaped, like any other special characters.
No. Your patch mishandles quotes.
Normal behavior: $ ./createp Type the command to execute: main a"b "c"d\" e CreateProcess returned: 1 error=0 GetCommandLine=[main a"b c"d\ e] main -> argc=4 0 [main] 1 [a"b] 2 [c"d] 3 [e]
With your patch: main a"b "c"d\" e CreateProcess returned: 1 error=0 GetCommandLine=[main "a\b "c\d\"" e] main -> argc=3 0 [main] 1 [a\b "c\d"] 2 [e] main -> __argc=3 0 [main] 1 [a\b "c\d"] 2 [e]
With your patch we: * change the command line from what was specified, just as before * add quotes where there are none * misinterpret quotes * don't split arguments properly anymore
The existing quote handling is perfect! I tested and retested it. The problem you are having is that we cannot garantee that the child process will get the exact same commandline because of the cmdline -> argv -> cmdline conversion. The fix for your problem is to pass the command line to the child process via a wineserver call or something.
Guess which is the first test I am going to write with the new testing framework!!! (and I would much prefer to print the contents of argv to file than to try and hard-code all the checks in the child, plus how am I going to know which was the command line that was given to me anyway!)
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ In a world without fences who needs Gates?