[BROWSEUI][SHELL32] Treat OnWinEvent's result parameter as optional. CORE-14443

Windows's explorer can call it with NULL.
This commit is contained in:
Thomas Faber 2018-03-08 10:28:33 +01:00
parent 84a9284a3f
commit 0aed0fd167
No known key found for this signature in database
GPG key ID: 076E7C3D44720826
8 changed files with 44 additions and 19 deletions

View file

@ -290,7 +290,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
HRESULT hResult;
RECT rect;
*theResult = 0;
if (theResult)
*theResult = 0;
switch (uMsg)
{

View file

@ -256,7 +256,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(
{
LPNMHDR hdr;
*theResult = 0;
if (theResult)
*theResult = 0;
switch (uMsg)
{

View file

@ -322,6 +322,7 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(
NMHDR *notifyHeader;
// RECT newBounds;
HRESULT hResult;
LRESULT result;
hResult = S_OK;
if (uMsg == WM_NOTIFY)
@ -342,7 +343,9 @@ HRESULT STDMETHODCALLTYPE CBaseBarSite::OnWinEvent(
#endif
break;
case NM_CUSTOMDRAW:
*theResult = OnCustomDraw((LPNMCUSTOMDRAW)lParam);
result = OnCustomDraw((LPNMCUSTOMDRAW)lParam);
if (theResult)
*theResult = result;
return S_OK;
}
}

View file

@ -1265,13 +1265,17 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::GetSizeMax(ULARGE_INTEGER *pcbSize)
HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
BOOL bHandled;
LRESULT result;
if (uMsg == WM_NOTIFY)
{
NMHDR *pNotifyHeader = (NMHDR*)lParam;
switch (pNotifyHeader->code)
{
case TVN_ITEMEXPANDING:
*theResult = OnTreeItemExpanding((LPNMTREEVIEW)lParam);
result = OnTreeItemExpanding((LPNMTREEVIEW)lParam);
if (theResult)
*theResult = result;
break;
case TVN_SELCHANGED:
OnSelectionChanged((LPNMTREEVIEW)lParam);
@ -1281,7 +1285,8 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
break;
case NM_RCLICK:
OnContextMenu(WM_CONTEXTMENU, (WPARAM)m_hWnd, GetMessagePos(), bHandled);
*theResult = 1;
if (theResult)
*theResult = 1;
break;
case TVN_BEGINDRAG:
case TVN_BEGINRDRAG:
@ -1295,7 +1300,8 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
LPCITEMIDLIST pChild;
HRESULT hr;
*theResult = 1;
if (theResult)
*theResult = 1;
NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
if (!info)
return E_FAIL;
@ -1304,7 +1310,7 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
return E_FAIL;
hr = pParent->GetAttributesOf(1, &pChild, &dwAttr);
if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME))
if (SUCCEEDED(hr) && (dwAttr & SFGAO_CANRENAME) && theResult)
*theResult = 0;
return S_OK;
}
@ -1314,7 +1320,8 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
NodeInfo *info = GetNodeInfo(dispInfo->item.hItem);
HRESULT hr;
*theResult = 0;
if (theResult)
*theResult = 0;
if (dispInfo->item.pszText)
{
LPITEMIDLIST pidlNew;
@ -1345,7 +1352,8 @@ HRESULT STDMETHODCALLTYPE CExplorerBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
ILFree(pidlNewAbs);
ILFree(pidlNew);
*theResult = 1;
if (theResult)
*theResult = 1;
}
return S_OK;
}

View file

@ -708,7 +708,8 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM
TRACE("(%p, %p, %u, %p, %p, %p)\n", this, hWnd, uMsg, wParam, lParam, plrResult);
*plrResult = 0;
if (plrResult)
*plrResult = 0;
if (m_hwndRebar == NULL)
return E_FAIL;

View file

@ -342,7 +342,8 @@ HRESULT CISFBand::CreateSimpleToolbar(HWND hWndParent)
if (chk)
SHInvokeDefaultCommand(m_hWnd, m_pISF, (LPITEMIDLIST)tb.dwData);
*theResult = TRUE;
if (theResult)
*theResult = TRUE;
break;
}
case WM_NOTIFY:
@ -393,18 +394,21 @@ HRESULT CISFBand::CreateSimpleToolbar(HWND hWndParent)
}
}
DestroyMenu(fmenu);
*theResult = TRUE;
if (theResult)
*theResult = TRUE;
break;
}
default:
*theResult = FALSE;
if (theResult)
*theResult = FALSE;
}
break;
}
default:
*theResult = FALSE;
default:
if (theResult)
*theResult = FALSE;
}
return S_OK;

View file

@ -723,7 +723,8 @@ HRESULT STDMETHODCALLTYPE CMenuBand::GetShellFolder(DWORD *pdwFlags, LPITEMIDLIS
HRESULT STDMETHODCALLTYPE CMenuBand::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
*theResult = 0;
if (theResult)
*theResult = 0;
if (uMsg == WM_WININICHANGE && wParam == SPI_SETFLATMENU)
{

View file

@ -49,8 +49,11 @@ LRESULT CMenuToolbarBase::OnWinEventWrap(UINT uMsg, WPARAM wParam, LPARAM lParam
HRESULT CMenuToolbarBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT *theResult)
{
NMHDR * hdr;
HRESULT hr;
LRESULT result;
*theResult = 0;
if (theResult)
*theResult = 0;
switch (uMsg)
{
case WM_COMMAND:
@ -75,7 +78,10 @@ HRESULT CMenuToolbarBase::OnWinEvent(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
return S_OK;
case NM_CUSTOMDRAW:
return OnCustomDraw(reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr), theResult);
hr = OnCustomDraw(reinterpret_cast<LPNMTBCUSTOMDRAW>(hdr), &result);
if (theResult)
*theResult = result;
return hr;
case TBN_GETINFOTIP:
return OnGetInfoTip(reinterpret_cast<LPNMTBGETINFOTIP>(hdr));