Make ShellExecuteA(0, NULL, "file.html", NULL, NULL, SW_SHOW) work again: #1

Dmitry Timoshkov dmitry at baikal.ru
Mon Jun 7 09:17:52 CDT 2004


Hello,

while investigating why simple
ShellExecuteA(0, NULL, "file.html", NULL, NULL, SW_SHOW);
no more works I've found 2 bugs preventing it from work.

This one is caused by removal of setting of the default "open" verb
if the provided verb is NULL. But that's what most applications do
when they want a default processing to happen, and at least it's not
wise to remove that probably not correct code without adding a working
implementation.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Restore default "open" functionality of ShellExecute.

--- cvs/hq/wine/dlls/shell32/shlexec.c	Tue Apr 27 01:25:40 2004
+++ wine/dlls/shell32/shlexec.c	Mon Jun 07 13:56:13 2004
@@ -716,6 +719,8 @@ static HDDEDATA CALLBACK dde_cb(UINT uTy
                                 HSZ hsz1, HSZ hsz2, HDDEDATA hData,
                                 ULONG_PTR dwData1, ULONG_PTR dwData2)
 {
+    TRACE("dde_cb: %04x, %04x, %p, %p, %p, %p, %p, %p\n",
+           uType, uFmt, hConv, hsz1, hsz2, hData, dwData1, dwData2);
     return NULL;
 }
 
@@ -1095,7 +1100,6 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEX
 	}
     }
 
-
     /* expand environment strings */
     if (ExpandEnvironmentStringsW(sei_tmp.lpFile, buffer, MAX_PATH))
 	lstrcpyW(wszApplicationName, buffer);
@@ -1109,7 +1113,7 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEX
 	    lstrcpyW(wszDir, buffer);
 
     /* Else, try to execute the filename */
-    TRACE("execute:'%s','%s','%s'\n", debugstr_w(wszApplicationName), debugstr_w(wszParameters), debugstr_w(wszDir));
+    TRACE("execute:%s,%s,%s\n", debugstr_w(wszApplicationName), debugstr_w(wszParameters), debugstr_w(wszDir));
 
     /* separate out command line arguments from executable file name */
     if (!*sei_tmp.lpParameters) {
@@ -1180,6 +1184,11 @@ BOOL WINAPI ShellExecuteExW32 (LPSHELLEX
         strcatW(wszApplicationName, wszParameters);
     }
 
+    /* We set the default to open, and that should generally work.
+       But that is not really the way the MS docs say to do it. */
+    if (!sei_tmp.lpVerb)
+        sei_tmp.lpVerb = wszOpen;
+
     retval = execfunc(wszApplicationName, NULL, FALSE, &sei_tmp, sei);
     if (retval > 32)
         return TRUE;
@@ -1268,7 +1277,9 @@ HINSTANCE WINAPI ShellExecuteA(HWND hWnd
     SHELLEXECUTEINFOA sei;
     HANDLE hProcess = 0;
 
-    TRACE("\n");
+    TRACE("%p,%s,%s,%s,%s,%d\n",
+           hWnd, lpOperation, lpFile, lpParameters, lpDirectory, iShowCmd);
+
     sei.cbSize = sizeof(sei);
     sei.fMask = 0;
     sei.hwnd = hWnd;






More information about the wine-patches mailing list