mshtml: IPropertyBag stub implementation.
[wine/wine-gecko.git] / dlls / mshtml / propbag.c
blobfd44f031d3b832e5d44c939419b45672aa1d7d10
1 /*
2 * Copyright 2010 Jacek Caban for CodeWeavers
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 "config.h"
21 #include <stdarg.h>
23 #define COBJMACROS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winuser.h"
28 #include "ole2.h"
29 #include "shlobj.h"
31 #include "mshtml_private.h"
32 #include "pluginhost.h"
34 #include "wine/debug.h"
35 #include "wine/unicode.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 typedef struct {
40 IPropertyBag IPropertyBag_iface;
42 LONG ref;
43 } PropertyBag;
45 static inline PropertyBag *impl_from_IPropertyBag(IPropertyBag *iface)
47 return CONTAINING_RECORD(iface, PropertyBag, IPropertyBag_iface);
50 static HRESULT WINAPI PropertyBag_QueryInterface(IPropertyBag *iface, REFIID riid, void **ppv)
52 PropertyBag *This = impl_from_IPropertyBag(iface);
54 if(IsEqualGUID(&IID_IUnknown, riid)) {
55 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
56 *ppv = &This->IPropertyBag_iface;
57 }else if(IsEqualGUID(&IID_IPropertyBag, riid)) {
58 TRACE("(%p)->(IID_IPropertyBag %p)\n", This, ppv);
59 *ppv = &This->IPropertyBag_iface;
60 }else {
61 WARN("Unsopported interface %s\n", debugstr_guid(riid));
62 *ppv = NULL;
63 return E_NOINTERFACE;
66 IUnknown_AddRef((IUnknown*)*ppv);
67 return S_OK;
70 static ULONG WINAPI PropertyBag_AddRef(IPropertyBag *iface)
72 PropertyBag *This = impl_from_IPropertyBag(iface);
73 LONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) ref=%d\n", This, ref);
77 return ref;
80 static ULONG WINAPI PropertyBag_Release(IPropertyBag *iface)
82 PropertyBag *This = impl_from_IPropertyBag(iface);
83 LONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) ref=%d\n", This, ref);
87 if(!ref)
88 heap_free(This);
90 return ref;
93 static HRESULT WINAPI PropertyBag_Read(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar, IErrorLog *pErrorLog)
95 PropertyBag *This = impl_from_IPropertyBag(iface);
96 FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(pszPropName), pVar, pErrorLog);
97 return E_NOTIMPL;
100 static HRESULT WINAPI PropertyBag_Write(IPropertyBag *iface, LPCOLESTR pszPropName, VARIANT *pVar)
102 PropertyBag *This = impl_from_IPropertyBag(iface);
103 FIXME("(%p)->(%s %s)\n", This, debugstr_w(pszPropName), debugstr_variant(pVar));
104 return E_NOTIMPL;
107 static const IPropertyBagVtbl PropertyBagVtbl = {
108 PropertyBag_QueryInterface,
109 PropertyBag_AddRef,
110 PropertyBag_Release,
111 PropertyBag_Read,
112 PropertyBag_Write
115 HRESULT create_param_prop_bag(IPropertyBag **ret)
117 PropertyBag *prop_bag;
119 prop_bag = heap_alloc(sizeof(*prop_bag));
120 if(!prop_bag)
121 return E_OUTOFMEMORY;
123 prop_bag->IPropertyBag_iface.lpVtbl = &PropertyBagVtbl;
124 prop_bag->ref = 1;
126 *ret = &prop_bag->IPropertyBag_iface;
127 return S_OK;