https://git.reactos.org/?p=reactos.git;a=commitdiff;h=33c7c91b36dbace264d9d70d606df5d6d1cd7552

commit 33c7c91b36dbace264d9d70d606df5d6d1cd7552
Author:     Doug Lyons <[email protected]>
AuthorDate: Tue Jul 6 12:36:15 2021 -0500
Commit:     GitHub <[email protected]>
CommitDate: Tue Jul 6 19:36:15 2021 +0200

    [SHELL32] Improve Start-Run Dialog Box Features (#3797) CORE-17351 
CORE-16898
    
    
    Improve performance of Start-Run Dialog Box Options
    
    This will fix:
    CORE-17351 'RunDlg fails calling URL without http'
    and
    CORE-16898 'RunCommand "iexplore" fails to open Wine IE'
    Both regressed by 0.4.10-dev-419-g bfcbda227f99c1b59e8ed71f5e0f59f793d496a1
---
 dll/win32/shell32/dialogs/dialogs.cpp | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/dll/win32/shell32/dialogs/dialogs.cpp 
b/dll/win32/shell32/dialogs/dialogs.cpp
index e576dbc0bfb..855b4ed16f9 100644
--- a/dll/win32/shell32/dialogs/dialogs.cpp
+++ b/dll/win32/shell32/dialogs/dialogs.cpp
@@ -586,6 +586,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, 
WPARAM wParam, LPARA
                     INT ic;
                     WCHAR *psz, *pszExpanded, *parent = NULL;
                     DWORD cchExpand;
+                    SHELLEXECUTEINFOW sei;
                     NMRUNFILEDLGW nmrfd;
 
                     ic = GetWindowTextLengthW(htxt);
@@ -595,6 +596,9 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, 
WPARAM wParam, LPARA
                         return TRUE;
                     }
 
+                    ZeroMemory(&sei, sizeof(sei));
+                    sei.cbSize = sizeof(sei);
+
                     /*
                      * Allocate a new MRU entry, we need to add two characters
                      * for the terminating "\\1" part, then the NULL character.
@@ -607,6 +611,9 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, 
WPARAM wParam, LPARA
                     }
 
                     GetWindowTextW(htxt, psz, ic + 1);
+                    sei.hwnd = hwnd;
+                    sei.nShow = SW_SHOWNORMAL;
+                    sei.lpFile = psz;
                     StrTrimW(psz, L" \t");
 
                     if (wcschr(psz, L'%') != NULL)
@@ -635,11 +642,20 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT 
message, WPARAM wParam, LPARA
                      */
                     LPCWSTR pszStartDir;
                     if (prfdp->lpstrDirectory)
+                    {
+                        sei.lpDirectory = prfdp->lpstrDirectory;
                         pszStartDir = prfdp->lpstrDirectory;
+                    }
                     else if (prfdp->uFlags & RFF_CALCDIRECTORY)
+                    {
+                        sei.lpDirectory = parent = 
RunDlg_GetParentDir(sei.lpFile);
                         pszStartDir = parent = 
RunDlg_GetParentDir(pszExpanded);
+                    }
                     else
+                    {
+                        sei.lpDirectory = NULL;
                         pszStartDir = NULL;
+                    }
 
                     /* Hide the dialog for now on, we will show it up in case 
of retry */
                     ShowWindow(hwnd, SW_HIDE);
@@ -669,10 +685,21 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT 
message, WPARAM wParam, LPARA
                             break;
 
                         case RF_OK:
+                            /* We use SECL_NO_UI because we don't want to see
+                             * errors here, but we will try again below and
+                             * there we will output our errors. */
                             if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, 
pszStartDir, SW_SHOWNORMAL, NULL,
-                                                           SECL_ALLOW_NONEXE)))
+                                                           SECL_ALLOW_NONEXE | 
SECL_NO_UI)))
+                            {
+                                /* Call GetWindowText again in case the 
contents of the edit box have changed. */
+                                GetWindowTextW(htxt, psz, ic + 1);
+                                FillList(htxt, psz, ic + 2 + 1, FALSE);
+                                EndDialog(hwnd, IDOK);
+                                break;
+                            }
+                            else if (SUCCEEDED(ShellExecuteExW(&sei)))
                             {
-                                /* Call again GetWindowText in case the 
contents of the edit box has changed? */
+                                /* Call GetWindowText again in case the 
contents of the edit box have changed. */
                                 GetWindowTextW(htxt, psz, ic + 1);
                                 FillList(htxt, psz, ic + 2 + 1, FALSE);
                                 EndDialog(hwnd, IDOK);

Reply via email to