mshtml: Added PluginHost's IDispatch stub implementation.

This commit is contained in:
Jacek Caban 2010-12-06 18:50:12 +01:00 committed by Alexandre Julliard
parent ec29487f12
commit 06aa58f44b
3 changed files with 106 additions and 0 deletions

View File

@ -111,6 +111,9 @@ static HRESULT WINAPI PHClientSite_QueryInterface(IOleClientSite *iface, REFIID
}else if(IsEqualGUID(&IID_IPropertyNotifySink, riid)) {
TRACE("(%p)->(IID_IPropertyNotifySink %p)\n", This, ppv);
*ppv = &This->IPropertyNotifySink_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
*ppv = &This->IDispatch_iface;
}else {
WARN("Unsupported interface %s\n", debugstr_guid(riid));
*ppv = NULL;
@ -318,6 +321,70 @@ static const IPropertyNotifySinkVtbl PropertyNotifySinkVtbl = {
PHPropertyNotifySink_OnRequestEdit
};
static inline PluginHost *impl_from_IDispatch(IDispatch *iface)
{
return CONTAINING_RECORD(iface, PluginHost, IDispatch_iface);
}
static HRESULT WINAPI PHDispatch_QueryInterface(IDispatch *iface, REFIID riid, void **ppv)
{
PluginHost *This = impl_from_IDispatch(iface);
return IOleClientSite_QueryInterface(&This->IOleClientSite_iface, riid, ppv);
}
static ULONG WINAPI PHDispatch_AddRef(IDispatch *iface)
{
PluginHost *This = impl_from_IDispatch(iface);
return IOleClientSite_AddRef(&This->IOleClientSite_iface);
}
static ULONG WINAPI PHDispatch_Release(IDispatch *iface)
{
PluginHost *This = impl_from_IDispatch(iface);
return IOleClientSite_Release(&This->IOleClientSite_iface);
}
static HRESULT WINAPI PHDispatch_GetTypeInfoCount(IDispatch *iface, UINT *pctinfo)
{
PluginHost *This = impl_from_IDispatch(iface);
FIXME("(%p)->(%p)\n", This, pctinfo);
return E_NOTIMPL;
}
static HRESULT WINAPI PHDispatch_GetTypeInfo(IDispatch *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
PluginHost *This = impl_from_IDispatch(iface);
FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
}
static HRESULT WINAPI PHDispatch_GetIDsOfNames(IDispatch *iface, REFIID riid,
LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
{
PluginHost *This = impl_from_IDispatch(iface);
FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId);
return E_NOTIMPL;
}
static HRESULT WINAPI PHDispatch_Invoke(IDispatch *iface, DISPID dispid, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
PluginHost *This = impl_from_IDispatch(iface);
FIXME("(%p)->(%d %x %p %p)\n", This, dispid, wFlags, pDispParams, pVarResult);
return E_NOTIMPL;
}
static const IDispatchVtbl DispatchVtbl = {
PHDispatch_QueryInterface,
PHDispatch_AddRef,
PHDispatch_Release,
PHDispatch_GetTypeInfoCount,
PHDispatch_GetTypeInfo,
PHDispatch_GetIDsOfNames,
PHDispatch_Invoke
};
HRESULT create_plugin_host(IUnknown *unk, PluginHost **ret)
{
PluginHost *host;
@ -329,6 +396,7 @@ HRESULT create_plugin_host(IUnknown *unk, PluginHost **ret)
host->IOleClientSite_iface.lpVtbl = &OleClientSiteVtbl;
host->IAdviseSinkEx_iface.lpVtbl = &AdviseSinkExVtbl;
host->IPropertyNotifySink_iface.lpVtbl = &PropertyNotifySinkVtbl;
host->IDispatch_iface.lpVtbl = &DispatchVtbl;
host->ref = 1;

View File

@ -22,6 +22,7 @@ typedef struct {
IOleClientSite IOleClientSite_iface;
IAdviseSinkEx IAdviseSinkEx_iface;
IPropertyNotifySink IPropertyNotifySink_iface;
IDispatch IDispatch_iface;
LONG ref;

View File

@ -87,6 +87,27 @@ static const char object_ax_str[] =
"</object>"
"</body></html>";
static const REFIID pluginhost_iids[] = {
&IID_IOleClientSite,
&IID_IAdviseSink,
&IID_IAdviseSinkEx,
&IID_IPropertyNotifySink,
&IID_IDispatch,
NULL
};
static const char *dbgstr_guid(REFIID riid)
{
static char buf[50];
sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
riid->Data1, riid->Data2, riid->Data3, riid->Data4[0],
riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4],
riid->Data4[5], riid->Data4[6], riid->Data4[7]);
return buf;
}
static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
{
IUnknown *unk1, *unk2;
@ -102,6 +123,21 @@ static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
return unk1 == unk2;
}
#define test_ifaces(i,ids) _test_ifaces(__LINE__,i,ids)
static void _test_ifaces(unsigned line, IUnknown *iface, REFIID *iids)
{
const IID * const *piid;
IUnknown *unk;
HRESULT hres;
for(piid = iids; *piid; piid++) {
hres = IDispatch_QueryInterface(iface, *piid, (void**)&unk);
ok_(__FILE__,line) (hres == S_OK, "Could not get %s interface: %08x\n", dbgstr_guid(*piid), hres);
if(SUCCEEDED(hres))
IUnknown_Release(unk);
}
}
static HRESULT ax_qi(REFIID,void**);
static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
@ -210,6 +246,7 @@ static HRESULT WINAPI QuickActivate_QuickActivate(IQuickActivate *iface, QACONTA
"container->pClientSite != container->pAdviseSink\n");
ok(iface_cmp((IUnknown*)container->pClientSite, (IUnknown*)container->pPropertyNotifySink),
"container->pClientSite != container->pPropertyNotifySink\n");
test_ifaces((IUnknown*)container->pClientSite, pluginhost_iids);
return S_OK;
}