webservices: Add support for UTF-8 encoded text in read_message_id.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Hans Leidekker 2018-10-31 14:21:30 +01:00 committed by Alexandre Julliard
parent ec2ea93bbb
commit 57db798965
3 changed files with 19 additions and 6 deletions

View File

@ -846,21 +846,33 @@ static HRESULT read_message_id( WS_XML_READER *reader, GUID *ret )
{
const WS_XML_NODE *node;
const WS_XML_TEXT_NODE *text;
const WS_XML_UNIQUE_ID_TEXT *id;
HRESULT hr;
if ((hr = WsReadNode( reader, NULL )) != S_OK) return hr;
if ((hr = WsGetReaderNode( reader, &node, NULL )) != S_OK) return hr;
if (node->nodeType != WS_XML_NODE_TYPE_TEXT) return WS_E_INVALID_FORMAT;
text = (const WS_XML_TEXT_NODE *)node;
if (text->text->textType != WS_XML_TEXT_TYPE_UNIQUE_ID)
switch (text->text->textType)
{
case WS_XML_TEXT_TYPE_UTF8:
{
const WS_XML_UTF8_TEXT *utf8 = (const WS_XML_UTF8_TEXT *)text->text;
if (utf8->value.length != 45 || memcmp( utf8->value.bytes, "urn:uuid:", 9 ))
return WS_E_INVALID_FORMAT;
return str_to_guid( utf8->value.bytes + 9, utf8->value.length - 9, ret );
}
case WS_XML_TEXT_TYPE_UNIQUE_ID:
{
const WS_XML_UNIQUE_ID_TEXT *id = (const WS_XML_UNIQUE_ID_TEXT *)text->text;
*ret = id->value;
return S_OK;
}
default:
FIXME( "unhandled text type %u\n", text->text->textType );
return E_NOTIMPL;
}
id = (const WS_XML_UNIQUE_ID_TEXT *)text->text;
*ret = id->value;
return S_OK;
}
static HRESULT read_envelope_start( struct msg *msg, WS_XML_READER *reader )

View File

@ -3841,7 +3841,7 @@ static HRESULT str_to_float( const unsigned char *str, ULONG len, float *ret )
return S_OK;
}
static HRESULT str_to_guid( const unsigned char *str, ULONG len, GUID *ret )
HRESULT str_to_guid( const unsigned char *str, ULONG len, GUID *ret )
{
static const unsigned char hex[] =
{

View File

@ -71,6 +71,7 @@ HRESULT read_header( WS_XML_READER *, const WS_XML_STRING *, const WS_XML_STRING
HRESULT create_header_buffer( WS_XML_READER *, WS_HEAP *, WS_XML_BUFFER ** ) DECLSPEC_HIDDEN;
HRESULT text_to_text( const WS_XML_TEXT *, const WS_XML_TEXT *, ULONG *, WS_XML_TEXT ** ) DECLSPEC_HIDDEN;
HRESULT text_to_utf8text( const WS_XML_TEXT *, const WS_XML_UTF8_TEXT *, ULONG *, WS_XML_UTF8_TEXT ** ) DECLSPEC_HIDDEN;
HRESULT str_to_guid( const unsigned char *, ULONG, GUID * ) DECLSPEC_HIDDEN;
WS_XML_UTF8_TEXT *alloc_utf8_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
WS_XML_UTF16_TEXT *alloc_utf16_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;
WS_XML_BASE64_TEXT *alloc_base64_text( const BYTE *, ULONG ) DECLSPEC_HIDDEN;