https://git.reactos.org/?p=reactos.git;a=commitdiff;h=472787ffea068447d9ff5…
commit 472787ffea068447d9ff529f836ceff2a8a04c31
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Wed Dec 12 10:33:05 2018 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Wed Dec 12 10:33:05 2018 +0900
[SHELL32] Fix 'Run' dialog crash (#1117)
Running "%SYSTEMROOT%" sometimes crashed. This will fix it. CORE-15431
---
dll/win32/shell32/dialogs/dialogs.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dll/win32/shell32/dialogs/dialogs.cpp
b/dll/win32/shell32/dialogs/dialogs.cpp
index fc23284a13..f2fce61fd9 100644
--- a/dll/win32/shell32/dialogs/dialogs.cpp
+++ b/dll/win32/shell32/dialogs/dialogs.cpp
@@ -578,7 +578,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM
wParam, LPARA
if (wcschr(psz, L'%') != NULL)
{
- cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0);
+ cchExpand = ExpandEnvironmentStringsW(psz, NULL, 0) + 1;
pszExpanded = (WCHAR*)HeapAlloc(GetProcessHeap(), 0, cchExpand *
sizeof(WCHAR));
if (!pszExpanded)
{
@@ -604,7 +604,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM
wParam, LPARA
if (prfdp->lpstrDirectory)
pszStartDir = prfdp->lpstrDirectory;
else if (prfdp->uFlags & RFF_CALCDIRECTORY)
- pszStartDir = parent = RunDlg_GetParentDir(psz);
+ pszStartDir = parent = RunDlg_GetParentDir(pszExpanded);
else
pszStartDir = NULL;
@@ -640,8 +640,8 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM
wParam, LPARA
SECL_ALLOW_NONEXE)))
{
/* Call again GetWindowText in case the contents of the
edit box has changed? */
- GetWindowTextW(htxt, pszExpanded, ic + 1);
- FillList(htxt, pszExpanded, ic + 2 + 1, FALSE);
+ GetWindowTextW(htxt, psz, ic + 1);
+ FillList(htxt, psz, ic + 2 + 1, FALSE);
EndDialog(hwnd, IDOK);
break;
}