2 * Copyright 2010 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
32 #include "mshtml_private.h"
33 #include "pluginhost.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
39 const IID IID_HTMLPluginContainer
=
40 {0xbd7a6050,0xb373,0x4f6f,{0xa4,0x93,0xdd,0x40,0xc5,0x23,0xa8,0x6a}};
42 static BOOL
check_load_safety(PluginHost
*host
)
44 DWORD policy_size
, policy
;
45 struct CONFIRMSAFETY cs
;
49 cs
.clsid
= host
->clsid
;
50 cs
.pUnk
= host
->plugin_unk
;
51 cs
.dwFlags
= CONFIRMSAFETYACTION_LOADOBJECT
;
53 hres
= IInternetHostSecurityManager_QueryCustomPolicy(&host
->doc
->IInternetHostSecurityManager_iface
,
54 &GUID_CUSTOM_CONFIRMOBJECTSAFETY
, &ppolicy
, &policy_size
, (BYTE
*)&cs
, sizeof(cs
), 0);
58 policy
= *(DWORD
*)ppolicy
;
59 CoTaskMemFree(ppolicy
);
60 return policy
== URLPOLICY_ALLOW
;
63 static BOOL
check_script_safety(PluginHost
*host
)
65 DISPPARAMS params
= {NULL
,NULL
,0,0};
66 DWORD policy_size
, policy
;
67 struct CONFIRMSAFETY cs
;
73 cs
.clsid
= host
->clsid
;
74 cs
.pUnk
= host
->plugin_unk
;
77 hres
= IInternetHostSecurityManager_QueryCustomPolicy(&host
->doc
->IInternetHostSecurityManager_iface
,
78 &GUID_CUSTOM_CONFIRMOBJECTSAFETY
, &ppolicy
, &policy_size
, (BYTE
*)&cs
, sizeof(cs
), 0);
82 policy
= *(DWORD
*)ppolicy
;
83 CoTaskMemFree(ppolicy
);
85 if(policy
!= URLPOLICY_ALLOW
)
89 hres
= IDispatch_Invoke(host
->disp
, DISPID_SECURITYCTX
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
, ¶ms
, &v
, NULL
, &err
);
91 FIXME("Handle security ctx %s\n", debugstr_variant(&v
));
98 static void update_readystate(PluginHost
*host
)
100 DISPPARAMS params
= {NULL
,NULL
,0,0};
107 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IDispatchEx
, (void**)&dispex
);
108 if(SUCCEEDED(hres
)) {
109 FIXME("Use IDispatchEx\n");
110 IDispatchEx_Release(dispex
);
113 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IDispatch
, (void**)&disp
);
117 hres
= IDispatch_Invoke(disp
, DISPID_READYSTATE
, &IID_NULL
, 0, DISPATCH_PROPERTYGET
, ¶ms
, &v
, NULL
, &err
);
118 IDispatch_Release(disp
);
119 if(SUCCEEDED(hres
)) {
120 /* FIXME: make plugin readystate affect document readystate */
121 TRACE("readystate = %s\n", debugstr_variant(&v
));
126 /* FIXME: We shouldn't need this function and we should embed plugin directly in the main document */
127 static void get_pos_rect(PluginHost
*host
, RECT
*ret
)
131 ret
->bottom
= host
->rect
.bottom
- host
->rect
.top
;
132 ret
->right
= host
->rect
.right
- host
->rect
.left
;
135 static void load_prop_bag(PluginHost
*host
, IPersistPropertyBag
*persist_prop_bag
)
137 IPropertyBag
*prop_bag
;
140 hres
= create_param_prop_bag(host
->element
->element
.nselem
, &prop_bag
);
144 if(prop_bag
&& !check_load_safety(host
)) {
145 IPropertyBag_Release(prop_bag
);
150 hres
= IPersistPropertyBag_Load(persist_prop_bag
, prop_bag
, NULL
);
151 IPropertyBag_Release(prop_bag
);
153 WARN("Load failed: %08x\n", hres
);
155 hres
= IPersistPropertyBag_InitNew(persist_prop_bag
);
157 WARN("InitNew failed: %08x\n", hres
);
161 static void load_plugin(PluginHost
*host
)
163 IPersistPropertyBag2
*persist_prop_bag2
;
164 IPersistPropertyBag
*persist_prop_bag
;
167 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IPersistPropertyBag2
, (void**)&persist_prop_bag2
);
168 if(SUCCEEDED(hres
)) {
169 FIXME("Use IPersistPropertyBag2 iface\n");
170 IPersistPropertyBag2_Release(persist_prop_bag2
);
174 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IPersistPropertyBag
, (void**)&persist_prop_bag
);
175 if(SUCCEEDED(hres
)) {
176 load_prop_bag(host
, persist_prop_bag
);
177 IPersistPropertyBag_Release(persist_prop_bag
);
181 FIXME("No IPersistPropertyBag iface\n");
184 static void activate_plugin(PluginHost
*host
)
186 IClientSecurity
*client_security
;
187 IQuickActivate
*quick_activate
;
188 IOleObject
*ole_obj
= NULL
;
189 IOleCommandTarget
*cmdtrg
;
190 IViewObjectEx
*view_obj
;
196 if(!host
->plugin_unk
)
199 /* Note native calls QI on plugin for an undocumented IID and CLSID_HTMLDocument */
201 /* FIXME: call FreezeEvents(TRUE) */
203 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IClientSecurity
, (void**)&client_security
);
204 if(SUCCEEDED(hres
)) {
205 FIXME("Handle IClientSecurity\n");
206 IClientSecurity_Release(client_security
);
210 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IQuickActivate
, (void**)&quick_activate
);
211 if(SUCCEEDED(hres
)) {
212 QACONTAINER container
= {sizeof(container
)};
213 QACONTROL control
= {sizeof(control
)};
215 TRACE("Using IQuickActivate\n");
217 container
.pClientSite
= &host
->IOleClientSite_iface
;
218 container
.dwAmbientFlags
= QACONTAINER_SUPPORTSMNEMONICS
|QACONTAINER_MESSAGEREFLECT
|QACONTAINER_USERMODE
;
219 container
.pAdviseSink
= &host
->IAdviseSinkEx_iface
;
220 container
.pPropertyNotifySink
= &host
->IPropertyNotifySink_iface
;
222 hres
= IQuickActivate_QuickActivate(quick_activate
, &container
, &control
);
223 IQuickActivate_Release(quick_activate
);
225 FIXME("QuickActivate failed: %08x\n", hres
);
229 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IOleObject
, (void**)&ole_obj
);
230 if(SUCCEEDED(hres
)) {
231 hres
= IOleObject_GetMiscStatus(ole_obj
, DVASPECT_CONTENT
, &status
);
232 TRACE("GetMiscStatus returned %08x %x\n", hres
, status
);
234 hres
= IOleObject_SetClientSite(ole_obj
, &host
->IOleClientSite_iface
);
235 IOleObject_Release(ole_obj
);
237 FIXME("SetClientSite failed: %08x\n", hres
);
241 TRACE("Plugin does not support IOleObject\n");
248 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IViewObjectEx
, (void**)&view_obj
);
249 if(SUCCEEDED(hres
)) {
250 DWORD view_status
= 0;
252 hres
= IViewObjectEx_SetAdvise(view_obj
, DVASPECT_CONTENT
, 0, (IAdviseSink
*)&host
->IAdviseSinkEx_iface
);
254 WARN("SetAdvise failed: %08x\n", hres
);
256 hres
= IViewObjectEx_GetViewStatus(view_obj
, &view_status
);
257 IViewObjectEx_Release(view_obj
);
258 TRACE("GetViewStatus returned %08x %x\n", hres
, view_status
);
262 update_readystate(host
);
264 /* NOTE: Native QIs for IActiveScript, an undocumented IID, IOleControl and IRunnableObject */
266 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IDispatchEx
, (void**)&dispex
);
267 if(SUCCEEDED(hres
)) {
268 FIXME("Use IDispatchEx\n");
269 host
->disp
= (IDispatch
*)dispex
;
271 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IDispatch
, (void**)&disp
);
275 TRACE("no IDispatch iface\n");
278 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
279 if(SUCCEEDED(hres
)) {
280 FIXME("Use IOleCommandTarget\n");
281 IOleCommandTarget_Release(cmdtrg
);
284 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IOleObject
, (void**)&ole_obj
);
286 FIXME("Plugin does not support IOleObject\n");
291 get_pos_rect(host
, &rect
);
292 hres
= IOleObject_DoVerb(ole_obj
, OLEIVERB_INPLACEACTIVATE
, NULL
, &host
->IOleClientSite_iface
, 0, host
->hwnd
, &rect
);
293 IOleObject_Release(ole_obj
);
295 WARN("DoVerb failed: %08x\n", hres
);
298 if(host
->ip_object
) {
301 hres
= IOleInPlaceObject_GetWindow(host
->ip_object
, &hwnd
);
303 TRACE("hwnd %p\n", hwnd
);
307 void update_plugin_window(PluginHost
*host
, HWND hwnd
, const RECT
*rect
)
309 BOOL rect_changed
= FALSE
;
311 if(!hwnd
|| (host
->hwnd
&& host
->hwnd
!= hwnd
)) {
312 FIXME("unhandled hwnd\n");
316 TRACE("%p %s\n", hwnd
, wine_dbgstr_rect(rect
));
318 if(memcmp(rect
, &host
->rect
, sizeof(RECT
))) {
325 activate_plugin(host
);
328 if(rect_changed
&& host
->ip_object
)
329 IOleInPlaceObject_SetObjectRects(host
->ip_object
, &host
->rect
, &host
->rect
);
332 static void notif_enabled(PluginHost
*plugin_host
)
334 DISPPARAMS args
= {NULL
, NULL
, 0, 0};
340 hres
= IUnknown_QueryInterface(plugin_host
->plugin_unk
, &IID_IDispatch
, (void**)&disp
);
342 FIXME("Could not get IDispatch iface: %08x\n", hres
);
346 V_VT(&res
) = VT_EMPTY
;
347 hres
= IDispatch_Invoke(disp
, DISPID_ENABLED
, &IID_NULL
, 0/*FIXME*/, DISPATCH_PROPERTYGET
, &args
, &res
, NULL
, &err
);
348 IDispatch_Release(disp
);
349 if(SUCCEEDED(hres
)) {
350 FIXME("Got enabled %s\n", debugstr_variant(&res
));
355 void notif_container_change(HTMLPluginContainer
*plugin_container
, DISPID dispid
)
357 IOleControl
*ole_control
;
360 if(!plugin_container
->plugin_host
|| !plugin_container
->plugin_host
->plugin_unk
)
363 notif_enabled(plugin_container
->plugin_host
);
365 hres
= IUnknown_QueryInterface(plugin_container
->plugin_host
->plugin_unk
, &IID_IOleControl
, (void**)&ole_control
);
366 if(SUCCEEDED(hres
)) {
367 IOleControl_OnAmbientPropertyChange(ole_control
, dispid
);
368 IOleControl_Release(ole_control
);
372 HRESULT
get_plugin_disp(HTMLPluginContainer
*plugin_container
, IDispatch
**ret
)
376 host
= plugin_container
->plugin_host
;
378 ERR("No plugin host\n");
387 if(!check_script_safety(host
)) {
388 FIXME("Insecure object\n");
392 IDispatch_AddRef(host
->disp
);
397 HRESULT
get_plugin_dispid(HTMLPluginContainer
*plugin_container
, WCHAR
*name
, DISPID
*ret
)
404 if(!plugin_container
->plugin_host
) {
405 WARN("no plugin host\n");
406 return DISP_E_UNKNOWNNAME
;
409 disp
= plugin_container
->plugin_host
->disp
;
411 return DISP_E_UNKNOWNNAME
;
413 hres
= IDispatch_GetIDsOfNames(disp
, &IID_NULL
, &name
, 1, 0, &id
);
415 TRACE("no prop %s\n", debugstr_w(name
));
416 return DISP_E_UNKNOWNNAME
;
419 for(i
=0; i
< plugin_container
->props_len
; i
++) {
420 if(id
== plugin_container
->props
[i
]) {
421 *ret
= MSHTML_DISPID_CUSTOM_MIN
+i
;
426 if(!plugin_container
->props
) {
427 plugin_container
->props
= heap_alloc(8*sizeof(DISPID
));
428 if(!plugin_container
->props
)
429 return E_OUTOFMEMORY
;
430 plugin_container
->props_size
= 8;
431 }else if(plugin_container
->props_len
== plugin_container
->props_size
) {
434 new_props
= heap_realloc(plugin_container
->props
, plugin_container
->props_size
*2*sizeof(DISPID
));
436 return E_OUTOFMEMORY
;
438 plugin_container
->props
= new_props
;
439 plugin_container
->props_size
*= 2;
442 plugin_container
->props
[plugin_container
->props_len
] = id
;
443 *ret
= MSHTML_DISPID_CUSTOM_MIN
+plugin_container
->props_len
;
444 plugin_container
->props_len
++;
448 HRESULT
invoke_plugin_prop(HTMLPluginContainer
*plugin_container
, DISPID id
, LCID lcid
, WORD flags
, DISPPARAMS
*params
,
449 VARIANT
*res
, EXCEPINFO
*ei
)
453 host
= plugin_container
->plugin_host
;
454 if(!host
|| !host
->disp
) {
455 FIXME("Called with no disp\n");
459 if(!check_script_safety(host
)) {
460 FIXME("Insecure object\n");
464 if(id
< MSHTML_DISPID_CUSTOM_MIN
|| id
> MSHTML_DISPID_CUSTOM_MIN
+ plugin_container
->props_len
) {
469 return IDispatch_Invoke(host
->disp
, plugin_container
->props
[id
-MSHTML_DISPID_CUSTOM_MIN
], &IID_NULL
,
470 lcid
, flags
, params
, res
, ei
, NULL
);
473 static inline PluginHost
*impl_from_IOleClientSite(IOleClientSite
*iface
)
475 return CONTAINING_RECORD(iface
, PluginHost
, IOleClientSite_iface
);
478 static HRESULT WINAPI
PHClientSite_QueryInterface(IOleClientSite
*iface
, REFIID riid
, void **ppv
)
480 PluginHost
*This
= impl_from_IOleClientSite(iface
);
482 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
483 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
484 *ppv
= &This
->IOleClientSite_iface
;
485 }else if(IsEqualGUID(&IID_IOleClientSite
, riid
)) {
486 TRACE("(%p)->(IID_IOleClientSite %p)\n", This
, ppv
);
487 *ppv
= &This
->IOleClientSite_iface
;
488 }else if(IsEqualGUID(&IID_IAdviseSink
, riid
)) {
489 TRACE("(%p)->(IID_IAdviseSink %p)\n", This
, ppv
);
490 *ppv
= &This
->IAdviseSinkEx_iface
;
491 }else if(IsEqualGUID(&IID_IAdviseSinkEx
, riid
)) {
492 TRACE("(%p)->(IID_IAdviseSinkEx %p)\n", This
, ppv
);
493 *ppv
= &This
->IAdviseSinkEx_iface
;
494 }else if(IsEqualGUID(&IID_IPropertyNotifySink
, riid
)) {
495 TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This
, ppv
);
496 *ppv
= &This
->IPropertyNotifySink_iface
;
497 }else if(IsEqualGUID(&IID_IDispatch
, riid
)) {
498 TRACE("(%p)->(IID_IDispatch %p)\n", This
, ppv
);
499 *ppv
= &This
->IDispatch_iface
;
500 }else if(IsEqualGUID(&IID_IOleWindow
, riid
)) {
501 TRACE("(%p)->(IID_IOleWindow %p)\n", This
, ppv
);
502 *ppv
= &This
->IOleInPlaceSiteEx_iface
;
503 }else if(IsEqualGUID(&IID_IOleInPlaceSite
, riid
)) {
504 TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This
, ppv
);
505 *ppv
= &This
->IOleInPlaceSiteEx_iface
;
506 }else if(IsEqualGUID(&IID_IOleInPlaceSiteEx
, riid
)) {
507 TRACE("(%p)->(IID_IOleInPlaceSiteEx %p)\n", This
, ppv
);
508 *ppv
= &This
->IOleInPlaceSiteEx_iface
;
509 }else if(IsEqualGUID(&IID_IOleControlSite
, riid
)) {
510 TRACE("(%p)->(IID_IOleControlSite %p)\n", This
, ppv
);
511 *ppv
= &This
->IOleControlSite_iface
;
512 }else if(IsEqualGUID(&IID_IBindHost
, riid
)) {
513 TRACE("(%p)->(IID_IBindHost %p)\n", This
, ppv
);
514 *ppv
= &This
->IBindHost_iface
;
515 }else if(IsEqualGUID(&IID_IServiceProvider
, riid
)) {
516 TRACE("(%p)->(IID_IServiceProvider %p)\n", This
, ppv
);
517 *ppv
= &This
->IServiceProvider_iface
;
519 WARN("Unsupported interface %s\n", debugstr_guid(riid
));
521 return E_NOINTERFACE
;
524 IUnknown_AddRef((IUnknown
*)*ppv
);
528 static ULONG WINAPI
PHClientSite_AddRef(IOleClientSite
*iface
)
530 PluginHost
*This
= impl_from_IOleClientSite(iface
);
531 LONG ref
= InterlockedIncrement(&This
->ref
);
533 TRACE("(%p) ref=%d\n", This
, ref
);
538 static ULONG WINAPI
PHClientSite_Release(IOleClientSite
*iface
)
540 PluginHost
*This
= impl_from_IOleClientSite(iface
);
541 LONG ref
= InterlockedDecrement(&This
->ref
);
543 TRACE("(%p) ref=%d\n", This
, ref
);
547 IDispatch_Release(This
->disp
);
549 IOleInPlaceObject_Release(This
->ip_object
);
550 list_remove(&This
->entry
);
552 This
->element
->plugin_host
= NULL
;
554 IUnknown_Release(This
->plugin_unk
);
561 static HRESULT WINAPI
PHClientSite_SaveObject(IOleClientSite
*iface
)
563 PluginHost
*This
= impl_from_IOleClientSite(iface
);
564 FIXME("(%p)\n", This
);
568 static HRESULT WINAPI
PHClientSite_GetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
569 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
571 PluginHost
*This
= impl_from_IOleClientSite(iface
);
573 TRACE("(%p)->(%d %d %p)\n", This
, dwAssign
, dwWhichMoniker
, ppmk
);
575 switch(dwWhichMoniker
) {
576 case OLEWHICHMK_CONTAINER
:
577 if(!This
->doc
|| !This
->doc
->window
|| !This
->doc
->window
->mon
) {
578 FIXME("no moniker\n");
582 *ppmk
= This
->doc
->window
->mon
;
583 IMoniker_AddRef(*ppmk
);
586 FIXME("which %d\n", dwWhichMoniker
);
593 static HRESULT WINAPI
PHClientSite_GetContainer(IOleClientSite
*iface
, IOleContainer
**ppContainer
)
595 PluginHost
*This
= impl_from_IOleClientSite(iface
);
597 TRACE("(%p)->(%p)\n", This
, ppContainer
);
600 ERR("Called on detached object\n");
604 *ppContainer
= &This
->doc
->basedoc
.IOleContainer_iface
;
605 IOleContainer_AddRef(*ppContainer
);
609 static HRESULT WINAPI
PHClientSite_ShowObject(IOleClientSite
*iface
)
611 PluginHost
*This
= impl_from_IOleClientSite(iface
);
613 TRACE("(%p)\n", This
);
618 static HRESULT WINAPI
PHClientSite_OnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
620 PluginHost
*This
= impl_from_IOleClientSite(iface
);
621 FIXME("(%p)->(%x)\n", This
, fShow
);
625 static HRESULT WINAPI
PHClientSite_RequestNewObjectLayout(IOleClientSite
*iface
)
627 PluginHost
*This
= impl_from_IOleClientSite(iface
);
628 FIXME("(%p)\n", This
);
632 static const IOleClientSiteVtbl OleClientSiteVtbl
= {
633 PHClientSite_QueryInterface
,
635 PHClientSite_Release
,
636 PHClientSite_SaveObject
,
637 PHClientSite_GetMoniker
,
638 PHClientSite_GetContainer
,
639 PHClientSite_ShowObject
,
640 PHClientSite_OnShowWindow
,
641 PHClientSite_RequestNewObjectLayout
644 static inline PluginHost
*impl_from_IAdviseSinkEx(IAdviseSinkEx
*iface
)
646 return CONTAINING_RECORD(iface
, PluginHost
, IAdviseSinkEx_iface
);
649 static HRESULT WINAPI
PHAdviseSinkEx_QueryInterface(IAdviseSinkEx
*iface
, REFIID riid
, void **ppv
)
651 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
652 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
655 static ULONG WINAPI
PHAdviseSinkEx_AddRef(IAdviseSinkEx
*iface
)
657 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
658 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
661 static ULONG WINAPI
PHAdviseSinkEx_Release(IAdviseSinkEx
*iface
)
663 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
664 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
667 static void WINAPI
PHAdviseSinkEx_OnDataChange(IAdviseSinkEx
*iface
, FORMATETC
*pFormatetc
, STGMEDIUM
*pStgMedium
)
669 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
670 FIXME("(%p)->(%p %p)\n", This
, pFormatetc
, pStgMedium
);
673 static void WINAPI
PHAdviseSinkEx_OnViewChange(IAdviseSinkEx
*iface
, DWORD dwAspect
, LONG lindex
)
675 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
676 FIXME("(%p)->(%d %d)\n", This
, dwAspect
, lindex
);
679 static void WINAPI
PHAdviseSinkEx_OnRename(IAdviseSinkEx
*iface
, IMoniker
*pmk
)
681 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
682 FIXME("(%p)->(%p)\n", This
, pmk
);
685 static void WINAPI
PHAdviseSinkEx_OnSave(IAdviseSinkEx
*iface
)
687 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
688 FIXME("(%p)\n", This
);
691 static void WINAPI
PHAdviseSinkEx_OnClose(IAdviseSinkEx
*iface
)
693 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
694 FIXME("(%p)\n", This
);
697 static void WINAPI
PHAdviseSinkEx_OnViewStatusChange(IAdviseSinkEx
*iface
, DWORD dwViewStatus
)
699 PluginHost
*This
= impl_from_IAdviseSinkEx(iface
);
700 FIXME("(%p)->(%d)\n", This
, dwViewStatus
);
703 static const IAdviseSinkExVtbl AdviseSinkExVtbl
= {
704 PHAdviseSinkEx_QueryInterface
,
705 PHAdviseSinkEx_AddRef
,
706 PHAdviseSinkEx_Release
,
707 PHAdviseSinkEx_OnDataChange
,
708 PHAdviseSinkEx_OnViewChange
,
709 PHAdviseSinkEx_OnRename
,
710 PHAdviseSinkEx_OnSave
,
711 PHAdviseSinkEx_OnClose
,
712 PHAdviseSinkEx_OnViewStatusChange
715 static inline PluginHost
*impl_from_IPropertyNotifySink(IPropertyNotifySink
*iface
)
717 return CONTAINING_RECORD(iface
, PluginHost
, IPropertyNotifySink_iface
);
720 static HRESULT WINAPI
PHPropertyNotifySink_QueryInterface(IPropertyNotifySink
*iface
, REFIID riid
, void **ppv
)
722 PluginHost
*This
= impl_from_IPropertyNotifySink(iface
);
723 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
726 static ULONG WINAPI
PHPropertyNotifySink_AddRef(IPropertyNotifySink
*iface
)
728 PluginHost
*This
= impl_from_IPropertyNotifySink(iface
);
729 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
732 static ULONG WINAPI
PHPropertyNotifySink_Release(IPropertyNotifySink
*iface
)
734 PluginHost
*This
= impl_from_IPropertyNotifySink(iface
);
735 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
738 static HRESULT WINAPI
PHPropertyNotifySink_OnChanged(IPropertyNotifySink
*iface
, DISPID dispID
)
740 PluginHost
*This
= impl_from_IPropertyNotifySink(iface
);
742 TRACE("(%p)->(%d)\n", This
, dispID
);
745 case DISPID_READYSTATE
:
746 update_readystate(This
);
749 FIXME("Unimplemented dispID %d\n", dispID
);
756 static HRESULT WINAPI
PHPropertyNotifySink_OnRequestEdit(IPropertyNotifySink
*iface
, DISPID dispID
)
758 PluginHost
*This
= impl_from_IPropertyNotifySink(iface
);
759 FIXME("(%p)->(%d)\n", This
, dispID
);
763 static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
= {
764 PHPropertyNotifySink_QueryInterface
,
765 PHPropertyNotifySink_AddRef
,
766 PHPropertyNotifySink_Release
,
767 PHPropertyNotifySink_OnChanged
,
768 PHPropertyNotifySink_OnRequestEdit
771 static inline PluginHost
*impl_from_IDispatch(IDispatch
*iface
)
773 return CONTAINING_RECORD(iface
, PluginHost
, IDispatch_iface
);
776 static HRESULT WINAPI
PHDispatch_QueryInterface(IDispatch
*iface
, REFIID riid
, void **ppv
)
778 PluginHost
*This
= impl_from_IDispatch(iface
);
779 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
782 static ULONG WINAPI
PHDispatch_AddRef(IDispatch
*iface
)
784 PluginHost
*This
= impl_from_IDispatch(iface
);
785 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
788 static ULONG WINAPI
PHDispatch_Release(IDispatch
*iface
)
790 PluginHost
*This
= impl_from_IDispatch(iface
);
791 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
794 static HRESULT WINAPI
PHDispatch_GetTypeInfoCount(IDispatch
*iface
, UINT
*pctinfo
)
796 PluginHost
*This
= impl_from_IDispatch(iface
);
797 FIXME("(%p)->(%p)\n", This
, pctinfo
);
801 static HRESULT WINAPI
PHDispatch_GetTypeInfo(IDispatch
*iface
, UINT iTInfo
,
802 LCID lcid
, ITypeInfo
**ppTInfo
)
804 PluginHost
*This
= impl_from_IDispatch(iface
);
805 FIXME("(%p)->(%d %d %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
809 static HRESULT WINAPI
PHDispatch_GetIDsOfNames(IDispatch
*iface
, REFIID riid
,
810 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
812 PluginHost
*This
= impl_from_IDispatch(iface
);
813 FIXME("(%p)->(%s %p %d %d %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
, rgDispId
);
817 static HRESULT WINAPI
PHDispatch_Invoke(IDispatch
*iface
, DISPID dispid
, REFIID riid
, LCID lcid
,
818 WORD wFlags
, DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
820 PluginHost
*This
= impl_from_IDispatch(iface
);
821 FIXME("(%p)->(%d %x %p %p)\n", This
, dispid
, wFlags
, pDispParams
, pVarResult
);
825 static const IDispatchVtbl DispatchVtbl
= {
826 PHDispatch_QueryInterface
,
829 PHDispatch_GetTypeInfoCount
,
830 PHDispatch_GetTypeInfo
,
831 PHDispatch_GetIDsOfNames
,
835 static inline PluginHost
*impl_from_IOleInPlaceSiteEx(IOleInPlaceSiteEx
*iface
)
837 return CONTAINING_RECORD(iface
, PluginHost
, IOleInPlaceSiteEx_iface
);
840 static HRESULT WINAPI
PHInPlaceSite_QueryInterface(IOleInPlaceSiteEx
*iface
, REFIID riid
, void **ppv
)
842 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
843 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
846 static ULONG WINAPI
PHInPlaceSite_AddRef(IOleInPlaceSiteEx
*iface
)
848 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
849 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
852 static ULONG WINAPI
PHInPlaceSite_Release(IOleInPlaceSiteEx
*iface
)
854 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
855 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
858 static HRESULT WINAPI
PHInPlaceSite_GetWindow(IOleInPlaceSiteEx
*iface
, HWND
*phwnd
)
860 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
862 TRACE("(%p)->(%p)\n", This
, phwnd
);
868 static HRESULT WINAPI
PHInPlaceSite_ContextSensitiveHelp(IOleInPlaceSiteEx
*iface
, BOOL fEnterMode
)
870 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
871 FIXME("(%p)->(%x)\n", This
, fEnterMode
);
875 static HRESULT WINAPI
PHInPlaceSite_CanInPlaceActivate(IOleInPlaceSiteEx
*iface
)
877 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
878 FIXME("(%p)\n", This
);
882 static HRESULT WINAPI
PHInPlaceSite_OnInPlaceActivate(IOleInPlaceSiteEx
*iface
)
884 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
885 FIXME("(%p)\n", This
);
889 static HRESULT WINAPI
PHInPlaceSite_OnUIActivate(IOleInPlaceSiteEx
*iface
)
891 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
893 TRACE("(%p)\n", This
);
895 if(!This
->plugin_unk
) {
896 ERR("No plugin object\n");
900 This
->ui_active
= TRUE
;
906 static HRESULT WINAPI
PHInPlaceSite_GetWindowContext(IOleInPlaceSiteEx
*iface
,
907 IOleInPlaceFrame
**ppFrame
, IOleInPlaceUIWindow
**ppDoc
, RECT
*lprcPosRect
,
908 RECT
*lprcClipRect
, OLEINPLACEFRAMEINFO
*frame_info
)
910 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
911 IOleInPlaceUIWindow
*ip_window
;
912 IOleInPlaceFrame
*ip_frame
;
916 TRACE("(%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, frame_info
);
918 if(!This
->doc
|| !This
->doc
->basedoc
.doc_obj
|| !This
->doc
->basedoc
.doc_obj
->ipsite
) {
919 FIXME("No ipsite\n");
923 hres
= IOleInPlaceSite_GetWindowContext(This
->doc
->basedoc
.doc_obj
->ipsite
, &ip_frame
, &ip_window
, &pr
, &cr
, frame_info
);
925 WARN("GetWindowContext failed: %08x\n", hres
);
930 IOleInPlaceUIWindow_Release(ip_window
);
932 IOleInPlaceFrame_Release(ip_frame
);
934 hres
= create_ip_frame(&ip_frame
);
938 hres
= create_ip_window(ppDoc
);
943 *lprcPosRect
= This
->rect
;
944 *lprcClipRect
= This
->rect
;
948 static HRESULT WINAPI
PHInPlaceSite_Scroll(IOleInPlaceSiteEx
*iface
, SIZE scrollExtent
)
950 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
951 FIXME("(%p)->({%d %d})\n", This
, scrollExtent
.cx
, scrollExtent
.cy
);
955 static HRESULT WINAPI
PHInPlaceSite_OnUIDeactivate(IOleInPlaceSiteEx
*iface
, BOOL fUndoable
)
957 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
958 FIXME("(%p)->(%x)\n", This
, fUndoable
);
962 static HRESULT WINAPI
PHInPlaceSite_OnInPlaceDeactivate(IOleInPlaceSiteEx
*iface
)
964 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
966 TRACE("(%p)\n", This
);
968 if(This
->ip_object
) {
969 IOleInPlaceObject_Release(This
->ip_object
);
970 This
->ip_object
= NULL
;
976 static HRESULT WINAPI
PHInPlaceSite_DiscardUndoState(IOleInPlaceSiteEx
*iface
)
978 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
979 FIXME("(%p)\n", This
);
983 static HRESULT WINAPI
PHInPlaceSite_DeactivateAndUndo(IOleInPlaceSiteEx
*iface
)
985 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
986 FIXME("(%p)\n", This
);
990 static HRESULT WINAPI
PHInPlaceSite_OnPosRectChange(IOleInPlaceSiteEx
*iface
, LPCRECT lprcPosRect
)
992 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
993 FIXME("(%p)->(%p)\n", This
, lprcPosRect
);
997 static HRESULT WINAPI
PHInPlaceSiteEx_OnInPlaceActivateEx(IOleInPlaceSiteEx
*iface
, BOOL
*pfNoRedraw
, DWORD dwFlags
)
999 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
1003 TRACE("(%p)->(%p %x)\n", This
, pfNoRedraw
, dwFlags
);
1008 hres
= IUnknown_QueryInterface(This
->plugin_unk
, &IID_IOleInPlaceObject
, (void**)&This
->ip_object
);
1012 hres
= IOleInPlaceObject_GetWindow(This
->ip_object
, &hwnd
);
1014 FIXME("Use hwnd %p\n", hwnd
);
1016 *pfNoRedraw
= FALSE
;
1020 static HRESULT WINAPI
PHInPlaceSiteEx_OnInPlaceDeactivateEx(IOleInPlaceSiteEx
*iface
, BOOL fNoRedraw
)
1022 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
1023 FIXME("(%p)->(%x)\n", This
, fNoRedraw
);
1027 static HRESULT WINAPI
PHInPlaceSiteEx_RequestUIActivate(IOleInPlaceSiteEx
*iface
)
1029 PluginHost
*This
= impl_from_IOleInPlaceSiteEx(iface
);
1030 FIXME("(%p)\n", This
);
1034 static const IOleInPlaceSiteExVtbl OleInPlaceSiteExVtbl
= {
1035 PHInPlaceSite_QueryInterface
,
1036 PHInPlaceSite_AddRef
,
1037 PHInPlaceSite_Release
,
1038 PHInPlaceSite_GetWindow
,
1039 PHInPlaceSite_ContextSensitiveHelp
,
1040 PHInPlaceSite_CanInPlaceActivate
,
1041 PHInPlaceSite_OnInPlaceActivate
,
1042 PHInPlaceSite_OnUIActivate
,
1043 PHInPlaceSite_GetWindowContext
,
1044 PHInPlaceSite_Scroll
,
1045 PHInPlaceSite_OnUIDeactivate
,
1046 PHInPlaceSite_OnInPlaceDeactivate
,
1047 PHInPlaceSite_DiscardUndoState
,
1048 PHInPlaceSite_DeactivateAndUndo
,
1049 PHInPlaceSite_OnPosRectChange
,
1050 PHInPlaceSiteEx_OnInPlaceActivateEx
,
1051 PHInPlaceSiteEx_OnInPlaceDeactivateEx
,
1052 PHInPlaceSiteEx_RequestUIActivate
1055 static inline PluginHost
*impl_from_IOleControlSite(IOleControlSite
*iface
)
1057 return CONTAINING_RECORD(iface
, PluginHost
, IOleControlSite_iface
);
1060 static HRESULT WINAPI
PHControlSite_QueryInterface(IOleControlSite
*iface
, REFIID riid
, void **ppv
)
1062 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1063 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
1066 static ULONG WINAPI
PHControlSite_AddRef(IOleControlSite
*iface
)
1068 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1069 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1072 static ULONG WINAPI
PHControlSite_Release(IOleControlSite
*iface
)
1074 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1075 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1078 static HRESULT WINAPI
PHControlSite_OnControlInfoChanged(IOleControlSite
*iface
)
1080 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1081 FIXME("(%p)\n", This
);
1085 static HRESULT WINAPI
PHControlSite_LockInPlaceActive(IOleControlSite
*iface
, BOOL fLock
)
1087 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1088 FIXME("(%p)->(%x)\n", This
, fLock
);
1092 static HRESULT WINAPI
PHControlSite_GetExtendedControl(IOleControlSite
*iface
, IDispatch
**ppDisp
)
1094 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1095 FIXME("(%p)->(%p)\n", This
, ppDisp
);
1099 static HRESULT WINAPI
PHControlSite_TransformCoords(IOleControlSite
*iface
, POINTL
*pPtlHimetric
, POINTF
*pPtfContainer
, DWORD dwFlags
)
1101 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1102 FIXME("(%p)->(%p %p %x)\n", This
, pPtlHimetric
, pPtfContainer
, dwFlags
);
1106 static HRESULT WINAPI
PHControlSite_TranslateAccelerator(IOleControlSite
*iface
, MSG
*pMsg
, DWORD grfModifiers
)
1108 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1109 FIXME("(%p)->(%x)\n", This
, grfModifiers
);
1113 static HRESULT WINAPI
PHControlSite_OnFocus(IOleControlSite
*iface
, BOOL fGotFocus
)
1115 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1116 FIXME("(%p)->(%x)\n", This
, fGotFocus
);
1120 static HRESULT WINAPI
PHControlSite_ShowPropertyFrame(IOleControlSite
*iface
)
1122 PluginHost
*This
= impl_from_IOleControlSite(iface
);
1123 FIXME("(%p)\n", This
);
1127 static const IOleControlSiteVtbl OleControlSiteVtbl
= {
1128 PHControlSite_QueryInterface
,
1129 PHControlSite_AddRef
,
1130 PHControlSite_Release
,
1131 PHControlSite_OnControlInfoChanged
,
1132 PHControlSite_LockInPlaceActive
,
1133 PHControlSite_GetExtendedControl
,
1134 PHControlSite_TransformCoords
,
1135 PHControlSite_TranslateAccelerator
,
1136 PHControlSite_OnFocus
,
1137 PHControlSite_ShowPropertyFrame
1140 static inline PluginHost
*impl_from_IBindHost(IBindHost
*iface
)
1142 return CONTAINING_RECORD(iface
, PluginHost
, IBindHost_iface
);
1145 static HRESULT WINAPI
PHBindHost_QueryInterface(IBindHost
*iface
, REFIID riid
, void **ppv
)
1147 PluginHost
*This
= impl_from_IBindHost(iface
);
1148 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
1151 static ULONG WINAPI
PHBindHost_AddRef(IBindHost
*iface
)
1153 PluginHost
*This
= impl_from_IBindHost(iface
);
1154 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1157 static ULONG WINAPI
PHBindHost_Release(IBindHost
*iface
)
1159 PluginHost
*This
= impl_from_IBindHost(iface
);
1160 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1163 static HRESULT WINAPI
PHBindHost_CreateMoniker(IBindHost
*iface
, LPOLESTR szName
, IBindCtx
*pBC
, IMoniker
**ppmk
, DWORD dwReserved
)
1165 PluginHost
*This
= impl_from_IBindHost(iface
);
1167 TRACE("(%p)->(%s %p %p %x)\n", This
, debugstr_w(szName
), pBC
, ppmk
, dwReserved
);
1169 if(!This
->doc
|| !This
->doc
->window
|| !This
->doc
->window
->mon
) {
1170 FIXME("no moniker\n");
1171 return E_UNEXPECTED
;
1174 return CreateURLMoniker(This
->doc
->window
->mon
, szName
, ppmk
);
1177 static HRESULT WINAPI
PHBindHost_MonikerBindToStorage(IBindHost
*iface
, IMoniker
*pMk
, IBindCtx
*pBC
,
1178 IBindStatusCallback
*pBSC
, REFIID riid
, void **ppvObj
)
1180 PluginHost
*This
= impl_from_IBindHost(iface
);
1181 FIXME("(%p)->(%p %p %p %s %p)\n", This
, pMk
, pBC
, pBSC
, debugstr_guid(riid
), ppvObj
);
1185 static HRESULT WINAPI
PHBindHost_MonikerBindToObject(IBindHost
*iface
, IMoniker
*pMk
, IBindCtx
*pBC
,
1186 IBindStatusCallback
*pBSC
, REFIID riid
, void **ppvObj
)
1188 PluginHost
*This
= impl_from_IBindHost(iface
);
1189 FIXME("(%p)->(%p %p %p %s %p)\n", This
, pMk
, pBC
, pBSC
, debugstr_guid(riid
), ppvObj
);
1193 static const IBindHostVtbl BindHostVtbl
= {
1194 PHBindHost_QueryInterface
,
1197 PHBindHost_CreateMoniker
,
1198 PHBindHost_MonikerBindToStorage
,
1199 PHBindHost_MonikerBindToObject
1202 static inline PluginHost
*impl_from_IServiceProvider(IServiceProvider
*iface
)
1204 return CONTAINING_RECORD(iface
, PluginHost
, IServiceProvider_iface
);
1207 static HRESULT WINAPI
PHServiceProvider_QueryInterface(IServiceProvider
*iface
, REFIID riid
, void **ppv
)
1209 PluginHost
*This
= impl_from_IServiceProvider(iface
);
1210 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
1213 static ULONG WINAPI
PHServiceProvider_AddRef(IServiceProvider
*iface
)
1215 PluginHost
*This
= impl_from_IServiceProvider(iface
);
1216 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1219 static ULONG WINAPI
PHServiceProvider_Release(IServiceProvider
*iface
)
1221 PluginHost
*This
= impl_from_IServiceProvider(iface
);
1222 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1225 static HRESULT WINAPI
PHServiceProvider_QueryService(IServiceProvider
*iface
, REFGUID guidService
, REFIID riid
, void **ppv
)
1227 PluginHost
*This
= impl_from_IServiceProvider(iface
);
1229 if(IsEqualGUID(guidService
, &SID_SBindHost
)) {
1230 TRACE("SID_SBindHost service\n");
1231 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppv
);
1234 TRACE("(%p)->(%s %s %p)\n", This
, debugstr_guid(guidService
), debugstr_guid(riid
), ppv
);
1236 if(!This
->doc
|| !This
->doc
->basedoc
.window
) {
1238 return E_NOINTERFACE
;
1241 return IServiceProvider_QueryService(&This
->doc
->basedoc
.window
->base
.IServiceProvider_iface
,
1242 guidService
, riid
, ppv
);
1245 static const IServiceProviderVtbl ServiceProviderVtbl
= {
1246 PHServiceProvider_QueryInterface
,
1247 PHServiceProvider_AddRef
,
1248 PHServiceProvider_Release
,
1249 PHServiceProvider_QueryService
1252 static HRESULT
assoc_element(PluginHost
*host
, HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
)
1254 HTMLPluginContainer
*container_elem
;
1258 hres
= get_node(doc
, (nsIDOMNode
*)nselem
, TRUE
, &node
);
1262 hres
= IHTMLDOMNode_QueryInterface(&node
->IHTMLDOMNode_iface
, &IID_HTMLPluginContainer
,
1263 (void**)&container_elem
);
1266 ERR("Not an object element\n");
1270 container_elem
->plugin_host
= host
;
1271 host
->element
= container_elem
;
1275 void detach_plugin_host(PluginHost
*host
)
1279 TRACE("%p\n", host
);
1284 if(host
->ip_object
) {
1286 IOleInPlaceObject_UIDeactivate(host
->ip_object
);
1287 IOleInPlaceObject_InPlaceDeactivate(host
->ip_object
);
1290 if(host
->plugin_unk
) {
1291 IOleObject
*ole_obj
;
1293 hres
= IUnknown_QueryInterface(host
->plugin_unk
, &IID_IOleObject
, (void**)&ole_obj
);
1294 if(SUCCEEDED(hres
)) {
1295 if(!host
->ip_object
)
1296 IOleObject_Close(ole_obj
, OLECLOSE_NOSAVE
);
1297 IOleObject_SetClientSite(ole_obj
, NULL
);
1298 IOleObject_Release(ole_obj
);
1303 host
->element
->plugin_host
= NULL
;
1304 host
->element
= NULL
;
1307 list_remove(&host
->entry
);
1308 list_init(&host
->entry
);
1312 HRESULT
create_plugin_host(HTMLDocumentNode
*doc
, nsIDOMElement
*nselem
, IUnknown
*unk
, const CLSID
*clsid
, PluginHost
**ret
)
1317 host
= heap_alloc_zero(sizeof(*host
));
1319 return E_OUTOFMEMORY
;
1321 host
->IOleClientSite_iface
.lpVtbl
= &OleClientSiteVtbl
;
1322 host
->IAdviseSinkEx_iface
.lpVtbl
= &AdviseSinkExVtbl
;
1323 host
->IPropertyNotifySink_iface
.lpVtbl
= &PropertyNotifySinkVtbl
;
1324 host
->IDispatch_iface
.lpVtbl
= &DispatchVtbl
;
1325 host
->IOleInPlaceSiteEx_iface
.lpVtbl
= &OleInPlaceSiteExVtbl
;
1326 host
->IOleControlSite_iface
.lpVtbl
= &OleControlSiteVtbl
;
1327 host
->IBindHost_iface
.lpVtbl
= &BindHostVtbl
;
1328 host
->IServiceProvider_iface
.lpVtbl
= &ServiceProviderVtbl
;
1332 hres
= assoc_element(host
, doc
, nselem
);
1338 IUnknown_AddRef(unk
);
1339 host
->plugin_unk
= unk
;
1340 host
->clsid
= *clsid
;
1343 list_add_tail(&doc
->plugin_hosts
, &host
->entry
);