shell32: fix program search in ShellExecuteEx, quote program name if it contains spaces [3rd]

Stefan Leichter Stefan.Leichter at camline.com
Thu Aug 20 08:14:07 CDT 2009


Am Wednesday 19 August 2009 12:05:04 schrieb Alexandre Julliard:
> Stefan Leichter <Stefan.Leichter at camline.com> writes:
> > @@ -1711,28 +1713,29 @@
> >  	}
> >  	else
> >  	{
> > -	    /* If the executable name is not quoted, we have to use this search
> > loop here, +        /* FIXME: what versions support this? Fails on
> > 2000/XP
> > +           If the executable name is not quoted, we have to use this
> > search loop here, that in CreateProcess() is not sufficient because it
> > does not handle shell links. */ WCHAR buffer[MAX_PATH],
> > xlpFile[MAX_PATH];
> > -	    LPWSTR space, s;
> > +        LPWSTR space;
> >
> > -	    LPWSTR beg = wszApplicationName/*sei_tmp.lpFile*/;
> > -	    for(s=beg; (space=strchrW(s, ' ')); s=space+1) {
> > -		int idx = space-sei_tmp.lpFile;
> > -		memcpy(buffer, sei_tmp.lpFile, idx * sizeof(WCHAR));
> > +        lstrcpynW(buffer, wszApplicationName,
> > sizeof(buffer)/sizeof(WCHAR)); +        while((space=strchrW(buffer, '
> > ')))
> > +        {
> > +            int idx = space-buffer;
> >  		buffer[idx] = '\0';
>
> This will break the loop since you don't reset the buffer contents. Also
> the indentation is messed up, please fix your editor setup.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ShellExecuteEx.diff
Type: text/x-diff
Size: 5175 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20090820/50821523/attachment.diff>


More information about the wine-patches mailing list