[Bug 9628] msiexec command line parsing incorrect

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Nov 23 14:36:22 CST 2007


Darragh Bailey <felix at compsoc.nuigalway.ie> changed:

           What    |Removed                     |Added
                 CC|                            |felix at compsoc.nuigalway.ie

--- Comment #3 from Darragh Bailey <felix at compsoc.nuigalway.ie>  2007-11-23 14:36:21 ---
Had a look at this and here's what I can make out that is happening in this
case, so I added some traces to take a look at the different command lines run.
Any of the output lines referred to with "bug 9628" are addition traces added
by me to my own code.

When msiexec is called by the setup program the command line is as follows:

trace:msiexec:main bug 9628: argv[0] = ""
trace:msiexec:main bug 9628: argv[1] = "/i"
trace:msiexec:main bug 9628: argv[2] = "Z:\home\dara\tmp\RPG Maker

Currently when the following line is run:
process_args( GetCommandLineW(), &argc, &argvW );

argvW gets returned as
trace:msiexec:main bug 9628: argvW[0] = "L"/i""
trace:msiexec:main bug 9628: argvW[1] = "L"Z:\\home\\dara\\tmp\\RPG Maker

and in the loop in the main function which processes the different options
starts of with:

        for(i = 1; i < argc; i++)
                WINE_TRACE("argvW[%d] = %s\n", i, wine_dbgstr_w(argvW[i]));

Which dumps to the console output:
trace:msiexec:main argvW[1] = L"Z:\\home\\dara\\tmp\\RPG Maker

Which means it skips the "/i" option because its expecting to start off at the
second element.

Changing the code back to what was before the change in comment 1 was made
gives the following:
i.e. after making the following change
-       process_args( GetCommandLineW(), &argc, &argvW );
+       argvW = CommandLineToArgvW( GetCommandLineW(), &argc );

argvW now outputs as:
trace:msiexec:main bug 9628: argvW[0] = "L"""
trace:msiexec:main bug 9628: argvW[1] = "L"/i""
trace:msiexec:main bug 9628: argvW[2] = "L"Z:\\home\\dara\\tmp\\RPG Maker

which means that in the main loop after ignoring the first option you see the
following which will get processed:

trace:msiexec:main argvW[1] = L"/i"
trace:msiexec:main argvW[2] = L"Z:\\home\\dara\\tmp\\RPG Maker

This suggests to me that the code using CommandLineToArgvW was correct, and
that  fix exposed another bug in the installers of other applications. It also
asks the question, why in this case does the program name 
"c:\windows\system32\msiexec.exe" not appear as the value to argv[0]?

Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.

More information about the wine-bugs mailing list