Jacek Caban : mshtml: Added PluginHost's IDispatch stub implementation.
Alexandre Julliard
julliard at winehq.org
Mon Dec 6 13:18:34 CST 2010
Module: wine
Branch: master
Commit: 06aa58f44be8d2d0fde3eb91fb27089a3e45b37c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=06aa58f44be8d2d0fde3eb91fb27089a3e45b37c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Dec 6 18:50:12 2010 +0100
mshtml: Added PluginHost's IDispatch stub implementation.
---
dlls/mshtml/pluginhost.c | 68 +++++++++++++++++++++++++++++++++++++++++++
dlls/mshtml/pluginhost.h | 1 +
dlls/mshtml/tests/activex.c | 37 +++++++++++++++++++++++
3 files changed, 106 insertions(+), 0 deletions(-)
diff --git a/dlls/mshtml/pluginhost.c b/dlls/mshtml/pluginhost.c
index 7853899..7e0dd0c 100644
--- a/dlls/mshtml/pluginhost.c
+++ b/dlls/mshtml/pluginhost.c
@@ -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;
diff --git a/dlls/mshtml/pluginhost.h b/dlls/mshtml/pluginhost.h
index 236587a..4965d9a 100644
--- a/dlls/mshtml/pluginhost.h
+++ b/dlls/mshtml/pluginhost.h
@@ -22,6 +22,7 @@ typedef struct {
IOleClientSite IOleClientSite_iface;
IAdviseSinkEx IAdviseSinkEx_iface;
IPropertyNotifySink IPropertyNotifySink_iface;
+ IDispatch IDispatch_iface;
LONG ref;
diff --git a/dlls/mshtml/tests/activex.c b/dlls/mshtml/tests/activex.c
index 4682c11..55e4952 100644
--- a/dlls/mshtml/tests/activex.c
+++ b/dlls/mshtml/tests/activex.c
@@ -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;
}
More information about the wine-cvs
mailing list