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; ITypeInfo *typeinfo;
GUID iid; GUID iid;
DWORD cookie; DWORD cookie;
BOOL is_dispiface;
sink_entry_t *handlers; sink_entry_t *handlers;
DWORD handlers_cnt; DWORD handlers_cnt;
@ -548,6 +549,9 @@ static HRESULT WINAPI PHEventSink_QueryInterface(IDispatch *iface, REFIID riid,
}else if(IsEqualGUID(riid, &IID_IDispatch)) { }else if(IsEqualGUID(riid, &IID_IDispatch)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv); TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = &This->IDispatch_iface; *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 { }else {
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv); WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
*ppv = NULL; *ppv = NULL;
@ -670,6 +674,7 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein
PHEventSink *ret; PHEventSink *ret;
IConnectionPoint *cp; IConnectionPoint *cp;
TYPEATTR *typeattr; TYPEATTR *typeattr;
TYPEKIND typekind;
GUID guid; GUID guid;
HRESULT hres; HRESULT hres;
@ -677,9 +682,17 @@ static PHEventSink *create_event_sink(PluginHost *plugin_host, ITypeInfo *typein
if(FAILED(hres)) if(FAILED(hres))
return NULL; return NULL;
typekind = typeattr->typekind;
guid = typeattr->guid; guid = typeattr->guid;
ITypeInfo_ReleaseTypeAttr(typeinfo, typeattr); 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); hres = IUnknown_QueryInterface(plugin_host->plugin_unk, &IID_IConnectionPointContainer, (void**)&cp_container);
if(FAILED(hres)) { if(FAILED(hres)) {
WARN("Could not get IConnectionPointContainer iface: %08x\n", 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->ref = 1;
ret->host = plugin_host; ret->host = plugin_host;
ret->iid = guid; ret->iid = guid;
ret->is_dispiface = typekind == TKIND_DISPATCH;
ITypeInfo_AddRef(typeinfo); ITypeInfo_AddRef(typeinfo);
ret->typeinfo = 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) static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *pUnkSink, DWORD *pdwCookie)
{ {
DispActiveXTest *ax_test;
IDispatchEx *dispex; IDispatchEx *dispex;
HRESULT hres; HRESULT hres;
@ -342,6 +343,10 @@ static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *
hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatchEx, (void**)&dispex); hres = IUnknown_QueryInterface(pUnkSink, &IID_IDispatchEx, (void**)&dispex);
ok(hres == E_NOINTERFACE, "QueryInterface(IID_IDispatchEx) returned: %08x\n", hres); 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; *pdwCookie = 0xdeadbeef;
return S_OK; return S_OK;
} }