ReactOS 0.4.16-dev-297-gc569aee
pluginhost.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PluginHost
 
struct  HTMLPluginContainer
 

Typedefs

typedef struct HTMLPluginContainer HTMLPluginContainer
 
typedef struct PHEventSink PHEventSink
 

Functions

 DEFINE_GUID (IID_HTMLPluginContainer, 0xbd7a6050, 0xb373, 0x4f6f, 0xa4, 0x93, 0xdd, 0x40, 0xc5, 0x23, 0xa8, 0x6a)
 
HRESULT create_plugin_host (HTMLDocumentNode *, HTMLPluginContainer *) DECLSPEC_HIDDEN
 
void update_plugin_window (PluginHost *, HWND, const RECT *) DECLSPEC_HIDDEN
 
void detach_plugin_host (PluginHost *) DECLSPEC_HIDDEN
 
HRESULT create_param_prop_bag (nsIDOMHTMLElement *, IPropertyBag **) DECLSPEC_HIDDEN
 
HRESULT create_ip_window (IOleInPlaceUIWindow **) DECLSPEC_HIDDEN
 
HRESULT create_ip_frame (IOleInPlaceFrame **) DECLSPEC_HIDDEN
 
HRESULT get_plugin_disp (HTMLPluginContainer *, IDispatch **) DECLSPEC_HIDDEN
 
HRESULT get_plugin_dispid (HTMLPluginContainer *, WCHAR *, DISPID *) DECLSPEC_HIDDEN
 
HRESULT invoke_plugin_prop (HTMLPluginContainer *, DISPID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *) DECLSPEC_HIDDEN
 
void notif_container_change (HTMLPluginContainer *, DISPID) DECLSPEC_HIDDEN
 
void bind_activex_event (HTMLDocumentNode *, HTMLPluginContainer *, WCHAR *, IDispatch *) DECLSPEC_HIDDEN
 

Variables

const IID IID_HTMLPluginContainer DECLSPEC_HIDDEN
 

Typedef Documentation

◆ HTMLPluginContainer

Definition at line 21 of file pluginhost.h.

◆ PHEventSink

Definition at line 22 of file pluginhost.h.

Function Documentation

◆ bind_activex_event()

void bind_activex_event ( HTMLDocumentNode doc,
HTMLPluginContainer plugin_container,
WCHAR event,
IDispatch disp 
)

Definition at line 758 of file pluginhost.c.

759{
760 PluginHost *plugin_host = plugin_container->plugin_host;
761 ITypeInfo *class_info, *source_info;
762 DISPID id;
764
765 TRACE("(%p %p %s %p)\n", doc, plugin_host, debugstr_w(event), disp);
766
767 if(!plugin_host || !plugin_host->plugin_unk) {
768 WARN("detached element %p\n", plugin_host);
769 return;
770 }
771
772 if(plugin_host->sink) {
773 source_info = plugin_host->sink->typeinfo;
774 ITypeInfo_AddRef(source_info);
775 }else {
776 IProvideClassInfo *provide_ci;
777
778 hres = IUnknown_QueryInterface(plugin_host->plugin_unk, &IID_IProvideClassInfo, (void**)&provide_ci);
779 if(FAILED(hres)) {
780 FIXME("No IProvideClassInfo, try GetTypeInfo?\n");
781 return;
782 }
783
784 hres = IProvideClassInfo_GetClassInfo(provide_ci, &class_info);
785 IProvideClassInfo_Release(provide_ci);
786 if(FAILED(hres) || !class_info) {
787 WARN("GetClassInfo failed: %08x\n", hres);
788 return;
789 }
790
791 source_info = get_eventiface_info(plugin_container, class_info);
792 ITypeInfo_Release(class_info);
793 if(!source_info)
794 return;
795 }
796
797 hres = ITypeInfo_GetIDsOfNames(source_info, &event, 1, &id);
798 if(FAILED(hres))
799 WARN("Could not get disp id: %08x\n", hres);
800 else if(!plugin_host->sink)
801 plugin_host->sink = create_event_sink(plugin_host, source_info);
802
803 ITypeInfo_Release(source_info);
804 if(FAILED(hres) || !plugin_host->sink)
805 return;
806
807 add_sink_handler(plugin_host->sink, id, disp);
808}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
struct _cl_event * event
Definition: glext.h:7739
GLuint id
Definition: glext.h:5910
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
static VARIANTARG static DISPID
Definition: ordinal.c:52
const GUID IID_IProvideClassInfo
static void add_sink_handler(PHEventSink *sink, DISPID id, IDispatch *disp)
Definition: pluginhost.c:486
static PHEventSink * create_event_sink(PluginHost *plugin_host, ITypeInfo *typeinfo)
Definition: pluginhost.c:650
static ITypeInfo * get_eventiface_info(HTMLPluginContainer *plugin_container, ITypeInfo *class_info)
Definition: pluginhost.c:713
#define TRACE(s)
Definition: solgame.cpp:4
PluginHost * plugin_host
Definition: pluginhost.h:56
ITypeInfo * typeinfo
Definition: pluginhost.c:464
PHEventSink * sink
Definition: pluginhost.h:49
IUnknown * plugin_unk
Definition: pluginhost.h:36

