msado15: Add a stub _Stream implementation.

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-06 14:54:20 +01:00 committed by Alexandre Julliard
parent db08f0c3f6
commit e54fc1a2de
5 changed files with 328 additions and 1 deletions

View File

@ -6,7 +6,8 @@ EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
connection.c \
main.c \
recordset.c
recordset.c \
stream.c
IDL_SRCS = \
msado15_classes.idl \

View File

@ -119,6 +119,7 @@ static const struct IClassFactoryVtbl msadocf_vtbl =
static struct msadocf connection_cf = { { &msadocf_vtbl }, Connection_create };
static struct msadocf recordset_cf = { { &msadocf_vtbl }, Recordset_create };
static struct msadocf stream_cf = { { &msadocf_vtbl }, Stream_create };
/***********************************************************************
* DllGetClassObject
@ -137,6 +138,10 @@ HRESULT WINAPI DllGetClassObject( REFCLSID clsid, REFIID iid, void **obj )
{
cf = &recordset_cf.IClassFactory_iface;
}
else if (IsEqualGUID( clsid, &CLSID_Stream ))
{
cf = &stream_cf.IClassFactory_iface;
}
if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
return IClassFactory_QueryInterface( cf, iid, obj );
}

View File

@ -33,3 +33,11 @@ coclass Connection { interface _Connection; }
uuid(00000535-0000-0010-8000-00aa006d2ea4)
]
coclass Recordset { interface _Recordset; }
[
threading(both),
progid("ADODB.Stream.6.0"),
vi_progid("ADODB.Stream"),
uuid(00000566-0000-0010-8000-00aa006d2ea4)
]
coclass Stream { interface _Stream; }

View File

@ -21,5 +21,6 @@
HRESULT Connection_create( void ** ) DECLSPEC_HIDDEN;
HRESULT Recordset_create( void ** ) DECLSPEC_HIDDEN;
HRESULT Stream_create( void ** ) DECLSPEC_HIDDEN;
#endif /* _WINE_MSADO15_PRIVATE_H_ */

312
dlls/msado15/stream.c Normal file
View File

