Jinoh Kang : shell32: Add stub for IShellItemImageFactory.

Alexandre Julliard julliard at winehq.org
Thu Apr 28 16:15:31 CDT 2022


Module: wine
Branch: master
Commit: 0ec8a1a4563cc6b1cc6e9d8b98527193aa81c33e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0ec8a1a4563cc6b1cc6e9d8b98527193aa81c33e

Author: Jinoh Kang <jinoh.kang.kr at gmail.com>
Date:   Wed Apr 27 03:17:43 2022 +0900

shell32: Add stub for IShellItemImageFactory.

Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/shellitem.c       | 50 ++++++++++++++++++++++++++++++++++++++++++
 dlls/shell32/tests/shlfolder.c |  1 -
 2 files changed, 50 insertions(+), 1 deletion(-)

diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c
index 0a3a76cbd6a..0381fa67f0d 100644
--- a/dlls/shell32/shellitem.c
+++ b/dlls/shell32/shellitem.c
@@ -39,6 +39,7 @@ typedef struct _ShellItem {
     LONG                    ref;
     LPITEMIDLIST            pidl;
     IPersistIDList          IPersistIDList_iface;
+    IShellItemImageFactory  IShellItemImageFactory_iface;
 } ShellItem;
 
 typedef struct _CustomDestinationList {
@@ -56,6 +57,11 @@ static inline ShellItem *impl_from_IPersistIDList( IPersistIDList *iface )
     return CONTAINING_RECORD(iface, ShellItem, IPersistIDList_iface);
 }
 
+static inline ShellItem *impl_from_IShellItemImageFactory( IShellItemImageFactory *iface )
+{
+    return CONTAINING_RECORD(iface, ShellItem, IShellItemImageFactory_iface);
+}
+
 static inline CustomDestinationList *impl_from_ICustomDestinationList( ICustomDestinationList *iface )
 {
     return CONTAINING_RECORD(iface, CustomDestinationList, ICustomDestinationList_iface);
@@ -79,6 +85,10 @@ static HRESULT WINAPI ShellItem_QueryInterface(IShellItem2 *iface, REFIID riid,
     {
         *ppv = &This->IPersistIDList_iface;
     }
+    else if (IsEqualIID(&IID_IShellItemImageFactory, riid))
+    {
+        *ppv = &This->IShellItemImageFactory_iface;
+    }
     else {
         FIXME("not implemented for %s\n", shdebugstr_guid(riid));
         *ppv = NULL;
@@ -536,6 +546,45 @@ static const IPersistIDListVtbl ShellItem_IPersistIDList_Vtbl = {
     ShellItem_IPersistIDList_GetIDList
 };
 
+static HRESULT WINAPI ShellItem_IShellItemImageFactory_QueryInterface(IShellItemImageFactory *iface,
+    REFIID riid, void **ppv)
+{
+    ShellItem *This = impl_from_IShellItemImageFactory(iface);
+    return IShellItem2_QueryInterface(&This->IShellItem2_iface, riid, ppv);
+}
+
+static ULONG WINAPI ShellItem_IShellItemImageFactory_AddRef(IShellItemImageFactory *iface)
+{
+    ShellItem *This = impl_from_IShellItemImageFactory(iface);
+    return IShellItem2_AddRef(&This->IShellItem2_iface);
+}
+
+static ULONG WINAPI ShellItem_IShellItemImageFactory_Release(IShellItemImageFactory *iface)
+{
+    ShellItem *This = impl_from_IShellItemImageFactory(iface);
+    return IShellItem2_Release(&This->IShellItem2_iface);
+}
+
+static HRESULT WINAPI ShellItem_IShellItemImageFactory_GetImage(IShellItemImageFactory *iface,
+    SIZE size, SIIGBF flags, HBITMAP *phbm)
+{
+    ShellItem *This = impl_from_IShellItemImageFactory(iface);
+    static int once;
+
+    if (!once++)
+        FIXME("%p ({%lu, %lu} %d %p): stub\n", This, size.cx, size.cy, flags, phbm);
+
+    *phbm = NULL;
+    return E_NOTIMPL;
+}
+
+static const IShellItemImageFactoryVtbl ShellItem_IShellItemImageFactory_Vtbl = {
+    ShellItem_IShellItemImageFactory_QueryInterface,
+    ShellItem_IShellItemImageFactory_AddRef,
+    ShellItem_IShellItemImageFactory_Release,
+    ShellItem_IShellItemImageFactory_GetImage,
+};
+
 
 HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
 {
@@ -553,6 +602,7 @@ HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **p
     This->ref = 1;
     This->pidl = NULL;
     This->IPersistIDList_iface.lpVtbl = &ShellItem_IPersistIDList_Vtbl;
+    This->IShellItemImageFactory_iface.lpVtbl = &ShellItem_IShellItemImageFactory_Vtbl;
 
     ret = IShellItem2_QueryInterface(&This->IShellItem2_iface, riid, ppv);
     IShellItem2_Release(&This->IShellItem2_iface);
diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 6f4ef724b1d..da606a9e707 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -4448,7 +4448,6 @@ static void test_IShellItemImageFactory(void)
 
     ret = IShellItem_QueryInterface(shellitem, &IID_IShellItemImageFactory, (void **)&siif);
     IShellItem_Release(shellitem);
-    todo_wine
     ok(ret == S_OK, "QueryInterface returned 0x%08lx\n", ret);
     if (SUCCEEDED(ret))
     {




More information about the wine-cvs mailing list