Still no luck on command line parse

lawson_whitney at lawson_whitney at
Sun Feb 3 16:25:39 CST 2002

On Sun, 3 Feb 2002, Francois Gouget wrote:

> > main gets it as constructed by the C runtime, isn't it?
>    Which main?
>  * the main of a Unix application. The C runtime invokes main so it gets
> the pointers from it after a fashion. But I am pretty sure these point
> to a memory block that was initialized by the kernel itself
>  * the main of a Winelib application. This one gets it from Wine. More
> precisely it gets it from scheduler/process.c:build_argv()
>  * and the WinMain of a Winelib application gets its command line from
> memory/environ.c:ENV_BuildCommandLine(), which builds it from the result
> of build_argv()
The main of a windows C program, I mean.  Well, lcclnk.exe produces PE
executables, so I guess that is what it is.  Its main gets whatever
lcccrt0.o sees fit to give it, I think.
>    If you have a 'z:' drive that points to /, then the first path is
> valid. Except if Wine changes the current drive or chooses another
> current driver for some reason... For instance here /home/fgouget
> corresponds to y:\ and z:\home\fgouget so I am not sure which one Wine
> would actually choose on startup. And if it chooses y:\, then
> /home/fgouget/foo.exe would not be a valid path anymore.
Well, /home/whit/cmdl is H:, and /gp/windose is C:, but what goes in
GetCommandLine() and argv[0] is what was on the unix command line.
If we wanted to try to idiot-proof the thing, maybe we would convert it
to a windows path, but that way lies madness.  If my damned app wants to
parse the command line, I don't see why I shouldn't give it a command
line it can parse.  Maybe something to that effect should go into the
> --
> Francois Gouget         fgouget at
>      The software said it requires Win95 or better, so I installed Linux.

It is impossible to make anything foolproof because fools are so

More information about the wine-users mailing list