patch for ShellExecuteEx(), ShellExecute()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fo ShellExecuteEx() is a bit better than that of yesterday.
It also corrects the return value of ShellExecute().
Now winefile does not display the superfluous "Success." message box any more 
when launching an executable in non-shell windows.


Changelog:
* implement flag SEE_MASK_IDLIST for ShellExecuteEx()
  (Now launching of executables in shell windows of winefile works.)
* extend error handling
* correct return value of ShellExecute()
* remove warning message for previously unimplemented flag 
SEE_MASK_INVOKEIDLIST
* add a few TRACE messages

-- 
Martin Fuchs
martin-fuchs@xxxxxxx
Index: shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.24
diff -u -r1.24 shlexec.c
--- shlexec.c	10 Dec 2003 00:39:31 -0000	1.24
+++ shlexec.c	13 Dec 2003 10:46:22 -0000
@@ -647,7 +647,7 @@
     if (sei->lpParameters)
         strcpy(szCommandline, sei->lpParameters);
 
-    if (sei->fMask & (SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY |
+    if (sei->fMask & (SEE_MASK_ICON | SEE_MASK_HOTKEY |
         SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT |
         SEE_MASK_DOENVSUBST | SEE_MASK_FLAG_NO_UI | SEE_MASK_UNICODE |
         SEE_MASK_NO_CONSOLE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR ))
@@ -658,12 +658,14 @@
     /* process the IDList */
     if ( (sei->fMask & SEE_MASK_INVOKEIDLIST) == SEE_MASK_INVOKEIDLIST) /*0x0c*/
     {
-        SHGetPathFromIDListA (sei->lpIDList,szApplicationName);
+        if (!SHGetPathFromIDListA(sei->lpIDList, szApplicationName))
+            return FALSE;
+
         TRACE("-- idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
     }
     else
     {
-        if (sei->fMask & SEE_MASK_IDLIST )
+        if (sei->fMask & SEE_MASK_IDLIST ) /*0x04*/
         {
             pos = strstr(szCommandline, "%I");
             if (pos)
@@ -679,6 +681,13 @@
                 memmove(pos+gap,pos+2,len);
                 memcpy(pos,szPidl,gap);
             }
+	    else
+	    {
+                if (!SHGetPathFromIDListA(sei->lpIDList, szApplicationName))
+                    return FALSE;
+
+                TRACE("--SEE_MASK_IDLIST: idlist=%p (%s)\n", sei->lpIDList, szApplicationName);
+	    }
         }
     }
 
@@ -731,7 +740,10 @@
 
     retval = execfunc(szApplicationName, NULL, sei, FALSE);
     if (retval > 32)
+    {
+        TRACE("execfunc: retval=%d sei->hInstApp=%p\n", retval, sei->hInstApp);
         return TRUE;
+    }
 
     /* Else, try to find the executable */
     cmd[0] = '\0';
@@ -790,6 +802,8 @@
         retval = (UINT)ShellExecuteA(sei->hwnd, lpOperation, lpstrTmpFile, NULL, NULL, 0);
     }
 
+    TRACE("ShellExecuteExA32 retval=%d\n", retval);
+
     if (retval <= 32)
     {
         sei->hInstApp = (HINSTANCE)retval;
@@ -845,7 +859,11 @@
  */
 BOOL WINAPI ShellExecuteExA (LPSHELLEXECUTEINFOA sei)
 {
-    return  ShellExecuteExA32 (sei, SHELL_ExecuteA);
+    BOOL ret =  ShellExecuteExA32 (sei, SHELL_ExecuteA);
+
+    TRACE("ShellExecuteExA(): ret=%d\n", ret);
+
+    return ret;
 }
 
 /*************************************************************************
@@ -855,7 +873,7 @@
 BOOL WINAPI ShellExecuteExW (LPSHELLEXECUTEINFOW sei)
 {
     SHELLEXECUTEINFOA seiA;
-    DWORD ret;
+    BOOL ret;
 
     TRACE("%p\n", sei);
 
@@ -886,6 +904,10 @@
     if (seiA.lpDirectory)	HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpDirectory );
     if (seiA.lpClass)	HeapFree( GetProcessHeap(), 0, (LPSTR) seiA.lpClass );
 
+    sei->hInstApp = seiA.hInstApp;
+
+    TRACE("ShellExecuteExW(): ret=%d\n", ret);
+
     return ret;
 }
 
@@ -916,6 +938,8 @@
     sei.dwHotKey = 0;
     sei.hProcess = hProcess;
 
-    ShellExecuteExW (&sei);
+    int ret = ShellExecuteExW (&sei);
+
+    TRACE("ShellExecuteW(): ret=%d module=%p", ret, sei.hInstApp);
     return sei.hInstApp;
 }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux