d3d9/tests: Fix test failure for IDirect3D9::CreateDevice in test_set_stream_source.
[wine] / dlls / shdocvw / persist.c
1 /*
2  * Implementation of IPersist interfaces for WebBrowser control
3  *
4  * Copyright 2001 John R. Sheets (for CodeWeavers)
5  * Copyright 2005 Jacek Caban
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "wine/debug.h"
23 #include "shdocvw.h"
24
25 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
26
27 /**********************************************************************
28  * Implement the IPersistStorage interface
29  */
30
31 #define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
32
33 static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface,
34         REFIID riid, LPVOID *ppobj)
35 {
36     WebBrowser *This = PERSTORAGE_THIS(iface);
37     return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
38 }
39
40 static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface)
41 {
42     WebBrowser *This = PERSTORAGE_THIS(iface);
43     return IWebBrowser_AddRef(WEBBROWSER(This));
44 }
45
46 static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface)
47 {
48     WebBrowser *This = PERSTORAGE_THIS(iface);
49     return IWebBrowser_Release(WEBBROWSER(This));
50 }
51
52 static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID)
53 {
54     WebBrowser *This = PERSTORAGE_THIS(iface);
55     FIXME("(%p)->(%p)\n", This, pClassID);
56     return E_NOTIMPL;
57 }
58
59 static HRESULT WINAPI PersistStorage_IsDirty(IPersistStorage *iface)
60 {
61     WebBrowser *This = PERSTORAGE_THIS(iface);
62     FIXME("(%p)\n", This);
63     return E_NOTIMPL;
64 }
65
66 static HRESULT WINAPI PersistStorage_InitNew(IPersistStorage *iface, LPSTORAGE pStg)
67 {
68     WebBrowser *This = PERSTORAGE_THIS(iface);
69     FIXME("(%p)->(%p)\n", This, pStg);
70     return S_OK;
71 }
72
73 static HRESULT WINAPI PersistStorage_Load(IPersistStorage *iface, LPSTORAGE pStg)
74 {
75     WebBrowser *This = PERSTORAGE_THIS(iface);
76     FIXME("(%p)->(%p)\n", This, pStg);
77     return E_NOTIMPL;
78 }
79
80 static HRESULT WINAPI PersistStorage_Save(IPersistStorage *iface, LPSTORAGE pStg,
81         BOOL fSameAsLoad)
82 {
83     WebBrowser *This = PERSTORAGE_THIS(iface);
84     FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
85     return E_NOTIMPL;
86 }
87
88 static HRESULT WINAPI PersistStorage_SaveCompleted(IPersistStorage *iface, LPSTORAGE pStgNew)
89 {
90     WebBrowser *This = PERSTORAGE_THIS(iface);
91     FIXME("(%p)->(%p)\n", This, pStgNew);
92     return E_NOTIMPL;
93 }
94
95 static const IPersistStorageVtbl PersistStorageVtbl =
96 {
97     PersistStorage_QueryInterface,
98     PersistStorage_AddRef,
99     PersistStorage_Release,
100     PersistStorage_GetClassID,
101     PersistStorage_IsDirty,
102     PersistStorage_InitNew,
103     PersistStorage_Load,
104     PersistStorage_Save,
105     PersistStorage_SaveCompleted
106 };
107
108 /**********************************************************************
109  * Implement the IPersistMemory interface
110  */
111
112 #define PERMEMORY_THIS(ifce) DEFINE_THIS(WebBrowser, PersistMemory, iface)
113
114 static HRESULT WINAPI PersistMemory_QueryInterface(IPersistMemory *iface,
115         REFIID riid, LPVOID *ppobj)
116 {
117     WebBrowser *This = PERMEMORY_THIS(iface);
118     return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
119 }
120
121 static ULONG WINAPI PersistMemory_AddRef(IPersistMemory *iface)
122 {
123     WebBrowser *This = PERMEMORY_THIS(iface);
124     return IWebBrowser_AddRef(WEBBROWSER(This));
125 }
126
127 static ULONG WINAPI PersistMemory_Release(IPersistMemory *iface)
128 {
129     WebBrowser *This = PERMEMORY_THIS(iface);
130     return IWebBrowser_Release(WEBBROWSER(This));
131 }
132
133 static HRESULT WINAPI PersistMemory_GetClassID(IPersistMemory *iface, CLSID *pClassID)
134 {
135     WebBrowser *This = PERMEMORY_THIS(iface);
136     FIXME("(%p)->(%p)\n", This, pClassID);
137     return E_NOTIMPL;
138 }
139
140 static HRESULT WINAPI PersistMemory_IsDirty(IPersistMemory *iface)
141 {
142     WebBrowser *This = PERMEMORY_THIS(iface);
143     FIXME("(%p)\n", This);
144     return E_NOTIMPL;
145 }
146
147 static HRESULT WINAPI PersistMemory_InitNew(IPersistMemory *iface)
148 {
149     WebBrowser *This = PERMEMORY_THIS(iface);
150     FIXME("(%p)\n", This);
151     return S_OK;
152 }
153
154 static HRESULT WINAPI PersistMemory_Load(IPersistMemory *iface, LPVOID pMem, ULONG cbSize)
155 {
156     WebBrowser *This = PERMEMORY_THIS(iface);
157     FIXME("(%p)->(%p %x)\n", This, pMem, cbSize);
158     return S_OK;
159 }
160
161 static HRESULT WINAPI PersistMemory_Save(IPersistMemory *iface, LPVOID pMem,
162         BOOL fClearDirty, ULONG cbSize)
163 {
164     WebBrowser *This = PERMEMORY_THIS(iface);
165     FIXME("(%p)->(%p %x %x)\n", This, pMem, fClearDirty, cbSize);
166     return E_NOTIMPL;
167 }
168
169 static HRESULT WINAPI PersistMemory_GetSizeMax(IPersistMemory *iface, ULONG *pCbSize)
170 {
171     WebBrowser *This = PERMEMORY_THIS(iface);
172     FIXME("(%p)->(%p)\n", This, pCbSize);
173     return E_NOTIMPL;
174 }
175
176 static const IPersistMemoryVtbl PersistMemoryVtbl =
177 {
178     PersistMemory_QueryInterface,
179     PersistMemory_AddRef,
180     PersistMemory_Release,
181     PersistMemory_GetClassID,
182     PersistMemory_IsDirty,
183     PersistMemory_Load,
184     PersistMemory_Save,
185     PersistMemory_GetSizeMax,
186     PersistMemory_InitNew
187 };
188
189 /**********************************************************************
190  * Implement the IPersistStreamInit interface
191  */
192
193 #define PERSTRINIT_THIS(iface) DEFINE_THIS(WebBrowser, PersistStreamInit, iface)
194
195 static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
196         REFIID riid, LPVOID *ppobj)
197 {
198     WebBrowser *This = PERSTRINIT_THIS(iface);
199     return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
200 }
201
202 static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
203 {
204     WebBrowser *This = PERSTRINIT_THIS(iface);
205     return IWebBrowser_AddRef(WEBBROWSER(This));
206 }
207
208 static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
209 {
210     WebBrowser *This = PERSTRINIT_THIS(iface);
211     return IWebBrowser_Release(WEBBROWSER(This));
212 }
213
214 static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
215 {
216     WebBrowser *This = PERSTRINIT_THIS(iface);
217     return IPersistStorage_GetClassID(PERSTORAGE(This), pClassID);
218 }
219
220 static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
221 {
222     WebBrowser *This = PERSTRINIT_THIS(iface);
223     return IPersistStorage_IsDirty(PERSTORAGE(This));
224 }
225
226 static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStg)
227 {
228     WebBrowser *This = PERSTRINIT_THIS(iface);
229     FIXME("(%p)->(%p)\n", This, pStg);
230     return S_OK;
231 }
232
233 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg,
234         BOOL fSameAsLoad)
235 {
236     WebBrowser *This = PERSTRINIT_THIS(iface);
237     FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
238     return E_NOTIMPL;
239 }
240
241 static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
242         ULARGE_INTEGER *pcbSize)
243 {
244     WebBrowser *This = PERSTRINIT_THIS(iface);
245     FIXME("(%p)->(%p)\n", This, pcbSize);
246     return E_NOTIMPL;
247 }
248
249 static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
250 {
251     WebBrowser *This = PERSTRINIT_THIS(iface);
252     FIXME("(%p)\n", This);
253     return S_OK;
254 }
255
256 #undef PERSTRINIT_THIS
257
258 static const IPersistStreamInitVtbl PersistStreamInitVtbl =
259 {
260     PersistStreamInit_QueryInterface,
261     PersistStreamInit_AddRef,
262     PersistStreamInit_Release,
263     PersistStreamInit_GetClassID,
264     PersistStreamInit_IsDirty,
265     PersistStreamInit_Load,
266     PersistStreamInit_Save,
267     PersistStreamInit_GetSizeMax,
268     PersistStreamInit_InitNew
269 };
270
271 void WebBrowser_Persist_Init(WebBrowser *This)
272 {
273     This->lpPersistStorageVtbl    = &PersistStorageVtbl;
274     This->lpPersistMemoryVtbl     = &PersistMemoryVtbl;
275     This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
276 }