mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 18:54:25 +00:00
[SHELL32] Ensure OpenAs_RunDLL does not loop to infinity and beyond.
This should fix a timeout on the apitests.
This commit is contained in:
parent
ed4eb9c7c3
commit
3904fd6257
|
@ -1035,7 +1035,7 @@ VOID COpenWithDialog::Accept()
|
||||||
if (m_pInfo->oaifInFlags & OAIF_EXEC)
|
if (m_pInfo->oaifInFlags & OAIF_EXEC)
|
||||||
m_pAppList->Execute(pApp, m_pInfo->pcszFile);
|
m_pAppList->Execute(pApp, m_pInfo->pcszFile);
|
||||||
|
|
||||||
DestroyWindow(m_hDialog);
|
EndDialog(m_hDialog, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1066,7 +1066,7 @@ INT_PTR CALLBACK COpenWithDialog::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
case IDCANCEL: /* cancel */
|
case IDCANCEL: /* cancel */
|
||||||
DestroyWindow(hwndDlg);
|
EndDialog(hwndDlg, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1085,7 +1085,7 @@ INT_PTR CALLBACK COpenWithDialog::DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
DestroyWindow(hwndDlg);
|
EndDialog(hwndDlg, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1427,8 +1427,7 @@ COpenWithMenu::Initialize(LPCITEMIDLIST pidlFolder,
|
||||||
HRESULT WINAPI
|
HRESULT WINAPI
|
||||||
SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
|
SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
|
||||||
{
|
{
|
||||||
MSG msg;
|
INT_PTR ret;
|
||||||
HWND hwnd;
|
|
||||||
|
|
||||||
TRACE("SHOpenWithDialog hwndParent %p poainfo %p\n", hwndParent, poainfo);
|
TRACE("SHOpenWithDialog hwndParent %p poainfo %p\n", hwndParent, poainfo);
|
||||||
|
|
||||||
|
@ -1439,25 +1438,16 @@ SHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
|
||||||
|
|
||||||
COpenWithDialog pDialog(poainfo);
|
COpenWithDialog pDialog(poainfo);
|
||||||
|
|
||||||
hwnd = CreateDialogParam(shell32_hInstance, MAKEINTRESOURCE(IDD_OPEN_WITH), hwndParent, COpenWithDialog::DialogProc, (LPARAM)&pDialog);
|
|
||||||
if (hwnd == NULL)
|
|
||||||
{
|
|
||||||
ERR("Failed to create dialog\n");
|
|
||||||
return E_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pDialog.IsNoOpen(hwndParent))
|
if (pDialog.IsNoOpen(hwndParent))
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
ShowWindow(hwnd, SW_SHOWNORMAL);
|
ret = DialogBoxParamW(shell32_hInstance, MAKEINTRESOURCE(IDD_OPEN_WITH), hwndParent,
|
||||||
|
COpenWithDialog::DialogProc, (LPARAM)&pDialog);
|
||||||
|
|
||||||
while (GetMessage(&msg, NULL, 0, 0) && IsWindow(hwnd))
|
if (ret == (INT_PTR)-1)
|
||||||
{
|
{
|
||||||
if (!IsDialogMessage(hwnd, &msg))
|
ERR("Failed to create dialog: %u\n", GetLastError());
|
||||||
{
|
return E_FAIL;
|
||||||
TranslateMessage(&msg);
|
|
||||||
DispatchMessage(&msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -2314,6 +2314,7 @@ OpenAs_RunDLLA(HWND hwnd, HINSTANCE hinst, LPCSTR cmdline, int cmdshow)
|
||||||
LPWSTR pszCmdLineW = NULL;
|
LPWSTR pszCmdLineW = NULL;
|
||||||
TRACE("%p, %p, %s, %d\n", hwnd, hinst, debugstr_a(cmdline), cmdshow);
|
TRACE("%p, %p, %s, %d\n", hwnd, hinst, debugstr_a(cmdline), cmdshow);
|
||||||
|
|
||||||
|
if (cmdline)
|
||||||
__SHCloneStrAtoW(&pszCmdLineW, cmdline);
|
__SHCloneStrAtoW(&pszCmdLineW, cmdline);
|
||||||
OpenAs_RunDLLW(hwnd, hinst, pszCmdLineW, cmdshow);
|
OpenAs_RunDLLW(hwnd, hinst, pszCmdLineW, cmdshow);
|
||||||
SHFree(pszCmdLineW);
|
SHFree(pszCmdLineW);
|
||||||
|
|
Loading…
Reference in a new issue