Henri Verbeet : shdocvw: Add a stub ITaskbarList implementation.

Alexandre Julliard julliard at winehq.org
Tue Mar 24 09:01:58 CDT 2009


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Mar 24 10:09:25 2009 +0100

shdocvw: Add a stub ITaskbarList implementation.

Based on a patch by Louis Lenders. Although MSDN claims this should be in
shell32, it really is in shdocvw.

---

 dlls/shdocvw/Makefile.in   |    1 +
 dlls/shdocvw/factory.c     |    9 ++-
 dlls/shdocvw/shdocvw.h     |    2 +
 dlls/shdocvw/shdocvw.inf   |    3 +
 dlls/shdocvw/taskbarlist.c |  157 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/uuid/uuid.c           |    1 +
 include/shobjidl.idl       |    2 +
 7 files changed, 173 insertions(+), 2 deletions(-)

diff --git a/dlls/shdocvw/Makefile.in b/dlls/shdocvw/Makefile.in
index 0fd59c5..d8035ff 100644
--- a/dlls/shdocvw/Makefile.in
+++ b/dlls/shdocvw/Makefile.in
@@ -23,6 +23,7 @@ C_SRCS = \
 	persist.c \
 	shdocvw_main.c \
 	shlinstobj.c \
+	taskbarlist.c \
 	urlhist.c \
 	view.c \
 	webbrowser.c
diff --git a/dlls/shdocvw/factory.c b/dlls/shdocvw/factory.c
index 9111300..751b5a4 100644
--- a/dlls/shdocvw/factory.c
+++ b/dlls/shdocvw/factory.c
@@ -135,6 +135,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
     static IClassFactoryImpl WB2ClassFactory = {&WBCF_Vtbl, WebBrowserV2_Create};
     static IClassFactoryImpl CUHClassFactory = {&WBCF_Vtbl, CUrlHistory_Create};
     static IClassFactoryImpl ISCClassFactory = {&WBCF_Vtbl, InternetShortcut_Create};
+    static IClassFactoryImpl TBLClassFactory = {&WBCF_Vtbl, TaskbarList_Create};
 
     TRACE("\n");
 
@@ -150,6 +151,9 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
     if(IsEqualGUID(&CLSID_InternetShortcut, rclsid))
         return IClassFactory_QueryInterface(FACTORY(&ISCClassFactory), riid, ppv);
 
+    if(IsEqualGUID(&CLSID_TaskbarList, rclsid))
+        return IClassFactory_QueryInterface(FACTORY(&TBLClassFactory), riid, ppv);
+
     /* As a last resort, figure if the CLSID belongs to a 'Shell Instance Object' */
     return SHDOCVW_GetShellInstanceObjectClassObject(rclsid, riid, ppv);
 }
