From: Connor McAdams cmcadams@codeweavers.com
v2: Use a shorter property name.
Treat WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE as a read-only property, and only allow it to be set upon channel creation.
Signed-off-by: Connor McAdams cmcadams@codeweavers.com Signed-off-by: Hans Leidekker hans@codeweavers.com --- dlls/webservices/channel.c | 21 ++++++++++++++++++++- dlls/webservices/tests/channel.c | 11 ++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c index cfb6566921d..4941844afe5 100644 --- a/dlls/webservices/channel.c +++ b/dlls/webservices/channel.c @@ -40,7 +40,7 @@ static const struct prop_desc channel_props[] = { sizeof(WS_ENCODING), TRUE }, /* WS_CHANNEL_PROPERTY_ENCODING */ { sizeof(WS_ENVELOPE_VERSION), FALSE }, /* WS_CHANNEL_PROPERTY_ENVELOPE_VERSION */ { sizeof(WS_ADDRESSING_VERSION), FALSE }, /* WS_CHANNEL_PROPERTY_ADDRESSING_VERSION */ - { sizeof(ULONG), FALSE }, /* WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE */ + { sizeof(ULONG), TRUE }, /* WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE */ { sizeof(WS_CHANNEL_STATE), TRUE }, /* WS_CHANNEL_PROPERTY_STATE */ { sizeof(WS_CALLBACK_MODEL), FALSE }, /* WS_CHANNEL_PROPERTY_ASYNC_CALLBACK_MODEL */ { sizeof(WS_IP_VERSION), FALSE }, /* WS_CHANNEL_PROPERTY_IP_VERSION */ @@ -236,6 +236,7 @@ struct channel char *send_buf; ULONG send_buflen; ULONG send_size; + ULONG dict_size; ULONG prop_count; struct prop prop[ARRAY_SIZE( channel_props )]; }; @@ -483,6 +484,7 @@ static HRESULT create_channel( WS_CHANNEL_TYPE type, WS_CHANNEL_BINDING binding, case WS_TCP_CHANNEL_BINDING: channel->u.tcp.socket = -1; channel->encoding = WS_ENCODING_XML_BINARY_SESSION_1; + channel->dict_size = 2048; break;
case WS_UDP_CHANNEL_BINDING: @@ -534,6 +536,16 @@ static HRESULT create_channel( WS_CHANNEL_TYPE type, WS_CHANNEL_BINDING binding, break;
} + case WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE: + if (channel->binding != WS_TCP_CHANNEL_BINDING || !prop->value || prop->valueSize != sizeof(channel->dict_size)) + { + free_channel( channel ); + return E_INVALIDARG; + } + + channel->dict_size = *(ULONG *)prop->value; + break; + default: if ((hr = prop_set( channel->prop, channel->prop_count, prop->id, prop->value, prop->valueSize )) != S_OK) { @@ -712,6 +724,13 @@ HRESULT WINAPI WsGetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID else *(WS_CHANNEL_STATE *)buf = channel->state; break;
+ case WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE: + if (channel->binding != WS_TCP_CHANNEL_BINDING || !buf || size != sizeof(channel->dict_size)) + hr = E_INVALIDARG; + else + *(ULONG *)buf = channel->dict_size; + break; + default: hr = prop_get( channel->prop, channel->prop_count, id, buf, size ); } diff --git a/dlls/webservices/tests/channel.c b/dlls/webservices/tests/channel.c index f70eafaecc8..d5d35904c1c 100644 --- a/dlls/webservices/tests/channel.c +++ b/dlls/webservices/tests/channel.c @@ -66,6 +66,10 @@ static void test_WsCreateChannel(void) ok( hr == S_OK, "got %#lx\n", hr ); ok( addr_version == WS_ADDRESSING_VERSION_1_0, "got %u\n", addr_version );
+ size = 0xdeadbeef; + hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE, &size, sizeof(size), NULL ); + ok( hr == E_INVALIDARG, "got %#lx\n", hr ); + /* read-only property */ state = 0xdeadbeef; hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_STATE, &state, sizeof(state), NULL ); @@ -112,10 +116,15 @@ static void test_WsCreateChannel(void) ok( hr == S_OK, "got %#lx\n", hr ); ok( addr_version == WS_ADDRESSING_VERSION_1_0, "got %u\n", addr_version );
+ /* Read-only, only settable on channel creation. */ + size = 4096; + hr = WsSetChannelProperty( channel, WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE, &size, sizeof(size), NULL ); + ok( hr == E_INVALIDARG, "got %#lx\n", hr ); + size = 0xdeadbeef; hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_MAX_SESSION_DICTIONARY_SIZE, &size, sizeof(size), NULL ); ok( hr == S_OK, "got %#lx\n", hr ); - todo_wine ok( size == 2048, "got %lu\n", size ); + ok( size == 2048, "got %lu\n", size );
WsFreeChannel( channel ); }