@ -0,0 +1,312 @@
/*
* Copyright 2019 Hans Leidekker for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#define COBJMACROS
#include "objbase.h"
#include "msado15_backcompat.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "msado15_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(msado15);
struct stream
{
_Stream Stream_iface;
LONG refs;
};
static inline struct stream *impl_from_Stream( _Stream *iface )
{
return CONTAINING_RECORD( iface, struct stream, Stream_iface );
}
static ULONG WINAPI stream_AddRef( _Stream *iface )
{
struct stream *stream = impl_from_Stream( iface );
return InterlockedIncrement( &stream->refs );
}
static ULONG WINAPI stream_Release( _Stream *iface )
{
struct stream *stream = impl_from_Stream( iface );
LONG refs = InterlockedDecrement( &stream->refs );
if (!refs)
{
TRACE( "destroying %p\n", stream );
heap_free( stream );
}
return refs;
}
static HRESULT WINAPI stream_QueryInterface( _Stream *iface, REFIID riid, void **obj )
{
TRACE( "%p, %s, %p\n", iface, debugstr_guid(riid), obj );
if (IsEqualGUID( riid, &IID__Stream ) || IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ))
{
*obj = iface;
}
else
{
FIXME( "interface %s not implemented\n", debugstr_guid(riid) );
return E_NOINTERFACE;
}
stream_AddRef( iface );
return S_OK;
}
static HRESULT WINAPI stream_GetTypeInfoCount( _Stream *iface, UINT *count )
{
FIXME( "%p, %p\n", iface, count );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_GetTypeInfo( _Stream *iface, UINT index, LCID lcid, ITypeInfo **info )
{
FIXME( "%p, %u, %u, %p\n", iface, index, lcid, info );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_GetIDsOfNames( _Stream *iface, REFIID riid, LPOLESTR *names, UINT count,
LCID lcid, DISPID *dispid )
{
FIXME( "%p, %s, %p, %u, %u, %p\n", iface, debugstr_guid(riid), names, count, lcid, dispid );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Invoke( _Stream *iface, DISPID member, REFIID riid, LCID lcid, WORD flags,
DISPPARAMS *params, VARIANT *result, EXCEPINFO *excep_info, UINT *arg_err )
{
FIXME( "%p, %d, %s, %d, %d, %p, %p, %p, %p\n", iface, member, debugstr_guid(riid), lcid, flags, params,
result, excep_info, arg_err );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_Size( _Stream *iface, LONG *size )
{
FIXME( "%p, %p\n", iface, size );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_EOS( _Stream *iface, VARIANT_BOOL *eos )
{
FIXME( "%p, %p\n", iface, eos );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_Position( _Stream *iface, LONG *pos )
{
FIXME( "%p, %p\n", iface, pos );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_put_Position( _Stream *iface, LONG pos )
{
FIXME( "%p, %d\n", iface, pos );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_Type( _Stream *iface, StreamTypeEnum *type )
{
FIXME( "%p, %p\n", iface, type );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_put_Type( _Stream *iface, StreamTypeEnum type )
{
FIXME( "%p, %u\n", iface, type );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_LineSeparator( _Stream *iface, LineSeparatorEnum *sep )
{
FIXME( "%p, %p\n", iface, sep );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_put_LineSeparator( _Stream *iface, LineSeparatorEnum sep )
{
FIXME( "%p, %d\n", iface, sep );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_State( _Stream *iface, ObjectStateEnum *state )
{
FIXME( "%p, %p\n", iface, state );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_Mode( _Stream *iface, ConnectModeEnum *mode )
{
FIXME( "%p, %p\n", iface, mode );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_put_Mode( _Stream *iface, ConnectModeEnum mode )
{
FIXME( "%p, %u\n", iface, mode );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_get_Charset( _Stream *iface, BSTR *charset )
{
FIXME( "%p, %p\n", iface, charset );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_put_Charset( _Stream *iface, BSTR charset )
{
FIXME( "%p, %s\n", iface, debugstr_w(charset) );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Read( _Stream *iface, LONG size, VARIANT *val )
{
FIXME( "%p, %d, %p\n", iface, size, val );
return E_NOTIMPL;
}
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;
}
static HRESULT WINAPI stream_Close( _Stream *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_SkipLine( _Stream *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Write( _Stream *iface, VARIANT buf )
{
FIXME( "%p, %s\n", iface, debugstr_variant(&buf) );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_SetEOS( _Stream *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_CopyTo( _Stream *iface, _Stream *dst, LONG size )
{
FIXME( "%p, %p, %d\n", iface, dst, size );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Flush( _Stream *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_SaveToFile( _Stream *iface, BSTR filename, SaveOptionsEnum options )
{
FIXME( "%p, %s, %u\n", iface, debugstr_w(filename), options );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_LoadFromFile( _Stream *iface, BSTR filename )
{
FIXME( "%p, %s\n", iface, debugstr_w(filename) );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_ReadText( _Stream *iface, LONG len, BSTR *ret )
{
FIXME( "%p, %d, %p\n", iface, len, ret );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_WriteText( _Stream *iface, BSTR data, StreamWriteEnum options )
{
FIXME( "%p, %p, %u\n", iface, debugstr_w(data), options );
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Cancel( _Stream *iface )
{
FIXME( "%p\n", iface );
return E_NOTIMPL;
}
static const struct _StreamVtbl stream_vtbl =
{
stream_QueryInterface,
stream_AddRef,
stream_Release,
stream_GetTypeInfoCount,
stream_GetTypeInfo,
stream_GetIDsOfNames,
stream_Invoke,
stream_get_Size,
stream_get_EOS,
stream_get_Position,
stream_put_Position,
stream_get_Type,
stream_put_Type,
stream_get_LineSeparator,
stream_put_LineSeparator,
stream_get_State,
stream_get_Mode,
stream_put_Mode,
stream_get_Charset,
stream_put_Charset,
stream_Read,
stream_Open,
stream_Close,
stream_SkipLine,
stream_Write,
stream_SetEOS,
stream_CopyTo,
stream_Flush,
stream_SaveToFile,
stream_LoadFromFile,
stream_ReadText,
stream_WriteText,
stream_Cancel
};
HRESULT Stream_create( void **obj )
{
struct stream *stream;
if (!(stream = heap_alloc_zero( sizeof(*stream) ))) return E_OUTOFMEMORY;
stream->Stream_iface.lpVtbl = &stream_vtbl;
stream->refs = 1;
*obj = &stream->Stream_iface;
TRACE( "returning iface %p\n", *obj );
return S_OK;
}