ShellExecute patch

Andreas Mohr andi at rhlx01.fht-esslingen.de
Sun Dec 23 10:30:06 CST 2001


Hi all,

some program didn't like ShellExecute calling into WinExec16()
(long file name issue, spaces etc.).
Thus we now use either WinExec16 or WinExec.

Also fixed some typo.

Alexandre, could you fix the compile warning ?
Somehow I couldn't figure out how to forcibly silence it...

Thanks !

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: dlls/shell32/shell.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell.c,v
retrieving revision 1.33
diff -u -r1.33 shell.c
--- dlls/shell32/shell.c	6 Nov 2001 22:31:20 -0000	1.33
+++ dlls/shell32/shell.c	23 Dec 2001 14:28:46 -0000
@@ -335,12 +335,13 @@
 /*************************************************************************
  *				ShellExecute		[SHELL.20]
  */
-HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation,
-                                   LPCSTR lpFile, LPCSTR lpParameters,
-                                   LPCSTR lpDirectory, INT16 iShowCmd )
+HINSTANCE WINAPI SHELL_Execute( HWND hWnd, LPCSTR lpOperation,
+                                LPCSTR lpFile, LPCSTR lpParameters,
+                                LPCSTR lpDirectory, INT iShowCmd, BOOL win32 )
 {   HINSTANCE16 retval=31;
     char old_dir[1024];
     char cmd[1024] = "";
+    HINSTANCE WINAPI (*pWinExec)(LPCSTR lpCmdLine, UINT nCmdShow);
 
     TRACE("(%04x,'%s','%s','%s','%s',%x)\n",
 		hWnd, lpOperation ? lpOperation:"<null>", lpFile ? lpFile:"<null>",
@@ -348,6 +349,9 @@
 		lpDirectory ? lpDirectory : "<null>", iShowCmd);
 
     if (lpFile==NULL) return 0; /* should not happen */
+
+    pWinExec = (win32) ? WinExec : WinExec16;
+
     if (lpOperation==NULL) /* default is open */
       lpOperation="open";
 
@@ -360,7 +364,7 @@
     strcpy(cmd,lpFile);
     strcat(cmd,lpParameters ? lpParameters : "");
 
-    retval = WinExec16( cmd, iShowCmd );
+    retval = pWinExec( cmd, iShowCmd);
 
     /* Unable to execute lpFile directly
        Check if we can match an application to lpFile */
@@ -376,7 +380,7 @@
             strcat(cmd," ");
             strcat(cmd,lpParameters);
         }
-        retval = WinExec16( cmd, iShowCmd );
+        retval = pWinExec( cmd, iShowCmd );
       }
       else if(PathIsURLA((LPSTR)lpFile))    /* File not found, check for URL */
       {
@@ -441,7 +445,7 @@
 		}
 	    }
  
-	    retval = WinExec16( cmd, iShowCmd );
+	    retval = pWinExec( cmd, iShowCmd );
 	}
       }
     /* Check if file specified is in the form www.??????.*** */
@@ -456,6 +460,16 @@
     if (lpDirectory)
       SetCurrentDirectoryA( old_dir );
     return retval;
+}
+
+/*************************************************************************
+ *				ShellExecute		[SHELL.20]
+ */
+HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation,
+                                   LPCSTR lpFile, LPCSTR lpParameters,
+                                   LPCSTR lpDirectory, INT16 iShowCmd )
+{
+    return SHELL_Execute(hWnd, lpOperation, lpFile, lpParameters, lpDirectory, iShowCmd, FALSE);
 }
 
 /*************************************************************************
Index: dlls/shell32/shell32_main.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell32_main.c,v
retrieving revision 1.88
diff -u -r1.88 shell32_main.c
--- dlls/shell32/shell32_main.c	6 Nov 2001 22:31:20 -0000	1.88
+++ dlls/shell32/shell32_main.c	23 Dec 2001 14:28:47 -0000
@@ -194,7 +194,7 @@
                               SHFILEINFOA *psfi, UINT sizeofpsfi,
                               UINT flags )
 {
-	char szLoaction[MAX_PATH];
+	char szLocation[MAX_PATH];
 	int iIndex;
 	DWORD ret = TRUE, dwAttributes = 0;
 	IShellFolder * psfParent = NULL;
@@ -357,11 +357,11 @@
 
 	  if (SUCCEEDED(hr))
 	  {
-	    hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLoaction, MAX_PATH, &iIndex, &uFlags);
+	    hr = IExtractIconA_GetIconLocation(pei, (flags & SHGFI_OPENICON)? GIL_OPENICON : 0,szLocation, MAX_PATH, &iIndex, &uFlags);
 	    /* fixme what to do with the index? */
 
 	    if(uFlags != GIL_NOTFILENAME)
-	      strcpy (psfi->szDisplayName, szLoaction);
+	      strcpy (psfi->szDisplayName, szLocation);
 	    else
 	      ret = FALSE;
 	      
@@ -704,8 +704,8 @@
                                     LPCSTR lpFile, LPCSTR lpParameters,
                                     LPCSTR lpDirectory, INT iShowCmd )
 {   TRACE("\n");
-    return ShellExecute16( hWnd, lpOperation, lpFile, lpParameters,
-                           lpDirectory, iShowCmd );
+    return SHELL_Execute( hWnd, lpOperation, lpFile, lpParameters,
+                           lpDirectory, iShowCmd, TRUE );
 }
 
 /*************************************************************************


More information about the wine-patches mailing list