Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49272 Signed-off-by: Aaro Altonen a.altonen@hotmail.com --- dlls/msado15/connection.c | 67 +++++++++++++++++++++++++++++++--- dlls/msado15/tests/msado15.c | 5 +++ include/msado15_backcompat.idl | 2 +- 3 files changed, 67 insertions(+), 7 deletions(-)
diff --git a/dlls/msado15/connection.c b/dlls/msado15/connection.c index 2f0aa0c8df..5d8d8cb72b 100644 --- a/dlls/msado15/connection.c +++ b/dlls/msado15/connection.c @@ -32,12 +32,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 +51,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 +89,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 +407,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 +458,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/tests/msado15.c b/dlls/msado15/tests/msado15.c index 9834f55863..349363b7c5 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); diff --git a/include/msado15_backcompat.idl b/include/msado15_backcompat.idl index 68fda6ab21..33e76c2da3 100644 --- a/include/msado15_backcompat.idl +++ b/include/msado15_backcompat.idl @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-import "oaidl.idl"; +import "ocidl.idl";
interface _ADO; interface _Collection;
--- a/include/msado15_backcompat.idl +++ b/include/msado15_backcompat.idl @@ -16,7 +16,7 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-import "oaidl.idl"; +import "ocidl.idl";
We should have the same header dependencies as native. You can instead include ocidl.h in connection.c. You also need to move the initguid.h include from main.c to connection.c to avoid undefined reference errors.