CreateProcess command line parsing
Francois Gouget
fgouget at free.fr
Mon Nov 14 14:10:32 CST 2005
On Thu, 10 Nov 2005, Rufoo wrote:
> I am looking at dlls/kernel/process.cc:get_file_name
> that parses the command line. It seems to handle the
> case where the application name has spaces in it but
> the application name is not enclosed in double quotes.
> According to MSDN documentation, CreateProcess
> requires the app name(and the app name in the command
> line) to be enclosed in quotes if it has spaces in it.
Please check MSDN again. Here is what it says:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
---
The lpApplicationName parameter can be NULL. In that case, the module
name must be the first white space-delimited token in the lpCommandLine
string. If you are using a long file name that contains a space, use
quoted strings to indicate where the file name ends and the arguments
begin; otherwise, the file name is ambiguous. For example, consider the
string "c:\program files\sub dir\program name". This string can be
interpreted in a number of ways. The system tries to interpret the
possibilities in the following order:
c:\program.exe files\sub dir\program name
c:\program files\sub.exe dir\program name
c:\program files\sub dir\program.exe name
c:\program files\sub dir\program name.exe
---
The most significant part being 'The system tries to interpret the
possibilities'. And it's quite common for applications to rely on this.
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
145 = 1! + 4! + 5!
More information about the wine-devel
mailing list