msado15: Implement _Stream_Open and _Stream_Close.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2019-12-09 11:24:29 +01:00 committed by Alexandre Julliard
parent 849ff3b60d
commit 5290480c89
3 changed files with 35 additions and 4 deletions

View File

@ -19,6 +19,8 @@
#ifndef _WINE_MSADO15_PRIVATE_H_
#define _WINE_MSADO15_PRIVATE_H_
#define MAKE_ADO_HRESULT( err ) MAKE_HRESULT( SEVERITY_ERROR, FACILITY_CONTROL, err )
HRESULT Connection_create( void ** ) DECLSPEC_HIDDEN;
HRESULT Recordset_create( void ** ) DECLSPEC_HIDDEN;
HRESULT Stream_create( void ** ) DECLSPEC_HIDDEN;

View File

@ -34,6 +34,7 @@ struct stream
{
_Stream Stream_iface;
LONG refs;
ObjectStateEnum state;
StreamTypeEnum type;
};
@ -198,14 +199,25 @@ static HRESULT WINAPI stream_Read( _Stream *iface, LONG size, VARIANT *val )
static HRESULT WINAPI stream_Open( _Stream *iface, VARIANT src, ConnectModeEnum mode, StreamOpenOptionsEnum options,
BSTR username, BSTR password )
{
FIXME( "%p, %s, %u, %d, %s, %p\n", iface, debugstr_variant(&src), mode, options, debugstr_w(username), password );
return E_NOTIMPL;
struct stream *stream = impl_from_Stream( iface );
FIXME( "%p, %s, %u, %d, %s, %p\n", stream, debugstr_variant(&src), mode, options, debugstr_w(username), password );
if (stream->state == adStateOpen) return MAKE_ADO_HRESULT( adErrObjectOpen );
stream->state = adStateOpen;
return S_OK;
}
static HRESULT WINAPI stream_Close( _Stream *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
struct stream *stream = impl_from_Stream( iface );
TRACE( "%p\n", stream );
if (stream->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
stream->state = adStateClosed;
return S_OK;
}
static HRESULT WINAPI stream_SkipLine( _Stream *iface )

View File

@ -23,11 +23,14 @@
#include <msado15_backcompat.h>
#include "wine/test.h"
#define MAKE_ADO_HRESULT( err ) MAKE_HRESULT( SEVERITY_ERROR, FACILITY_CONTROL, err )
static void test_Stream(void)
{
_Stream *stream;
StreamTypeEnum type;
LONG refs;
VARIANT missing;
HRESULT hr;
hr = CoCreateInstance( &CLSID_Stream, NULL, CLSCTX_INPROC_SERVER, &IID__Stream, (void **)&stream );
@ -51,6 +54,20 @@ static void test_Stream(void)
hr = _Stream_put_Type( stream, adTypeText );
ok( hr == S_OK, "got %08x\n", hr );
V_VT( &missing ) = VT_ERROR;
V_ERROR( &missing ) = DISP_E_PARAMNOTFOUND;
hr = _Stream_Open( stream, missing, adModeUnknown, adOpenStreamUnspecified, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = _Stream_Open( stream, missing, adModeUnknown, adOpenStreamUnspecified, NULL, NULL );
ok( hr == MAKE_ADO_HRESULT( adErrObjectOpen ), "got %08x\n", hr );
hr = _Stream_Close( stream );
ok( hr == S_OK, "got %08x\n", hr );
hr = _Stream_Close( stream );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
refs = _Stream_Release( stream );
ok( !refs, "got %d\n", refs );
}