From 4f382430f2176bc576c80e89c8324107278c0ed6 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Fri, 11 Mar 2011 11:39:07 +0100 Subject: [PATCH] shdocvw: COM cleanup for the ITaskbarList iface. --- dlls/shdocvw/taskbarlist.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/shdocvw/taskbarlist.c b/dlls/shdocvw/taskbarlist.c index 2c380800ddf..d8535067741 100644 --- a/dlls/shdocvw/taskbarlist.c +++ b/dlls/shdocvw/taskbarlist.c @@ -27,10 +27,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(shdocvw); struct taskbar_list { - const struct ITaskbarListVtbl *lpVtbl; + ITaskbarList ITaskbarList_iface; LONG refcount; }; +static inline struct taskbar_list *impl_from_ITaskbarList(ITaskbarList *iface) +{ + return CONTAINING_RECORD(iface, struct taskbar_list, ITaskbarList_iface); +} + /* IUnknown methods */ static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList *iface, REFIID riid, void **object) @@ -53,7 +58,7 @@ static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList *iface static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList *iface) { - struct taskbar_list *This = (struct taskbar_list *)iface; + struct taskbar_list *This = impl_from_ITaskbarList(iface); ULONG refcount = InterlockedIncrement(&This->refcount); TRACE("%p increasing refcount to %u\n", This, refcount); @@ -63,7 +68,7 @@ static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList *iface) static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList *iface) { - struct taskbar_list *This = (struct taskbar_list *)iface; + struct taskbar_list *This = impl_from_ITaskbarList(iface); ULONG refcount = InterlockedDecrement(&This->refcount); TRACE("%p decreasing refcount to %u\n", This, refcount); @@ -150,12 +155,12 @@ HRESULT TaskbarList_Create(IUnknown *outer, REFIID riid, void **taskbar_list) return E_OUTOFMEMORY; } - object->lpVtbl = &taskbar_list_vtbl; + object->ITaskbarList_iface.lpVtbl = &taskbar_list_vtbl; object->refcount = 0; TRACE("Created ITaskbarList %p\n", object); - hr = ITaskbarList_QueryInterface((ITaskbarList *)object, riid, taskbar_list); + hr = ITaskbarList_QueryInterface(&object->ITaskbarList_iface, riid, taskbar_list); if (FAILED(hr)) { HeapFree(GetProcessHeap(), 0, object);