Referenced by bind_event_scripts().

◆ create_ip_frame()

HRESULT create_ip_frame ( IOleInPlaceFrame **  ret)

Definition at line 189 of file ipwindow.c.

190{
191 InPlaceFrame *frame;
192
193 frame = heap_alloc_zero(sizeof(*frame));
194 if(!frame)
195 return E_OUTOFMEMORY;
196
198 frame->ref = 1;
199
200 *ret = &frame->IOleInPlaceFrame_iface;
201 return S_OK;
202}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:52
static const IOleInPlaceFrameVtbl OleInPlaceFrameVtbl
Definition: ipwindow.c:171
IOleInPlaceFrame IOleInPlaceFrame_iface
Definition: ipwindow.c:22
LONG ref
Definition: ipwindow.c:23
int ret

Referenced by PHInPlaceSite_GetWindowContext().

◆ create_ip_window()

HRESULT create_ip_window ( IOleInPlaceUIWindow **  ret)

Definition at line 317 of file ipwindow.c.

318{
319 InPlaceUIWindow *uiwindow;
320
321 uiwindow = heap_alloc_zero(sizeof(*uiwindow));
322 if(!uiwindow)
323 return E_OUTOFMEMORY;
324
326 uiwindow->ref = 1;
327
328 *ret = &uiwindow->IOleInPlaceUIWindow_iface;
329 return S_OK;
330}
static const IOleInPlaceUIWindowVtbl OleInPlaceUIWindowVtbl
Definition: ipwindow.c:305
IOleInPlaceUIWindow IOleInPlaceUIWindow_iface
Definition: ipwindow.c:205

Referenced by PHInPlaceSite_GetWindowContext().

◆ create_param_prop_bag()

HRESULT create_param_prop_bag ( nsIDOMHTMLElement nselem,
IPropertyBag **  ret 
)

Definition at line 317 of file propbag.c.

318{
319 PropertyBag *prop_bag;
321
322 prop_bag = heap_alloc(sizeof(*prop_bag));
323 if(!prop_bag)
324 return E_OUTOFMEMORY;
325
326 prop_bag->IPropertyBag_iface.lpVtbl = &PropertyBagVtbl;
327 prop_bag->IPropertyBag2_iface.lpVtbl = &PropertyBag2Vtbl;
328 prop_bag->ref = 1;
329
330 list_init(&prop_bag->props);
331 hres = fill_props(nselem, prop_bag);
332 if(FAILED(hres) || list_empty(&prop_bag->props)) {
333 IPropertyBag_Release(&prop_bag->IPropertyBag_iface);
334 *ret = NULL;
335 return hres;
336 }
337
338 *ret = &prop_bag->IPropertyBag_iface;
339 return S_OK;
340}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_init(struct list_entry *head)
Definition: list.h:51
#define NULL
Definition: types.h:112
static const IPropertyBagVtbl PropertyBagVtbl
Definition: propbag.c:174
static const IPropertyBag2Vtbl PropertyBag2Vtbl
Definition: propbag.c:243
static HRESULT fill_props(nsIDOMHTMLElement *nselem, PropertyBag *prop_bag)
Definition: propbag.c:254
struct list props
Definition: propbag.c:27
LONG ref
Definition: propbag.c:25
IPropertyBag2 IPropertyBag2_iface
Definition: propbag.c:23
IPropertyBag IPropertyBag_iface
Definition: propbag.c:22

