From 215f6c47caf16f966809b92002619adb622d30df Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 6 Aug 2008 16:10:52 -0700 Subject: [PATCH] shell32: Handle directories in ShellExecute. --- dlls/shell32/shlexec.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index fec78701d84..d83a1321f83 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 ); -- 2.11.4.GIT