From 4058b68966e6933b83b6164140a32006a5bd8263 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Thu, 14 Jul 2016 14:14:28 +0300 Subject: [PATCH] msscript: Implement some connection point methods. Signed-off-by: Nikolay Sivov Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/msscript.ocx/msscript.c | 15 +++++++++---- dlls/msscript.ocx/tests/msscript.c | 35 +++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c index 5be53da5e69..bc3f5c1cae4 100644 --- a/dlls/msscript.ocx/msscript.c +++ b/dlls/msscript.ocx/msscript.c @@ -1282,9 +1282,10 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *i { ConnectionPoint *This = impl_from_IConnectionPoint(iface); - FIXME("(%p)->(%p)\n", This, iid); + TRACE("(%p)->(%p)\n", This, iid); - return E_NOTIMPL; + *iid = *This->riid; + return S_OK; } static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface, @@ -1292,9 +1293,15 @@ static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoi { ConnectionPoint *This = impl_from_IConnectionPoint(iface); - FIXME("(%p)->(%p)\n", This, container); + TRACE("(%p)->(%p)\n", This, container); - return E_NOTIMPL; + if (!container) + return E_POINTER; + + *container = &This->control->IConnectionPointContainer_iface; + IConnectionPointContainer_AddRef(*container); + + return S_OK; } static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *unk_sink, diff --git a/dlls/msscript.ocx/tests/msscript.c b/dlls/msscript.ocx/tests/msscript.c index 714b07529b7..f4e63060f73 100644 --- a/dlls/msscript.ocx/tests/msscript.c +++ b/dlls/msscript.ocx/tests/msscript.c @@ -782,10 +782,11 @@ if (hr == S_OK) static void test_connectionpoints(void) { - IConnectionPointContainer *container; + IConnectionPointContainer *container, *container2; IConnectionPoint *cp; IScriptControl *sc; HRESULT hr; + IID iid; hr = CoCreateInstance(&CLSID_ScriptControl, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, &IID_IScriptControl, (void**)&sc); @@ -799,10 +800,42 @@ static void test_connectionpoints(void) hr = IConnectionPointContainer_FindConnectionPoint(container, &IID_IPropertyNotifySink, &cp); ok(hr == S_OK, "got 0x%08x\n", hr); + + if (0) /* crashes on win2k3 */ + { + hr = IConnectionPoint_GetConnectionPointContainer(cp, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + } + + hr = IConnectionPoint_GetConnectionInterface(cp, &iid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualIID(&iid, &IID_IPropertyNotifySink), "got %s\n", wine_dbgstr_guid(&iid)); + + hr = IConnectionPoint_GetConnectionPointContainer(cp, &container2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(container2 == container, "got %p, expected %p\n", container2, container); + IConnectionPointContainer_Release(container2); + IConnectionPoint_Release(cp); hr = IConnectionPointContainer_FindConnectionPoint(container, &DIID_DScriptControlSource, &cp); ok(hr == S_OK, "got 0x%08x\n", hr); + + if (0) /* crashes on win2k3 */ + { + hr = IConnectionPoint_GetConnectionPointContainer(cp, NULL); + ok(hr == E_POINTER, "got 0x%08x\n", hr); + } + + hr = IConnectionPoint_GetConnectionInterface(cp, &iid); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(IsEqualIID(&iid, &DIID_DScriptControlSource), "got %s\n", wine_dbgstr_guid(&iid)); + + hr = IConnectionPoint_GetConnectionPointContainer(cp, &container2); + ok(hr == S_OK, "got 0x%08x\n", hr); + ok(container2 == container, "got %p, expected %p\n", container2, container); + IConnectionPointContainer_Release(container2); + IConnectionPoint_Release(cp); IConnectionPointContainer_Release(container);