diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c index 0f68c25972b..4f088add084 100644 --- a/dlls/mshtml/pluginhost.c +++ b/dlls/mshtml/pluginhost.c @@ -485,6 +485,7 @@ struct PHEventSink { ITypeInfo *typeinfo; GUID iid; DWORD cookie; + BOOL is_dispiface; sink_entry_t *handlers; DWORD handlers_cnt; @@ -548,6 +549,9 @@ static HRESULT WINAPI PHEventSink_QueryInterface(IDispatch *iface, REFIID riid, }else if(IsEqualGUID(riid, &IID_IDispatch)) { TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); *ppv = &This->IDispatch_iface; + }else if(This->is_dispiface && IsEqualGUID(riid, &This->iid)) { + TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); + *ppv = &This->IDispatch_iface; }else { WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); *ppv = NULL; @@ -670,6 +674,7 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein PHEventSink *ret; IConnectionPoint *cp; TYPEATTR *typeattr; + TYPEKIND typekind; GUID guid; HRESULT hres; @@ -677,9 +682,17 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein if(FAILED(hres)) return NULL; + typekind = typeattr->typekind; guid = typeattr->guid; ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); + TRACE("guid %s typekind %d\n", debugstr_guid(&guid), typekind); + + if(typekind != TKIND_INTERFACE && typekind != TKIND_DISPATCH) { + WARN("invalid typekind %d\n", typekind); + return NULL; + } + hres = IUnknown_QueryInterface(plugin_host->plugin_unk, &IID_IConnectionPointContainer, (void**)&cp_container); if(FAILED(hres)) { WARN("Could not get IConnectionPointContainer iface: %08x\n", hres); @@ -699,6 +712,7 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein ret->ref = 1; ret->host = plugin_host; ret->iid = guid; + ret->is_dispiface = typekind == TKIND_DISPATCH; ITypeInfo_AddRef(typeinfo); ret->typeinfo = typeinfo; diff --git a/dlls/mshtml/tests/activex.c b/dlls/mshtml/tests/activex.c index e861d37548e..0bb2837491e 100644 --- a/dlls/mshtml/tests/activex.c +++ b/dlls/mshtml/tests/activex.c @@ -331,6 +331,7 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoi static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink, DWORD *pdwCookie) { + DispActiveXTest *ax_test; IDispatchEx *dispex; HRESULT hres; @@ -342,6 +343,10 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown * hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatchEx, (void**)&dispex); ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDispatchEx) returned: %08x\n", hres); + hres = IUnknown_QueryInterface(pUnkSink, &DIID_DispActiveXTest, (void**)&ax_test); + ok(hres == S_OK, "Could not get DispActiveXTest iface: %08x\n", hres); + DispActiveXTest_Release(ax_test); + *pdwCookie = 0xdeadbeef; return S_OK; }