winedbg: Don't dereference possibly NULL thread pointer.
[wine/zf.git] / dlls / uiribbon / uiribbon.c
blob18cb4870f9a5f0817f093ab19ad2927a762b15db
1 /*
2 * Copyright 2017 Fabian Maurer
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "wine/debug.h"
21 #define COBJMACROS
23 #include "uiribbon_private.h"
25 #include <stdio.h>
27 WINE_DEFAULT_DEBUG_CHANNEL(uiribbon);
29 static inline UIRibbonFrameworkImpl *impl_from_IUIFramework(IUIFramework *iface)
31 return CONTAINING_RECORD(iface, UIRibbonFrameworkImpl, IUIFramework_iface);
34 /*** IUnknown methods ***/
36 static HRESULT WINAPI UIRibbonFrameworkImpl_QueryInterface(IUIFramework *iface, REFIID riid, void **ppvObject)
38 UIRibbonFrameworkImpl *This = impl_from_IUIFramework(iface);
40 TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject);
42 if (IsEqualGUID(riid, &IID_IUnknown)
43 || IsEqualGUID(riid, &IID_IUIFramework))
45 IUnknown_AddRef(iface);
46 *ppvObject = &This->IUIFramework_iface;
47 return S_OK;
50 ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject);
51 return E_NOINTERFACE;
54 static ULONG WINAPI UIRibbonFrameworkImpl_AddRef(IUIFramework *iface)
56 UIRibbonFrameworkImpl *This = impl_from_IUIFramework(iface);
57 ULONG ref = InterlockedIncrement(&This->ref);
59 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
61 return ref;
64 static ULONG WINAPI UIRibbonFrameworkImpl_Release(IUIFramework *iface)
66 UIRibbonFrameworkImpl *This = impl_from_IUIFramework(iface);
67 ULONG ref = InterlockedDecrement(&This->ref);
69 TRACE("(%p/%p)->(): new ref %d\n", iface, This, ref);
71 if (!ref)
72 HeapFree(GetProcessHeap(), 0, This);
74 return ref;
77 /*** IUIFramework methods ***/
79 static HRESULT WINAPI UIRibbonFrameworkImpl_Initialize(IUIFramework *iface, HWND frameWnd, IUIApplication *application)
81 FIXME("(%p, %p): stub!\n", frameWnd, application);
83 return E_NOTIMPL;
86 static HRESULT WINAPI UIRibbonFrameworkImpl_Destroy(IUIFramework *iface)
88 FIXME("(): stub!\n");
90 return E_NOTIMPL;
93 static HRESULT WINAPI UIRibbonFrameworkImpl_LoadUI(IUIFramework *iface, HINSTANCE instance, LPCWSTR resourceName)
95 FIXME("(%p, %s): stub!\n", instance, debugstr_w(resourceName));
97 return E_NOTIMPL;
100 static HRESULT WINAPI UIRibbonFrameworkImpl_GetView(IUIFramework *iface, UINT32 viewId, REFIID riid, void **ppv)
102 FIXME("(%u, %p, %p): stub!\n", viewId, riid, ppv);
104 return E_NOTIMPL;
107 static HRESULT WINAPI UIRibbonFrameworkImpl_GetUICommandProperty(IUIFramework *iface, UINT32 commandId, REFPROPERTYKEY key, PROPVARIANT *value)
109 FIXME("(%u, %p, %p): stub!\n", commandId, key, value);
111 return E_NOTIMPL;
114 static HRESULT WINAPI UIRibbonFrameworkImpl_SetUICommandProperty(IUIFramework *iface, UINT32 commandId, REFPROPERTYKEY key, PROPVARIANT value)
116 FIXME("(%u, %p): stub!\n", commandId, key);
118 return E_NOTIMPL;
121 static HRESULT WINAPI UIRibbonFrameworkImpl_InvalidateUICommand(IUIFramework *iface, UINT32 commandId, UI_INVALIDATIONS flags, const PROPERTYKEY *key)
123 FIXME("(%u, %#x, %p): stub!\n", commandId, flags, key);
125 return E_NOTIMPL;
128 static HRESULT WINAPI UIRibbonFrameworkImpl_FlushPendingInvalidations(IUIFramework *iface)
130 FIXME("(): stub!\n");
132 return E_NOTIMPL;
135 static HRESULT WINAPI UIRibbonFrameworkImpl_SetModes(IUIFramework *iface, INT32 iModes)
137 FIXME("(%d): stub!\n", iModes);
139 return E_NOTIMPL;
142 static const IUIFrameworkVtbl IUIFramework_Vtbl =
144 UIRibbonFrameworkImpl_QueryInterface,
145 UIRibbonFrameworkImpl_AddRef,
146 UIRibbonFrameworkImpl_Release,
147 UIRibbonFrameworkImpl_Initialize,
148 UIRibbonFrameworkImpl_Destroy,
149 UIRibbonFrameworkImpl_LoadUI,
150 UIRibbonFrameworkImpl_GetView,
151 UIRibbonFrameworkImpl_GetUICommandProperty,
152 UIRibbonFrameworkImpl_SetUICommandProperty,
153 UIRibbonFrameworkImpl_InvalidateUICommand,
154 UIRibbonFrameworkImpl_FlushPendingInvalidations,
155 UIRibbonFrameworkImpl_SetModes
158 HRESULT UIRibbonFrameworkImpl_Create(IUnknown *pUnkOuter, void **ppObj)
160 UIRibbonFrameworkImpl *object;
162 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
164 object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(UIRibbonFrameworkImpl));
165 if (!object)
166 return E_OUTOFMEMORY;
168 object->IUIFramework_iface.lpVtbl = &IUIFramework_Vtbl;
169 object->ref = 1;
171 *ppObj = &object->IUIFramework_iface;
173 return S_OK;