windows.applicationmodel/tests: Use PathRemoveFileSpecW() instead of PathCchRemoveFil...
[wine.git] / dlls / ieframe / ie.c
blobe44178f3aaa6f6dcd06c102ec98a7756468c416b
1 /*
2 * Copyright 2006 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
19 #include "ieframe.h"
21 #include "wine/debug.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(ieframe);
25 static inline InternetExplorer *impl_from_IWebBrowser2(IWebBrowser2 *iface)
27 return CONTAINING_RECORD(iface, InternetExplorer, IWebBrowser2_iface);
30 static HRESULT WINAPI InternetExplorer_QueryInterface(IWebBrowser2 *iface, REFIID riid, LPVOID *ppv)
32 InternetExplorer *This = impl_from_IWebBrowser2(iface);
34 *ppv = NULL;
36 if(IsEqualGUID(&IID_IUnknown, riid)) {
37 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
38 *ppv = &This->IWebBrowser2_iface;
39 }else if(IsEqualGUID(&IID_IDispatch, riid)) {
40 TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
41 *ppv = &This->IWebBrowser2_iface;
42 }else if(IsEqualGUID(&IID_IWebBrowser, riid)) {
43 TRACE("(%p)->(IID_IWebBrowser %p)\n", This, ppv);
44 *ppv = &This->IWebBrowser2_iface;
45 }else if(IsEqualGUID(&IID_IWebBrowserApp, riid)) {
46 TRACE("(%p)->(IID_IWebBrowserApp %p)\n", This, ppv);
47 *ppv = &This->IWebBrowser2_iface;
48 }else if(IsEqualGUID(&IID_IWebBrowser2, riid)) {
49 TRACE("(%p)->(IID_IWebBrowser2 %p)\n", This, ppv);
50 *ppv = &This->IWebBrowser2_iface;
51 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
52 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
53 *ppv = &This->doc_host.cps.IConnectionPointContainer_iface;
54 }else if(IsEqualGUID(&IID_IExternalConnection, riid)) {
55 TRACE("(%p)->(IID_IExternalConnection %p)\n", This, ppv);
56 *ppv = &This->IExternalConnection_iface;
57 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
58 TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
59 *ppv = &This->IServiceProvider_iface;
60 }else if(HlinkFrame_QI(&This->hlink_frame, riid, ppv)) {
61 return S_OK;
64 if(*ppv) {
65 IUnknown_AddRef((IUnknown*)*ppv);
66 return S_OK;
69 WARN("(%p)->(%s %p) interface not supported\n", This, debugstr_guid(riid), ppv);
70 return E_NOINTERFACE;
73 static ULONG WINAPI InternetExplorer_AddRef(IWebBrowser2 *iface)
75 InternetExplorer *This = impl_from_IWebBrowser2(iface);
76 LONG ref = InterlockedIncrement(&This->ref);
77 TRACE("(%p) ref=%ld\n", This, ref);
78 return ref;
81 static ULONG WINAPI InternetExplorer_Release(IWebBrowser2 *iface)
83 InternetExplorer *This = impl_from_IWebBrowser2(iface);
84 LONG ref = InterlockedDecrement(&This->ref);
86 TRACE("(%p) ref=%ld\n", This, ref);
88 if(!ref) {
89 deactivate_document(&This->doc_host);
90 DocHost_Release(&This->doc_host);
92 if(This->frame_hwnd)
93 DestroyWindow(This->frame_hwnd);
94 list_remove(&This->entry);
95 free(This);
97 released_obj();
100 return ref;
103 static HRESULT WINAPI InternetExplorer_GetTypeInfoCount(IWebBrowser2 *iface, UINT *pctinfo)
105 InternetExplorer *This = impl_from_IWebBrowser2(iface);
107 TRACE("(%p)->(%p)\n", This, pctinfo);
109 *pctinfo = 1;
110 return S_OK;
113 static HRESULT WINAPI InternetExplorer_GetTypeInfo(IWebBrowser2 *iface, UINT iTInfo, LCID lcid,
114 LPTYPEINFO *ppTInfo)
116 InternetExplorer *This = impl_from_IWebBrowser2(iface);
117 ITypeInfo *typeinfo;
118 HRESULT hres;
120 TRACE("(%p)->(%d %ld %p)\n", This, iTInfo, lcid, ppTInfo);
122 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
123 if(FAILED(hres))
124 return hres;
126 ITypeInfo_AddRef(typeinfo);
127 *ppTInfo = typeinfo;
128 return S_OK;
131 static HRESULT WINAPI InternetExplorer_GetIDsOfNames(IWebBrowser2 *iface, REFIID riid,
132 LPOLESTR *rgszNames, UINT cNames,
133 LCID lcid, DISPID *rgDispId)
135 InternetExplorer *This = impl_from_IWebBrowser2(iface);
136 ITypeInfo *typeinfo;
137 HRESULT hres;
139 TRACE("(%p)->(%s %p %d %ld %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
140 lcid, rgDispId);
142 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
143 if(FAILED(hres))
144 return hres;
146 return ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
149 static HRESULT WINAPI InternetExplorer_Invoke(IWebBrowser2 *iface, DISPID dispIdMember,
150 REFIID riid, LCID lcid, WORD wFlags,
151 DISPPARAMS *pDispParams, VARIANT *pVarResult,
152 EXCEPINFO *pExepInfo, UINT *puArgErr)
154 InternetExplorer *This = impl_from_IWebBrowser2(iface);
155 ITypeInfo *typeinfo;
156 HRESULT hres;
158 TRACE("(%p)->(%ld %s %ld %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
159 lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
161 hres = get_typeinfo(IWebBrowser2_tid, &typeinfo);
162 if(FAILED(hres))
163 return hres;
165 return ITypeInfo_Invoke(typeinfo, &This->IWebBrowser2_iface, dispIdMember, wFlags, pDispParams,
166 pVarResult, pExepInfo, puArgErr);
169 static HRESULT WINAPI InternetExplorer_GoBack(IWebBrowser2 *iface)
171 InternetExplorer *This = impl_from_IWebBrowser2(iface);
172 TRACE("(%p)\n", This);
173 return go_back(&This->doc_host);
176 static HRESULT WINAPI InternetExplorer_GoForward(IWebBrowser2 *iface)
178 InternetExplorer *This = impl_from_IWebBrowser2(iface);
179 TRACE("(%p)\n", This);
180 return go_forward(&This->doc_host);
183 static HRESULT WINAPI InternetExplorer_GoHome(IWebBrowser2 *iface)
185 InternetExplorer *This = impl_from_IWebBrowser2(iface);
186 TRACE("(%p)\n", This);
187 return go_home(&This->doc_host);
190 static HRESULT WINAPI InternetExplorer_GoSearch(IWebBrowser2 *iface)
192 InternetExplorer *This = impl_from_IWebBrowser2(iface);
193 FIXME("(%p)\n", This);
194 return E_NOTIMPL;
197 static HRESULT WINAPI InternetExplorer_Navigate(IWebBrowser2 *iface, BSTR szUrl,
198 VARIANT *Flags, VARIANT *TargetFrameName,
199 VARIANT *PostData, VARIANT *Headers)
201 InternetExplorer *This = impl_from_IWebBrowser2(iface);
203 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(szUrl), debugstr_variant(Flags),
204 debugstr_variant(TargetFrameName), debugstr_variant(PostData), debugstr_variant(Headers));
206 return navigate_url(&This->doc_host, szUrl, Flags, TargetFrameName, PostData, Headers);
209 static HRESULT WINAPI InternetExplorer_Refresh(IWebBrowser2 *iface)
211 InternetExplorer *This = impl_from_IWebBrowser2(iface);
213 TRACE("(%p)\n", This);
215 return refresh_document(&This->doc_host, NULL);
218 static HRESULT WINAPI InternetExplorer_Refresh2(IWebBrowser2 *iface, VARIANT *Level)
220 InternetExplorer *This = impl_from_IWebBrowser2(iface);
222 TRACE("(%p)->(%s)\n", This, debugstr_variant(Level));
224 return refresh_document(&This->doc_host, Level);
227 static HRESULT WINAPI InternetExplorer_Stop(IWebBrowser2 *iface)
229 InternetExplorer *This = impl_from_IWebBrowser2(iface);
230 FIXME("(%p)\n", This);
231 return E_NOTIMPL;
234 static HRESULT WINAPI InternetExplorer_get_Application(IWebBrowser2 *iface, IDispatch **ppDisp)
236 InternetExplorer *This = impl_from_IWebBrowser2(iface);
237 FIXME("(%p)->(%p)\n", This, ppDisp);
238 return E_NOTIMPL;
241 static HRESULT WINAPI InternetExplorer_get_Parent(IWebBrowser2 *iface, IDispatch **ppDisp)
243 InternetExplorer *This = impl_from_IWebBrowser2(iface);
244 FIXME("(%p)->(%p)\n", This, ppDisp);
245 return E_NOTIMPL;
248 static HRESULT WINAPI InternetExplorer_get_Container(IWebBrowser2 *iface, IDispatch **ppDisp)
250 InternetExplorer *This = impl_from_IWebBrowser2(iface);
251 FIXME("(%p)->(%p)\n", This, ppDisp);
252 return E_NOTIMPL;
255 static HRESULT WINAPI InternetExplorer_get_Document(IWebBrowser2 *iface, IDispatch **ppDisp)
257 InternetExplorer *This = impl_from_IWebBrowser2(iface);
258 FIXME("(%p)->(%p)\n", This, ppDisp);
259 return E_NOTIMPL;
262 static HRESULT WINAPI InternetExplorer_get_TopLevelContainer(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
264 InternetExplorer *This = impl_from_IWebBrowser2(iface);
265 FIXME("(%p)->(%p)\n", This, pBool);
266 return E_NOTIMPL;
269 static HRESULT WINAPI InternetExplorer_get_Type(IWebBrowser2 *iface, BSTR *Type)
271 InternetExplorer *This = impl_from_IWebBrowser2(iface);
272 FIXME("(%p)->(%p)\n", This, Type);
273 return E_NOTIMPL;
276 static HRESULT WINAPI InternetExplorer_get_Left(IWebBrowser2 *iface, LONG *pl)
278 InternetExplorer *This = impl_from_IWebBrowser2(iface);
279 FIXME("(%p)->(%p)\n", This, pl);
280 return E_NOTIMPL;
283 static HRESULT WINAPI InternetExplorer_put_Left(IWebBrowser2 *iface, LONG Left)
285 InternetExplorer *This = impl_from_IWebBrowser2(iface);
286 FIXME("(%p)->(%ld)\n", This, Left);
287 return E_NOTIMPL;
290 static HRESULT WINAPI InternetExplorer_get_Top(IWebBrowser2 *iface, LONG *pl)
292 InternetExplorer *This = impl_from_IWebBrowser2(iface);
293 FIXME("(%p)->(%p)\n", This, pl);
294 return E_NOTIMPL;
297 static HRESULT WINAPI InternetExplorer_put_Top(IWebBrowser2 *iface, LONG Top)
299 InternetExplorer *This = impl_from_IWebBrowser2(iface);
300 FIXME("(%p)->(%ld)\n", This, Top);
301 return E_NOTIMPL;
304 static HRESULT WINAPI InternetExplorer_get_Width(IWebBrowser2 *iface, LONG *pl)
306 InternetExplorer *This = impl_from_IWebBrowser2(iface);
307 FIXME("(%p)->(%p)\n", This, pl);
308 return E_NOTIMPL;
311 static HRESULT WINAPI InternetExplorer_put_Width(IWebBrowser2 *iface, LONG Width)
313 InternetExplorer *This = impl_from_IWebBrowser2(iface);
314 FIXME("(%p)->(%ld)\n", This, Width);
315 return E_NOTIMPL;
318 static HRESULT WINAPI InternetExplorer_get_Height(IWebBrowser2 *iface, LONG *pl)
320 InternetExplorer *This = impl_from_IWebBrowser2(iface);
321 FIXME("(%p)->(%p)\n", This, pl);
322 return E_NOTIMPL;
325 static HRESULT WINAPI InternetExplorer_put_Height(IWebBrowser2 *iface, LONG Height)
327 InternetExplorer *This = impl_from_IWebBrowser2(iface);
328 FIXME("(%p)->(%ld)\n", This, Height);
329 return E_NOTIMPL;
332 static HRESULT WINAPI InternetExplorer_get_LocationName(IWebBrowser2 *iface, BSTR *LocationName)
334 InternetExplorer *This = impl_from_IWebBrowser2(iface);
335 FIXME("(%p)->(%p)\n", This, LocationName);
336 return E_NOTIMPL;
339 static HRESULT WINAPI InternetExplorer_get_LocationURL(IWebBrowser2 *iface, BSTR *LocationURL)
341 InternetExplorer *This = impl_from_IWebBrowser2(iface);
343 TRACE("(%p)->(%p)\n", This, LocationURL);
345 return get_location_url(&This->doc_host, LocationURL);
348 static HRESULT WINAPI InternetExplorer_get_Busy(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
350 InternetExplorer *This = impl_from_IWebBrowser2(iface);
352 TRACE("(%p)->(%p)\n", This, pBool);
354 *pBool = This->doc_host.busy;
355 return S_OK;
358 static HRESULT WINAPI InternetExplorer_Quit(IWebBrowser2 *iface)
360 InternetExplorer *This = impl_from_IWebBrowser2(iface);
361 FIXME("(%p)\n", This);
362 return E_NOTIMPL;
365 static HRESULT WINAPI InternetExplorer_ClientToWindow(IWebBrowser2 *iface, int *pcx, int *pcy)
367 InternetExplorer *This = impl_from_IWebBrowser2(iface);
368 FIXME("(%p)->(%p %p)\n", This, pcx, pcy);
369 return E_NOTIMPL;
372 static HRESULT WINAPI InternetExplorer_PutProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT vtValue)
374 InternetExplorer *This = impl_from_IWebBrowser2(iface);
375 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szProperty), debugstr_variant(&vtValue));
376 return E_NOTIMPL;
379 static HRESULT WINAPI InternetExplorer_GetProperty(IWebBrowser2 *iface, BSTR szProperty, VARIANT *pvtValue)
381 InternetExplorer *This = impl_from_IWebBrowser2(iface);
382 FIXME("(%p)->(%s %p)\n", This, debugstr_w(szProperty), pvtValue);
383 return E_NOTIMPL;
386 static HRESULT WINAPI InternetExplorer_get_Name(IWebBrowser2 *iface, BSTR *Name)
388 InternetExplorer *This = impl_from_IWebBrowser2(iface);
389 FIXME("(%p)->(%p)\n", This, Name);
390 return E_NOTIMPL;
393 static HRESULT WINAPI InternetExplorer_get_HWND(IWebBrowser2 *iface, SHANDLE_PTR *pHWND)
395 InternetExplorer *This = impl_from_IWebBrowser2(iface);
397 TRACE("(%p)->(%p)\n", This, pHWND);
399 *pHWND = (SHANDLE_PTR)This->frame_hwnd;
400 return S_OK;
403 static HRESULT WINAPI InternetExplorer_get_FullName(IWebBrowser2 *iface, BSTR *FullName)
405 InternetExplorer *This = impl_from_IWebBrowser2(iface);
406 FIXME("(%p)->(%p)\n", This, FullName);
407 return E_NOTIMPL;
410 static HRESULT WINAPI InternetExplorer_get_Path(IWebBrowser2 *iface, BSTR *Path)
412 InternetExplorer *This = impl_from_IWebBrowser2(iface);
413 FIXME("(%p)->(%p)\n", This, Path);
414 return E_NOTIMPL;
417 static HRESULT WINAPI InternetExplorer_get_Visible(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
419 InternetExplorer *This = impl_from_IWebBrowser2(iface);
421 TRACE("(%p)->(%p)\n", This, pBool);
423 *pBool = IsWindowVisible(This->frame_hwnd) ? VARIANT_TRUE : VARIANT_FALSE;
424 return S_OK;
427 static HRESULT WINAPI InternetExplorer_put_Visible(IWebBrowser2 *iface, VARIANT_BOOL Value)
429 InternetExplorer *This = impl_from_IWebBrowser2(iface);
430 TRACE("(%p)->(%x)\n", This, Value);
432 ShowWindow(This->frame_hwnd, Value ? SW_SHOW : SW_HIDE);
434 return S_OK;
437 static HRESULT WINAPI InternetExplorer_get_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL *pBool)
439 InternetExplorer *This = impl_from_IWebBrowser2(iface);
440 FIXME("(%p)->(%p)\n", This, pBool);
441 return E_NOTIMPL;
444 static HRESULT WINAPI InternetExplorer_put_StatusBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
446 InternetExplorer *This = impl_from_IWebBrowser2(iface);
447 FIXME("(%p)->(%x)\n", This, Value);
448 return E_NOTIMPL;
451 static HRESULT WINAPI InternetExplorer_get_StatusText(IWebBrowser2 *iface, BSTR *StatusText)
453 InternetExplorer *This = impl_from_IWebBrowser2(iface);
454 FIXME("(%p)->(%p)\n", This, StatusText);
455 return E_NOTIMPL;
458 static HRESULT WINAPI InternetExplorer_put_StatusText(IWebBrowser2 *iface, BSTR StatusText)
460 InternetExplorer *This = impl_from_IWebBrowser2(iface);
462 TRACE("(%p)->(%s)\n", This, debugstr_w(StatusText));
464 return update_ie_statustext(This, StatusText);
467 static HRESULT WINAPI InternetExplorer_get_ToolBar(IWebBrowser2 *iface, int *Value)
469 InternetExplorer *This = impl_from_IWebBrowser2(iface);
470 FIXME("(%p)->(%p)\n", This, Value);
471 return E_NOTIMPL;
474 static HRESULT WINAPI InternetExplorer_put_ToolBar(IWebBrowser2 *iface, int Value)
476 InternetExplorer *This = impl_from_IWebBrowser2(iface);
477 FIXME("(%p)->(%d)\n", This, Value);
478 return E_NOTIMPL;
481 static HRESULT WINAPI InternetExplorer_get_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
483 InternetExplorer *This = impl_from_IWebBrowser2(iface);
484 FIXME("(%p)->(%p)\n", This, Value);
485 return E_NOTIMPL;
488 static HRESULT WINAPI InternetExplorer_put_MenuBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
490 InternetExplorer *This = impl_from_IWebBrowser2(iface);
491 HMENU menu = NULL;
493 TRACE("(%p)->(%x)\n", This, Value);
495 if(Value)
496 menu = This->menu;
498 if(!SetMenu(This->frame_hwnd, menu))
499 return HRESULT_FROM_WIN32(GetLastError());
501 return S_OK;
504 static HRESULT WINAPI InternetExplorer_get_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL *pbFullScreen)
506 InternetExplorer *This = impl_from_IWebBrowser2(iface);
507 FIXME("(%p)->(%p)\n", This, pbFullScreen);
508 return E_NOTIMPL;
511 static HRESULT WINAPI InternetExplorer_put_FullScreen(IWebBrowser2 *iface, VARIANT_BOOL bFullScreen)
513 InternetExplorer *This = impl_from_IWebBrowser2(iface);
514 FIXME("(%p)->(%x)\n", This, bFullScreen);
515 return E_NOTIMPL;
518 static HRESULT WINAPI InternetExplorer_Navigate2(IWebBrowser2 *iface, VARIANT *URL, VARIANT *Flags,
519 VARIANT *TargetFrameName, VARIANT *PostData, VARIANT *Headers)
521 InternetExplorer *This = impl_from_IWebBrowser2(iface);
523 TRACE("(%p)->(%s %s %s %s %s)\n", This, debugstr_variant(URL), debugstr_variant(Flags),
524 debugstr_variant(TargetFrameName), debugstr_variant(PostData), debugstr_variant(Headers));
526 if(!URL)
527 return S_OK;
529 if(V_VT(URL) != VT_BSTR) {
530 FIXME("Unsupported V_VT(URL) %d\n", V_VT(URL));
531 return E_INVALIDARG;
534 return navigate_url(&This->doc_host, V_BSTR(URL), Flags, TargetFrameName, PostData, Headers);
537 static HRESULT WINAPI InternetExplorer_QueryStatusWB(IWebBrowser2 *iface, OLECMDID cmdID, OLECMDF *pcmdf)
539 InternetExplorer *This = impl_from_IWebBrowser2(iface);
540 FIXME("(%p)->(%d %p)\n", This, cmdID, pcmdf);
541 return E_NOTIMPL;
544 static HRESULT WINAPI InternetExplorer_ExecWB(IWebBrowser2 *iface, OLECMDID cmdID,
545 OLECMDEXECOPT cmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut)
547 InternetExplorer *This = impl_from_IWebBrowser2(iface);
548 FIXME("(%p)->(%d %d %s %p)\n", This, cmdID, cmdexecopt, debugstr_variant(pvaIn), pvaOut);
549 return E_NOTIMPL;
552 static HRESULT WINAPI InternetExplorer_ShowBrowserBar(IWebBrowser2 *iface, VARIANT *pvaClsid,
553 VARIANT *pvarShow, VARIANT *pvarSize)
555 InternetExplorer *This = impl_from_IWebBrowser2(iface);
556 FIXME("(%p)->(%s %s %s)\n", This, debugstr_variant(pvaClsid), debugstr_variant(pvarShow),
557 debugstr_variant(pvarSize));
558 return E_NOTIMPL;
561 static HRESULT WINAPI InternetExplorer_get_ReadyState(IWebBrowser2 *iface, READYSTATE *lpReadyState)
563 InternetExplorer *This = impl_from_IWebBrowser2(iface);
564 FIXME("(%p)->(%p)\n", This, lpReadyState);
565 return E_NOTIMPL;
568 static HRESULT WINAPI InternetExplorer_get_Offline(IWebBrowser2 *iface, VARIANT_BOOL *pbOffline)
570 InternetExplorer *This = impl_from_IWebBrowser2(iface);
571 FIXME("(%p)->(%p)\n", This, pbOffline);
572 return E_NOTIMPL;
575 static HRESULT WINAPI InternetExplorer_put_Offline(IWebBrowser2 *iface, VARIANT_BOOL bOffline)
577 InternetExplorer *This = impl_from_IWebBrowser2(iface);
578 FIXME("(%p)->(%x)\n", This, bOffline);
579 return E_NOTIMPL;
582 static HRESULT WINAPI InternetExplorer_get_Silent(IWebBrowser2 *iface, VARIANT_BOOL *pbSilent)
584 InternetExplorer *This = impl_from_IWebBrowser2(iface);
585 FIXME("(%p)->(%p)\n", This, pbSilent);
586 return E_NOTIMPL;
589 static HRESULT WINAPI InternetExplorer_put_Silent(IWebBrowser2 *iface, VARIANT_BOOL bSilent)
591 InternetExplorer *This = impl_from_IWebBrowser2(iface);
592 FIXME("(%p)->(%x)\n", This, bSilent);
593 return E_NOTIMPL;
596 static HRESULT WINAPI InternetExplorer_get_RegisterAsBrowser(IWebBrowser2 *iface,
597 VARIANT_BOOL *pbRegister)
599 InternetExplorer *This = impl_from_IWebBrowser2(iface);
600 FIXME("(%p)->(%p)\n", This, pbRegister);
601 return E_NOTIMPL;
604 static HRESULT WINAPI InternetExplorer_put_RegisterAsBrowser(IWebBrowser2 *iface,
605 VARIANT_BOOL bRegister)
607 InternetExplorer *This = impl_from_IWebBrowser2(iface);
608 FIXME("(%p)->(%x)\n", This, bRegister);
609 return E_NOTIMPL;
612 static HRESULT WINAPI InternetExplorer_get_RegisterAsDropTarget(IWebBrowser2 *iface,
613 VARIANT_BOOL *pbRegister)
615 InternetExplorer *This = impl_from_IWebBrowser2(iface);
616 FIXME("(%p)->(%p)\n", This, pbRegister);
617 return E_NOTIMPL;
620 static HRESULT WINAPI InternetExplorer_put_RegisterAsDropTarget(IWebBrowser2 *iface,
621 VARIANT_BOOL bRegister)
623 InternetExplorer *This = impl_from_IWebBrowser2(iface);
624 FIXME("(%p)->(%x)\n", This, bRegister);
625 return E_NOTIMPL;
628 static HRESULT WINAPI InternetExplorer_get_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL *pbRegister)
630 InternetExplorer *This = impl_from_IWebBrowser2(iface);
631 FIXME("(%p)->(%p)\n", This, pbRegister);
632 return E_NOTIMPL;
635 static HRESULT WINAPI InternetExplorer_put_TheaterMode(IWebBrowser2 *iface, VARIANT_BOOL bRegister)
637 InternetExplorer *This = impl_from_IWebBrowser2(iface);
638 FIXME("(%p)->(%x)\n", This, bRegister);
639 return E_NOTIMPL;
642 static HRESULT WINAPI InternetExplorer_get_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL *Value)
644 InternetExplorer *This = impl_from_IWebBrowser2(iface);
645 FIXME("(%p)->(%p)\n", This, Value);
646 return E_NOTIMPL;
649 static HRESULT WINAPI InternetExplorer_put_AddressBar(IWebBrowser2 *iface, VARIANT_BOOL Value)
651 InternetExplorer *This = impl_from_IWebBrowser2(iface);
652 FIXME("(%p)->(%x)\n", This, Value);
653 return E_NOTIMPL;
656 static HRESULT WINAPI InternetExplorer_get_Resizable(IWebBrowser2 *iface, VARIANT_BOOL *Value)
658 InternetExplorer *This = impl_from_IWebBrowser2(iface);
659 FIXME("(%p)->(%p)\n", This, Value);
660 return E_NOTIMPL;
663 static HRESULT WINAPI InternetExplorer_put_Resizable(IWebBrowser2 *iface, VARIANT_BOOL Value)
665 InternetExplorer *This = impl_from_IWebBrowser2(iface);
666 FIXME("(%p)->(%x)\n", This, Value);
667 return E_NOTIMPL;
670 static const IWebBrowser2Vtbl InternetExplorerVtbl =
672 InternetExplorer_QueryInterface,
673 InternetExplorer_AddRef,
674 InternetExplorer_Release,
675 InternetExplorer_GetTypeInfoCount,
676 InternetExplorer_GetTypeInfo,
677 InternetExplorer_GetIDsOfNames,
678 InternetExplorer_Invoke,
679 InternetExplorer_GoBack,
680 InternetExplorer_GoForward,
681 InternetExplorer_GoHome,
682 InternetExplorer_GoSearch,
683 InternetExplorer_Navigate,
684 InternetExplorer_Refresh,
685 InternetExplorer_Refresh2,
686 InternetExplorer_Stop,
687 InternetExplorer_get_Application,
688 InternetExplorer_get_Parent,
689 InternetExplorer_get_Container,
690 InternetExplorer_get_Document,
691 InternetExplorer_get_TopLevelContainer,
692 InternetExplorer_get_Type,
693 InternetExplorer_get_Left,
694 InternetExplorer_put_Left,
695 InternetExplorer_get_Top,
696 InternetExplorer_put_Top,
697 InternetExplorer_get_Width,
698 InternetExplorer_put_Width,
699 InternetExplorer_get_Height,
700 InternetExplorer_put_Height,
701 InternetExplorer_get_LocationName,
702 InternetExplorer_get_LocationURL,
703 InternetExplorer_get_Busy,
704 InternetExplorer_Quit,
705 InternetExplorer_ClientToWindow,
706 InternetExplorer_PutProperty,
707 InternetExplorer_GetProperty,
708 InternetExplorer_get_Name,
709 InternetExplorer_get_HWND,
710 InternetExplorer_get_FullName,
711 InternetExplorer_get_Path,
712 InternetExplorer_get_Visible,
713 InternetExplorer_put_Visible,
714 InternetExplorer_get_StatusBar,
715 InternetExplorer_put_StatusBar,
716 InternetExplorer_get_StatusText,
717 InternetExplorer_put_StatusText,
718 InternetExplorer_get_ToolBar,
719 InternetExplorer_put_ToolBar,
720 InternetExplorer_get_MenuBar,
721 InternetExplorer_put_MenuBar,
722 InternetExplorer_get_FullScreen,
723 InternetExplorer_put_FullScreen,
724 InternetExplorer_Navigate2,
725 InternetExplorer_QueryStatusWB,
726 InternetExplorer_ExecWB,
727 InternetExplorer_ShowBrowserBar,
728 InternetExplorer_get_ReadyState,
729 InternetExplorer_get_Offline,
730 InternetExplorer_put_Offline,
731 InternetExplorer_get_Silent,
732 InternetExplorer_put_Silent,
733 InternetExplorer_get_RegisterAsBrowser,
734 InternetExplorer_put_RegisterAsBrowser,
735 InternetExplorer_get_RegisterAsDropTarget,
736 InternetExplorer_put_RegisterAsDropTarget,
737 InternetExplorer_get_TheaterMode,
738 InternetExplorer_put_TheaterMode,
739 InternetExplorer_get_AddressBar,
740 InternetExplorer_put_AddressBar,
741 InternetExplorer_get_Resizable,
742 InternetExplorer_put_Resizable
745 static inline InternetExplorer *impl_from_IExternalConnection(IExternalConnection *iface)
747 return CONTAINING_RECORD(iface, InternetExplorer, IExternalConnection_iface);
751 * Document may keep references to InternetExplorer object causing circular references.
752 * We keep track of external references and release the document object when all
753 * external references are released. A visible main window is also considered as
754 * an external reference.
756 DWORD release_extern_ref(InternetExplorer *This, BOOL last_closes)
758 LONG ref = InterlockedDecrement(&This->extern_ref);
760 TRACE("ref = %ld\n", ref);
762 if(ref)
763 return ref;
765 if(!last_closes) {
766 WARN("Last external connection released with FALSE last_closes.\n");
767 return ref;
770 deactivate_document(&This->doc_host);
771 return ref;
774 static HRESULT WINAPI ExternalConnection_QueryInterface(IExternalConnection *iface, REFIID riid, void **ppv)
776 InternetExplorer *This = impl_from_IExternalConnection(iface);
777 return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
780 static ULONG WINAPI ExternalConnection_AddRef(IExternalConnection *iface)
782 InternetExplorer *This = impl_from_IExternalConnection(iface);
783 return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
786 static ULONG WINAPI ExternalConnection_Release(IExternalConnection *iface)
788 InternetExplorer *This = impl_from_IExternalConnection(iface);
789 return IWebBrowser2_Release(&This->IWebBrowser2_iface);
792 static DWORD WINAPI ExternalConnection_AddConnection(IExternalConnection *iface, DWORD extconn, DWORD reserved)
794 InternetExplorer *This = impl_from_IExternalConnection(iface);
796 TRACE("(%p)->(%lx %lx)\n", This, extconn, reserved);
798 if(extconn != EXTCONN_STRONG)
799 return 0;
801 return InterlockedIncrement(&This->extern_ref);
804 static DWORD WINAPI ExternalConnection_ReleaseConnection(IExternalConnection *iface, DWORD extconn,
805 DWORD reserved, BOOL fLastReleaseCloses)
807 InternetExplorer *This = impl_from_IExternalConnection(iface);
809 TRACE("(%p)->(%lx %lx %x)\n", This, extconn, reserved, fLastReleaseCloses);
811 if(extconn != EXTCONN_STRONG)
812 return 0;
814 return release_extern_ref(This, fLastReleaseCloses);
817 static const IExternalConnectionVtbl ExternalConnectionVtbl = {
818 ExternalConnection_QueryInterface,
819 ExternalConnection_AddRef,
820 ExternalConnection_Release,
821 ExternalConnection_AddConnection,
822 ExternalConnection_ReleaseConnection
825 static inline InternetExplorer *impl_from_IServiceProvider(IServiceProvider *iface)
827 return CONTAINING_RECORD(iface, InternetExplorer, IServiceProvider_iface);
830 static HRESULT WINAPI IEServiceProvider_QueryInterface(IServiceProvider *iface,
831 REFIID riid, LPVOID *ppv)
833 InternetExplorer *This = impl_from_IServiceProvider(iface);
834 return IWebBrowser2_QueryInterface(&This->IWebBrowser2_iface, riid, ppv);
837 static ULONG WINAPI IEServiceProvider_AddRef(IServiceProvider *iface)
839 InternetExplorer *This = impl_from_IServiceProvider(iface);
840 return IWebBrowser2_AddRef(&This->IWebBrowser2_iface);
843 static ULONG WINAPI IEServiceProvider_Release(IServiceProvider *iface)
845 InternetExplorer *This = impl_from_IServiceProvider(iface);
846 return IWebBrowser2_Release(&This->IWebBrowser2_iface);
849 static HRESULT WINAPI IEServiceProvider_QueryService(IServiceProvider *iface,
850 REFGUID guidService, REFIID riid, void **ppv)
852 InternetExplorer *This = impl_from_IServiceProvider(iface);
854 if(IsEqualGUID(&SID_SHTMLWindow, riid)) {
855 TRACE("(%p)->(SID_SHTMLWindow)\n", This);
856 return IHTMLWindow2_QueryInterface(&This->doc_host.html_window.IHTMLWindow2_iface, riid, ppv);
859 FIXME("(%p)->(%s, %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
860 *ppv = NULL;
861 return E_NOINTERFACE;
864 static const IServiceProviderVtbl ServiceProviderVtbl =
866 IEServiceProvider_QueryInterface,
867 IEServiceProvider_AddRef,
868 IEServiceProvider_Release,
869 IEServiceProvider_QueryService
872 void InternetExplorer_WebBrowser_Init(InternetExplorer *This)
874 This->IWebBrowser2_iface.lpVtbl = &InternetExplorerVtbl;
875 This->IExternalConnection_iface.lpVtbl = &ExternalConnectionVtbl;
876 This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;