Index: reactos/dll/win32/shell32/dialogs/dialogs.cpp =================================================================== --- reactos/dll/win32/shell32/dialogs/dialogs.cpp (revision 74622) +++ reactos/dll/win32/shell32/dialogs/dialogs.cpp (working copy) @@ -353,6 +353,44 @@ EnableWindow(GetDlgItem(hwnd, IDOK), Enable); } +static void +LTrim(LPWSTR psz) +{ + WORD wInfo; + LPWSTR pch = psz; + + while (GetStringTypeW(CT_CTYPE1, pch, 1, &wInfo)) + { + if (!(wInfo & C1_SPACE)) + { + break; + } + + ++pch; + } + + MoveMemory(psz, pch, (lstrlen(pch) + 1) * sizeof(WCHAR)); +} + +static void +RTrim(LPWSTR psz) +{ + WORD wInfo; + LPWSTR pch = psz + lstrlenW(psz); + + while (psz < pch) + { + if (!GetStringTypeW(CT_CTYPE1, pch - 1, 1, &wInfo) || + !(wInfo & C1_SPACE)) + { + break; + } + + --pch; + *pch = UNICODE_NULL; + } +} + /* Dialog procedure for RunFileDlg */ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { @@ -435,6 +473,9 @@ GetWindowTextW(htxt, psz, ic + 1); + LTrim(psz); + RTrim(psz); + sei.hwnd = hwnd; sei.nShow = SW_SHOWNORMAL; sei.lpFile = psz; @@ -482,8 +523,11 @@ case RF_OK: if (ShellExecuteExW(&sei)) { - /* Call again GetWindowText in case the contents of the edit box has changed? */ GetWindowTextW(htxt, psz, ic + 1); + + LTrim(psz); + RTrim(psz); + FillList(htxt, psz, ic + 2 + 1, FALSE); EndDialog(hwnd, IDOK); break;