"Francois" == Francois Gouget fgouget@free.fr writes:
Francois> 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.
Francois> No. Your patch mishandles quotes.
Francois> Normal behavior: $ ./createp Type the command to execute: main Francois> a"b "c"d\" e CreateProcess returned: 1 error=0 Francois> GetCommandLine=[main a"b c"d\ e] main -> argc=4 0 [main] 1 Francois> [a"b] 2 [c"d] 3 [e]
Show me what lpCmdLine your test program passes to CreateProsess. Are you sure createp code doesn't misshandle things. Trying with my commandline test program, it looks right: : > wine -- cmdline.exe a"b "c"d\" e : fixme:win32:PE_CreateModule Security directory ignored : "a"b c"d\ e" The first and last quotes are added by my program.
E.g. tcsh chokes on your argument arangement (but tcsh isn't _the_ reference:-): : > wine -- cmdline.exe a"b "c"d\" e : Überflüssiges ". "Überflüssiges" == Surplus
Francois> With your patch: main a"b "c"d\" e CreateProcess returned: Francois> 1 error=0 GetCommandLine=[main "a\b "c\d\"" e] main -> argc=3 Francois> 0 [main] 1 [a\b "c\d"] 2 [e] main -> __argc=3 0 [main] 1 [a\b Francois> "c\d"] 2 [e]
Francois> With your patch we: * change the command line from what was Francois> specified, just as before * add quotes where there are none * Francois> misinterpret quotes * don't split arguments properly anymore
Francois> The existing quote handling is perfect!
Run a.exe of the tests appended and see the difference. Run against the DOS Shell in WinXX(/Vmware) to see what should happen.
Francois> I tested and Francois> retested it. The problem you are having is that we cannot Francois> garantee that the child process will get the exact same Francois> commandline because of the cmdline -> argv -> cmdline Francois> conversion. The fix for your problem is to pass the command Francois> line to the child process via a wineserver call or something.
Francois> Guess which is the first test I am going to write with the Francois> new testing framework!!! (and I would much prefer to print Francois> the contents of argv to file than to try and hard-code all the Francois> checks in the child, plus how am I going to know which was the Francois> command line that was given to me anyway!
Contend of my tests: caller.c: Programm that calls cmdline via CreateProcess cmdline.c: Print the arguments ucmdline.c: prints the arguments( Unix-File)