Vincent Povirk : shell32: Add stub implementation of IShellItem.

Alexandre Julliard julliard at winehq.org
Tue Feb 24 10:21:40 CST 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Feb 18 12:32:32 2009 -0600

shell32: Add stub implementation of IShellItem.

---

 dlls/shell32/Makefile.in    |    1 +
 dlls/shell32/shell32_main.h |    1 +
 dlls/shell32/shellitem.c    |  176 +++++++++++++++++++++++++++++++++++++++++++
 dlls/shell32/shellole.c     |    1 +
 include/shlguid.h           |    2 +
 5 files changed, 181 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in
index 4fe4300..d416eec 100644
--- a/dlls/shell32/Makefile.in
+++ b/dlls/shell32/Makefile.in
@@ -29,6 +29,7 @@ C_SRCS = \
 	recyclebin.c \
 	regsvr.c \
 	shell32_main.c \
+	shellitem.c \
 	shelllink.c \
 	shellole.c \
 	shellord.c \
diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h
index 88ffb0c..973e526 100644
--- a/dlls/shell32/shell32_main.h
+++ b/dlls/shell32/shell32_main.h
@@ -85,6 +85,7 @@ IContextMenu2 *	ISvBgCm_Constructor(LPSHELLFOLDER pSFParent, BOOL bDesktop);
 LPSHELLVIEW	IShellView_Constructor(LPSHELLFOLDER);
 
 HRESULT WINAPI IFSFolder_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
+HRESULT WINAPI IShellItem_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI IShellLink_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
 HRESULT WINAPI IShellLink_ConstructFromFile(IUnknown * pUnkOuter, REFIID riid, LPCITEMIDLIST pidl, LPVOID * ppv);
 HRESULT WINAPI ISF_Desktop_Constructor(IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv);
diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
new file mode 100644
index 0000000..53964a7
--- /dev/null
+++ b/dlls/shell32/shellitem.c
@@ -0,0 +1,176 @@
+/*
+ * IShellItem implementation
+ *
+ * Copyright 2008 Vincent Povirk for CodeWeavers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+
+#define COBJMACROS
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+
+#include "windef.h"
+#include "winbase.h"
+#include "wine/debug.h"
+
+#include "pidl.h"
+#include "shell32_main.h"
+#include "debughlp.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shell);
+
+typedef struct _ShellItem {
+    const IShellItemVtbl    *lpIShellItemVtbl;
+    LONG                    ref;
+    LPITEMIDLIST            pidl;
+} ShellItem;
+
+
+static HRESULT WINAPI ShellItem_QueryInterface(IShellItem *iface, REFIID riid,
+    void **ppv)
+{
+    ShellItem *This = (ShellItem*)iface;
+
+    TRACE("(%p,%p,%p)\n", iface, riid, ppv);
+
+    if (!ppv) return E_INVALIDARG;
+
+    if (IsEqualIID(&IID_IUnknown, riid) || IsEqualIID(&IID_IShellItem, riid))
+    {
+        *ppv = This;
+    }
+    else {
+        FIXME("not implemented for %s\n", shdebugstr_guid(riid));
+        *ppv = NULL;
+        return E_NOINTERFACE;
+    }
+
+    IUnknown_AddRef((IUnknown*)*ppv);
+    return S_OK;
+}
+
+static ULONG WINAPI ShellItem_AddRef(IShellItem *iface)
+{
+    ShellItem *This = (ShellItem*)iface;
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    TRACE("(%p), new refcount=%i\n", iface, ref);
+
+    return ref;
+}
+
+static ULONG WINAPI ShellItem_Release(IShellItem *iface)
+{
+    ShellItem *This = (ShellItem*)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+
+    TRACE("(%p), new refcount=%i\n", iface, ref);
+
+    if (ref == 0)
+    {
+        ILFree(This->pidl);
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+static HRESULT WINAPI ShellItem_BindToHandler(IShellItem *iface, IBindCtx *pbc,
+    REFGUID rbhid, REFIID riid, void **ppvOut)
+{
+    FIXME("(%p,%p,%s,%p,%p)\n", iface, pbc, shdebugstr_guid(rbhid), riid, ppvOut);
+
+    *ppvOut = NULL;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ShellItem_GetParent(IShellItem *iface, IShellItem **ppsi)
+{
+    FIXME("(%p,%p)\n", iface, ppsi);
+
+    *ppsi = NULL;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ShellItem_GetDisplayName(IShellItem *iface, SIGDN sigdnName,
+    LPWSTR *ppszName)
+{
+    FIXME("(%p,%x,%p)\n", iface, sigdnName, ppszName);
+
+    *ppszName = NULL;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ShellItem_GetAttributes(IShellItem *iface, SFGAOF sfgaoMask,
+    SFGAOF *psfgaoAttribs)
+{
+    FIXME("(%p,%x,%p)\n", iface, sfgaoMask, psfgaoAttribs);
+
+    *psfgaoAttribs = 0;
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI ShellItem_Compare(IShellItem *iface, IShellItem *oth,
+    SICHINTF hint, int *piOrder)
+{
+    FIXME("(%p,%p,%x,%p)\n", iface, oth, hint, piOrder);
+
+    return E_NOTIMPL;
+}
+
+static const IShellItemVtbl ShellItem_Vtbl = {
+    ShellItem_QueryInterface,
+    ShellItem_AddRef,
+    ShellItem_Release,
+    ShellItem_BindToHandler,
+    ShellItem_GetParent,
+    ShellItem_GetDisplayName,
+    ShellItem_GetAttributes,
+    ShellItem_Compare
+};
+
+
+HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
+{
+    ShellItem *This;
+    HRESULT ret;
+
+    TRACE("(%p,%s)\n",pUnkOuter, debugstr_guid(riid));
+
+    *ppv = NULL;
+
+    if (pUnkOuter) return CLASS_E_NOAGGREGATION;
+
+    This = HeapAlloc(GetProcessHeap(), 0, sizeof(ShellItem));
+    This->lpIShellItemVtbl = &ShellItem_Vtbl;
+    This->ref = 1;
+    This->pidl = NULL;
+
+    ret = ShellItem_QueryInterface((IShellItem*)This, riid, ppv);
+    ShellItem_Release((IShellItem*)This);
+
+    return ret;
+}
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index 69229f3..9e63c1e 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -64,6 +64,7 @@ static const struct {
 	{&CLSID_MyComputer,	ISF_MyComputer_Constructor},
 	{&CLSID_NetworkPlaces,  ISF_NetworkPlaces_Constructor},
 	{&CLSID_ShellDesktop,	ISF_Desktop_Constructor},
+	{&CLSID_ShellItem,	IShellItem_Constructor},
 	{&CLSID_ShellLink,	IShellLink_Constructor},
 	{&CLSID_DragDropHelper, IDropTargetHelper_Constructor},
 	{&CLSID_ControlPanel,	IControlPanel_Constructor},
diff --git a/include/shlguid.h b/include/shlguid.h
index d7c2b55..1692dec 100644
--- a/include/shlguid.h
+++ b/include/shlguid.h
@@ -131,6 +131,8 @@ DEFINE_GUID(CLSID_ACListISF,      0x03c036f1, 0xa186, 0x11d0, 0x82, 0x4a, 0x00,
 
 DEFINE_GUID(CLSID_ProgressDialog, 0xf8383852, 0xfcd3, 0x11d1, 0xa6, 0xb9, 0x0, 0x60, 0x97, 0xdf, 0x5b, 0xd4);
 
+DEFINE_GUID(CLSID_ShellItem,      0x2fe352ea, 0xfd1f, 0x11d2, 0xb1, 0xf4, 0x00, 0xc0, 0x4f, 0x8e, 0xeb, 0x3e);
+
 #define PSGUID_SHELLDETAILS     {0x28636aa6, 0x953d, 0x11d2, 0xb5, 0xd6, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0}
 DEFINE_GUID(FMTID_ShellDetails,  0x28636aa6, 0x953d, 0x11d2, 0xb5, 0xd6, 0x0, 0xc0, 0x4f, 0xd9, 0x18, 0xd0);
 #define PID_FINDDATA        0




More information about the wine-cvs mailing list