shell32: Use return value from IShellFolder_GetAttributesOf.

Vincent Povirk madewokherd at gmail.com
Fri Aug 14 13:13:23 CDT 2015


This is independent from the comdlg32 patches implementing overwrite
confirmation, and it probably doesn't matter in practice, it's just
something I happened to notice when I was trying to figure out how to
test if an IShellItem or PIDL exists without relying on the
filesystem.

IShellFolder::GetAttributesOf with SFGAO_VALIDATE is supposed to
return an error code for PIDL's that don't exist. I have verified that
checking for file existence in this way (through IShellItem) works on
Windows, but I didn't write an automated test for it. Wine doesn't
implement this, but someone could in theory create a shell extension
that does, and then they could save files to it using the item file
dialog. In this case, we need IShellItem to pass through the error
code for files that don't exist.

In practice, this scenario of saving to a non-filesystem folder will
probably never happen, but we might as well fix this in case it
matters someday.
-------------- next part --------------
From dd7d1532acf00da91a8ef3c73f98321ca5d2eeeb Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Fri, 14 Aug 2015 11:41:55 -0500
Subject: [PATCH 3/3] shell32: Use return value from
 IShellFolder_GetAttributesOf.

---
 dlls/shell32/shellitem.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
index a410381..853325c 100644
--- a/dlls/shell32/shellitem.c
+++ b/dlls/shell32/shellitem.c
@@ -271,10 +271,13 @@ static HRESULT WINAPI ShellItem_GetAttributes(IShellItem2 *iface, SFGAOF sfgaoMa
         *psfgaoAttribs &= sfgaoMask;
         IShellFolder_Release(parent_folder);
 
-        if(sfgaoMask == *psfgaoAttribs)
-            return S_OK;
-        else
-            return S_FALSE;
+        if (SUCCEEDED(ret))
+        {
+            if(sfgaoMask == *psfgaoAttribs)
+                return S_OK;
+            else
+                return S_FALSE;
+        }
     }
 
     return ret;
-- 
2.1.4



More information about the wine-patches mailing list