Lei Zhang : shell32: Handle directories in ShellExecute.

Alexandre Julliard julliard at winehq.org
Mon Aug 18 10:47:09 CDT 2008


Module: wine
Branch: master
Commit: 215f6c47caf16f966809b92002619adb622d30df
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=215f6c47caf16f966809b92002619adb622d30df

Author: Lei Zhang <thestig at google.com>
Date:   Wed Aug  6 16:10:52 2008 -0700

shell32: Handle directories in ShellExecute.

---

 dlls/shell32/shlexec.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index fec7870..d83a132 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1755,6 +1755,34 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
                                           sei, execfunc );
         HeapFree( GetProcessHeap(), 0, env );
     }
+    else if (PathIsDirectoryW(lpFile))
+    {
+        static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r',0};
+        static const WCHAR wQuote[] = {'"',0};
+        WCHAR wExec[MAX_PATH];
+        WCHAR * lpQuotedFile = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * (strlenW(lpFile) + 3) );
+
+        if (lpQuotedFile)
+        {
+            retval = SHELL_FindExecutable( sei_tmp.lpDirectory, wExplorer,
+                                           wszOpen, wExec, MAX_PATH,
+                                           NULL, &env, NULL, NULL );
+            if (retval > 32)
+            {
+                strcpyW(lpQuotedFile, wQuote);
+                strcatW(lpQuotedFile, lpFile);
+                strcatW(lpQuotedFile, wQuote);
+                retval = SHELL_quote_and_execute( wExec, lpQuotedFile,
+                                                  lpstrProtocol,
+                                                  wszApplicationName, env,
+                                                  &sei_tmp, sei, execfunc );
+                HeapFree( GetProcessHeap(), 0, env );
+            }
+            HeapFree( GetProcessHeap(), 0, lpQuotedFile );
+        }
+        else
+            retval = 0; /* Out of memory */
+    }
     else if (PathIsURLW(lpFile))    /* File not found, check for URL */
     {
         retval = SHELL_execute_url( lpFile, wFile, wcmd, &sei_tmp, sei, execfunc );




More information about the wine-cvs mailing list