mshtml: Return dispinterface from PHEventSink::QueryInterface.

This commit is contained in:
Jacek Caban 2012-10-08 15:00:50 +02:00 committed by Alexandre Julliard
parent 470137b6d3
commit 6ae3418aaf
2 changed files with 19 additions and 0 deletions

View File

@ -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;

View File

@ -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;
}