Shell execute with URLs, take 2

Duane Clark dclark at akamail.com
Sun Sep 15 12:20:03 CDT 2002


Same as the previous patch, except calls WaitForInputIdle directly, as 
pointed out by Eric.

Changelog:
	Wait for app to come up before attempting DDE connection.
	PathIsURL should fail on text without a proper "scheme".


-------------- next part --------------
Index: dlls/shell32/shlexec.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlexec.c,v
retrieving revision 1.7
diff -u -r1.7 shlexec.c
--- dlls/shell32/shlexec.c	6 Sep 2002 19:41:18 -0000	1.7
+++ dlls/shell32/shlexec.c	15 Sep 2002 17:15:16 -0000
@@ -47,7 +47,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(exec);
 
-/* this function is supposed to expand the escape sequences found in the registry
+/***********************************************************************
+ * this function is supposed to expand the escape sequences found in the registry
  * some diving reported that the following were used:
  * + %1, %2...  seem to report to parameter of index N in ShellExecute pmts
  *	%1 file
@@ -106,7 +107,7 @@
  *	SHELL_ExecuteA [Internal]
  *
  */
-static HINSTANCE SHELL_ExecuteA(char *lpCmd, LPSHELLEXECUTEINFOA sei, BOOL is32)
+static HINSTANCE SHELL_ExecuteA(char *lpCmd, LPSHELLEXECUTEINFOA sei, BOOL is32, BOOL shWait)
 {
     STARTUPINFOA  startup;
     PROCESS_INFORMATION info;
@@ -122,6 +123,11 @@
         if (CreateProcessA(NULL, lpCmd, NULL, NULL, FALSE, 0,
                         NULL, sei->lpDirectory, &startup, &info))
         {
+            /* Give 30 seconds to the app to come up, if desired. Probably only needed
+               when starting app immediately before making a DDE connection. */
+            if (shWait)
+                if (WaitForInputIdle( info.hProcess, 30000 ) == -1)
+                    WARN("WaitForInputIdle failed: Error %ld\n", GetLastError() );
             retval = (HINSTANCE)33;
             if(sei->fMask & SEE_MASK_NOCLOSEPROCESS)
 	        sei->hProcess = info.hProcess;
@@ -381,7 +387,7 @@
     if (!hConv)
     {
         TRACE("Launching '%s'\n", start);
-        ret = SHELL_ExecuteA(start, sei, is32);
+        ret = SHELL_ExecuteA(start, sei, is32, TRUE);
         if (ret < 32)
         {
             TRACE("Couldn't launch\n");
@@ -390,6 +396,7 @@
         hConv = DdeConnect(ddeInst, hszApp, hszTopic, NULL);
         if (!hConv)
         {
+            TRACE("Couldn't connect. ret=%d\n", ret);
             ret = 30; /* whatever */
             goto error;
         }
@@ -405,7 +412,7 @@
     TRACE("%s %s => %s\n", exec, lpFile, res);
 
     ret = (DdeClientTransaction(res, strlen(res) + 1, hConv, 0L, 0,
-                                XTYP_EXECUTE, 10000, &tid) != DMLERR_NO_ERROR) ? 31 : 32;
+                                XTYP_EXECUTE, 10000, &tid) != DMLERR_NO_ERROR) ? 31 : 33;
     DdeDisconnect(hConv);
  error:
     DdeUninitialize(ddeInst);
@@ -444,7 +451,7 @@
             /* Is there a replace() function anywhere? */
             cmd[cmdlen] = '\0';
             argify(param, sizeof(param), cmd, lpFile);
-            retval = SHELL_ExecuteA(param, sei, is32);
+            retval = SHELL_ExecuteA(param, sei, is32, FALSE);
         }
     }
     else TRACE("ooch\n");
@@ -576,7 +583,7 @@
             strcat(cmd, " ");
             strcat(cmd, szApplicationName);
         }
-        retval = SHELL_ExecuteA(cmd, sei, is32);
+        retval = SHELL_ExecuteA(cmd, sei, is32, FALSE);
         if (retval > 32)
             return TRUE;
         else
@@ -600,7 +607,7 @@
         strcat(szApplicationName, szCommandline);
     }
 
-    retval = SHELL_ExecuteA(szApplicationName, sei, is32);
+    retval = SHELL_ExecuteA(szApplicationName, sei, is32, FALSE);
     if (retval > 32)
         return TRUE;
 
@@ -617,7 +624,7 @@
         if (*lpstrProtocol)
             retval = execute_from_key(lpstrProtocol, szApplicationName, sei, is32);
         else
-            retval = SHELL_ExecuteA(cmd, sei, is32);
+            retval = SHELL_ExecuteA(cmd, sei, is32, FALSE);
     }
     else if (PathIsURLA((LPSTR)lpFile))    /* File not found, check for URL */
     {
@@ -625,7 +632,6 @@
         INT iSize;
 
         lpstrRes = strchr(lpFile, ':');
-        /* PathIsURLA probably should fail on strings without a ':', but it doesn't */
         if (lpstrRes)
             iSize = lpstrRes - lpFile;
         else
Index: dlls/shlwapi/path.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/path.c,v
retrieving revision 1.22
diff -u -r1.22 path.c
--- dlls/shlwapi/path.c	28 Aug 2002 23:42:34 -0000	1.22
+++ dlls/shlwapi/path.c	15 Sep 2002 17:15:18 -0000
@@ -1858,7 +1858,7 @@
     /* get protocol        */
     base.size = sizeof(base);
     res1 = SHLWAPI_1(lpstrPath, &base);
-    return (base.fcncde) ? TRUE : FALSE;
+    return (base.fcncde > 0) ? TRUE : FALSE;
 }
 
 /*************************************************************************
@@ -1874,7 +1874,7 @@
     /* get protocol        */
     base.size = sizeof(base);
     res1 = SHLWAPI_2(lpstrPath, &base);
-    return (base.fcncde) ? TRUE : FALSE;
+    return (base.fcncde > 0) ? TRUE : FALSE;
 }
 
 /*************************************************************************
Index: dlls/shlwapi/ordinal.c
===================================================================
RCS file: /home/wine/wine/dlls/shlwapi/ordinal.c,v
retrieving revision 1.53
diff -u -r1.53 ordinal.c
--- dlls/shlwapi/ordinal.c	10 Sep 2002 00:32:27 -0000	1.53
+++ dlls/shlwapi/ordinal.c	15 Sep 2002 17:15:19 -0000
@@ -170,6 +170,7 @@
     DWORD cnt;
     const SHL_2_inet_scheme *inet_pro;
 
+    y->fcncde = URL_SCHEME_INVALID;
     if (y->size != 0x18) return E_INVALIDARG;
     /* FIXME: leading white space generates error of 0x80041001 which
      *        is undefined
@@ -226,6 +227,7 @@
     LPSTR cmpstr;
     INT len;
 
+    y->fcncde = URL_SCHEME_INVALID;
     if (y->size != 0x18) return E_INVALIDARG;
     /* FIXME: leading white space generates error of 0x80041001 which
      *        is undefined


More information about the wine-patches mailing list