msscript: Added IConnectionPointContainer stub.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-06-16 12:17:11 +03:00 committed by Alexandre Julliard
parent 7f5adb69cd
commit d6a389dc95
2 changed files with 83 additions and 0 deletions

View File

@ -34,6 +34,7 @@ struct ScriptControl {
IPersistStreamInit IPersistStreamInit_iface;
IOleObject IOleObject_iface;
IOleControl IOleControl_iface;
IConnectionPointContainer IConnectionPointContainer_iface;
LONG ref;
IOleClientSite *site;
SIZEL extent;
@ -140,6 +141,11 @@ static inline ScriptControl *impl_from_IOleControl(IOleControl *iface)
return CONTAINING_RECORD(iface, ScriptControl, IOleControl_iface);
}
static inline ScriptControl *impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
{
return CONTAINING_RECORD(iface, ScriptControl, IConnectionPointContainer_iface);
}
static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID riid, void **ppv)
{
ScriptControl *This = impl_from_IScriptControl(iface);
@ -165,6 +171,9 @@ static HRESULT WINAPI ScriptControl_QueryInterface(IScriptControl *iface, REFIID
}else if(IsEqualGUID(&IID_IOleControl, riid)) {
TRACE("(%p)->(IID_IOleControl %p)\n", This, ppv);
*ppv = &This->IOleControl_iface;
}else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) {
TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv);
*ppv = &This->IConnectionPointContainer_iface;
}else {
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
*ppv = NULL;
@ -856,6 +865,50 @@ static const IOleControlVtbl OleControlVtbl = {
OleControl_FreezeEvents
};
static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface, REFIID riid, void **obj)
{
ScriptControl *This = impl_from_IConnectionPointContainer(iface);
return IScriptControl_QueryInterface(&This->IScriptControl_iface, riid, obj);
}
static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
{
ScriptControl *This = impl_from_IConnectionPointContainer(iface);
return IScriptControl_AddRef(&This->IScriptControl_iface);
}
static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
{
ScriptControl *This = impl_from_IConnectionPointContainer(iface);
return IScriptControl_Release(&This->IScriptControl_iface);
}
static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface, IEnumConnectionPoints **enum_points)
{
ScriptControl *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p)->(%p)\n", This, enum_points);
return E_NOTIMPL;
}
static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, IConnectionPoint **cp)
{
ScriptControl *This = impl_from_IConnectionPointContainer(iface);
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), cp);
return E_NOTIMPL;
}
static const IConnectionPointContainerVtbl ConnectionPointContainerVtbl = {
ConnectionPointContainer_QueryInterface,
ConnectionPointContainer_AddRef,
ConnectionPointContainer_Release,
ConnectionPointContainer_EnumConnectionPoints,
ConnectionPointContainer_FindConnectionPoint
};
static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
{
ScriptControl *script_control;
@ -873,6 +926,7 @@ static HRESULT WINAPI ScriptControl_CreateInstance(IClassFactory *iface, IUnknow
script_control->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
script_control->IOleObject_iface.lpVtbl = &OleObjectVtbl;
script_control->IOleControl_iface.lpVtbl = &OleControlVtbl;
script_control->IConnectionPointContainer_iface.lpVtbl = &ConnectionPointContainerVtbl;
script_control->ref = 1;
script_control->site = NULL;

View File

@ -93,6 +93,15 @@ DEFINE_EXPECT(InitNew);
DEFINE_EXPECT(Close);
DEFINE_EXPECT(SetScriptSite);
#define EXPECT_REF(obj,ref) _expect_ref((IUnknown*)obj, ref, __LINE__)
static void _expect_ref(IUnknown* obj, ULONG ref, int line)
{
ULONG rc;
IUnknown_AddRef(obj);
rc = IUnknown_Release(obj);
ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
}
static IActiveScriptSite *site;
static SCRIPTSTATE state;
@ -769,7 +778,26 @@ if (hr == S_OK)
}
else
skip("Could not register TestScript engine\n");
}
static void test_connectionpoints(void)
{
IConnectionPointContainer *container;
IScriptControl *sc;
HRESULT hr;
hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER,
&IID_IScriptControl, (void**)&sc);
ok(hr == S_OK, "got 0x%08x\n", hr);
EXPECT_REF(sc, 1);
hr = IScriptControl_QueryInterface(sc, &IID_IConnectionPointContainer, (void**)&container);
ok(hr == S_OK, "got 0x%08x\n", hr);
EXPECT_REF(sc, 2);
EXPECT_REF(container, 2);
IConnectionPointContainer_Release(container);
IScriptControl_Release(sc);
}
START_TEST(msscript)
@ -791,6 +819,7 @@ START_TEST(msscript)
test_persiststreaminit();
test_olecontrol();
test_Language();
test_connectionpoints();
CoUninitialize();
}