Revert r66580 and r66579.
[reactos.git] / reactos / dll / win32 / ieframe / ie.c
1 /*
2 * Copyright 2006 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 "ieframe.h"
20
21 static inline InternetExplorer *impl_from_IWebBrowser2(IWebBrowser2 *iface)
22 {
23 return CONTAINING_RECORD(iface, InternetExplorer, IWebBrowser2_iface);
24 }
25
26 static HRESULT WINAPI InternetExplorer_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
27 {
28 InternetExplorer *This = impl_from_IWebBrowser2(iface);
29
30 *ppv = NULL;
31
32 if(IsEqualGUID(&IID_IUnknown, riid)) {
33 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
34 *ppv = &This->IWebBrowser2_iface;
35 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
36 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
37 *ppv = &This->IWebBrowser2_iface;
38 }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
39 TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
40 *ppv = &This->IWebBrowser2_iface;
41 }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
42 TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
43 *ppv = &This->IWebBrowser2_iface;
44 }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
45 TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
46 *ppv = &This->IWebBrowser2_iface;
47 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
48 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
49 *ppv = &This->doc_host.cps.IConnectionPointContainer_iface;
50 }else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
51 TRACE("(%p)->(IID_IExternalConnection %p)\n", This, ppv);
52 *ppv = &This->IExternalConnection_iface;
53 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
54 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
55 *ppv = &This->IServiceProvider_iface;
56 }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) {
57 return S_OK;
58 }
59
60 if(*ppv) {
61 IUnknown_AddRef((IUnknown*)*ppv);
62 return S_OK;
63 }
64
65 WARN("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
66 return E_NOINTERFACE;
67 }
68
69 static ULONG WINAPI InternetExplorer_AddRef(IWebBrowser2 *iface)
70 {
71 InternetExplorer *This = impl_from_IWebBrowser2(iface);
72 LONG ref = InterlockedIncrement(&This->ref);
73 TRACE("(%p) ref=%d\n", This, ref);
74 return ref;
75 }
76
77 static ULONG WINAPI InternetExplorer_Release(IWebBrowser2 *iface)
78 {
79 InternetExplorer *This = impl_from_IWebBrowser2(iface);
80 LONG ref = InterlockedDecrement(&This->ref);
81
82 TRACE("(%p) ref=%d\n", This, ref);
83
84 if(!ref) {
85 deactivate_document(&This->doc_host);
86 DocHost_Release(&This->doc_host);
87
88 if(This->frame_hwnd)
89 DestroyWindow(This->frame_hwnd);
90 list_remove(&This->entry);
91 heap_free(This);
92
93 released_obj();
94 }
95
96 return ref;
97 }
98
99 static HRESULT WINAPI InternetExplorer_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
100 {
101 InternetExplorer *This = impl_from_IWebBrowser2(iface);
102 FIXME("(%p)->(%p)\n", This, pctinfo);
103 return E_NOTIMPL;
104 }
105
106 static HRESULT WINAPI InternetExplorer_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
107 LPTYPEINFO *ppTInfo)
108 {
109 InternetExplorer *This = impl_from_IWebBrowser2(iface);
110 FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
111 return E_NOTIMPL;
112 }
113
114 static HRESULT WINAPI InternetExplorer_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
115 LPOLESTR *rgszNames, UINT cNames,
116 LCID lcid, DISPID *rgDispId)
117 {
118 InternetExplorer *This = impl_from_IWebBrowser2(iface);
119 FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
120 lcid, rgDispId);
121 return E_NOTIMPL;
122 }
123
124 static HRESULT WINAPI InternetExplorer_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
125 REFIID riid, LCID lcid, WORD wFlags,
126 DISPPARAMS *pDispParams, VARIANT *pVarResult,
127 EXCEPINFO *pExepInfo, UINT *puArgErr)
128 {
129 InternetExplorer *This = impl_from_IWebBrowser2(iface);
130 FIXME("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
131 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
132 return E_NOTIMPL;
133 }
134
135 static HRESULT WINAPI InternetExplorer_GoBack(IWebBrowser2 *iface)
136 {
137 InternetExplorer *This = impl_from_IWebBrowser2(iface);
138 TRACE("(%p)\n", This);
139 return go_back(&This->doc_host);
140 }
141
142 static HRESULT WINAPI InternetExplorer_GoForward(IWebBrowser2 *iface)
143 {
144 InternetExplorer *This = impl_from_IWebBrowser2(iface);
145 TRACE("(%p)\n", This);
146 return go_forward(&This->doc_host);
147 }
148
149 static HRESULT WINAPI InternetExplorer_GoHome(IWebBrowser2 *iface)
150 {
151 InternetExplorer *This = impl_from_IWebBrowser2(iface);
152 TRACE("(%p)\n", This);
153 return go_home(&This->doc_host);
154 }
155
156 static HRESULT WINAPI InternetExplorer_GoSearch(IWebBrowser2 *iface)
157 {
158 InternetExplorer *This = impl_from_IWebBrowser2(iface);
159 FIXME("(%p)\n", This);
160 return E_NOTIMPL;
161 }
162
163 static HRESULT WINAPI InternetExplorer_Navigate(IWebBrowser2 *iface, BSTR szUrl,
164 VARIANT *Flags, VARIANT *TargetFrameName,
165 VARIANT *PostData, VARIANT *Headers)
166 {
167 InternetExplorer *This = impl_from_IWebBrowser2(iface);
168
169 TRACE("(%p)->(%s %p %p %p %p)\n", This, debugstr_w(szUrl), Flags, TargetFrameName,
170 PostData, Headers);
171
172 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
173 }
174
175 static HRESULT WINAPI InternetExplorer_Refresh(IWebBrowser2 *iface)
176 {
177 InternetExplorer *This = impl_from_IWebBrowser2(iface);
178
179 TRACE("(%p)\n", This);
180
181 return refresh_document(&This->doc_host);
182 }
183
184 static HRESULT WINAPI InternetExplorer_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
185 {
186 InternetExplorer *This = impl_from_IWebBrowser2(iface);
187 FIXME("(%p)->(%p)\n", This, Level);
188 return E_NOTIMPL;
189 }
190
191 static HRESULT WINAPI InternetExplorer_Stop(IWebBrowser2 *iface)
192 {
193 InternetExplorer *This = impl_from_IWebBrowser2(iface);
194 FIXME("(%p)\n", This);
195 return E_NOTIMPL;
196 }
197
198 static HRESULT WINAPI InternetExplorer_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
199 {
200 InternetExplorer *This = impl_from_IWebBrowser2(iface);
201 FIXME("(%p)->(%p)\n", This, ppDisp);
202 return E_NOTIMPL;
203 }
204
205 static HRESULT WINAPI InternetExplorer_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
206 {
207 InternetExplorer *This = impl_from_IWebBrowser2(iface);
208 FIXME("(%p)->(%p)\n", This, ppDisp);
209 return E_NOTIMPL;
210 }
211
212 static HRESULT WINAPI InternetExplorer_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
213 {
214 InternetExplorer *This = impl_from_IWebBrowser2(iface);
215 FIXME("(%p)->(%p)\n", This, ppDisp);
216 return E_NOTIMPL;
217 }
218
219 static HRESULT WINAPI InternetExplorer_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
220 {
221 InternetExplorer *This = impl_from_IWebBrowser2(iface);
222 FIXME("(%p)->(%p)\n", This, ppDisp);
223 return E_NOTIMPL;
224 }
225
226 static HRESULT WINAPI InternetExplorer_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
227 {
228 InternetExplorer *This = impl_from_IWebBrowser2(iface);
229 FIXME("(%p)->(%p)\n", This, pBool);
230 return E_NOTIMPL;
231 }
232
233 static HRESULT WINAPI InternetExplorer_get_Type(IWebBrowser2 *iface, BSTR *Type)
234 {
235 InternetExplorer *This = impl_from_IWebBrowser2(iface);
236 FIXME("(%p)->(%p)\n", This, Type);
237 return E_NOTIMPL;
238 }
239
240 static HRESULT WINAPI InternetExplorer_get_Left(IWebBrowser2 *iface, LONG *pl)
241 {
242 InternetExplorer *This = impl_from_IWebBrowser2(iface);
243 FIXME("(%p)->(%p)\n", This, pl);
244 return E_NOTIMPL;
245 }
246
247 static HRESULT WINAPI InternetExplorer_put_Left(IWebBrowser2 *iface, LONG Left)
248 {
249 InternetExplorer *This = impl_from_IWebBrowser2(iface);
250 FIXME("(%p)->(%d)\n", This, Left);
251 return E_NOTIMPL;
252 }
253
254 static HRESULT WINAPI InternetExplorer_get_Top(IWebBrowser2 *iface, LONG *pl)
255 {
256 InternetExplorer *This = impl_from_IWebBrowser2(iface);
257 FIXME("(%p)->(%p)\n", This, pl);
258 return E_NOTIMPL;
259 }
260
261 static HRESULT WINAPI InternetExplorer_put_Top(IWebBrowser2 *iface, LONG Top)
262 {
263 InternetExplorer *This = impl_from_IWebBrowser2(iface);
264 FIXME("(%p)->(%d)\n", This, Top);
265 return E_NOTIMPL;
266 }
267
268 static HRESULT WINAPI InternetExplorer_get_Width(IWebBrowser2 *iface, LONG *pl)
269 {
270 InternetExplorer *This = impl_from_IWebBrowser2(iface);
271 FIXME("(%p)->(%p)\n", This, pl);
272 return E_NOTIMPL;
273 }
274
275 static HRESULT WINAPI InternetExplorer_put_Width(IWebBrowser2 *iface, LONG Width)
276 {
277 InternetExplorer *This = impl_from_IWebBrowser2(iface);
278 FIXME("(%p)->(%d)\n", This, Width);
279 return E_NOTIMPL;
280 }
281
282 static HRESULT WINAPI InternetExplorer_get_Height(IWebBrowser2 *iface, LONG *pl)
283 {
284 InternetExplorer *This = impl_from_IWebBrowser2(iface);
285 FIXME("(%p)->(%p)\n", This, pl);
286 return E_NOTIMPL;
287 }
288
289 static HRESULT WINAPI InternetExplorer_put_Height(IWebBrowser2 *iface, LONG Height)
290 {
291 InternetExplorer *This = impl_from_IWebBrowser2(iface);
292 FIXME("(%p)->(%d)\n", This, Height);
293 return E_NOTIMPL;
294 }
295
296 static HRESULT WINAPI InternetExplorer_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
297 {
298 InternetExplorer *This = impl_from_IWebBrowser2(iface);
299 FIXME("(%p)->(%p)\n", This, LocationName);
300 return E_NOTIMPL;
301 }
302
303 static HRESULT WINAPI InternetExplorer_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
304 {
305 InternetExplorer *This = impl_from_IWebBrowser2(iface);
306
307 TRACE("(%p)->(%p)\n", This, LocationURL);
308
309 return get_location_url(&This->doc_host, LocationURL);
310 }
311
312 static HRESULT WINAPI InternetExplorer_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
313 {
314 InternetExplorer *This = impl_from_IWebBrowser2(iface);
315 FIXME("(%p)->(%p)\n", This, pBool);
316 return E_NOTIMPL;
317 }
318
319 static HRESULT WINAPI InternetExplorer_Quit(IWebBrowser2 *iface)
320 {
321 InternetExplorer *This = impl_from_IWebBrowser2(iface);
322 FIXME("(%p)\n", This);
323 return E_NOTIMPL;
324 }
325
326 static HRESULT WINAPI InternetExplorer_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
327 {
328 InternetExplorer *This = impl_from_IWebBrowser2(iface);
329 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
330 return E_NOTIMPL;
331 }
332
333 static HRESULT WINAPI InternetExplorer_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
334 {
335 InternetExplorer *This = impl_from_IWebBrowser2(iface);
336 FIXME("(%p)->(%s)\n", This, debugstr_w(szProperty));
337 return E_NOTIMPL;
338 }
339
340 static HRESULT WINAPI InternetExplorer_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
341 {
342 InternetExplorer *This = impl_from_IWebBrowser2(iface);
343 FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
344 return E_NOTIMPL;
345 }
346
347 static HRESULT WINAPI InternetExplorer_get_Name(IWebBrowser2 *iface, BSTR *Name)
348 {
349 InternetExplorer *This = impl_from_IWebBrowser2(iface);
350 FIXME("(%p)->(%p)\n", This, Name);
351 return E_NOTIMPL;
352 }
353
354 static HRESULT WINAPI InternetExplorer_get_HWND(IWebBrowser2 *iface, SHANDLE_PTR *pHWND)
355 {
356 InternetExplorer *This = impl_from_IWebBrowser2(iface);
357
358 TRACE("(%p)->(%p)\n", This, pHWND);
359
360 *pHWND = (SHANDLE_PTR)This->frame_hwnd;
361 return S_OK;
362 }
363
364 static HRESULT WINAPI InternetExplorer_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
365 {
366 InternetExplorer *This = impl_from_IWebBrowser2(iface);
367 FIXME("(%p)->(%p)\n", This, FullName);
368 return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI InternetExplorer_get_Path(IWebBrowser2 *iface, BSTR *Path)
372 {
373 InternetExplorer *This = impl_from_IWebBrowser2(iface);
374 FIXME("(%p)->(%p)\n", This, Path);
375 return E_NOTIMPL;
376 }
377
378 static HRESULT WINAPI InternetExplorer_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
379 {
380 InternetExplorer *This = impl_from_IWebBrowser2(iface);
381
382 TRACE("(%p)->(%p)\n", This, pBool);
383
384 *pBool = IsWindowVisible(This->frame_hwnd) ? VARIANT_TRUE : VARIANT_FALSE;
385 return S_OK;
386 }
387
388 static HRESULT WINAPI InternetExplorer_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
389 {
390 InternetExplorer *This = impl_from_IWebBrowser2(iface);
391 TRACE("(%p)->(%x)\n", This, Value);
392
393 ShowWindow(This->frame_hwnd, Value ? SW_SHOW : SW_HIDE);
394
395 return S_OK;
396 }
397
398 static HRESULT WINAPI InternetExplorer_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
399 {
400 InternetExplorer *This = impl_from_IWebBrowser2(iface);
401 FIXME("(%p)->(%p)\n", This, pBool);
402 return E_NOTIMPL;
403 }
404
405 static HRESULT WINAPI InternetExplorer_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
406 {
407 InternetExplorer *This = impl_from_IWebBrowser2(iface);
408 FIXME("(%p)->(%x)\n", This, Value);
409 return E_NOTIMPL;
410 }
411
412 static HRESULT WINAPI InternetExplorer_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
413 {
414 InternetExplorer *This = impl_from_IWebBrowser2(iface);
415 FIXME("(%p)->(%p)\n", This, StatusText);
416 return E_NOTIMPL;
417 }
418
419 static HRESULT WINAPI InternetExplorer_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
420 {
421 InternetExplorer *This = impl_from_IWebBrowser2(iface);
422
423 TRACE("(%p)->(%s)\n", This, debugstr_w(StatusText));
424
425 return update_ie_statustext(This, StatusText);
426 }
427
428 static HRESULT WINAPI InternetExplorer_get_ToolBar(IWebBrowser2 *iface, int *Value)
429 {
430 InternetExplorer *This = impl_from_IWebBrowser2(iface);
431 FIXME("(%p)->(%p)\n", This, Value);
432 return E_NOTIMPL;
433 }
434
435 static HRESULT WINAPI InternetExplorer_put_ToolBar(IWebBrowser2 *iface, int Value)
436 {
437 InternetExplorer *This = impl_from_IWebBrowser2(iface);
438 FIXME("(%p)->(%d)\n", This, Value);
439 return E_NOTIMPL;
440 }
441
442 static HRESULT WINAPI InternetExplorer_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
443 {
444 InternetExplorer *This = impl_from_IWebBrowser2(iface);
445 FIXME("(%p)->(%p)\n", This, Value);
446 return E_NOTIMPL;
447 }
448
449 static HRESULT WINAPI InternetExplorer_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
450 {
451 InternetExplorer *This = impl_from_IWebBrowser2(iface);
452 HMENU menu = NULL;
453
454 TRACE("(%p)->(%x)\n", This, Value);
455
456 if(Value)
457 menu = This->menu;
458
459 if(!SetMenu(This->frame_hwnd, menu))
460 return HRESULT_FROM_WIN32(GetLastError());
461
462 return S_OK;
463 }
464
465 static HRESULT WINAPI InternetExplorer_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
466 {
467 InternetExplorer *This = impl_from_IWebBrowser2(iface);
468 FIXME("(%p)->(%p)\n", This, pbFullScreen);
469 return E_NOTIMPL;
470 }
471
472 static HRESULT WINAPI InternetExplorer_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
473 {
474 InternetExplorer *This = impl_from_IWebBrowser2(iface);
475 FIXME("(%p)->(%x)\n", This, bFullScreen);
476 return E_NOTIMPL;
477 }
478
479 static HRESULT WINAPI InternetExplorer_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
480 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
481 {
482 InternetExplorer *This = impl_from_IWebBrowser2(iface);
483
484 TRACE("(%p)->(%p %p %p %p %p)\n", This, URL, Flags, TargetFrameName, PostData, Headers);
485
486 if(!URL)
487 return S_OK;
488
489 if(V_VT(URL) != VT_BSTR) {
490 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
491 return E_INVALIDARG;
492 }
493
494 return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
495 }
496
497 static HRESULT WINAPI InternetExplorer_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
498 {
499 InternetExplorer *This = impl_from_IWebBrowser2(iface);
500 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
501 return E_NOTIMPL;
502 }
503
504 static HRESULT WINAPI InternetExplorer_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
505 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
506 {
507 InternetExplorer *This = impl_from_IWebBrowser2(iface);
508 FIXME("(%p)->(%d %d %p %p)\n", This, cmdID, cmdexecopt, pvaIn, pvaOut);
509 return E_NOTIMPL;
510 }
511
512 static HRESULT WINAPI InternetExplorer_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
513 VARIANT *pvarShow, VARIANT *pvarSize)
514 {
515 InternetExplorer *This = impl_from_IWebBrowser2(iface);
516 FIXME("(%p)->(%p %p %p)\n", This, pvaClsid, pvarShow, pvarSize);
517 return E_NOTIMPL;
518 }
519
520 static HRESULT WINAPI InternetExplorer_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
521 {
522 InternetExplorer *This = impl_from_IWebBrowser2(iface);
523 FIXME("(%p)->(%p)\n", This, lpReadyState);
524 return E_NOTIMPL;
525 }
526
527 static HRESULT WINAPI InternetExplorer_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
528 {
529 InternetExplorer *This = impl_from_IWebBrowser2(iface);
530 FIXME("(%p)->(%p)\n", This, pbOffline);
531 return E_NOTIMPL;
532 }
533
534 static HRESULT WINAPI InternetExplorer_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
535 {
536 InternetExplorer *This = impl_from_IWebBrowser2(iface);
537 FIXME("(%p)->(%x)\n", This, bOffline);
538 return E_NOTIMPL;
539 }
540
541 static HRESULT WINAPI InternetExplorer_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
542 {
543 InternetExplorer *This = impl_from_IWebBrowser2(iface);
544 FIXME("(%p)->(%p)\n", This, pbSilent);
545 return E_NOTIMPL;
546 }
547
548 static HRESULT WINAPI InternetExplorer_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
549 {
550 InternetExplorer *This = impl_from_IWebBrowser2(iface);
551 FIXME("(%p)->(%x)\n", This, bSilent);
552 return E_NOTIMPL;
553 }
554
555 static HRESULT WINAPI InternetExplorer_get_RegisterAsBrowser(IWebBrowser2 *iface,
556 VARIANT_BOOL *pbRegister)
557 {
558 InternetExplorer *This = impl_from_IWebBrowser2(iface);
559 FIXME("(%p)->(%p)\n", This, pbRegister);
560 return E_NOTIMPL;
561 }
562
563 static HRESULT WINAPI InternetExplorer_put_RegisterAsBrowser(IWebBrowser2 *iface,
564 VARIANT_BOOL bRegister)
565 {
566 InternetExplorer *This = impl_from_IWebBrowser2(iface);
567 FIXME("(%p)->(%x)\n", This, bRegister);
568 return E_NOTIMPL;
569 }
570
571 static HRESULT WINAPI InternetExplorer_get_RegisterAsDropTarget(IWebBrowser2 *iface,
572 VARIANT_BOOL *pbRegister)
573 {
574 InternetExplorer *This = impl_from_IWebBrowser2(iface);
575 FIXME("(%p)->(%p)\n", This, pbRegister);
576 return E_NOTIMPL;
577 }
578
579 static HRESULT WINAPI InternetExplorer_put_RegisterAsDropTarget(IWebBrowser2 *iface,
580 VARIANT_BOOL bRegister)
581 {
582 InternetExplorer *This = impl_from_IWebBrowser2(iface);
583 FIXME("(%p)->(%x)\n", This, bRegister);
584 return E_NOTIMPL;
585 }
586
587 static HRESULT WINAPI InternetExplorer_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
588 {
589 InternetExplorer *This = impl_from_IWebBrowser2(iface);
590 FIXME("(%p)->(%p)\n", This, pbRegister);
591 return E_NOTIMPL;
592 }
593
594 static HRESULT WINAPI InternetExplorer_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
595 {
596 InternetExplorer *This = impl_from_IWebBrowser2(iface);
597 FIXME("(%p)->(%x)\n", This, bRegister);
598 return E_NOTIMPL;
599 }
600
601 static HRESULT WINAPI InternetExplorer_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
602 {
603 InternetExplorer *This = impl_from_IWebBrowser2(iface);
604 FIXME("(%p)->(%p)\n", This, Value);
605 return E_NOTIMPL;
606 }
607
608 static HRESULT WINAPI InternetExplorer_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
609 {
610 InternetExplorer *This = impl_from_IWebBrowser2(iface);
611 FIXME("(%p)->(%x)\n", This, Value);
612 return E_NOTIMPL;
613 }
614
615 static HRESULT WINAPI InternetExplorer_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
616 {
617 InternetExplorer *This = impl_from_IWebBrowser2(iface);
618 FIXME("(%p)->(%p)\n", This, Value);
619 return E_NOTIMPL;
620 }
621
622 static HRESULT WINAPI InternetExplorer_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
623 {
624 InternetExplorer *This = impl_from_IWebBrowser2(iface);
625 FIXME("(%p)->(%x)\n", This, Value);
626 return E_NOTIMPL;
627 }
628
629 static const IWebBrowser2Vtbl InternetExplorerVtbl =
630 {
631 InternetExplorer_QueryInterface,
632 InternetExplorer_AddRef,
633 InternetExplorer_Release,
634 InternetExplorer_GetTypeInfoCount,
635 InternetExplorer_GetTypeInfo,
636 InternetExplorer_GetIDsOfNames,
637 InternetExplorer_Invoke,
638 InternetExplorer_GoBack,
639 InternetExplorer_GoForward,
640 InternetExplorer_GoHome,
641 InternetExplorer_GoSearch,
642 InternetExplorer_Navigate,
643 InternetExplorer_Refresh,
644 InternetExplorer_Refresh2,
645 InternetExplorer_Stop,
646 InternetExplorer_get_Application,
647 InternetExplorer_get_Parent,
648 InternetExplorer_get_Container,
649 InternetExplorer_get_Document,
650 InternetExplorer_get_TopLevelContainer,
651 InternetExplorer_get_Type,
652 InternetExplorer_get_Left,
653 InternetExplorer_put_Left,
654 InternetExplorer_get_Top,
655 InternetExplorer_put_Top,
656 InternetExplorer_get_Width,
657 InternetExplorer_put_Width,
658 InternetExplorer_get_Height,
659 InternetExplorer_put_Height,
660 InternetExplorer_get_LocationName,
661 InternetExplorer_get_LocationURL,
662 InternetExplorer_get_Busy,
663 InternetExplorer_Quit,
664 InternetExplorer_ClientToWindow,
665 InternetExplorer_PutProperty,
666 InternetExplorer_GetProperty,
667 InternetExplorer_get_Name,
668 InternetExplorer_get_HWND,
669 InternetExplorer_get_FullName,
670 InternetExplorer_get_Path,
671 InternetExplorer_get_Visible,
672 InternetExplorer_put_Visible,
673 InternetExplorer_get_StatusBar,
674 InternetExplorer_put_StatusBar,
675 InternetExplorer_get_StatusText,
676 InternetExplorer_put_StatusText,
677 InternetExplorer_get_ToolBar,
678 InternetExplorer_put_ToolBar,
679 InternetExplorer_get_MenuBar,
680 InternetExplorer_put_MenuBar,
681 InternetExplorer_get_FullScreen,
682 InternetExplorer_put_FullScreen,
683 InternetExplorer_Navigate2,
684 InternetExplorer_QueryStatusWB,
685 InternetExplorer_ExecWB,
686 InternetExplorer_ShowBrowserBar,
687 InternetExplorer_get_ReadyState,
688 InternetExplorer_get_Offline,
689 InternetExplorer_put_Offline,
690 InternetExplorer_get_Silent,
691 InternetExplorer_put_Silent,
692 InternetExplorer_get_RegisterAsBrowser,
693 InternetExplorer_put_RegisterAsBrowser,
694 InternetExplorer_get_RegisterAsDropTarget,
695 InternetExplorer_put_RegisterAsDropTarget,
696 InternetExplorer_get_TheaterMode,
697 InternetExplorer_put_TheaterMode,
698 InternetExplorer_get_AddressBar,
699 InternetExplorer_put_AddressBar,
700 InternetExplorer_get_Resizable,
701 InternetExplorer_put_Resizable
702 };
703
704 static inline InternetExplorer *impl_from_IExternalConnection(IExternalConnection *iface)
705 {
706 return CONTAINING_RECORD(iface, InternetExplorer, IExternalConnection_iface);
707 }
708
709 /*
710 * Document may keep references to InternetExplorer object causing circular references.
711 * We keep track of external references and release the document object when all
712 * external references are released. A visible main window is also considered as
713 * an external reference.
714 */
715 DWORD release_extern_ref(InternetExplorer *This, BOOL last_closes)
716 {
717 LONG ref = InterlockedDecrement(&This->extern_ref);
718
719 TRACE("ref = %d\n", ref);
720
721 if(ref)
722 return ref;
723
724 if(!last_closes) {
725 WARN("Last external connection released with FALSE last_closes.\n");
726 return ref;
727 }
728
729 deactivate_document(&This->doc_host);
730 return ref;
731 }
732
733 static HRESULT WINAPI ExternalConnection_QueryInterface(IExternalConnection *iface, REFIID riid, void **ppv)
734 {
735 InternetExplorer *This = impl_from_IExternalConnection(iface);
736 return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
737 }
738
739 static ULONG WINAPI ExternalConnection_AddRef(IExternalConnection *iface)
740 {
741 InternetExplorer *This = impl_from_IExternalConnection(iface);
742 return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
743 }
744
745 static ULONG WINAPI ExternalConnection_Release(IExternalConnection *iface)
746 {
747 InternetExplorer *This = impl_from_IExternalConnection(iface);
748 return IWebBrowser2_Release(&This->IWebBrowser2_iface);
749 }
750
751 static DWORD WINAPI ExternalConnection_AddConnection(IExternalConnection *iface, DWORD extconn, DWORD reserved)
752 {
753 InternetExplorer *This = impl_from_IExternalConnection(iface);
754
755 TRACE("(%p)->(%x %x)\n", This, extconn, reserved);
756
757 if(extconn != EXTCONN_STRONG)
758 return 0;
759
760 return InterlockedIncrement(&This->extern_ref);
761 }
762
763 static DWORD WINAPI ExternalConnection_ReleaseConnection(IExternalConnection *iface, DWORD extconn,
764 DWORD reserved, BOOL fLastReleaseCloses)
765 {
766 InternetExplorer *This = impl_from_IExternalConnection(iface);
767
768 TRACE("(%p)->(%x %x %x)\n", This, extconn, reserved, fLastReleaseCloses);
769
770 if(extconn != EXTCONN_STRONG)
771 return 0;
772
773 return release_extern_ref(This, fLastReleaseCloses);
774 }
775
776 static const IExternalConnectionVtbl ExternalConnectionVtbl = {
777 ExternalConnection_QueryInterface,
778 ExternalConnection_AddRef,
779 ExternalConnection_Release,
780 ExternalConnection_AddConnection,
781 ExternalConnection_ReleaseConnection
782 };
783
784 static inline InternetExplorer *impl_from_IServiceProvider(IServiceProvider *iface)
785 {
786 return CONTAINING_RECORD(iface, InternetExplorer, IServiceProvider_iface);
787 }
788
789 static HRESULT WINAPI IEServiceProvider_QueryInterface(IServiceProvider *iface,
790 REFIID riid, LPVOID *ppv)
791 {
792 InternetExplorer *This = impl_from_IServiceProvider(iface);
793 return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
794 }
795
796 static ULONG WINAPI IEServiceProvider_AddRef(IServiceProvider *iface)
797 {
798 InternetExplorer *This = impl_from_IServiceProvider(iface);
799 return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
800 }
801
802 static ULONG WINAPI IEServiceProvider_Release(IServiceProvider *iface)
803 {
804 InternetExplorer *This = impl_from_IServiceProvider(iface);
805 return IWebBrowser2_Release(&This->IWebBrowser2_iface);
806 }
807
808 static HRESULT WINAPI IEServiceProvider_QueryService(IServiceProvider *iface,
809 REFGUID guidService, REFIID riid, void **ppv)
810 {
811 InternetExplorer *This = impl_from_IServiceProvider(iface);
812
813 if(IsEqualGUID(&SID_SHTMLWindow, riid)) {
814 TRACE("(%p)->(SID_SHTMLWindow)\n", This);
815 return IHTMLWindow2_QueryInterface(&This->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
816 }
817
818 FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
819 *ppv = NULL;
820 return E_NOINTERFACE;
821 }
822
823 static const IServiceProviderVtbl ServiceProviderVtbl =
824 {
825 IEServiceProvider_QueryInterface,
826 IEServiceProvider_AddRef,
827 IEServiceProvider_Release,
828 IEServiceProvider_QueryService
829 };
830
831 void InternetExplorer_WebBrowser_Init(InternetExplorer *This)
832 {
833 This->IWebBrowser2_iface.lpVtbl = &InternetExplorerVtbl;
834 This->IExternalConnection_iface.lpVtbl = &ExternalConnectionVtbl;
835 This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
836 }