@@ -213,8 +217,8 @@ static const GUID CLSID_MruLongList =
 static HRESULT register_server(BOOL doregister)
 {
     STRTABLEA strtable;
-    STRENTRYA pse[14];
-    static CLSID const *clsids[14];
+    STRENTRYA pse[15];
+    static CLSID const *clsids[15];
     unsigned int i = 0;
     HRESULT hres;
 
@@ -230,6 +234,7 @@ static HRESULT register_server(BOOL doregister)
     INF_SET_CLSID(ShellShellNameSpace);
     INF_SET_CLSID(ShellUIHelper);
     INF_SET_CLSID(ShellWindows);
+    INF_SET_CLSID(TaskbarList);
     INF_SET_CLSID(WebBrowser);
     INF_SET_CLSID(WebBrowser_V1);
 
diff --git a/dlls/shdocvw/shdocvw.h b/dlls/shdocvw/shdocvw.h
index fc8c3b5..b148611 100644
--- a/dlls/shdocvw/shdocvw.h
+++ b/dlls/shdocvw/shdocvw.h
@@ -227,6 +227,8 @@ HRESULT CUrlHistory_Create(IUnknown*,REFIID,void**);
 
 HRESULT InternetShortcut_Create(IUnknown*,REFIID,void**);
 
+HRESULT TaskbarList_Create(IUnknown*,REFIID,void**);
+
 #define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
 
 /**********************************************************************
diff --git a/dlls/shdocvw/shdocvw.inf b/dlls/shdocvw/shdocvw.inf
index 025c4b1..d67443d 100644
--- a/dlls/shdocvw/shdocvw.inf
+++ b/dlls/shdocvw/shdocvw.inf
@@ -126,6 +126,9 @@ HKCR,"InternetShortcut\shell\open\command",,,"rundll32.exe shdocvw.dll,OpenURL %
 HKCR,"InternetShortcut\shell\print\command",,,"rundll32.exe mshtml.dll,PrintHTML ""%1"""
 HKCR,"InternetShortcut\shell\printto\command",,,"rundll32.exe mshtml.dll,PrintHTML ""%1"" ""%2"" ""%3"" ""%4"""
 
+HKCR,"CLSID\%CLSID_TaskbarList%",,,"Task Bar Communication"
+HKCR,"CLSID\%CLSID_TaskbarList%\InProcServer32",,,"%MODULE%"
+HKCR,"CLSID\%CLSID_TaskbarList%\InProcServer32","ThreadingModel",,"Apartment"
 
 [URL.Reg]
 HKLM,"Software\Microsoft\Windows\CurrentVersion\URL\DefaultPrefix",,,"http://"
diff --git a/dlls/shdocvw/taskbarlist.c b/dlls/shdocvw/taskbarlist.c
new file mode 100644
index 0000000..e0e063c
--- /dev/null
+++ b/dlls/shdocvw/taskbarlist.c
@@ -0,0 +1,157 @@
+/*
+ * Copyright 2009 Henri Verbeet 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 "wine/debug.h"
+
+#include "shdocvw.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
+
+struct taskbar_list
+{
+    const struct ITaskbarListVtbl *lpVtbl;
+    LONG refcount;
+};
+
+/* IUnknown methods */
+
+static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList *iface, REFIID riid, void **object)
+{
+    TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
+
+    if (IsEqualGUID(riid, &IID_ITaskbarList)
+            || IsEqualGUID(riid, &IID_IUnknown))
+    {
+        IUnknown_AddRef(iface);
+        *object = iface;
+        return S_OK;
+    }
+
+    WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
+
+    *object = NULL;
+    return E_NOINTERFACE;
+}
+
+static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList *iface)
+{
+    struct taskbar_list *This = (struct taskbar_list *)iface;
+    ULONG refcount = InterlockedIncrement(&This->refcount);
+
+    TRACE("%p increasing refcount to %u\n", This, refcount);
+
+    return refcount;
+}
+
+static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList *iface)
+{
+    struct taskbar_list *This = (struct taskbar_list *)iface;
+    ULONG refcount = InterlockedDecrement(&This->refcount);
+
+    TRACE("%p decreasing refcount to %u\n", This, refcount);
+
+    if (!refcount)
+    {
+        HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return refcount;
+}
+
+/* ITaskbarList methods */
+
+static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList *iface, HWND hwnd)
+{
+    FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList *iface, HWND hwnd)
+{
+    FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList *iface, HWND hwnd)
+{
+    FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList *iface, HWND hwnd)
+{
+    FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
+
+    return E_NOTIMPL;
+}
+
+static const struct ITaskbarListVtbl taskbar_list_vtbl =
+{
+    /* IUnknown methods */
+    taskbar_list_QueryInterface,
+    taskbar_list_AddRef,
+    taskbar_list_Release,
+    /* ITaskbarList methods */
+    taskbar_list_HrInit,
+    taskbar_list_AddTab,
+    taskbar_list_DeleteTab,
+    taskbar_list_ActivateTab,
+    taskbar_list_SetActiveAlt,
+};
+
+HRESULT TaskbarList_Create(IUnknown *outer, REFIID riid, void **taskbar_list)
+{
+    struct taskbar_list *object;
+
+    TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
+
+    if (outer)
+    {
+        WARN("Aggregation not supported\n");
+        return CLASS_E_NOAGGREGATION;
+    }
+
+    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
+    if (!object)
+    {
+        ERR("Failed to allocate taskbar list object memory\n");
+        return E_OUTOFMEMORY;
+    }
+
+    object->lpVtbl = &taskbar_list_vtbl;
+    object->refcount = 1;
+
+    *taskbar_list = object;
+
+    TRACE("Created ITaskbarList %p\n", object);
+
+    return S_OK;
+}
diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c
index 36dd205..35d4ae8 100644
--- a/dlls/uuid/uuid.c
+++ b/dlls/uuid/uuid.c
@@ -113,6 +113,7 @@ DEFINE_GUID(CLSID_InProcFreeMarshaler,    0x0000033a,0x0000,0x0000,0xc0,0x00,0x0
 DEFINE_GUID(CLSID_TF_ThreadMgr,           0x529a9e6b,0x6587,0x4f23,0xab,0x9e,0x9c,0x7d,0x68,0x3e,0x3c,0x50);
 DEFINE_GUID(CLSID_TF_InputProcessorProfiles, 0x33c53a50,0xf456,0x4884,0xb0,0x49,0x85,0xfd,0x64,0x3e,0xcf,0xed);
 DEFINE_GUID(CLSID_TF_CategoryMgr,         0xA4B544A1,0x438D,0x4B41,0x93,0x25,0x86,0x95,0x23,0xE2,0xD6,0xC7);
+DEFINE_GUID(CLSID_TaskbarList,            0x56fdf344,0xfd6d,0x11d0,0x95,0x8a,0x00,0x60,0x97,0xc9,0xa0,0x90);
 DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD,     0x34745c63,0xb2f0,0x4784,0x8b,0x67,0x5e,0x12,0xc8,0x70,0x1a,0x31);
 DEFINE_GUID(GUID_TFCAT_TIP_SPEECH,       0xB5A73CD1,0x8355,0x426B,0xA1,0x61,0x25,0x98,0x08,0xF2,0x6B,0x14);
 DEFINE_GUID(GUID_TFCAT_TIP_HANDWRITING,  0x246ecb87,0xc2f2,0x4abe,0x90,0x5b,0xc8,0xb3,0x8a,0xdd,0x2c,0x43);
diff --git a/include/shobjidl.idl b/include/shobjidl.idl
index 324f5e5..5acd302 100644
--- a/include/shobjidl.idl
+++ b/include/shobjidl.idl
@@ -1479,6 +1479,8 @@ interface ITaskbarList : IUnknown
         [in] HWND hwnd);
 }
 
+cpp_quote("EXTERN_C const CLSID CLSID_TaskbarList;")
+
 /*****************************************************************************
  *    IAutoCompleteDropDown interface
  */




More information about the wine-cvs mailing list