msado15: Add ISupportErrorInfo support to _Connection.

Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alistair Leslie-Hughes 2019-12-12 16:42:05 +01:00 committed by Alexandre Julliard
parent cf7a432df5
commit 23b50cac89
2 changed files with 52 additions and 9 deletions

View File

@ -32,11 +32,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct connection struct connection
{ {
_Connection Connection_iface; _Connection Connection_iface;
LONG refs; ISupportErrorInfo ISupportErrorInfo_iface;
LONG refs;
ObjectStateEnum state; ObjectStateEnum state;
LONG timeout; LONG timeout;
}; };
static inline struct connection *impl_from_Connection( _Connection *iface ) static inline struct connection *impl_from_Connection( _Connection *iface )
@ -44,6 +44,11 @@ static inline struct connection *impl_from_Connection( _Connection *iface )
return CONTAINING_RECORD( iface, struct connection, Connection_iface ); return CONTAINING_RECORD( iface, struct connection, Connection_iface );
} }
static inline struct connection *impl_from_ISupportErrorInfo( ISupportErrorInfo *iface )
{
return CONTAINING_RECORD( iface, struct connection, ISupportErrorInfo_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 );
@ -64,13 +69,18 @@ static ULONG WINAPI connection_Release( _Connection *iface )
static HRESULT WINAPI connection_QueryInterface( _Connection *iface, REFIID riid, void **obj ) static HRESULT WINAPI connection_QueryInterface( _Connection *iface, REFIID riid, void **obj )
{ {
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj ); struct connection *connection = impl_from_Connection( iface );
TRACE( "%p, %s, %p\n", connection, debugstr_guid(riid), obj );
if (IsEqualGUID( riid, &IID__Connection ) || IsEqualGUID( riid, &IID_IDispatch ) || if (IsEqualGUID( riid, &IID__Connection ) || IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown )) IsEqualGUID( riid, &IID_IUnknown ))
{ {
*obj = iface; *obj = iface;
} }
else if(IsEqualGUID( riid, &IID_ISupportErrorInfo ))
{
*obj = &connection->ISupportErrorInfo_iface;
}
else else
{ {
FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
@ -339,12 +349,46 @@ static const struct _ConnectionVtbl connection_vtbl =
connection_Cancel connection_Cancel
}; };
static HRESULT WINAPI supporterror_QueryInterface( ISupportErrorInfo *iface, REFIID riid, void **obj )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
return connection_QueryInterface( &connection->Connection_iface, riid, obj );
}
static ULONG WINAPI supporterror_AddRef( ISupportErrorInfo *iface )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
return connection_AddRef( &connection->Connection_iface );
}
static ULONG WINAPI supporterror_Release( ISupportErrorInfo *iface )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
return connection_Release( &connection->Connection_iface );
}
static HRESULT WINAPI supporterror_InterfaceSupportsErrorInfo( ISupportErrorInfo *iface, REFIID riid )
{
struct connection *connection = impl_from_ISupportErrorInfo( iface );
FIXME( "%p, %s\n", connection, debugstr_guid(riid) );
return S_FALSE;
}
static const struct ISupportErrorInfoVtbl support_error_vtbl =
{
supporterror_QueryInterface,
supporterror_AddRef,
supporterror_Release,
supporterror_InterfaceSupportsErrorInfo
};
HRESULT Connection_create( void **obj ) HRESULT Connection_create( void **obj )
{ {
struct connection *connection; struct connection *connection;
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->refs = 1; connection->refs = 1;
connection->state = adStateClosed; connection->state = adStateClosed;
connection->timeout = 30; connection->timeout = 30;

View File

@ -414,9 +414,8 @@ static void test_Connection(void)
ok(hr == E_NOINTERFACE, "Unexpected IRunnableObject interface\n"); ok(hr == E_NOINTERFACE, "Unexpected IRunnableObject interface\n");
hr = _Connection_QueryInterface(connection, &IID_ISupportErrorInfo, (void**)&errorinfo); hr = _Connection_QueryInterface(connection, &IID_ISupportErrorInfo, (void**)&errorinfo);
todo_wine ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n"); ok(hr == S_OK, "Failed to get ISupportErrorInfo interface\n");
if (hr == S_OK) ISupportErrorInfo_Release(errorinfo);
ISupportErrorInfo_Release(errorinfo);
if (0) /* Crashes on windows */ if (0) /* Crashes on windows */
{ {