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
19 #include "mshtml_private.h"
23 IHTMLStorage IHTMLStorage_iface
;
27 static inline HTMLStorage
*impl_from_IHTMLStorage(IHTMLStorage
*iface
)
29 return CONTAINING_RECORD(iface
, HTMLStorage
, IHTMLStorage_iface
);
32 static HRESULT WINAPI
HTMLStorage_QueryInterface(IHTMLStorage
*iface
, REFIID riid
, void **ppv
)
34 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
36 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
38 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
39 *ppv
= &This
->IHTMLStorage_iface
;
40 }else if(IsEqualGUID(&IID_IHTMLStorage
, riid
)) {
41 *ppv
= &This
->IHTMLStorage_iface
;
42 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
43 return *ppv
? S_OK
: E_NOINTERFACE
;
46 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
50 IUnknown_AddRef((IUnknown
*)*ppv
);
54 static ULONG WINAPI
HTMLStorage_AddRef(IHTMLStorage
*iface
)
56 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
57 LONG ref
= InterlockedIncrement(&This
->ref
);
59 TRACE("(%p) ref=%d\n", This
, ref
);
64 static ULONG WINAPI
HTMLStorage_Release(IHTMLStorage
*iface
)
66 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
67 LONG ref
= InterlockedDecrement(&This
->ref
);
69 TRACE("(%p) ref=%d\n", This
, ref
);
72 release_dispex(&This
->dispex
);
79 static HRESULT WINAPI
HTMLStorage_GetTypeInfoCount(IHTMLStorage
*iface
, UINT
*pctinfo
)
81 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
82 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
85 static HRESULT WINAPI
HTMLStorage_GetTypeInfo(IHTMLStorage
*iface
, UINT iTInfo
,
86 LCID lcid
, ITypeInfo
**ppTInfo
)
88 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
90 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
93 static HRESULT WINAPI
HTMLStorage_GetIDsOfNames(IHTMLStorage
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
94 LCID lcid
, DISPID
*rgDispId
)
96 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
98 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
102 static HRESULT WINAPI
HTMLStorage_Invoke(IHTMLStorage
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
103 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
105 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
107 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
108 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
111 static HRESULT WINAPI
HTMLStorage_get_length(IHTMLStorage
*iface
, LONG
*p
)
113 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
114 FIXME("(%p)->(%p)\n", This
, p
);
118 static HRESULT WINAPI
HTMLStorage_get_remainingSpace(IHTMLStorage
*iface
, LONG
*p
)
120 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
121 FIXME("(%p)->(%p)\n", This
, p
);
125 static HRESULT WINAPI
HTMLStorage_key(IHTMLStorage
*iface
, LONG lIndex
, BSTR
*p
)
127 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
128 FIXME("(%p)->(%d %p)\n", This
, lIndex
, p
);
132 static HRESULT WINAPI
HTMLStorage_getItem(IHTMLStorage
*iface
, BSTR bstrKey
, VARIANT
*p
)
134 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
135 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrKey
), p
);
139 static HRESULT WINAPI
HTMLStorage_setItem(IHTMLStorage
*iface
, BSTR bstrKey
, BSTR bstrValue
)
141 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
142 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(bstrKey
), debugstr_w(bstrValue
));
146 static HRESULT WINAPI
HTMLStorage_removeItem(IHTMLStorage
*iface
, BSTR bstrKey
)
148 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
149 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrKey
));
153 static HRESULT WINAPI
HTMLStorage_clear(IHTMLStorage
*iface
)
155 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
156 FIXME("(%p)->()\n", This
);
160 static const IHTMLStorageVtbl HTMLStorageVtbl
= {
161 HTMLStorage_QueryInterface
,
164 HTMLStorage_GetTypeInfoCount
,
165 HTMLStorage_GetTypeInfo
,
166 HTMLStorage_GetIDsOfNames
,
168 HTMLStorage_get_length
,
169 HTMLStorage_get_remainingSpace
,
173 HTMLStorage_removeItem
,
177 static const tid_t HTMLStorage_iface_tids
[] = {
181 static dispex_static_data_t HTMLStorage_dispex
= {
185 HTMLStorage_iface_tids
188 HRESULT
create_storage(IHTMLStorage
**p
)
190 HTMLStorage
*storage
;
192 storage
= heap_alloc_zero(sizeof(*storage
));
194 return E_OUTOFMEMORY
;
196 storage
->IHTMLStorage_iface
.lpVtbl
= &HTMLStorageVtbl
;
198 init_dispex(&storage
->dispex
, (IUnknown
*)&storage
->IHTMLStorage_iface
, &HTMLStorage_dispex
);
200 *p
= &storage
->IHTMLStorage_iface
;