[PATCH v2 2/2] shell32: Make SHChangeNotify() dwItenN checks stricter
Serge Gautherie
winehq-git_serge_180711 at gautherie.fr
Tue Feb 25 23:46:46 CST 2020
Signed-off-by: Serge Gautherie <winehq-git_serge_180711 at gautherie.fr>
---
dlls/shell32/changenotify.c | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/dlls/shell32/changenotify.c b/dlls/shell32/changenotify.c
index 6c77a6c..6959fb7 100644
--- a/dlls/shell32/changenotify.c
+++ b/dlls/shell32/changenotify.c
@@ -280,31 +280,47 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID
if(uFlags & ~(SHCNF_TYPE|SHCNF_FLUSH))
FIXME("ignoring unsupported flags: %x\n", uFlags);
- if( ( wEventId & SHCNE_NOITEMEVENTS ) && ( dwItem1 || dwItem2 ) )
+ /* FIXME: Either set to NULL or return, not both */
+ if ((wEventId & SHCNE_NOITEMEVENTS) && (dwItem1 || dwItem2))
{
- TRACE("dwItem1 and dwItem2 are not zero, but should be\n");
- dwItem1 = 0;
- dwItem2 = 0;
+ WARN("dwItem1 and/or dwItem2 are not NULL\n");
+ dwItem1 = NULL;
+ dwItem2 = NULL;
return;
}
- else if( ( wEventId & SHCNE_ONEITEMEVENTS ) && dwItem2 )
+ else if ((wEventId & SHCNE_ONEITEMEVENTS) && (!dwItem1 || dwItem2))
{
- TRACE("dwItem2 is not zero, but should be\n");
- dwItem2 = 0;
+ WARN("dwItem1 is NULL and/or dwItem2 is not NULL\n");
+ dwItem2 = NULL;
+ return;
+ }
+ else if ((wEventId & SHCNE_SECONDITEMEVENTS) && (dwItem1 || !dwItem2))
+ {
+ WARN("dwItem1 is not NULL and/or dwItem2 is NULL\n");
+ dwItem1 = NULL;
+ return;
+ }
+ else if (!dwItem1 || !dwItem2)
+ {
+ WARN("dwItem1 and/or dwItem2 are NULL\n");
return;
}
- if( ( ( wEventId & SHCNE_NOITEMEVENTS ) &&
- ( wEventId & ~SHCNE_NOITEMEVENTS ) ) ||
- ( ( wEventId & SHCNE_ONEITEMEVENTS ) &&
- ( wEventId & ~SHCNE_ONEITEMEVENTS ) ) ||
- ( ( wEventId & SHCNE_TWOITEMEVENTS ) &&
- ( wEventId & ~SHCNE_TWOITEMEVENTS ) ) )
+ if (((wEventId & SHCNE_NOITEMEVENTS ) && (wEventId & ~SHCNE_NOITEMEVENTS )) ||
+ ((wEventId & SHCNE_ONEITEMEVENTS ) && (wEventId & ~SHCNE_ONEITEMEVENTS )) ||
+ ((wEventId & SHCNE_SECONDITEMEVENTS) && (wEventId & ~SHCNE_SECONDITEMEVENTS)) ||
+ ((wEventId & SHCNE_TWOITEMEVENTS ) && (wEventId & ~SHCNE_TWOITEMEVENTS )))
{
WARN("mutually incompatible events listed\n");
return;
}
+ if ((wEventId & SHCNE_SECONDITEMEVENTS))
+ {
+ FIXME("SHChangeNotify with (wEventId & SHCNE_SECONDITEMEVENTS)\n");
+ return;
+ }
+
/* convert paths in IDLists*/
switch (uFlags & SHCNF_TYPE)
{
@@ -351,6 +367,7 @@ void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID
notify = TRUE;
else if( wEventId & ( SHCNE_ONEITEMEVENTS | SHCNE_TWOITEMEVENTS ) )
notify = should_notify( Pidls[0], pidl, subtree );
+ /* FIXME: Following if() is masked by previous one */
else if( wEventId & SHCNE_TWOITEMEVENTS )
notify = should_notify( Pidls[1], pidl, subtree );
}
--
2.10.0.windows.1
More information about the wine-devel
mailing list