Referenced by load_prop_bag().

◆ create_plugin_host()

HRESULT create_plugin_host ( HTMLDocumentNode doc,
HTMLPluginContainer container 
)

Definition at line 2048 of file pluginhost.c.

2049{
2051 IUnknown *unk;
2052 CLSID clsid;
2053
2054 assert(!container->plugin_host);
2055
2056 unk = create_activex_object(doc, container->element.nselem, &clsid);
2057 if(!unk)
2058 return E_FAIL;
2059
2060 host = heap_alloc_zero(sizeof(*host));
2061 if(!host) {
2062 IUnknown_Release(unk);
2063 return E_OUTOFMEMORY;
2064 }
2065
2066 host->IOleClientSite_iface.lpVtbl = &OleClientSiteVtbl;
2067 host->IAdviseSinkEx_iface.lpVtbl = &AdviseSinkExVtbl;
2068 host->IPropertyNotifySink_iface.lpVtbl = &PropertyNotifySinkVtbl;
2069 host->IDispatch_iface.lpVtbl = &DispatchVtbl;
2070 host->IOleInPlaceSiteEx_iface.lpVtbl = &OleInPlaceSiteExVtbl;
2071 host->IOleControlSite_iface.lpVtbl = &OleControlSiteVtbl;
2072 host->IBindHost_iface.lpVtbl = &BindHostVtbl;
2073 host->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
2074
2075 host->ref = 1;
2076
2077 host->plugin_unk = unk;
2078 host->clsid = clsid;
2079
2080 host->doc = doc;
2081 list_add_tail(&doc->plugin_hosts, &host->entry);
2082
2083 container->plugin_host = host;
2084 host->element = container;
2085
2087
2088 return S_OK;
2089}
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
#define E_FAIL
Definition: ddrawi.h:102
#define assert(x)
Definition: debug.h:53
REFCLSID clsid
Definition: msctf.c:82
static const IOleClientSiteVtbl OleClientSiteVtbl
Definition: pluginhost.c:992
static const IOleInPlaceSiteExVtbl OleInPlaceSiteExVtbl
Definition: pluginhost.c:1398
static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl
Definition: pluginhost.c:1123
static const IOleControlSiteVtbl OleControlSiteVtbl
Definition: pluginhost.c:1491
static const IAdviseSinkExVtbl AdviseSinkExVtbl
Definition: pluginhost.c:1063
static const IBindHostVtbl BindHostVtbl
Definition: pluginhost.c:1557
static const IDispatchVtbl DispatchVtbl
Definition: pluginhost.c:1185
static IUnknown * create_activex_object(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem, CLSID *clsid)
Definition: pluginhost.c:1945
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: pluginhost.c:1609
static void initialize_plugin_object(PluginHost *host)
Definition: pluginhost.c:163
struct list plugin_hosts
char * host
Definition: whois.c:55

Referenced by HTMLObjectElement2_put_classid(), and NPP_New().

◆ DEFINE_GUID()

DEFINE_GUID ( IID_HTMLPluginContainer  ,
0xbd7a6050  ,
0xb373  ,
0x4f6f  ,
0xa4  ,
0x93  ,
0xdd  ,
0x40  ,
0xc5  ,
0x23  ,
0xa8  ,
0x6a   
)

◆ detach_plugin_host()

void detach_plugin_host ( PluginHost host)

Definition at line 1988 of file pluginhost.c.

