Author: pschweitzer
Date: Sat Jul 15 07:48:47 2017
New Revision: 75349
URL: http://svn.reactos.org/svn/reactos?rev=75349&view=rev
Log:
[SHELL32]
In case a FSD doesn't support directory changes notifications, don't try to requeue a notification each time it returns 0 data.
Just quit instead.
CORE-13549
Modified:
trunk/reactos/dll/win32/shell32/wine/changenotify.c
Modified: trunk/reactos/dll/win32/shell32/wine/changenotify.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/cha…
==============================================================================
--- trunk/reactos/dll/win32/shell32/wine/changenotify.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/wine/changenotify.c [iso-8859-1] Sat Jul 15 07:48:47 2017
@@ -735,6 +735,15 @@
{
InterlockedIncrement(&item->pParent->wQueuedCount);
}
+
+ /* If the FSD doesn't support directory change notifications, there's no
+ * no need to retry and requeue notification
+ */
+ if (dwErrorCode == ERROR_INVALID_FUNCTION)
+ {
+ WARN("Directory watching not supported\n");
+ goto quit;
+ }
#endif
/* This likely means overflow, so force whole directory refresh. */
Author: pschweitzer
Date: Sat Jul 15 07:45:28 2017
New Revision: 75348
URL: http://svn.reactos.org/svn/reactos?rev=75348&view=rev
Log:
[SHELL32]
Avoid double-free and use-after-free in case the FSD fails to register the change directory notification
CORE-13549
Modified:
trunk/reactos/dll/win32/shell32/wine/changenotify.c
Modified: trunk/reactos/dll/win32/shell32/wine/changenotify.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/wine/cha…
==============================================================================
--- trunk/reactos/dll/win32/shell32/wine/changenotify.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/wine/changenotify.c [iso-8859-1] Sat Jul 15 07:45:28 2017
@@ -723,6 +723,20 @@
}
#endif
+#ifdef __REACTOS__
+ /* This is to avoid double-free and potential use after free
+ * In case it failed, _BeginRead() already deferenced item
+ * But if failure comes the FSD, the APC routine (us) will
+ * be called as well, which will cause a double-free on quit.
+ * Avoid this by deferencing only once in case of failure and thus,
+ * incrementing reference count here
+ */
+ if (dwErrorCode != ERROR_SUCCESS)
+ {
+ InterlockedIncrement(&item->pParent->wQueuedCount);
+ }
+#endif
+
/* This likely means overflow, so force whole directory refresh. */
if (!dwNumberOfBytesTransfered)
{