Aaro Altonen : msado15: Implement _Command get/put CommandType.
Alexandre Julliard
julliard at winehq.org
Tue Nov 10 13:46:21 CST 2020
Module: wine
Branch: stable
Commit: baa0431972184441b7bbdcbde5f2b020d9de57e8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=baa0431972184441b7bbdcbde5f2b020d9de57e8
Author: Aaro Altonen <a.altonen at hotmail.com>
Date: Mon May 25 17:01:30 2020 +0300
msado15: Implement _Command get/put CommandType.
Signed-off-by: Aaro Altonen <a.altonen at hotmail.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 6255b031af691988f96c4e648c4f0975575f0487)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/msado15/command.c | 34 ++++++++++++++++++++++++++++------
dlls/msado15/tests/msado15.c | 13 +++++++++++++
2 files changed, 41 insertions(+), 6 deletions(-)
diff --git a/dlls/msado15/command.c b/dlls/msado15/command.c
index a96fd739908..9081f1554f3 100644
--- a/dlls/msado15/command.c
+++ b/dlls/msado15/command.c
@@ -31,8 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct command
{
- _Command Command_iface;
- LONG ref;
+ _Command Command_iface;
+ LONG ref;
+ CommandTypeEnum type;
};
static inline struct command *impl_from_Command( _Command *iface )
@@ -193,14 +194,34 @@ static HRESULT WINAPI command_get_Parameters( _Command *iface, Parameters **para
static HRESULT WINAPI command_put_CommandType( _Command *iface, CommandTypeEnum type )
{
- FIXME( "%p, %d\n", iface, type );
- return E_NOTIMPL;
+ struct command *command = impl_from_Command( iface );
+
+ TRACE( "%p, %d\n", iface, type );
+
+ switch (type)
+ {
+ case adCmdUnspecified:
+ case adCmdUnknown:
+ case adCmdText:
+ case adCmdTable:
+ case adCmdStoredProc:
+ case adCmdFile:
+ case adCmdTableDirect:
+ command->type = type;
+ return S_OK;
+ }
+
+ return MAKE_ADO_HRESULT( adErrInvalidArgument );
}
static HRESULT WINAPI command_get_CommandType( _Command *iface, CommandTypeEnum *type )
{
- FIXME( "%p, %p\n", iface, type );
- return E_NOTIMPL;
+ struct command *command = impl_from_Command( iface );
+
+ TRACE( "%p, %p\n", iface, type );
+
+ *type = command->type;
+ return S_OK;
}
static HRESULT WINAPI command_get_Name(_Command *iface, BSTR *name)
@@ -305,6 +326,7 @@ HRESULT Command_create( void **obj )
if (!(command = heap_alloc( sizeof(*command) ))) return E_OUTOFMEMORY;
command->Command_iface.lpVtbl = &command_vtbl;
+ command->type = adCmdUnknown;
command->ref = 1;
*obj = &command->Command_iface;
diff --git a/dlls/msado15/tests/msado15.c b/dlls/msado15/tests/msado15.c
index afdf0dfb6aa..e17cda4fdb1 100644
--- a/dlls/msado15/tests/msado15.c
+++ b/dlls/msado15/tests/msado15.c
@@ -706,6 +706,7 @@ static void test_Command(void)
_ADO *ado;
Command15 *command15;
Command25 *command25;
+ CommandTypeEnum cmd_type = adCmdUnspecified;
hr = CoCreateInstance( &CLSID_Command, NULL, CLSCTX_INPROC_SERVER, &IID__Command, (void **)&command );
ok( hr == S_OK, "got %08x\n", hr );
@@ -722,6 +723,18 @@ static void test_Command(void)
ok( hr == S_OK, "got %08x\n", hr );
Command25_Release( command25 );
+ hr = _Command_get_CommandType( command, &cmd_type );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( cmd_type == adCmdUnknown, "got %08x\n", cmd_type );
+
+ _Command_put_CommandType( command, adCmdText );
+ hr = _Command_get_CommandType( command, &cmd_type );
+ ok( hr == S_OK, "got %08x\n", hr );
+ ok( cmd_type == adCmdText, "got %08x\n", cmd_type );
+
+ hr = _Command_put_CommandType( command, 0xdeadbeef );
+ ok( hr == MAKE_ADO_HRESULT( adErrInvalidArgument ), "got %08x\n", hr );
+
_Command_Release( command );
}
More information about the wine-cvs
mailing list