Vincent Povirk : shell32: Implement ShellItem_GetAttributes.

Alexandre Julliard julliard at winehq.org
Fri May 22 08:25:33 CDT 2009


Module: wine
Branch: master
Commit: bced77fb076a26539074818a6d83448fa7342d4c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bced77fb076a26539074818a6d83448fa7342d4c

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Thu May 21 13:24:32 2009 -0500

shell32: Implement ShellItem_GetAttributes.

---

 dlls/shell32/shellitem.c |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
index ffd528b..13cb1f6 100644
--- a/dlls/shell32/shellitem.c
+++ b/dlls/shell32/shellitem.c
@@ -126,6 +126,27 @@ static HRESULT ShellItem_get_parent_pidl(ShellItem *This, LPITEMIDLIST *parent_p
     }
 }
 
+static HRESULT ShellItem_get_parent_shellfolder(ShellItem *This, IShellFolder **ppsf)
+{
+    LPITEMIDLIST parent_pidl;
+    IShellFolder *desktop;
+    HRESULT ret;
+
+    ret = ShellItem_get_parent_pidl(This, &parent_pidl);
+    if (SUCCEEDED(ret))
+    {
+        ret = SHGetDesktopFolder(&desktop);
+        if (SUCCEEDED(ret))
+        {
+            ret = IShellFolder_BindToObject(desktop, parent_pidl, NULL, &IID_IShellFolder, (void**)ppsf);
+            IShellFolder_Release(desktop);
+        }
+        ILFree(parent_pidl);
+    }
+
+    return ret;
+}
+
 static HRESULT WINAPI ShellItem_BindToHandler(IShellItem *iface, IBindCtx *pbc,
     REFGUID rbhid, REFIID riid, void **ppvOut)
 {
@@ -167,11 +188,23 @@ static HRESULT WINAPI ShellItem_GetDisplayName(IShellItem *iface, SIGDN sigdnNam
 static HRESULT WINAPI ShellItem_GetAttributes(IShellItem *iface, SFGAOF sfgaoMask,
     SFGAOF *psfgaoAttribs)
 {
-    FIXME("(%p,%x,%p)\n", iface, sfgaoMask, psfgaoAttribs);
+    ShellItem *This = (ShellItem*)iface;
+    IShellFolder *parent_folder;
+    LPITEMIDLIST child_pidl;
+    HRESULT ret;
 
-    *psfgaoAttribs = 0;
+    TRACE("(%p,%x,%p)\n", iface, sfgaoMask, psfgaoAttribs);
 
-    return E_NOTIMPL;
+    ret = ShellItem_get_parent_shellfolder(This, &parent_folder);
+    if (SUCCEEDED(ret))
+    {
+        child_pidl = ILFindLastID(This->pidl);
+        *psfgaoAttribs = sfgaoMask;
+        ret = IShellFolder_GetAttributesOf(parent_folder, 1, (LPCITEMIDLIST*)&child_pidl, psfgaoAttribs);
+        IShellFolder_Release(parent_folder);
+    }
+
+    return ret;
 }
 
 static HRESULT WINAPI ShellItem_Compare(IShellItem *iface, IShellItem *oth,




More information about the wine-cvs mailing list