From: Alistair Leslie-Hughes leslie_alistair@hotmail.com
--- dlls/msado15/command.c | 66 ++++++++++++++++++++++++++++++++++++ dlls/msado15/tests/msado15.c | 5 +++ 2 files changed, 71 insertions(+)
diff --git a/dlls/msado15/command.c b/dlls/msado15/command.c index 152528308e0..762a13c8776 100644 --- a/dlls/msado15/command.c +++ b/dlls/msado15/command.c @@ -32,6 +32,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15); struct command { _Command Command_iface; + ADOCommandConstruction ADOCommandConstruction_iface; LONG ref; CommandTypeEnum type; BSTR text; @@ -43,8 +44,14 @@ static inline struct command *impl_from_Command( _Command *iface ) return CONTAINING_RECORD( iface, struct command, Command_iface ); }
+static inline struct command *impl_from_ADOCommandConstruction( ADOCommandConstruction *iface ) +{ + return CONTAINING_RECORD( iface, struct command, ADOCommandConstruction_iface ); +} + static HRESULT WINAPI command_QueryInterface( _Command *iface, REFIID riid, void **obj ) { + struct command *command = impl_from_Command( iface ); TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj );
*obj = NULL; @@ -58,6 +65,10 @@ static HRESULT WINAPI command_QueryInterface( _Command *iface, REFIID riid, void { *obj = iface; } + else if (IsEqualIID(riid, &IID_ADOCommandConstruction)) + { + *obj = &command->ADOCommandConstruction_iface; + } else { FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); @@ -374,12 +385,67 @@ static const struct _CommandVtbl command_vtbl = command_get_NamedParameters };
+static HRESULT WINAPI construction_QueryInterface(ADOCommandConstruction *iface, REFIID riid, void **obj) +{ + TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj ); + + *obj = NULL; + + if (IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_ADOCommandConstruction)) + { + *obj = iface; + } + else + { + FIXME( "interface %s not implemented\n", debugstr_guid(riid) ); + return E_NOINTERFACE; + } + + ADOCommandConstruction_AddRef( iface ); + return S_OK; +} + +static ULONG WINAPI construction_AddRef(ADOCommandConstruction *iface) +{ + struct command *command = impl_from_ADOCommandConstruction( iface ); + return _Command_AddRef(&command->Command_iface); +} + +static ULONG WINAPI construction_Release(ADOCommandConstruction *iface) +{ + struct command *command = impl_from_ADOCommandConstruction( iface ); + return _Command_Release(&command->Command_iface); +} + +static HRESULT WINAPI construction_get_OLEDBCommand(ADOCommandConstruction *iface, IUnknown **command) +{ + FIXME("%p, %p\n", iface, command); + return E_NOTIMPL; +} + +static HRESULT WINAPI construction_put_OLEDBCommand(ADOCommandConstruction *iface, IUnknown *command) +{ + FIXME("%p, %p\n", iface, command); + return E_NOTIMPL; +} + +static ADOCommandConstructionVtbl construct_vtbl = +{ + construction_QueryInterface, + construction_AddRef, + construction_Release, + construction_get_OLEDBCommand, + construction_put_OLEDBCommand +}; + HRESULT Command_create( void **obj ) { struct command *command;
if (!(command = malloc( sizeof(*command) ))) return E_OUTOFMEMORY; command->Command_iface.lpVtbl = &command_vtbl; + command->ADOCommandConstruction_iface.lpVtbl = &construct_vtbl; command->type = adCmdUnknown; command->text = NULL; command->connection = NULL; diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c index b6c1c391e71..8826fb5b0e8 100644 --- a/dlls/msado15/tests/msado15.c +++ b/dlls/msado15/tests/msado15.c @@ -1331,6 +1331,7 @@ static void test_Command(void) CommandTypeEnum cmd_type = adCmdUnspecified; BSTR cmd_text = (BSTR)"test"; _Connection *connection; + ADOCommandConstruction *adocommand;
hr = CoCreateInstance( &CLSID_Command, NULL, CLSCTX_INPROC_SERVER, &IID__Command, (void **)&command ); ok( hr == S_OK, "got %08lx\n", hr ); @@ -1347,6 +1348,10 @@ static void test_Command(void) ok( hr == S_OK, "got %08lx\n", hr ); Command25_Release( command25 );
+ hr = _Command_QueryInterface( command, &IID_ADOCommandConstruction, (void **)&adocommand ); + ok( hr == S_OK, "got %08lx\n", hr ); + ADOCommandConstruction_Release( adocommand ); + hr = _Command_get_CommandType( command, &cmd_type ); ok( hr == S_OK, "got %08lx\n", hr ); ok( cmd_type == adCmdUnknown, "got %08x\n", cmd_type );