Alistair Leslie-Hughes : msado15: Implement _Command get/putref ActiveConnection.
Alexandre Julliard
julliard at winehq.org
Fri Oct 9 16:00:44 CDT 2020
Module: wine
Branch: master
Commit: aff59389658461630206c3683d84bd754555bc30
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aff59389658461630206c3683d84bd754555bc30
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Fri Oct 9 18:57:15 2020 +1100
msado15: Implement _Command get/putref ActiveConnection.
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msado15/command.c | 20 ++++++++++++++++----
dlls/msado15/tests/msado15.c | 9 +++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/dlls/msado15/command.c b/dlls/msado15/command.c
index eb7b3a035e..d19108a1a2 100644
--- a/dlls/msado15/command.c
+++ b/dlls/msado15/command.c
@@ -35,6 +35,7 @@ struct command
LONG ref;
CommandTypeEnum type;
BSTR text;
+ _Connection *connection;
};
static inline struct command *impl_from_Command( _Command *iface )
@@ -80,6 +81,7 @@ static ULONG WINAPI command_Release( _Command *iface )
if (!ref)
{
TRACE( "destroying %p\n", command );
+ if (command->connection) _Connection_Release(command->connection);
heap_free( command->text );
heap_free( command );
}
@@ -121,14 +123,23 @@ static HRESULT WINAPI command_get_Properties( _Command *iface, Properties **prop
static HRESULT WINAPI command_get_ActiveConnection( _Command *iface, _Connection **connection )
{
- FIXME( "%p, %p\n", iface, connection );
- return E_NOTIMPL;
+ struct command *command = impl_from_Command( iface );
+ TRACE( "%p, %p\n", iface, connection );
+
+ *connection = command->connection;
+ if (command->connection) _Connection_AddRef(command->connection);
+ return S_OK;
}
static HRESULT WINAPI command_putref_ActiveConnection( _Command *iface, _Connection *connection )
{
- FIXME( "%p, %p\n", iface, connection );
- return E_NOTIMPL;
+ struct command *command = impl_from_Command( iface );
+ TRACE( "%p, %p\n", iface, connection );
+
+ if (command->connection) _Connection_Release(command->connection);
+ command->connection = connection;
+ if (command->connection) _Connection_AddRef(command->connection);
+ return S_OK;
}
static HRESULT WINAPI command_put_ActiveConnection( _Command *iface, VARIANT connection )
@@ -343,6 +354,7 @@ HRESULT Command_create( void **obj )
command->Command_iface.lpVtbl = &command_vtbl;
command->type = adCmdUnknown;
command->text = NULL;
+ command->connection = NULL;
command->ref = 1;
*obj = &command->Command_iface;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index efcee58c56..378c2eb918 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -850,6 +850,7 @@ static void test_Command(void)
Command25 *command25;
CommandTypeEnum cmd_type = adCmdUnspecified;
BSTR cmd_text = (BSTR)"test";
+ _Connection *connection;
hr = CoCreateInstance( &CLSID_Command, NULL, CLSCTX_INPROC_SERVER, &IID__Command, (void **)&command );
ok( hr == S_OK, "got %08x\n", hr );
@@ -903,6 +904,14 @@ static void test_Command(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( !wcscmp( L"test", cmd_text ), "got %p\n", wine_dbgstr_w( cmd_text ) );
+ connection = (_Connection*)0xdeadbeef;
+ hr = _Command_get_ActiveConnection( command, &connection );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( connection == NULL, "got %p\n", connection );
+
+ hr = _Command_putref_ActiveConnection( command, NULL );
+ ok( hr == S_OK, "got %08x\n", hr );
+
_Command_Release( command );
}
More information about the wine-cvs
mailing list