webservices: Implement WsGetWriterPosition.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2016-06-21 14:04:47 +02:00 committed by Alexandre Julliard
parent 768197795d
commit 600e2e53c8
3 changed files with 66 additions and 1 deletions

View File

@ -1486,6 +1486,52 @@ static void test_WsMoveWriter(void)
WsFreeHeap( heap );
}
static void test_WsGetWriterPosition(void)
{
WS_HEAP *heap;
WS_XML_WRITER *writer;
WS_XML_BUFFER *buffer;
WS_XML_NODE_POSITION pos;
HRESULT hr;
hr = WsGetWriterPosition( NULL, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateHeap( 1 << 16, 0, NULL, 0, &heap, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsCreateWriter( NULL, 0, &writer, NULL ) ;
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetWriterPosition( writer, &pos, NULL );
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
/* writer must be set to an XML buffer */
hr = WsGetWriterPosition( writer, &pos, NULL );
todo_wine ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
hr = WsCreateXmlBuffer( heap, NULL, 0, &buffer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsSetOutputToBuffer( writer, buffer, NULL, 0, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsGetWriterPosition( writer, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
pos.buffer = pos.node = NULL;
hr = WsGetWriterPosition( writer, &pos, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( pos.buffer != NULL, "buffer not set\n" );
ok( pos.node != NULL, "node not set\n" );
WsFreeWriter( writer );
WsFreeHeap( heap );
}
START_TEST(writer)
{
test_WsCreateWriter();
@ -1505,4 +1551,5 @@ START_TEST(writer)
test_WsGetPrefixFromNamespace();
test_complex_struct_type();
test_WsMoveWriter();
test_WsGetWriterPosition();
}

View File

@ -87,7 +87,7 @@
@ stub WsGetSecurityTokenProperty
@ stub WsGetServiceHostProperty
@ stdcall WsGetServiceProxyProperty(ptr long ptr long ptr)
@ stub WsGetWriterPosition
@ stdcall WsGetWriterPosition(ptr ptr ptr)
@ stdcall WsGetWriterProperty(ptr long ptr long ptr)
@ stdcall WsGetXmlAttribute(ptr ptr ptr ptr ptr ptr)
@ stub WsInitializeMessage

View File

@ -1801,3 +1801,21 @@ HRESULT WINAPI WsMoveWriter( WS_XML_WRITER *handle, WS_MOVE_TO move, BOOL *found
return write_move_to( writer, move, found );
}
/**************************************************************************
* WsGetWriterPosition [webservices.@]
*/
HRESULT WINAPI WsGetWriterPosition( WS_XML_WRITER *handle, WS_XML_NODE_POSITION *pos, WS_ERROR *error )
{
struct writer *writer = (struct writer *)handle;
TRACE( "%p %p %p\n", handle, pos, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!writer || !pos) return E_INVALIDARG;
if (!writer->output_type) return WS_E_INVALID_OPERATION;
pos->buffer = (WS_XML_BUFFER *)writer->output_buf;
pos->node = writer->current;
return S_OK;
}