Author: gadamopoulos
Date: Wed Aug 30 12:49:59 2017
New Revision: 75713

URL: http://svn.reactos.org/svn/reactos?rev=75713&view=rev
Log:
[SHELL32] -SHChangeNotifyRegister: Don't call CreateFileW with something that 
is not a filesystem path as this will obviously fail like when we are browsing 
My Computer.

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/changenotify.c?rev=75713&r1=75712&r2=75713&view=diff
==============================================================================
--- trunk/reactos/dll/win32/shell32/wine/changenotify.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/shell32/wine/changenotify.c [iso-8859-1] Wed Aug 30 
12:49:59 2017
@@ -647,25 +647,38 @@
 BOOL _OpenDirectory(LPNOTIFYREGISTER item)
 {
     STRRET strFile;
-    IShellFolder *psfDesktop;
+    IShellFolder *psf;
     HRESULT hr;
+    LPCITEMIDLIST child;
+    ULONG ulAttrs;
 
     // Makes function idempotent
     if (item->hDirectory && !(item->hDirectory == INVALID_HANDLE_VALUE))
         return TRUE;
 
-    hr = SHGetDesktopFolder(&psfDesktop);
+    hr = SHBindToParent(item->pidl, &IID_IShellFolder, (LPVOID*)&psf, &child);
     if (FAILED_UNEXPECTEDLY(hr))
-        return FALSE;
-
-    hr = IShellFolder_GetDisplayNameOf(psfDesktop, item->pidl, 
SHGDN_FORPARSING, &strFile);
-    IShellFolder_Release(psfDesktop);
+        return hr;
+
+    ulAttrs = SFGAO_FILESYSTEM | SFGAO_FOLDER;
+    hr = IShellFolder_GetAttributesOf(psf, 1, (LPCITEMIDLIST*)&child, 
&ulAttrs);
+    if (SUCCEEDED(hr))
+        hr = IShellFolder_GetDisplayNameOf(psf, child, SHGDN_FORPARSING, 
&strFile);
+
+    IShellFolder_Release(psf);
     if (FAILED_UNEXPECTEDLY(hr))
         return FALSE;
 
     hr = StrRetToBufW(&strFile, NULL, item->wstrDirectory, 
_countof(item->wstrDirectory));
     if (FAILED_UNEXPECTEDLY(hr))
         return FALSE;
+
+    if ((ulAttrs & (SFGAO_FILESYSTEM | SFGAO_FOLDER)) != (SFGAO_FILESYSTEM | 
SFGAO_FOLDER))
+    {
+        TRACE("_OpenDirectory ignoring %s\n", debugstr_w(item->wstrDirectory));
+        item->hDirectory = INVALID_HANDLE_VALUE;
+        return FALSE;
+    }
 
     TRACE("_OpenDirectory %s\n", debugstr_w(item->wstrDirectory));
 


Reply via email to