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) @@ -407,10 +407,11 @@ { LRESULT lRet; HWND htxt = GetDlgItem(hwnd, IDC_RUNDLG_EDITPATH); - INT ic; - WCHAR *psz, *parent = NULL; + INT ic, ic_save; + WCHAR *psz, *pch, *parent = NULL; SHELLEXECUTEINFOW sei; NMRUNFILEDLGW nmrfd; + WORD wInfo; ic = GetWindowTextLengthW(htxt); if (ic == 0) @@ -435,9 +436,20 @@ GetWindowTextW(htxt, psz, ic + 1); + ic_save = ic; + pch = psz; + while (GetStringTypeW(CT_CTYPE1, pch, 1, &wInfo)) + { + if (!(wInfo & C1_SPACE)) + break; + + ++pch; + --ic; + } + sei.hwnd = hwnd; sei.nShow = SW_SHOWNORMAL; - sei.lpFile = psz; + sei.lpFile = pch; /* * The precedence is the following: first the user-given @@ -482,9 +494,20 @@ case RF_OK: if (ShellExecuteExW(&sei)) { - /* Call again GetWindowText in case the contents of the edit box has changed? */ + ic = ic_save; GetWindowTextW(htxt, psz, ic + 1); - FillList(htxt, psz, ic + 2 + 1, FALSE); + + pch = psz; + while (GetStringTypeW(CT_CTYPE1, pch, 1, &wInfo)) + { + if (!(wInfo & C1_SPACE)) + break; + + ++pch; + --ic; + } + + FillList(htxt, pch, ic + 2 + 1, FALSE); EndDialog(hwnd, IDOK); break; }