shell32 patch 23i
Martin Fuchs
martin-fuchs at gmx.net
Fri Apr 9 08:46:21 CDT 2004
Changelog:
separate out command line arguments from executable file name
Index: shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.40
diff -u -p -d -r1.40 shlexec.c
--- shlexec.c 7 Apr 2004 03:49:51 -0000 1.40
+++ shlexec.c 9 Apr 2004 13:44:59 -0000
@@ -1107,9 +1107,71 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEX
/* Else, try to execute the filename */
TRACE("execute:'%s','%s','%s'\n", debugstr_w(wszApplicationName), debugstr_w(wszCommandline), debugstr_w(wszDir));
- strcpyW(wfileName, wszApplicationName);
+ /* separate out command line arguments from executable file name */
+ if (!sei_tmp.lpParameters[0]) {
+ /* If the executable path is quoted, handle the rest of the command line as parameters. */
+ if (sei_tmp.lpFile[0] == '"') {
+ LPWSTR src = wszApplicationName/*sei_tmp.lpFile*/ + 1;
+ LPWSTR dst = wfileName;
+ LPWSTR end;
+
+ /* copy the unquoted executabe path to 'wfileName' */
+ while(*src && *src!='"')
+ *dst++ = *src++;
+
+ *dst = '\0';
+
+ if (*src == '"') {
+ end = ++src;
+
+ while(isspace(*src))
+ ++src;
+ } else
+ end = src;
+
+ /* copy the parameter string to 'wszParameters' */
+ strcpyW(wszParameters, src);
+
+ /* terminate previous command string after the quote character */
+ *end = '\0';
+ }
+ else
+ {
+ /* 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 beg = wszApplicationName/*sei_tmp.lpFile*/;
+ for(s=beg; (space=strchrW(s, ' ')); s=space+1) {
+ int idx = space-sei_tmp.lpFile;
+ strncpyW(buffer, sei_tmp.lpFile, idx);
+ buffer[idx] = '\0';
+
+ /*FIXME This finds directory paths if the targeted file name contains spaces. */
+ if (SearchPathW(*sei_tmp.lpDirectory? sei_tmp.lpDirectory: NULL, buffer, wszExe, sizeof(xlpFile), xlpFile, NULL))
+ {
+ /* separate out command from parameter string */
+ LPCWSTR p = space + 1;
+
+ while(isspaceW(*p))
+ ++p;
+
+ strcpyW(wszParameters, p);
+ *space = '\0';
+
+ break;
+ }
+ }
+
+ strcpyW(wfileName, sei_tmp.lpFile);
+ }
+ } else
+ strcpyW(wfileName, sei_tmp.lpFile);
+
lpFile = wfileName;
- if (wszCommandline[0]) {
+
+ if (sei_tmp.lpParameters[0]) {
strcatW(wszApplicationName, wSpace);
strcatW(wszApplicationName, wszCommandline);
}
More information about the wine-patches
mailing list