ReactOS 0.4.15-dev-7842-g558ab78
htmlstorage.c
Go to the documentation of this file.
1/*
2 * Copyright 2012 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include "mshtml_private.h"
20
21typedef struct {
23 IHTMLStorage IHTMLStorage_iface;
26
27static inline HTMLStorage *impl_from_IHTMLStorage(IHTMLStorage *iface)
28{
29 return CONTAINING_RECORD(iface, HTMLStorage, IHTMLStorage_iface);
30}
31
32static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID riid, void **ppv)
33{
35
36 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
37
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;
44 }else {
45 *ppv = NULL;
46 WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
47 return E_NOINTERFACE;
48 }
49
50 IUnknown_AddRef((IUnknown*)*ppv);
51 return S_OK;
52}
53
54static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
55{
58
59 TRACE("(%p) ref=%d\n", This, ref);
60
61 return ref;
62}
63
64static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
65{
68
69 TRACE("(%p) ref=%d\n", This, ref);
70
71 if(!ref) {
72 release_dispex(&This->dispex);
74 }
75
76 return ref;
77}
78
79static HRESULT WINAPI HTMLStorage_GetTypeInfoCount(IHTMLStorage *iface, UINT *pctinfo)
80{
82 return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
83}
84
85static HRESULT WINAPI HTMLStorage_GetTypeInfo(IHTMLStorage *iface, UINT iTInfo,
86 LCID lcid, ITypeInfo **ppTInfo)
87{
89
90 return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
91}
92
93static HRESULT WINAPI HTMLStorage_GetIDsOfNames(IHTMLStorage *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
94 LCID lcid, DISPID *rgDispId)
95{
97
98 return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
99 lcid, rgDispId);
100}
101
102static HRESULT WINAPI HTMLStorage_Invoke(IHTMLStorage *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
103 WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
104{
106
107 return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
108 pDispParams, pVarResult, pExcepInfo, puArgErr);
109}
110
111static HRESULT WINAPI HTMLStorage_get_length(IHTMLStorage *iface, LONG *p)
112{
114 FIXME("(%p)->(%p)\n", This, p);
115 return E_NOTIMPL;
116}
117
119{
121 FIXME("(%p)->(%p)\n", This, p);
122 return E_NOTIMPL;
123}
124
125static HRESULT WINAPI HTMLStorage_key(IHTMLStorage *iface, LONG lIndex, BSTR *p)
126{
128 FIXME("(%p)->(%d %p)\n", This, lIndex, p);
129 return E_NOTIMPL;
130}
131
132static HRESULT WINAPI HTMLStorage_getItem(IHTMLStorage *iface, BSTR bstrKey, VARIANT *p)
133{
135 FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrKey), p);
136 return E_NOTIMPL;
137}
138
139static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BSTR bstrValue)
140{
142 FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrKey), debugstr_w(bstrValue));
143 return E_NOTIMPL;
144}
145
146static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey)
147{
149 FIXME("(%p)->(%s)\n", This, debugstr_w(bstrKey));
150 return E_NOTIMPL;
151}
152
153static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)
154{
156 FIXME("(%p)->()\n", This);
157 return E_NOTIMPL;
158}
159
160static const IHTMLStorageVtbl HTMLStorageVtbl = {
175};
176
178 IHTMLStorage_tid,
179 0
180};
182 NULL,
183 IHTMLStorage_tid,
184 NULL,
186};
187
188HRESULT create_storage(IHTMLStorage **p)
189{
190 HTMLStorage *storage;
191
192 storage = heap_alloc_zero(sizeof(*storage));
193 if(!storage)
194 return E_OUTOFMEMORY;
195
196 storage->IHTMLStorage_iface.lpVtbl = &HTMLStorageVtbl;
197 storage->ref = 1;
199
200 *p = &storage->IHTMLStorage_iface;
201 return S_OK;
202}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
OLECHAR * BSTR
Definition: compat.h:2293
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
unsigned short WORD
Definition: ntddk_ex.h:93
GLfloat GLfloat p
Definition: glext.h:8902
static HRESULT WINAPI HTMLStorage_get_length(IHTMLStorage *iface, LONG *p)
Definition: htmlstorage.c:111
static const tid_t HTMLStorage_iface_tids[]
Definition: htmlstorage.c:177
static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey)
Definition: htmlstorage.c:146
static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)
Definition: htmlstorage.c:153
static const IHTMLStorageVtbl HTMLStorageVtbl
Definition: htmlstorage.c:160
static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
Definition: htmlstorage.c:54
static HRESULT WINAPI HTMLStorage_GetTypeInfoCount(IHTMLStorage *iface, UINT *pctinfo)
Definition: htmlstorage.c:79
static HRESULT WINAPI HTMLStorage_GetTypeInfo(IHTMLStorage *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlstorage.c:85
static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
Definition: htmlstorage.c:64
static dispex_static_data_t HTMLStorage_dispex
Definition: htmlstorage.c:181
static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID riid, void **ppv)
Definition: htmlstorage.c:32
static HRESULT WINAPI HTMLStorage_getItem(IHTMLStorage *iface, BSTR bstrKey, VARIANT *p)
Definition: htmlstorage.c:132
static HRESULT WINAPI HTMLStorage_Invoke(IHTMLStorage *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: htmlstorage.c:102
static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BSTR bstrValue)
Definition: htmlstorage.c:139
static HRESULT WINAPI HTMLStorage_key(IHTMLStorage *iface, LONG lIndex, BSTR *p)
Definition: htmlstorage.c:125
static HRESULT WINAPI HTMLStorage_get_remainingSpace(IHTMLStorage *iface, LONG *p)
Definition: htmlstorage.c:118
static HRESULT WINAPI HTMLStorage_GetIDsOfNames(IHTMLStorage *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlstorage.c:93
static HTMLStorage * impl_from_IHTMLStorage(IHTMLStorage *iface)
Definition: htmlstorage.c:27
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
#define debugstr_w
Definition: kernel32.h:32
static HGLOBAL create_storage(void)
Definition: clipboard.c:1289
static LPOLESTR
Definition: stg_prop.c:27
static VARIANTARG static DISPID
Definition: ordinal.c:52
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
DWORD LCID
Definition: nls.h:13
#define TRACE(s)
Definition: solgame.cpp:4
DispatchEx dispex
Definition: htmlstorage.c:22
IHTMLStorage IHTMLStorage_iface
Definition: htmlstorage.c:23
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:531
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364