https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0aed0fd167863d1674e73…
commit 0aed0fd167863d1674e73a7fdb22fd1fb7a319f0
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Thu Mar 8 10:28:33 2018 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Thu Mar 8 12:21:24 2018 +0100
[BROWSEUI][SHELL32] Treat OnWinEvent's result parameter as optional. CORE-14443
Windows's explorer can call it with NULL.
---
dll/win32/browseui/addressband.cpp | 3 ++-
dll/win32/browseui/addresseditbox.cpp | 3 ++-
dll/win32/browseui/basebarsite.cpp | 5 ++++-
dll/win32/browseui/explorerband.cpp | 20 ++++++++++++++------
dll/win32/browseui/shellbars/CBandSite.cpp | 3 ++-
dll/win32/browseui/shellbars/CISFBand.cpp | 16 ++++++++++------
dll/win32/shell32/shellmenu/CMenuBand.cpp | 3 ++-
dll/win32/shell32/shellmenu/CMenuToolbars.cpp | 10 ++++++++--
8 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/dll/win32/browseui/addressband.cpp b/dll/win32/browseui/addressband.cpp
index 55164a9b1c..c319dbd628 100644
--- a/dll/win32/browseui/addressband.cpp
+++ b/dll/win32/browseui/addressband.cpp
@@ -290,7 +290,8 @@ HRESULT STDMETHODCALLTYPE CAddressBand::OnWinEvent(
HRESULT hResult;
RECT rect;
- *theResult = 0;
+ if (theResult)
+ *theResult = 0;
switch (uMsg)
{
diff --git a/dll/win32/browseui/addresseditbox.cpp
b/dll/win32/browseui/addresseditbox.cpp
index 091272dcf5..f5748ec6c8 100644
--- a/dll/win32/browseui/addresseditbox.cpp
+++ b/dll/win32/browseui/addresseditbox.cpp
@@ -256,7 +256,8 @@ HRESULT STDMETHODCALLTYPE CAddressEditBox::OnWinEvent(
{
LPNMHDR hdr;
- *theResult = 0;
+ if (theResult)
+ *theResult = 0;
switch (uMsg)
{
diff --git a/dll/win32/browseui/basebarsite.cpp b/dll/win32/browseui/basebarsite.cpp
index 5a53387c86..8d2675d996 100644
--- a/dll/win32/browseui/basebarsite.cpp
+++ b/dll/win32/browseui/basebarsite.cpp
@@ -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;
}
}
diff --git a/dll/win32/browseui/explorerband.cpp b/dll/win32/browseui/explorerband.cpp
index 2b398bd2f1..968b173ec3 100644
--- a/dll/win32/browseui/explorerband.cpp
+++ b/dll/win32/browseui/explorerband.cpp
@@ -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;
}
diff --git a/dll/win32/browseui/shellbars/CBandSite.cpp
b/dll/win32/browseui/shellbars/CBandSite.cpp
index 13f78a2b94..fea22c3987 100644
--- a/dll/win32/browseui/shellbars/CBandSite.cpp
+++ b/dll/win32/browseui/shellbars/CBandSite.cpp
@@ -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;
diff --git a/dll/win32/browseui/shellbars/CISFBand.cpp
b/dll/win32/browseui/shellbars/CISFBand.cpp
index 8d538c21ac..722d72b60a 100644
--- a/dll/win32/browseui/shellbars/CISFBand.cpp
+++ b/dll/win32/browseui/shellbars/CISFBand.cpp
@@ -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;
diff --git a/dll/win32/shell32/shellmenu/CMenuBand.cpp
b/dll/win32/shell32/shellmenu/CMenuBand.cpp
index e09bc007ee..49cb279184 100644
--- a/dll/win32/shell32/shellmenu/CMenuBand.cpp
+++ b/dll/win32/shell32/shellmenu/CMenuBand.cpp
@@ -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)
{
diff --git a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
index a33070af2c..fd98086e4a 100644
--- a/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
+++ b/dll/win32/shell32/shellmenu/CMenuToolbars.cpp
@@ -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));