From 93dfc9b60e849a6512d2899f2300d86f4f4140c8 Mon Sep 17 00:00:00 2001 From: Aaro Altonen Date: Thu, 28 May 2020 16:13:40 +0300 Subject: [PATCH] msado15: Add IConnectionPointContainer stub to _Connection. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49272 Signed-off-by: Aaro Altonen Signed-off-by: Alexandre Julliard --- dlls/msado15/connection.c | 69 ++++++++++++++++++++++++++++++++---- dlls/msado15/main.c | 1 - dlls/msado15/tests/msado15.c | 5 +++ 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c index 2f0aa0c8dfc..8ed39a3a518 100644 --- a/dlls/msado15/connection.c +++ b/dlls/msado15/connection.c @@ -20,6 +20,8 @@ #include "windef.h" #include "winbase.h" #define COBJMACROS +#include "initguid.h" +#include "ocidl.h" #include "objbase.h" #include "msado15_backcompat.h" @@ -32,12 +34,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15); struct connection { - _Connection Connection_iface; - ISupportErrorInfo ISupportErrorInfo_iface; - LONG refs; - ObjectStateEnum state; - LONG timeout; - WCHAR *datasource; + _Connection Connection_iface; + ISupportErrorInfo ISupportErrorInfo_iface; + IConnectionPointContainer IConnectionPointContainer_iface; + LONG refs; + ObjectStateEnum state; + LONG timeout; + WCHAR *datasource; }; static inline struct connection *impl_from_Connection( _Connection *iface ) @@ -50,6 +53,11 @@ static inline struct connection *impl_from_ISupportErrorInfo( ISupportErrorInfo return CONTAINING_RECORD( iface, struct connection, ISupportErrorInfo_iface ); } +static inline struct connection *impl_from_IConnectionPointContainer( IConnectionPointContainer *iface ) +{ + return CONTAINING_RECORD( iface, struct connection, IConnectionPointContainer_iface ); +} + static ULONG WINAPI connection_AddRef( _Connection *iface ) { struct connection *connection = impl_from_Connection( iface ); @@ -83,6 +91,10 @@ static HRESULT WINAPI connection_QueryInterface( _Connection *iface, REFIID riid { *obj = &connection->ISupportErrorInfo_iface; } + else if (IsEqualGUID( riid, &IID_IConnectionPointContainer )) + { + *obj = &connection->IConnectionPointContainer_iface; + } else { FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); @@ -397,6 +409,50 @@ static const struct ISupportErrorInfoVtbl support_error_vtbl = supporterror_InterfaceSupportsErrorInfo }; +static HRESULT WINAPI connpointcontainer_QueryInterface( IConnectionPointContainer *iface, + REFIID riid, void **obj ) +{ + struct connection *connection = impl_from_IConnectionPointContainer( iface ); + return connection_QueryInterface( &connection->Connection_iface, riid, obj ); +} + +static ULONG WINAPI connpointcontainer_AddRef( IConnectionPointContainer *iface ) +{ + struct connection *connection = impl_from_IConnectionPointContainer( iface ); + return connection_AddRef( &connection->Connection_iface ); +} + +static ULONG WINAPI connpointcontainer_Release( IConnectionPointContainer *iface ) +{ + struct connection *connection = impl_from_IConnectionPointContainer( iface ); + return connection_Release( &connection->Connection_iface ); +} + +static HRESULT WINAPI connpointcontainer_EnumConnectionPoints( IConnectionPointContainer *iface, + IEnumConnectionPoints **points ) +{ + struct connection *connection = impl_from_IConnectionPointContainer( iface ); + FIXME( "%p, %p\n", connection, points ); + return E_NOTIMPL; +} + +static HRESULT WINAPI connpointcontainer_FindConnectionPoint( IConnectionPointContainer *iface, + REFIID riid, IConnectionPoint **point ) +{ + struct connection *connection = impl_from_IConnectionPointContainer( iface ); + FIXME( "%p, %s, %p\n", connection, debugstr_guid( riid ), point ); + return E_NOTIMPL; +} + +static const struct IConnectionPointContainerVtbl connpointcontainer_vtbl = +{ + connpointcontainer_QueryInterface, + connpointcontainer_AddRef, + connpointcontainer_Release, + connpointcontainer_EnumConnectionPoints, + connpointcontainer_FindConnectionPoint +}; + HRESULT Connection_create( void **obj ) { struct connection *connection; @@ -404,6 +460,7 @@ HRESULT Connection_create( void **obj ) if (!(connection = heap_alloc( sizeof(*connection) ))) return E_OUTOFMEMORY; connection->Connection_iface.lpVtbl = &connection_vtbl; connection->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl; + connection->IConnectionPointContainer_iface.lpVtbl = &connpointcontainer_vtbl; connection->refs = 1; connection->state = adStateClosed; connection->timeout = 30; diff --git a/dlls/msado15/main.c b/dlls/msado15/main.c index 3115474b843..770a02fc59d 100644 --- a/dlls/msado15/main.c +++ b/dlls/msado15/main.c @@ -19,7 +19,6 @@ #include #include "windef.h" #include "winbase.h" -#include "initguid.h" #define COBJMACROS #include "objbase.h" #include "rpcproxy.h" diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index 9834f55863e..349363b7c56 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -666,6 +666,7 @@ static void test_Connection(void) _Connection *connection; IRunnableObject *runtime; ISupportErrorInfo *errorinfo; + IConnectionPointContainer *pointcontainer; LONG state, timeout; BSTR str, str2; @@ -679,6 +680,10 @@ static void test_Connection(void) ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n"); ISupportErrorInfo_Release(errorinfo); + hr = _Connection_QueryInterface(connection, &IID_IConnectionPointContainer, (void**)&pointcontainer); + ok(hr == S_OK, "Failed to get IConnectionPointContainer interface %08x\n", hr); + IConnectionPointContainer_Release(pointcontainer); + if (0) /* Crashes on windows */ { hr = _Connection_get_State(connection, NULL);