msado15: Implement _Stream_get_Size.

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:33 +01:00 committed by Alexandre Julliard
parent 06d055f0e6
commit 93a7a9037a
2 changed files with 21 additions and 3 deletions

View File

@ -113,8 +113,13 @@ static HRESULT WINAPI stream_Invoke( _Stream *iface, DISPID member, REFIID riid,
static HRESULT WINAPI stream_get_Size( _Stream *iface, LONG *size )
{
FIXME( "%p, %p\n", iface, size );
return E_NOTIMPL;
struct stream *stream = impl_from_Stream( iface );
TRACE( "%p, %p\n", stream, size );
if (stream->state == adStateClosed) return MAKE_ADO_HRESULT( adErrObjectClosed );
*size = stream->size;
return S_OK;
}
static HRESULT WINAPI stream_get_EOS( _Stream *iface, VARIANT_BOOL *eos )

View File

@ -50,7 +50,7 @@ static void test_Stream(void)
{
_Stream *stream;
StreamTypeEnum type;
LONG refs, pos;
LONG refs, size, pos;
ObjectStateEnum state;
VARIANT missing, val;
HRESULT hr;
@ -58,6 +58,9 @@ static void test_Stream(void)
hr = CoCreateInstance( &CLSID_Stream, NULL, CLSCTX_INPROC_SERVER, &IID__Stream, (void **)&stream );
ok( hr == S_OK, "got %08x\n", hr );
hr = _Stream_get_Size( stream, &size );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
hr = _Stream_get_Position( stream, &pos );
ok( hr == MAKE_ADO_HRESULT( adErrObjectClosed ), "got %08x\n", hr );
@ -103,11 +106,21 @@ static void test_Stream(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( state == adStateOpen, "got %u\n", state );
size = -1;
hr = _Stream_get_Size( stream, &size );
ok( hr == S_OK, "got %08x\n", hr );
ok( !size, "got %d\n", size );
pos = -1;
hr = _Stream_get_Position( stream, &pos );
ok( hr == S_OK, "got %08x\n", hr );
ok( !pos, "got %d\n", pos );
size = -1;
hr = _Stream_get_Size( stream, &size );
ok( hr == S_OK, "got %08x\n", hr );
ok( !size, "got %d\n", size );
hr = _Stream_Read( stream, 2, &val );
ok( hr == MAKE_ADO_HRESULT( adErrIllegalOperation ), "got %08x\n", hr );