FW: argc/argv issue - More info, hack and questions...

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Wed May 1 14:13:10 CDT 2002

Hi, I havent had any replies to the attached issue I was debugging - Can
anyone assist, or should I just submit the patch. I know the patch works but
I feel it is just masking a compatibility problem between two of the wine
internal routines.

-----Original Message-----


I am still investigating this argv/argc issue. The sequence of events as far
as I can tell:

CreateProcessA(NULL, "regsvr32 comdlg32.ocx",....)
Process_CREATE calls fork_and_exec( NULL, "regsvr32 comdlg32.ocx", ...)
This sees there is no explicitly specified filename so inserts wine and --
into the command line (now "wine -- regsvr32 comdlg32.ocx")

Eventually the new process starts with the wine -- regsvr32 comdlg32.ocx as
the command line, so it needs to strip off the inserted fields, and in
PROCESS_InitWine, main_exe_name is correct (path\regsvr32.exe) but the
argc/argv includes these new fields. At the top it states:

(Scheduler/process.c, lines 491/492):
    app_argv++;  /* remove argv[0] (wine itself) */

This obviously leaves behine the -- and things go downhill from there

Interestingly wine -- regsvr32 comdlg32.ocx works fine, so there must be
command line processing here which doesnt occur during the CreateProcess

Should fork_and_exec insert the -- into the command line? If it should,
should PROCESS_InitWine check for it, ie:
    app_argv++;       /* remove argv[0] (wine itself) */
    if (app_argc && strcmp(app_argv[0], "--") == 0) {
       app_argv++;    /* remove argv[1] ('--' inserted by fork_and_exec) */

However, what implications are of doing this (it works, of course). This
feels like hacking around an imcompatibility within wine but I am happy to
submit a patch as it definitely resolves a problem for me.


More information about the wine-devel mailing list