2 * Copyright 2012 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
28 #include "wine/debug.h"
30 #include "mshtml_private.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
36 IHTMLStorage IHTMLStorage_iface;
40 static inline HTMLStorage *impl_from_IHTMLStorage(IHTMLStorage *iface)
42 return CONTAINING_RECORD(iface, HTMLStorage, IHTMLStorage_iface);
45 static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID riid, void **ppv)
47 HTMLStorage *This = impl_from_IHTMLStorage(iface);
51 if(IsEqualGUID(&IID_IUnknown, riid)) {
52 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
53 *ppv = &This->IHTMLStorage_iface;
54 }else if(IsEqualGUID(&IID_IHTMLStorage, riid)) {
55 TRACE("(%p)->(IID_IHTMLStorage %p)\n", This, ppv);
56 *ppv = &This->IHTMLStorage_iface;
57 }else if(dispex_query_interface(&This->dispex, riid, ppv)) {
58 return *ppv ? S_OK : E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*ppv);
66 WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
70 static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
72 HTMLStorage *This = impl_from_IHTMLStorage(iface);
73 LONG ref = InterlockedIncrement(&This->ref);
75 TRACE("(%p) ref=%d\n", This, ref);
80 static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
82 HTMLStorage *This = impl_from_IHTMLStorage(iface);
83 LONG ref = InterlockedDecrement(&This->ref);
85 TRACE("(%p) ref=%d\n", This, ref);
88 release_dispex(&This->dispex);
95 static HRESULT WINAPI HTMLStorage_GetTypeInfoCount(IHTMLStorage *iface, UINT *pctinfo)
97 HTMLStorage *This = impl_from_IHTMLStorage(iface);
98 FIXME("(%p)->(%p)\n", This, pctinfo);
102 static HRESULT WINAPI HTMLStorage_GetTypeInfo(IHTMLStorage *iface, UINT iTInfo,
103 LCID lcid, ITypeInfo **ppTInfo)
105 HTMLStorage *This = impl_from_IHTMLStorage(iface);
107 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
110 static HRESULT WINAPI HTMLStorage_GetIDsOfNames(IHTMLStorage *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
111 LCID lcid, DISPID *rgDispId)
113 HTMLStorage *This = impl_from_IHTMLStorage(iface);
115 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
119 static HRESULT WINAPI HTMLStorage_Invoke(IHTMLStorage *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
120 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
122 HTMLStorage *This = impl_from_IHTMLStorage(iface);
124 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
125 pDispParams, pVarResult, pExcepInfo, puArgErr);
128 static HRESULT WINAPI HTMLStorage_get_length(IHTMLStorage *iface, LONG *p)
130 HTMLStorage *This = impl_from_IHTMLStorage(iface);
131 FIXME("(%p)->(%p)\n", This, p);
135 static HRESULT WINAPI HTMLStorage_get_remainingSpace(IHTMLStorage *iface, LONG *p)
137 HTMLStorage *This = impl_from_IHTMLStorage(iface);
138 FIXME("(%p)->(%p)\n", This, p);
142 static HRESULT WINAPI HTMLStorage_key(IHTMLStorage *iface, LONG lIndex, BSTR *p)
144 HTMLStorage *This = impl_from_IHTMLStorage(iface);
145 FIXME("(%p)->(%d %p)\n", This, lIndex, p);
149 static HRESULT WINAPI HTMLStorage_getItem(IHTMLStorage *iface, BSTR bstrKey, VARIANT *p)
151 HTMLStorage *This = impl_from_IHTMLStorage(iface);
152 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrKey), p);
156 static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BSTR bstrValue)
158 HTMLStorage *This = impl_from_IHTMLStorage(iface);
159 FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrKey), debugstr_w(bstrValue));
163 static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey)
165 HTMLStorage *This = impl_from_IHTMLStorage(iface);
166 FIXME("(%p)->(%s)\n", This, debugstr_w(bstrKey));
170 static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)
172 HTMLStorage *This = impl_from_IHTMLStorage(iface);
173 FIXME("(%p)->()\n", This);
177 static const IHTMLStorageVtbl HTMLStorageVtbl = {
178 HTMLStorage_QueryInterface,
181 HTMLStorage_GetTypeInfoCount,
182 HTMLStorage_GetTypeInfo,
183 HTMLStorage_GetIDsOfNames,
185 HTMLStorage_get_length,
186 HTMLStorage_get_remainingSpace,
190 HTMLStorage_removeItem,
194 static const tid_t HTMLStorage_iface_tids[] = {
198 static dispex_static_data_t HTMLStorage_dispex = {
202 HTMLStorage_iface_tids
205 HRESULT create_storage(IHTMLStorage **p)
207 HTMLStorage *storage;
209 storage = heap_alloc_zero(sizeof(*storage));
211 return E_OUTOFMEMORY;
213 storage->IHTMLStorage_iface.lpVtbl = &HTMLStorageVtbl;
215 init_dispex(&storage->dispex, (IUnknown*)&storage->IHTMLStorage_iface, &HTMLStorage_dispex);
217 *p = &storage->IHTMLStorage_iface;