ReactOS  0.4.15-dev-341-g17c5fb8
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 
21 typedef struct {
23  IHTMLStorage IHTMLStorage_iface;
25 } HTMLStorage;
26 
27 static inline HTMLStorage *impl_from_IHTMLStorage(IHTMLStorage *iface)
28 {
29  return CONTAINING_RECORD(iface, HTMLStorage, IHTMLStorage_iface);
30 }
31 
32 static 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 
54 static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
55 {
58 
59  TRACE("(%p) ref=%d\n", This, ref);
60 
61  return ref;
62 }
63 
64 static 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);
73  heap_free(This);
74  }
75 
76  return ref;
77 }
78 
79 static HRESULT WINAPI HTMLStorage_GetTypeInfoCount(IHTMLStorage *iface, UINT *pctinfo)
80 {
82  return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
83 }
84 
85 static 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 
93 static 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 
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)
104 {
106 
107  return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
108  pDispParams, pVarResult, pExcepInfo, puArgErr);
109 }
110 
111 static HRESULT WINAPI HTMLStorage_get_length(IHTMLStorage *iface, LONG *p)
112 {
114  FIXME("(%p)->(%p)\n", This, p);
115  return E_NOTIMPL;
116 }
117 
118 static HRESULT WINAPI HTMLStorage_get_remainingSpace(IHTMLStorage *iface, LONG *p)
119 {
121  FIXME("(%p)->(%p)\n", This, p);
122  return E_NOTIMPL;
123 }
124 
125 static 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 
132 static 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 
139 static 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 
146 static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey)
147 {
149  FIXME("(%p)->(%s)\n", This, debugstr_w(bstrKey));
150  return E_NOTIMPL;
151 }
152 
153 static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)
154 {
156  FIXME("(%p)->()\n", This);
157  return E_NOTIMPL;
158 }
159 
160 static const IHTMLStorageVtbl HTMLStorageVtbl = {
175 };
176 
177 static const tid_t HTMLStorage_iface_tids[] = {
178  IHTMLStorage_tid,
179  0
180 };
182  NULL,
183  IHTMLStorage_tid,
184  NULL,
186 };
187 
188 HRESULT 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 }
DispatchEx dispex
Definition: htmlstorage.c:22
static HRESULT WINAPI HTMLStorage_QueryInterface(IHTMLStorage *iface, REFIID riid, void **ppv)
Definition: htmlstorage.c:32
#define REFIID
Definition: guiddef.h:118
static HRESULT WINAPI HTMLStorage_GetTypeInfoCount(IHTMLStorage *iface, UINT *pctinfo)
Definition: htmlstorage.c:79
#define E_NOINTERFACE
Definition: winerror.h:2364
static HRESULT WINAPI HTMLStorage_getItem(IHTMLStorage *iface, BSTR bstrKey, VARIANT *p)
Definition: htmlstorage.c:132
static HRESULT WINAPI HTMLStorage_get_length(IHTMLStorage *iface, LONG *p)
Definition: htmlstorage.c:111
REFIID riid
Definition: precomp.h:44
tid_t
Definition: ieframe.h:311
#define WARN(fmt,...)
Definition: debug.h:112
REFIID LPVOID * ppv
Definition: atlbase.h:39
DWORD LCID
Definition: nls.h:13
OLECHAR * BSTR
Definition: compat.h:1943
static const IHTMLStorageVtbl HTMLStorageVtbl
Definition: htmlstorage.c:160
static LPOLESTR
Definition: stg_prop.c:27
Definition: send.c:48
static HRESULT WINAPI HTMLStorage_removeItem(IHTMLStorage *iface, BSTR bstrKey)
Definition: htmlstorage.c:146
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:535
static ULONG WINAPI HTMLStorage_AddRef(IHTMLStorage *iface)
Definition: htmlstorage.c:54
static HRESULT WINAPI HTMLStorage_GetIDsOfNames(IHTMLStorage *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: htmlstorage.c:93
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HTMLStorage * impl_from_IHTMLStorage(IHTMLStorage *iface)
Definition: htmlstorage.c:27
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
static ULONG WINAPI HTMLStorage_Release(IHTMLStorage *iface)
Definition: htmlstorage.c:64
GLenum GLint ref
Definition: glext.h:6028
static HRESULT WINAPI HTMLStorage_clear(IHTMLStorage *iface)
Definition: htmlstorage.c:153
#define FIXME(fmt,...)
Definition: debug.h:111
static dispex_static_data_t HTMLStorage_dispex
Definition: htmlstorage.c:181
static HRESULT WINAPI HTMLStorage_setItem(IHTMLStorage *iface, BSTR bstrKey, BSTR bstrValue)
Definition: htmlstorage.c:139
smooth NULL
Definition: ftsmooth.c:416
static HRESULT WINAPI HTMLStorage_key(IHTMLStorage *iface, LONG lIndex, BSTR *p)
Definition: htmlstorage.c:125
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT WINAPI HTMLStorage_get_remainingSpace(IHTMLStorage *iface, LONG *p)
Definition: htmlstorage.c:118
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:78
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
unsigned short WORD
Definition: ntddk_ex.h:93
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT create_storage(IHTMLStorage **p)
Definition: htmlstorage.c:188
_In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon.h:534
struct stdole::EXCEPINFO EXCEPINFO
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
BOOL dispex_query_interface(DispatchEx *This, REFIID riid, void **ppv)
Definition: dispex.c:1656
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
HRESULT init_dispex(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype)
Definition: dispex.c:919
struct stdole::DISPPARAMS DISPPARAMS
unsigned int ULONG
Definition: retypes.h:1
static const tid_t HTMLStorage_iface_tids[]
Definition: htmlstorage.c:177
GLfloat GLfloat p
Definition: glext.h:8902
void release_dispex(DispatchEx *This)
Definition: dispex.c:1706
static HRESULT WINAPI HTMLStorage_GetTypeInfo(IHTMLStorage *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: htmlstorage.c:85
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
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
IHTMLStorage IHTMLStorage_iface
Definition: htmlstorage.c:23