1989{
1990 HRESULT hres;
1991
1992 TRACE("%p\n", host);
1993
1994 if(!host->doc)
1995 return;
1996
1997 if(host->ip_object) {
1998 if(host->ui_active)
1999 IOleInPlaceObject_UIDeactivate(host->ip_object);
2000 IOleInPlaceObject_InPlaceDeactivate(host->ip_object);
2001 }
2002
2003 if(host->plugin_unk) {
2004 IOleObject *ole_obj;
2005
2006 hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IOleObject, (void**)&ole_obj);
2007 if(SUCCEEDED(hres)) {
2008 if(!host->ip_object)
2009 IOleObject_Close(ole_obj, OLECLOSE_NOSAVE);
2010 IOleObject_SetClientSite(ole_obj, NULL);
2011 IOleObject_Release(ole_obj);
2012 }
2013 }
2014
2015 if(host->sink) {
2016 IConnectionPointContainer *cp_container;
2018
2019 assert(host->plugin_unk != NULL);
2020
2021 hres = IUnknown_QueryInterface(host->plugin_unk, &IID_IConnectionPointContainer, (void**)&cp_container);
2022 if(SUCCEEDED(hres)) {
2023 hres = IConnectionPointContainer_FindConnectionPoint(cp_container, &host->sink->iid, &cp);
2024 IConnectionPointContainer_Release(cp_container);
2025 if(SUCCEEDED(hres)) {
2026 IConnectionPoint_Unadvise(cp, host->sink->cookie);
2027 IConnectionPoint_Release(cp);
2028 }
2029 }
2030
2031 host->sink->host = NULL;
2032 IDispatch_Release(&host->sink->IDispatch_iface);
2033 host->sink = NULL;
2034 }
2035
2037
2038 if(host->element) {
2039 host->element->plugin_host = NULL;
2040 host->element = NULL;
2041 }
2042
2043 list_remove(&host->entry);
2044 list_init(&host->entry);
2045 host->doc = NULL;
2046}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
#define SUCCEEDED(hr)
Definition: intsafe.h:50
POINT cp
Definition: magnifier.c:59
const GUID IID_IConnectionPointContainer
const GUID IID_IOleObject
static void release_plugin_ifaces(PluginHost *This)
Definition: pluginhost.c:875

Referenced by detach_inner_window(), HTMLDocumentNode_destructor(), HTMLObjectElement_destructor(), and NPP_Destroy().

◆ get_plugin_disp()

HRESULT get_plugin_disp ( HTMLPluginContainer plugin_container,
IDispatch **  ret 
)

Definition at line 352 of file pluginhost.c.

353{
355
356 host = plugin_container->plugin_host;
357 if(!host) {
358 ERR("No plugin host\n");
359 return E_UNEXPECTED;
360 }
361
362 if(!host->disp) {
363 *ret = NULL;
364 return S_OK;
365 }
366
368 FIXME("Insecure object\n");
369 return E_FAIL;
370 }
371
372 IDispatch_AddRef(host->disp);
373 *ret = host->disp;
374 return S_OK;
375}
#define ERR(fmt,...)
Definition: precomp.h:57
static BOOL check_script_safety(PluginHost *host)
Definition: pluginhost.c:42
#define E_UNEXPECTED
Definition: winerror.h:2456

Referenced by HTMLObjectElement_get_object().

◆ get_plugin_dispid()

HRESULT get_plugin_dispid ( HTMLPluginContainer plugin_container,
WCHAR name,
DISPID ret 
)

Definition at line 377 of file pluginhost.c.

378{
379 IDispatch *disp;
380 DISPID id;
381 DWORD i;
383
384 if(!plugin_container->plugin_host) {
385 WARN("no plugin host\n");
386 return DISP_E_UNKNOWNNAME;
387 }
388
389 disp = plugin_container->plugin_host->disp;
390 if(!disp)
391 return DISP_E_UNKNOWNNAME;
392
393 hres = IDispatch_GetIDsOfNames(disp, &IID_NULL, &name, 1, 0, &id);
394 if(FAILED(hres)) {
395 TRACE("no prop %s\n", debugstr_w(name));
396 return DISP_E_UNKNOWNNAME;
397 }
398
399 for(i=0; i < plugin_container->props_len; i++) {
400 if(id == plugin_container->props[i]) {
402 return S_OK;
403 }
404 }
405
406 if(!plugin_container->props) {
407 plugin_container->props = heap_alloc(8*sizeof(DISPID));
408 if(!plugin_container->props)
409 return E_OUTOFMEMORY;
410 plugin_container->props_size = 8;
411 }else if(plugin_container->props_len == plugin_container->props_size) {
412 DISPID *new_props;
413
414 new_props = heap_realloc(plugin_container->props, plugin_container->props_size*2*sizeof(DISPID));
415 if(!new_props)
416 return E_OUTOFMEMORY;
417
418 plugin_container->props = new_props;
419 plugin_container->props_size *= 2;
420 }
421
422 plugin_container->props[plugin_container->props_len] = id;
423 *ret = MSHTML_DISPID_CUSTOM_MIN+plugin_container->props_len;
424 plugin_container->props_len++;
425 return S_OK;
426}
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define MSHTML_DISPID_CUSTOM_MIN
#define IID_NULL
Definition: guiddef.h:98
IDispatch * disp
Definition: pluginhost.h:40
Definition: name.c:39
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515

