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
);
49 TRACE("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
51 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
52 *ppv
= &This
->IHTMLStorage_iface
;
53 }else if(IsEqualGUID(&IID_IHTMLStorage
, riid
)) {
54 *ppv
= &This
->IHTMLStorage_iface
;
55 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
56 return *ppv
? S_OK
: E_NOINTERFACE
;
59 WARN("(%p)->(%s %p)\n", This
, debugstr_mshtml_guid(riid
), ppv
);
63 IUnknown_AddRef((IUnknown
*)*ppv
);
67 static ULONG WINAPI
HTMLStorage_AddRef(IHTMLStorage
*iface
)
69 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
70 LONG ref
= InterlockedIncrement(&This
->ref
);
72 TRACE("(%p) ref=%d\n", This
, ref
);
77 static ULONG WINAPI
HTMLStorage_Release(IHTMLStorage
*iface
)
79 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
80 LONG ref
= InterlockedDecrement(&This
->ref
);
82 TRACE("(%p) ref=%d\n", This
, ref
);
85 release_dispex(&This
->dispex
);
92 static HRESULT WINAPI
HTMLStorage_GetTypeInfoCount(IHTMLStorage
*iface
, UINT
*pctinfo
)
94 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
95 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
98 static HRESULT WINAPI
HTMLStorage_GetTypeInfo(IHTMLStorage
*iface
, UINT iTInfo
,
99 LCID lcid
, ITypeInfo
**ppTInfo
)
101 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
103 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
106 static HRESULT WINAPI
HTMLStorage_GetIDsOfNames(IHTMLStorage
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
107 LCID lcid
, DISPID
*rgDispId
)
109 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
111 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
115 static HRESULT WINAPI
HTMLStorage_Invoke(IHTMLStorage
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
116 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
118 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
120 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
121 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
124 static HRESULT WINAPI
HTMLStorage_get_length(IHTMLStorage
*iface
, LONG
*p
)
126 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
127 FIXME("(%p)->(%p)\n", This
, p
);
131 static HRESULT WINAPI
HTMLStorage_get_remainingSpace(IHTMLStorage
*iface
, LONG
*p
)
133 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
134 FIXME("(%p)->(%p)\n", This
, p
);
138 static HRESULT WINAPI
HTMLStorage_key(IHTMLStorage
*iface
, LONG lIndex
, BSTR
*p
)
140 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
141 FIXME("(%p)->(%d %p)\n", This
, lIndex
, p
);
145 static HRESULT WINAPI
HTMLStorage_getItem(IHTMLStorage
*iface
, BSTR bstrKey
, VARIANT
*p
)
147 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
148 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrKey
), p
);
152 static HRESULT WINAPI
HTMLStorage_setItem(IHTMLStorage
*iface
, BSTR bstrKey
, BSTR bstrValue
)
154 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
155 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(bstrKey
), debugstr_w(bstrValue
));
159 static HRESULT WINAPI
HTMLStorage_removeItem(IHTMLStorage
*iface
, BSTR bstrKey
)
161 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
162 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrKey
));
166 static HRESULT WINAPI
HTMLStorage_clear(IHTMLStorage
*iface
)
168 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
169 FIXME("(%p)->()\n", This
);
173 static const IHTMLStorageVtbl HTMLStorageVtbl
= {
174 HTMLStorage_QueryInterface
,
177 HTMLStorage_GetTypeInfoCount
,
178 HTMLStorage_GetTypeInfo
,
179 HTMLStorage_GetIDsOfNames
,
181 HTMLStorage_get_length
,
182 HTMLStorage_get_remainingSpace
,
186 HTMLStorage_removeItem
,
190 static const tid_t HTMLStorage_iface_tids
[] = {
194 static dispex_static_data_t HTMLStorage_dispex
= {
197 HTMLStorage_iface_tids
200 HRESULT
create_html_storage(compat_mode_t compat_mode
, IHTMLStorage
**p
)
202 HTMLStorage
*storage
;
204 storage
= heap_alloc_zero(sizeof(*storage
));
206 return E_OUTOFMEMORY
;
208 storage
->IHTMLStorage_iface
.lpVtbl
= &HTMLStorageVtbl
;
210 init_dispatch(&storage
->dispex
, (IUnknown
*)&storage
->IHTMLStorage_iface
, &HTMLStorage_dispex
, compat_mode
);
212 *p
= &storage
->IHTMLStorage_iface
;