Hi all, slightly changed resubmission of ShellExecute patch. ShellExecute() is supposed to call WinExec() instead of WinExec16() (proper long filename support) -- Andreas Mohr Stauferstr. 6, D-71272 Renningen, Germany
Determining best CVS host... Using CVSROOT :pserver:cvs@rhlx01.fht-esslingen.de:/home/wine Index: dlls/shell32/shell.c =================================================================== RCS file: /home/wine/wine/dlls/shell32/shell.c,v retrieving revision 1.36 diff -u -r1.36 shell.c --- dlls/shell32/shell.c 14 Feb 2002 19:20:30 -0000 1.36 +++ dlls/shell32/shell.c 21 Feb 2002 21:15:28 -0000 @@ -335,12 +335,13 @@ /************************************************************************* * ShellExecute [SHELL.20] */ -HINSTANCE16 WINAPI ShellExecute16( HWND16 hWnd, LPCSTR lpOperation, - LPCSTR lpFile, LPCSTR lpParameters, - LPCSTR lpDirectory, INT16 iShowCmd ) +HINSTANCE 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) ? (void *)WinExec : (void *)WinExec16; + if (lpOperation==NULL) /* default is open */ lpOperation="open"; @@ -363,7 +367,7 @@ strcat(cmd,lpParameters ); } - retval = WinExec16( cmd, iShowCmd ); + retval = pWinExec( cmd, iShowCmd); /* Unable to execute lpFile directly Check if we can match an application to lpFile */ @@ -379,7 +383,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 */ { @@ -444,7 +448,7 @@ } } - retval = WinExec16( cmd, iShowCmd ); + retval = pWinExec( cmd, iShowCmd ); } } /* Check if file specified is in the form www.??????.*** */ @@ -459,6 +463,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.91 diff -u -r1.91 shell32_main.c --- dlls/shell32/shell32_main.c 2 Feb 2002 18:42:15 -0000 1.91 +++ dlls/shell32/shell32_main.c 21 Feb 2002 21:15:28 -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; @@ -703,8 +703,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 ); } /************************************************************************* Index: dlls/shell32/shell32_main.h =================================================================== RCS file: /home/wine/wine/dlls/shell32/shell32_main.h,v retrieving revision 1.44 diff -u -r1.44 shell32_main.h --- dlls/shell32/shell32_main.h 2 Feb 2002 18:42:15 -0000 1.44 +++ dlls/shell32/shell32_main.h 21 Feb 2002 21:15:28 -0000 @@ -163,6 +163,7 @@ BOOL SHELL_DeleteFileA(LPCSTR pszFile, BOOL bShowUI); BOOL SHELL_WarnItemDelete(int nKindOfDialog, LPCSTR szDir); +HINSTANCE SHELL_Execute( HWND hWnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT iShowCmd, BOOL win32 ); extern HINSTANCE SHELL_FindExecutable(LPCSTR,LPCSTR ,LPSTR); /* 16-bit functions */