Referenced by HTMLObjectElement_get_dispid().

◆ invoke_plugin_prop()

HRESULT invoke_plugin_prop ( HTMLPluginContainer plugin_container,
DISPID  id,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT res,
EXCEPINFO *  ei 
)

Definition at line 428 of file pluginhost.c.

430{
432
433 host = plugin_container->plugin_host;
434 if(!host || !host->disp) {
435 FIXME("Called with no disp\n");
436 return E_UNEXPECTED;
437 }
438
440 FIXME("Insecure object\n");
441 return E_FAIL;
442 }
443
444 if(id < MSHTML_DISPID_CUSTOM_MIN || id > MSHTML_DISPID_CUSTOM_MIN + plugin_container->props_len) {
445 ERR("Invalid id\n");
446 return E_FAIL;
447 }
448
449 return IDispatch_Invoke(host->disp, plugin_container->props[id-MSHTML_DISPID_CUSTOM_MIN], &IID_NULL,
450 lcid, flags, params, res, ei, NULL);
451}
GLuint res
Definition: glext.h:9613
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161

Referenced by HTMLObjectElement_invoke().

◆ notif_container_change()

void notif_container_change ( HTMLPluginContainer plugin_container,
DISPID  dispid 
)

Definition at line 335 of file pluginhost.c.

336{
337 IOleControl *ole_control;
339
340 if(!plugin_container->plugin_host || !plugin_container->plugin_host->plugin_unk)
341 return;
342
343 notif_enabled(plugin_container->plugin_host);
344
345 hres = IUnknown_QueryInterface(plugin_container->plugin_host->plugin_unk, &IID_IOleControl, (void**)&ole_control);
346 if(SUCCEEDED(hres)) {
347 IOleControl_OnAmbientPropertyChange(ole_control, dispid);
348 IOleControl_Release(ole_control);
349 }
350}
const GUID IID_IOleControl
static void notif_enabled(PluginHost *plugin_host)
Definition: pluginhost.c:312

Referenced by HTMLObjectElement_put_height(), and HTMLObjectElement_put_width().

◆ update_plugin_window()

void update_plugin_window ( PluginHost host,
HWND  hwnd,
const RECT rect 
)

Definition at line 287 of file pluginhost.c.

288{
289 BOOL rect_changed = FALSE;
290
291 if(!hwnd || (host->hwnd && host->hwnd != hwnd)) {
292 FIXME("unhandled hwnd\n");
293 return;
294 }
295
296 TRACE("%p %s\n", hwnd, wine_dbgstr_rect(rect));
297
298 if(memcmp(rect, &host->rect, sizeof(RECT))) {
299 host->rect = *rect;
300 rect_changed = TRUE;
301 }
302
303 if(!host->hwnd) {
304 host->hwnd = hwnd;
306 }
307
308 if(rect_changed && host->ip_object)
309 IOleInPlaceObject_SetObjectRects(host->ip_object, &host->rect, &host->rect);
310}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static void embed_plugin_object(PluginHost *host)
Definition: pluginhost.c:260
& rect
Definition: startmenu.cpp:1413
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

Referenced by NPP_SetWindow().

Variable Documentation

◆ DECLSPEC_HIDDEN

const IID IID_HTMLPluginContainer DECLSPEC_HIDDEN
extern

Definition at line 289 of file d3dcompiler_private.h.