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
21 #define WIN32_NO_STATUS
28 //#include "winuser.h"
31 #include <wine/debug.h>
33 #include "mshtml_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
39 IHTMLStorage IHTMLStorage_iface
;
43 static inline HTMLStorage
*impl_from_IHTMLStorage(IHTMLStorage
*iface
)
45 return CONTAINING_RECORD(iface
, HTMLStorage
, IHTMLStorage_iface
);
48 static HRESULT WINAPI
HTMLStorage_QueryInterface(IHTMLStorage
*iface
, REFIID riid
, void **ppv
)
50 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
54 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
55 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
56 *ppv
= &This
->IHTMLStorage_iface
;
57 }else if(IsEqualGUID(&IID_IHTMLStorage
, riid
)) {
58 TRACE("(%p)->(IID_IHTMLStorage %p)\n", This
, ppv
);
59 *ppv
= &This
->IHTMLStorage_iface
;
60 }else if(dispex_query_interface(&This
->dispex
, riid
, ppv
)) {
61 return *ppv
? S_OK
: E_NOINTERFACE
;
65 IUnknown_AddRef((IUnknown
*)*ppv
);
69 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
73 static ULONG WINAPI
HTMLStorage_AddRef(IHTMLStorage
*iface
)
75 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
76 LONG ref
= InterlockedIncrement(&This
->ref
);
78 TRACE("(%p) ref=%d\n", This
, ref
);
83 static ULONG WINAPI
HTMLStorage_Release(IHTMLStorage
*iface
)
85 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
86 LONG ref
= InterlockedDecrement(&This
->ref
);
88 TRACE("(%p) ref=%d\n", This
, ref
);
91 release_dispex(&This
->dispex
);
98 static HRESULT WINAPI
HTMLStorage_GetTypeInfoCount(IHTMLStorage
*iface
, UINT
*pctinfo
)
100 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
101 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
104 static HRESULT WINAPI
HTMLStorage_GetTypeInfo(IHTMLStorage
*iface
, UINT iTInfo
,
105 LCID lcid
, ITypeInfo
**ppTInfo
)
107 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
109 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
, iTInfo
, lcid
, ppTInfo
);
112 static HRESULT WINAPI
HTMLStorage_GetIDsOfNames(IHTMLStorage
*iface
, REFIID riid
, LPOLESTR
*rgszNames
, UINT cNames
,
113 LCID lcid
, DISPID
*rgDispId
)
115 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
117 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
, riid
, rgszNames
, cNames
,
121 static HRESULT WINAPI
HTMLStorage_Invoke(IHTMLStorage
*iface
, DISPID dispIdMember
, REFIID riid
, LCID lcid
,
122 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
124 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
126 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
, dispIdMember
, riid
, lcid
, wFlags
,
127 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
130 static HRESULT WINAPI
HTMLStorage_get_length(IHTMLStorage
*iface
, LONG
*p
)
132 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
133 FIXME("(%p)->(%p)\n", This
, p
);
137 static HRESULT WINAPI
HTMLStorage_get_remainingSpace(IHTMLStorage
*iface
, LONG
*p
)
139 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
140 FIXME("(%p)->(%p)\n", This
, p
);
144 static HRESULT WINAPI
HTMLStorage_key(IHTMLStorage
*iface
, LONG lIndex
, BSTR
*p
)
146 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
147 FIXME("(%p)->(%d %p)\n", This
, lIndex
, p
);
151 static HRESULT WINAPI
HTMLStorage_getItem(IHTMLStorage
*iface
, BSTR bstrKey
, VARIANT
*p
)
153 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
154 FIXME("(%p)->(%s %p)\n", This
, debugstr_w(bstrKey
), p
);
158 static HRESULT WINAPI
HTMLStorage_setItem(IHTMLStorage
*iface
, BSTR bstrKey
, BSTR bstrValue
)
160 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
161 FIXME("(%p)->(%s %s)\n", This
, debugstr_w(bstrKey
), debugstr_w(bstrValue
));
165 static HRESULT WINAPI
HTMLStorage_removeItem(IHTMLStorage
*iface
, BSTR bstrKey
)
167 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
168 FIXME("(%p)->(%s)\n", This
, debugstr_w(bstrKey
));
172 static HRESULT WINAPI
HTMLStorage_clear(IHTMLStorage
*iface
)
174 HTMLStorage
*This
= impl_from_IHTMLStorage(iface
);
175 FIXME("(%p)->()\n", This
);
179 static const IHTMLStorageVtbl HTMLStorageVtbl
= {
180 HTMLStorage_QueryInterface
,
183 HTMLStorage_GetTypeInfoCount
,
184 HTMLStorage_GetTypeInfo
,
185 HTMLStorage_GetIDsOfNames
,
187 HTMLStorage_get_length
,
188 HTMLStorage_get_remainingSpace
,
192 HTMLStorage_removeItem
,
196 static const tid_t HTMLStorage_iface_tids
[] = {
200 static dispex_static_data_t HTMLStorage_dispex
= {
204 HTMLStorage_iface_tids
207 HRESULT
create_storage(IHTMLStorage
**p
)
209 HTMLStorage
*storage
;
211 storage
= heap_alloc_zero(sizeof(*storage
));
213 return E_OUTOFMEMORY
;
215 storage
->IHTMLStorage_iface
.lpVtbl
= &HTMLStorageVtbl
;
217 init_dispex(&storage
->dispex
, (IUnknown
*)&storage
->IHTMLStorage_iface
, &HTMLStorage_dispex
);
219 *p
= &storage
->IHTMLStorage_iface
;