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

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Mon Apr 29 08:30:26 CDT 2002


Hello,

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) */
    app_argc--;

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

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

Question:
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) */
    app_argc--;
    if (app_argc && strcmp(app_argv[0], "--") == 0) {
       app_argv++;    /* remove argv[1] ('--' inserted by fork_and_exec) */
       app_argc--;
    }

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.

Regards,
Jason




More information about the wine-devel mailing list