winedbg: Don't dereference possibly NULL thread pointer.
[wine/zf.git] / dlls / explorerframe / taskbarlist.c
blob6f24f35992705e5988efe840fa8fb44999676a80
1 /*
2 * Copyright 2009 Henri Verbeet for CodeWeavers
3 * Copyright 2011 André Hentschel
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "explorerframe_main.h"
23 #include "wine/debug.h"
24 #include "wine/heap.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(explorerframe);
28 struct taskbar_list
30 ITaskbarList4 ITaskbarList4_iface;
31 LONG refcount;
34 static inline struct taskbar_list *impl_from_ITaskbarList4(ITaskbarList4 *iface)
36 return CONTAINING_RECORD(iface, struct taskbar_list, ITaskbarList4_iface);
39 /* IUnknown methods */
41 static HRESULT STDMETHODCALLTYPE taskbar_list_QueryInterface(ITaskbarList4 *iface, REFIID riid, void **object)
43 TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
45 if (IsEqualGUID(riid, &IID_ITaskbarList) ||
46 IsEqualGUID(riid, &IID_ITaskbarList2) ||
47 IsEqualGUID(riid, &IID_ITaskbarList3) ||
48 IsEqualGUID(riid, &IID_ITaskbarList4) ||
49 IsEqualGUID(riid, &IID_IUnknown))
51 ITaskbarList4_AddRef(iface);
52 *object = iface;
53 return S_OK;
56 WARN("%s not implemented, returning E_NOINTERFACE\n", debugstr_guid(riid));
58 *object = NULL;
59 return E_NOINTERFACE;
62 static ULONG STDMETHODCALLTYPE taskbar_list_AddRef(ITaskbarList4 *iface)
64 struct taskbar_list *This = impl_from_ITaskbarList4(iface);
65 ULONG refcount = InterlockedIncrement(&This->refcount);
67 TRACE("%p increasing refcount to %u\n", This, refcount);
69 return refcount;
72 static ULONG STDMETHODCALLTYPE taskbar_list_Release(ITaskbarList4 *iface)
74 struct taskbar_list *This = impl_from_ITaskbarList4(iface);
75 ULONG refcount = InterlockedDecrement(&This->refcount);
77 TRACE("%p decreasing refcount to %u\n", This, refcount);
79 if (!refcount)
81 heap_free(This);
82 EFRAME_UnlockModule();
85 return refcount;
88 /* ITaskbarList methods */
90 static HRESULT STDMETHODCALLTYPE taskbar_list_HrInit(ITaskbarList4 *iface)
92 TRACE("iface %p\n", iface);
94 return S_OK;
97 static HRESULT STDMETHODCALLTYPE taskbar_list_AddTab(ITaskbarList4 *iface, HWND hwnd)
99 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
101 return E_NOTIMPL;
104 static HRESULT STDMETHODCALLTYPE taskbar_list_DeleteTab(ITaskbarList4 *iface, HWND hwnd)
106 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
108 return E_NOTIMPL;
111 static HRESULT STDMETHODCALLTYPE taskbar_list_ActivateTab(ITaskbarList4 *iface, HWND hwnd)
113 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
115 return E_NOTIMPL;
118 static HRESULT STDMETHODCALLTYPE taskbar_list_SetActiveAlt(ITaskbarList4 *iface, HWND hwnd)
120 FIXME("iface %p, hwnd %p stub!\n", iface, hwnd);
122 return E_NOTIMPL;
125 /* ITaskbarList2 method */
127 static HRESULT STDMETHODCALLTYPE taskbar_list_MarkFullscreenWindow(ITaskbarList4 *iface,
128 HWND hwnd,
129 BOOL fullscreen)
131 FIXME("iface %p, hwnd %p, fullscreen %s stub!\n", iface, hwnd, (fullscreen)?"true":"false");
133 return E_NOTIMPL;
136 /* ITaskbarList3 methods */
138 static HRESULT STDMETHODCALLTYPE taskbar_list_SetProgressValue(ITaskbarList4 *iface,
139 HWND hwnd,
140 ULONGLONG ullCompleted,
141 ULONGLONG ullTotal)
143 static BOOL fixme_once;
144 if(!fixme_once++) FIXME("iface %p, hwnd %p, ullCompleted %s, ullTotal %s stub!\n", iface, hwnd,
145 wine_dbgstr_longlong(ullCompleted), wine_dbgstr_longlong(ullTotal));
147 return S_OK;
150 static HRESULT STDMETHODCALLTYPE taskbar_list_SetProgressState(ITaskbarList4 *iface,
151 HWND hwnd,
152 TBPFLAG tbpFlags)
154 static BOOL fixme_once;
155 if(!fixme_once++) FIXME("iface %p, hwnd %p, flags %x stub!\n", iface, hwnd, tbpFlags);
157 return S_OK;
160 static HRESULT STDMETHODCALLTYPE taskbar_list_RegisterTab(ITaskbarList4 *iface, HWND hwndTab, HWND hwndMDI)
162 FIXME("iface %p, hwndTab %p, hwndMDI %p stub!\n", iface, hwndTab, hwndMDI);
164 return S_OK;
167 static HRESULT STDMETHODCALLTYPE taskbar_list_UnregisterTab(ITaskbarList4 *iface, HWND hwndTab)
169 FIXME("iface %p, hwndTab %p stub!\n", iface, hwndTab);
171 return E_NOTIMPL;
174 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabOrder(ITaskbarList4 *iface,
175 HWND hwndTab,
176 HWND hwndInsertBefore)
178 FIXME("iface %p, hwndTab %p, hwndInsertBefore %p stub!\n", iface, hwndTab, hwndInsertBefore);
180 return E_NOTIMPL;
183 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabActive(ITaskbarList4 *iface,
184 HWND hwndTab,
185 HWND hwndMDI,
186 DWORD dwReserved)
188 FIXME("iface %p, hwndTab %p, hwndMDI %p, dwReserved %x stub!\n", iface, hwndTab, hwndMDI, dwReserved);
190 return E_NOTIMPL;
193 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarAddButtons(ITaskbarList4 *iface,
194 HWND hwnd,
195 UINT cButtons,
196 LPTHUMBBUTTON pButton)
198 FIXME("iface %p, hwnd %p, cButtons %u, pButton %p stub, faking success!\n", iface, hwnd, cButtons, pButton);
200 return S_OK;
203 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarUpdateButtons(ITaskbarList4 *iface,
204 HWND hwnd,
205 UINT cButtons,
206 LPTHUMBBUTTON pButton)
208 FIXME("iface %p, hwnd %p, cButtons %u, pButton %p stub, faking success!\n", iface, hwnd, cButtons, pButton);
210 return S_OK;
213 static HRESULT STDMETHODCALLTYPE taskbar_list_ThumbBarSetImageList(ITaskbarList4 *iface,
214 HWND hwnd,
215 HIMAGELIST himl)
217 FIXME("iface %p, hwnd %p, himl %p stub!\n", iface, hwnd, himl);
219 return S_OK;
222 static HRESULT STDMETHODCALLTYPE taskbar_list_SetOverlayIcon(ITaskbarList4 *iface,
223 HWND hwnd,
224 HICON hIcon,
225 LPCWSTR pszDescription)
227 FIXME("iface %p, hwnd %p, hIcon %p, pszDescription %s stub!\n", iface, hwnd, hIcon,
228 debugstr_w(pszDescription));
230 return S_OK;
233 static HRESULT STDMETHODCALLTYPE taskbar_list_SetThumbnailTooltip(ITaskbarList4 *iface,
234 HWND hwnd,
235 LPCWSTR pszTip)
237 FIXME("iface %p, hwnd %p, pszTip %s stub, faking success!\n", iface, hwnd, debugstr_w(pszTip));
239 return S_OK;
242 static HRESULT STDMETHODCALLTYPE taskbar_list_SetThumbnailClip(ITaskbarList4 *iface,
243 HWND hwnd,
244 RECT *prcClip)
246 FIXME("iface %p, hwnd %p, prcClip %s stub!\n", iface, hwnd, wine_dbgstr_rect(prcClip));
248 return E_NOTIMPL;
251 /* ITaskbarList4 method */
253 static HRESULT STDMETHODCALLTYPE taskbar_list_SetTabProperties(ITaskbarList4 *iface,
254 HWND hwndTab,
255 STPFLAG stpFlags)
257 FIXME("iface %p, hwndTab %p, stpFlags %u stub!\n", iface, hwndTab, stpFlags);
259 return E_NOTIMPL;
262 static const struct ITaskbarList4Vtbl taskbar_list_vtbl =
264 /* IUnknown methods */
265 taskbar_list_QueryInterface,
266 taskbar_list_AddRef,
267 taskbar_list_Release,
268 /* ITaskbarList methods */
269 taskbar_list_HrInit,
270 taskbar_list_AddTab,
271 taskbar_list_DeleteTab,
272 taskbar_list_ActivateTab,
273 taskbar_list_SetActiveAlt,
274 /* ITaskbarList2 method */
275 taskbar_list_MarkFullscreenWindow,
276 /* ITaskbarList3 methods */
277 taskbar_list_SetProgressValue,
278 taskbar_list_SetProgressState,
279 taskbar_list_RegisterTab,
280 taskbar_list_UnregisterTab,
281 taskbar_list_SetTabOrder,
282 taskbar_list_SetTabActive,
283 taskbar_list_ThumbBarAddButtons,
284 taskbar_list_ThumbBarUpdateButtons,
285 taskbar_list_ThumbBarSetImageList,
286 taskbar_list_SetOverlayIcon,
287 taskbar_list_SetThumbnailTooltip,
288 taskbar_list_SetThumbnailClip,
289 /* ITaskbarList4 method */
290 taskbar_list_SetTabProperties,
293 HRESULT TaskbarList_Constructor(IUnknown *outer, REFIID riid, void **taskbar_list)
295 struct taskbar_list *object;
296 HRESULT hres;
298 TRACE("outer %p, riid %s, taskbar_list %p\n", outer, debugstr_guid(riid), taskbar_list);
300 if (outer)
302 WARN("Aggregation not supported\n");
303 *taskbar_list = NULL;
304 return CLASS_E_NOAGGREGATION;
307 object = heap_alloc(sizeof(*object));
308 if (!object)
310 ERR("Failed to allocate taskbar list object memory\n");
311 *taskbar_list = NULL;
312 return E_OUTOFMEMORY;
315 object->ITaskbarList4_iface.lpVtbl = &taskbar_list_vtbl;
316 object->refcount = 1;
317 EFRAME_LockModule();
319 TRACE("Created ITaskbarList4 %p\n", object);
321 hres = ITaskbarList4_QueryInterface(&object->ITaskbarList4_iface, riid, taskbar_list);
322 ITaskbarList4_Release(&object->ITaskbarList4_iface);
323 return hres;