msado15: Add IConnectionPointContainer stub to _Connection.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49272
Signed-off-by: Aaro Altonen <a.altonen@hotmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aaro Altonen 2020-05-28 16:13:40 +03:00 committed by Alexandre Julliard
parent 6870f13704
commit 93dfc9b60e
3 changed files with 68 additions and 7 deletions

View File

@ -20,6 +20,8 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#define COBJMACROS #define COBJMACROS
#include "initguid.h"
#include "ocidl.h"
#include "objbase.h" #include "objbase.h"
#include "msado15_backcompat.h" #include "msado15_backcompat.h"
@ -32,12 +34,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct connection struct connection
{ {
_Connection Connection_iface; _Connection Connection_iface;
ISupportErrorInfo ISupportErrorInfo_iface; ISupportErrorInfo ISupportErrorInfo_iface;
LONG refs; IConnectionPointContainer IConnectionPointContainer_iface;
ObjectStateEnum state; LONG refs;
LONG timeout; ObjectStateEnum state;
WCHAR *datasource; LONG timeout;
WCHAR *datasource;
}; };
static inline struct connection *impl_from_Connection( _Connection *iface ) 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 ); 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 ) static ULONG WINAPI connection_AddRef( _Connection *iface )
{ {
struct connection *connection = impl_from_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; *obj = &connection->ISupportErrorInfo_iface;
} }
else if (IsEqualGUID( riid, &IID_IConnectionPointContainer ))
{
*obj = &connection->IConnectionPointContainer_iface;
}
else else
{ {
FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
@ -397,6 +409,50 @@ static const struct ISupportErrorInfoVtbl support_error_vtbl =
supporterror_InterfaceSupportsErrorInfo 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 ) HRESULT Connection_create( void **obj )
{ {
struct connection *connection; struct connection *connection;
@ -404,6 +460,7 @@ HRESULT Connection_create( void **obj )
if (!(connection = heap_alloc( sizeof(*connection) ))) return E_OUTOFMEMORY; if (!(connection = heap_alloc( sizeof(*connection) ))) return E_OUTOFMEMORY;
connection->Connection_iface.lpVtbl = &connection_vtbl; connection->Connection_iface.lpVtbl = &connection_vtbl;
connection->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl; connection->ISupportErrorInfo_iface.lpVtbl = &support_error_vtbl;
connection->IConnectionPointContainer_iface.lpVtbl = &connpointcontainer_vtbl;
connection->refs = 1; connection->refs = 1;
connection->state = adStateClosed; connection->state = adStateClosed;
connection->timeout = 30; connection->timeout = 30;

View File

@ -19,7 +19,6 @@
#include <stdarg.h> #include <stdarg.h>
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "initguid.h"
#define COBJMACROS #define COBJMACROS
#include "objbase.h" #include "objbase.h"
#include "rpcproxy.h" #include "rpcproxy.h"

View File

@ -666,6 +666,7 @@ static void test_Connection(void)
_Connection *connection; _Connection *connection;
IRunnableObject *runtime; IRunnableObject *runtime;
ISupportErrorInfo *errorinfo; ISupportErrorInfo *errorinfo;
IConnectionPointContainer *pointcontainer;
LONG state, timeout; LONG state, timeout;
BSTR str, str2; BSTR str, str2;
@ -679,6 +680,10 @@ static void test_Connection(void)
ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n"); ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
ISupportErrorInfo_Release(errorinfo); 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 */ if (0) /* Crashes on windows */
{ {
hr = _Connection_get_State(connection, NULL); hr = _Connection_get_State(connection, NULL);