start.exe: Handle the process title argument

Alexander Nicolaysen Sørnes alex at thehandofagony.com
Mon Jan 28 09:11:17 CST 2008


On Monday 28 January 2008 04:58:12 you wrote:
> "Alexander Nicolaysen Sørnes" <alex at thehandofagony.com> wrote:
> > +           NOTE: This will only work when run from Wine's cmd, but
> > that's ok as start is a builtin +                 shell command on NT */
>
> What's the purpose of the comment above?
>

Just to be informative to someone working with start.exe.  I can remove it.

> > +        if(argc > 1 && (vi.dwMajorVersion >= 5 || (vi.dwMajorVersion ==
> > 4 && vi.dwPlatformId == 2)))
>
> Unless there is an app which would break because of the title set there is
> no need to check the version.
>

I don't have an app handy that relies on the DOS/Win 9x behaviour of start, 
but commands like

start "notepad" a.txt
start "C:\Program Files\app.exe"

would work with the old behaviour but not with the new one; thus I assumed 
some apps would break if not checking the Windows version.




> > +        {
> > +            int cmdcount;
> > +            WCHAR* cmdline = GetCommandLineW();
> > +            WCHAR** cmdargs = CommandLineToArgvW(cmdline, &cmdcount);
> > +            WCHAR* pos = cmdline;
>
> wmain() already has arc/argv pair of parameters, why do you need to parse
> command line again?
>

We need to check for the first parameter beginning with a double quote (").  
This is stripped from the argv array.



> > +
> > +            pos += lstrlenW(cmdargs[0]);
> > +
> > +            while(*pos == ' ')
> > +                pos++;
> > +
> > +            if(*pos == '"')
> > +            {
> > +                /* FIXME: Set the process title */
> > +                i++;
> > +            }
> > +            LocalFree(cmdargs);
> > +        }
>
> I assume that you've added LocalFree as MSDN suggests, but
> CommandLineToArgvW in Wine uses GlobalAlloc, perhaps you could fix that?


Sure. :)



More information about the wine-devel mailing list