webservices: Implement WsGetDictionary.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Hans Leidekker 2017-05-30 10:09:08 +02:00 committed by Alexandre Julliard
parent 8214fcfa5d
commit 419604e15b
3 changed files with 59 additions and 2 deletions

View File

@ -86,6 +86,24 @@ static WS_XML_DICTIONARY dict_builtin =
{0x82704485,0x222a,0x4f7c,{0xb9,0x7b,0xe9,0xa4,0x62,0xa9,0x66,0x2b}}
};
/**************************************************************************
* WsGetDictionary [webservices.@]
*/
HRESULT WINAPI WsGetDictionary( WS_ENCODING encoding, WS_XML_DICTIONARY **dict, WS_ERROR *error )
{
TRACE( "%u %p %p\n", encoding, dict, error );
if (error) FIXME( "ignoring error parameter\n" );
if (!dict) return E_INVALIDARG;
if (encoding == WS_ENCODING_XML_BINARY_1 || encoding == WS_ENCODING_XML_BINARY_SESSION_1)
*dict = &dict_builtin;
else
*dict = NULL;
return S_OK;
}
static inline int cmp_string( const unsigned char *str, ULONG len, const unsigned char *str2, ULONG len2 )
{
if (len < len2) return -1;

View File

@ -1183,6 +1183,7 @@ static void test_WsReadNode(void)
static const char str17[] = "<!--comment-->";
HRESULT hr;
WS_XML_READER *reader;
WS_XML_DICTIONARY *dict;
const WS_XML_NODE *node;
unsigned int i;
int found;
@ -1334,6 +1335,21 @@ static void test_WsReadNode(void)
ok( !memcmp( comment->value.bytes, " comment ", 9 ), "wrong data\n" );
}
dict = (WS_XML_DICTIONARY *)0xdeadbeef;
hr = WsGetDictionary( WS_ENCODING_XML_UTF8, &dict, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( dict == NULL, "got %p\n", dict );
dict = (WS_XML_DICTIONARY *)0xdeadbeef;
hr = WsGetDictionary( WS_ENCODING_XML_BINARY_1, &dict, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( dict != NULL, "dict not set\n" );
dict = (WS_XML_DICTIONARY *)0xdeadbeef;
hr = WsGetDictionary( WS_ENCODING_XML_BINARY_SESSION_1, &dict, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( dict != NULL, "dict not set\n" );
WsFreeReader( reader );
}
@ -4898,7 +4914,7 @@ static void test_dictionary(void)
const WS_XML_ATTRIBUTE *attr;
const WS_XML_UTF8_TEXT *utf8;
WS_XML_STRING strings[6];
WS_XML_DICTIONARY dict;
WS_XML_DICTIONARY dict, *dict2;
WS_XML_READER *reader;
HRESULT hr;
@ -5163,6 +5179,29 @@ static void test_dictionary(void)
ok( hr == S_OK, "got %08x\n", hr );
ok( node->nodeType == WS_XML_NODE_TYPE_END_ELEMENT, "got %u\n", node->nodeType );
hr = WsGetDictionary( 0, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsGetDictionary( WS_ENCODING_XML_UTF8, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
dict2 = (WS_XML_DICTIONARY *)0xdeadbeef;
hr = WsGetDictionary( WS_ENCODING_XML_UTF8, &dict2, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( dict2 == NULL, "got %p\n", dict2 );
dict2 = (WS_XML_DICTIONARY *)0xdeadbeef;
hr = WsGetDictionary( WS_ENCODING_XML_BINARY_1, &dict2, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( dict2 != NULL, "dict2 not set\n" );
ok( dict2 != &dict, "got %p\n", dict2 );
dict2 = (WS_XML_DICTIONARY *)0xdeadbeef;
hr = WsGetDictionary( WS_ENCODING_XML_BINARY_SESSION_1, &dict2, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( dict2 != NULL, "dict2 not set\n" );
ok( dict2 != &dict, "got %p\n", dict2 );
WsFreeReader( reader );
}

View File

@ -61,7 +61,7 @@
@ stdcall WsFreeWriter(ptr)
@ stdcall WsGetChannelProperty(ptr long ptr long ptr)
@ stub WsGetCustomHeader
@ stub WsGetDictionary
@ stdcall WsGetDictionary(long ptr ptr)
@ stdcall WsGetErrorProperty(ptr long ptr long)
@ stdcall WsGetErrorString(ptr long ptr)
@ stub WsGetFaultErrorDetail