diff --git a/dll/win32/shell32/dialogs/dialogs.cpp b/dll/win32/shell32/dialogs/dialogs.cpp index 5903fe4b31..0f6f63a0b8 100644 --- a/dll/win32/shell32/dialogs/dialogs.cpp +++ b/dll/win32/shell32/dialogs/dialogs.cpp @@ -553,6 +553,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); @@ -562,6 +563,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. @@ -574,6 +578,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) @@ -602,11 +609,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); @@ -636,8 +652,16 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARA break; case RF_OK: - if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL, - SECL_ALLOW_NONEXE))) + if (ShellExecuteExW(&sei)) + { + /* Call again GetWindowText in case the contents of the edit box has changed? */ + GetWindowTextW(htxt, psz, ic + 1); + FillList(htxt, psz, ic + 2 + 1, FALSE); + EndDialog(hwnd, IDOK); + break; + } + else if (SUCCEEDED(ShellExecCmdLine(hwnd, pszExpanded, pszStartDir, SW_SHOWNORMAL, NULL, + SECL_ALLOW_NONEXE))) { /* Call again GetWindowText in case the contents of the edit box has changed? */ GetWindowTextW(htxt, psz, ic + 1);