diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c index ca59f33534e..7ae4e346908 100644 --- a/dlls/webservices/reader.c +++ b/dlls/webservices/reader.c @@ -565,6 +565,16 @@ HRESULT WINAPI WsGetReaderProperty( WS_XML_READER *handle, WS_XML_READER_PROPERT return get_reader_prop( reader, id, buf, size ); } +/************************************************************************** + * WsGetXmlAttribute [webservices.@] + */ +HRESULT WINAPI WsGetXmlAttribute( WS_XML_READER *handle, const WS_XML_STRING *attr, + WS_HEAP *heap, WCHAR **str, ULONG *len, WS_ERROR *error ) +{ + FIXME( "%p %p %p %p %p %p: stub\n", handle, debugstr_xmlstr(attr), heap, str, len, error ); + return E_NOTIMPL; +} + static WS_XML_STRING *alloc_xml_string( const char *data, ULONG len ) { WS_XML_STRING *ret; diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c index f0c70776ccd..03dd569a081 100644 --- a/dlls/webservices/tests/reader.c +++ b/dlls/webservices/tests/reader.c @@ -58,6 +58,9 @@ static const char data7[] = static const char data8[] = "test"; +static const char data9[] = + "test"; + static void test_WsCreateError(void) { HRESULT hr; @@ -1286,6 +1289,62 @@ static void test_WsReadType(void) WsFreeHeap( heap ); } +static void test_WsGetXmlAttribute(void) +{ + static const WCHAR valueW[] = {'v','a','l','u','e',0}; + HRESULT hr; + WS_XML_READER *reader; + WS_XML_STRING xmlstr; + WS_HEAP *heap; + WCHAR *str; + ULONG count; + int found; + + hr = WsCreateHeap( 1 << 16, 0, NULL, 0, &heap, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsCreateReader( NULL, 0, &reader, NULL ) ; + ok( hr == S_OK, "got %08x\n", hr ); + + hr = set_input( reader, data9, sizeof(data9) - 1 ); + ok( hr == S_OK, "got %08x\n", hr ); + + hr = WsFillReader( reader, sizeof(data9) - 1, NULL, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + + found = -1; + hr = WsReadToStartElement( reader, NULL, NULL, &found, NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( found == TRUE, "got %d\n", found ); + + xmlstr.bytes = (BYTE *)"attr"; + xmlstr.length = sizeof("attr") - 1; + xmlstr.dictionary = NULL; + xmlstr.id = 0; + str = NULL; + count = 0; + hr = WsGetXmlAttribute( reader, &xmlstr, heap, &str, &count, NULL ); + todo_wine ok( hr == S_OK, "got %08x\n", hr ); + todo_wine ok( str != NULL, "str not set\n" ); + todo_wine ok( count == 5, "got %u\n", count ); + /* string is not null-terminated */ + if (str) ok( !memcmp( str, valueW, count * sizeof(WCHAR) ), "wrong data\n" ); + + xmlstr.bytes = (BYTE *)"none"; + xmlstr.length = sizeof("none") - 1; + xmlstr.dictionary = NULL; + xmlstr.id = 0; + str = (WCHAR *)0xdeadbeef; + count = 0xdeadbeef; + hr = WsGetXmlAttribute( reader, &xmlstr, heap, &str, &count, NULL ); + todo_wine ok( hr == S_FALSE, "got %08x\n", hr ); + todo_wine ok( str == NULL, "str not set\n" ); + todo_wine ok( !count, "got %u\n", count ); + + WsFreeReader( reader ); + WsFreeHeap( heap ); +} + START_TEST(reader) { test_WsCreateError(); @@ -1298,4 +1357,5 @@ START_TEST(reader) test_WsReadEndElement(); test_WsReadNode(); test_WsReadType(); + test_WsGetXmlAttribute(); } diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec index 15c2c894073..b666a08300d 100644 --- a/dlls/webservices/webservices.spec +++ b/dlls/webservices/webservices.spec @@ -89,7 +89,7 @@ @ stub WsGetServiceProxyProperty @ stub WsGetWriterPosition @ stdcall WsGetWriterProperty(ptr long ptr long ptr) -@ stub WsGetXmlAttribute +@ stdcall WsGetXmlAttribute(ptr ptr ptr ptr ptr ptr) @ stub WsInitializeMessage @ stub WsMarkHeaderAsUnderstood @ stub WsMatchPolicyAlternative