[PATCH 2/2] msado15: Implement IConnectionPointContainer_FindConnectionPoint.

Aaro Altonen a.altonen at hotmail.com
Mon Jun 1 06:42:18 CDT 2020


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49303
Signed-off-by: Aaro Altonen <a.altonen at hotmail.com>
---
 dlls/msado15/connection.c    | 17 +++++++++++++++--
 dlls/msado15/tests/msado15.c | 27 +++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c
index be201cb90b..9e8c05522e 100644
--- a/dlls/msado15/connection.c
+++ b/dlls/msado15/connection.c
@@ -23,6 +23,7 @@
 #include "initguid.h"
 #include "ocidl.h"
 #include "objbase.h"
+#include "olectl.h"
 #include "msado15_backcompat.h"
 
 #include "wine/debug.h"
@@ -455,8 +456,20 @@ static HRESULT WINAPI connpointcontainer_FindConnectionPoint( IConnectionPointCo
         REFIID riid, IConnectionPoint **point )
 {
     struct connection *connection = impl_from_IConnectionPointContainer( iface );
-    FIXME( "%p, %s, %p\n", connection, debugstr_guid( riid ), point );
-    return E_NOTIMPL;
+
+    TRACE( "%p, %s %p\n", connection, debugstr_guid( riid ), point );
+
+    if (!point) return E_POINTER;
+
+    if (IsEqualIID( riid, connection->cp_connev.riid ))
+    {
+        *point = &connection->cp_connev.IConnectionPoint_iface;
+        IConnectionPoint_AddRef( *point );
+        return S_OK;
+    }
+
+    FIXME( "unsupported connection point %s\n", debugstr_guid( riid ) );
+    return CONNECT_E_NOCONNECTION;
 }
 
 static const struct IConnectionPointContainerVtbl connpointcontainer_vtbl =
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index 349363b7c5..a8d2afdd41 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -20,6 +20,7 @@
 #define COBJMACROS
 #include <initguid.h>
 #include <oledb.h>
+#include <olectl.h>
 #include <msado15_backcompat.h>
 #include "wine/test.h"
 
@@ -805,10 +806,36 @@ static void test_Command(void)
     _Command_Release( command );
 }
 
+static void test_ConnectionPoint(void)
+{
+    HRESULT hr;
+    ULONG refs;
+    IConnectionPoint *point;
+    IConnectionPointContainer *pointcontainer;
+
+    hr = CoCreateInstance( &CLSID_Connection, NULL, CLSCTX_INPROC_SERVER,
+            &IID_IConnectionPointContainer, (void**)&pointcontainer );
+
+    hr = IConnectionPointContainer_FindConnectionPoint( pointcontainer, &DIID_ConnectionEvents, NULL );
+    ok( hr == E_POINTER, "got %08x\n", hr );
+
+    hr = IConnectionPointContainer_FindConnectionPoint( pointcontainer, &DIID_RecordsetEvents, &point );
+    ok( hr == CONNECT_E_NOCONNECTION, "got %08x\n", hr );
+
+    hr = IConnectionPointContainer_FindConnectionPoint( pointcontainer, &DIID_ConnectionEvents, &point );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    refs = IConnectionPoint_Release( point );
+    ok( refs == 1, "got %u", refs );
+
+    IConnectionPointContainer_Release( pointcontainer );
+}
+
 START_TEST(msado15)
 {
     CoInitialize( NULL );
     test_Connection();
+    test_ConnectionPoint();
     test_Fields();
     test_Recordset();
     test_Stream();
-- 
2.26.2




More information about the wine-devel mailing list