This patch: http://www.winehq.org/pipermail/wine-cvs/2005-August/017595.html broke execution of Control Panel items. The cpanel code would concatenate the name of the .cpl file and the display name and pass that in the lpFile member of the SHELLEXECUTEINFO struct. This is solved by passing .cpl in lpFile and display name in lpParameters. I ran into another problem: just before calling the execfunc(), any parameters would be appended to wszApplicationName. Unfortunately, sei_tmp.lpFile points to wszApplicationName at that point, so if the execfunc() fails (e.g. for a .cpl file) sei_tmp.lpFile is messed up. Fixing this allowed one of the todo tests to succeeed. Since looking at/tracing through the ShellExecuteEx code makes me scream in agony every time, I would appreciate a review of the patch below.
Ge van Geldorp.
Index: dlls/shell32/cpanelfolder.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/cpanelfolder.c,v retrieving revision 1.20 diff -u -r1.20 cpanelfolder.c --- dlls/shell32/cpanelfolder.c 27 Jul 2005 11:10:52 -0000 1.20 +++ dlls/shell32/cpanelfolder.c 8 Sep 2005 21:38:08 -0000 @@ -970,6 +970,7 @@ SHELLEXECUTEINFOW sei_tmp; PIDLCPanelStruct* pcpanel; WCHAR path[MAX_PATH]; + WCHAR params[MAX_PATH]; BOOL ret; int l;
@@ -990,12 +991,13 @@
/* pass applet name to Control_RunDLL to distinguish between applets in one .cpl file */ path[l++] = '"'; - path[l++] = ' '; + path[l] = '\0';
- MultiByteToWideChar(CP_ACP, 0, pcpanel->szName+pcpanel->offsDispName, -1, path+l, MAX_PATH); + MultiByteToWideChar(CP_ACP, 0, pcpanel->szName+pcpanel->offsDispName, -1, params, MAX_PATH);
memcpy(&sei_tmp, psei, sizeof(sei_tmp)); sei_tmp.lpFile = path; + sei_tmp.lpParameters = params; sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST; sei_tmp.lpVerb = wCplopen;
Index: dlls/shell32/shlexec.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v retrieving revision 1.71 diff -u -r1.71 shlexec.c --- dlls/shell32/shlexec.c 8 Sep 2005 18:54:52 -0000 1.71 +++ dlls/shell32/shlexec.c 8 Sep 2005 21:38:09 -0000 @@ -1263,9 +1263,10 @@
lpFile = wfileName;
+ strcpyW(wcmd, wszApplicationName); if (sei_tmp.lpParameters[0]) { - strcatW(wszApplicationName, wSpace); - strcatW(wszApplicationName, wszParameters); + strcatW(wcmd, wSpace); + strcatW(wcmd, wszParameters); }
/* We set the default to open, and that should generally work. @@ -1273,7 +1274,7 @@ if (!sei_tmp.lpVerb) sei_tmp.lpVerb = wszOpen;
- retval = execfunc(wszApplicationName, NULL, FALSE, &sei_tmp, sei); + retval = execfunc(wcmd, NULL, FALSE, &sei_tmp, sei); if (retval > 32) return TRUE;
Index: dlls/shell32/tests/shlexec.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/tests/shlexec.c,v retrieving revision 1.5 diff -u -r1.5 shlexec.c --- dlls/shell32/tests/shlexec.c 23 Aug 2005 09:37:30 -0000 1.5 +++ dlls/shell32/tests/shlexec.c 8 Sep 2005 21:38:09 -0000 @@ -704,9 +704,7 @@ okChildInt("argcA", 5); okChildString("argvA3", "Open"); sprintf(filename, "%s\test file.shlexec", tmpdir); - todo_wine { okChildPath("argvA4", filename); - }
sprintf(filename, "%s\test_shortcut_exe.lnk", tmpdir); rc=shell_execute_ex(SEE_MASK_NOZONECHECKS, NULL, filename, NULL, NULL);