From 64254a0a808bace4ca21e812964135234e3cb21b Mon Sep 17 00:00:00 2001 From: Hans Leidekker Date: Mon, 17 May 2021 15:36:12 +0200 Subject: [PATCH] webservices: Implement WsGetChannelProperty(WS_CHANNEL_PROPERTY_STATE). Signed-off-by: Hans Leidekker Signed-off-by: Alexandre Julliard --- dlls/webservices/channel.c | 5 +++++ dlls/webservices/tests/channel.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c index fd7c8d6029d..8e902e5aed7 100644 --- a/dlls/webservices/channel.c +++ b/dlls/webservices/channel.c @@ -672,6 +672,11 @@ HRESULT WINAPI WsGetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID else *(WS_ENCODING *)buf = channel->encoding; break; + case WS_CHANNEL_PROPERTY_STATE: + if (!buf || size != sizeof(channel->state)) hr = E_INVALIDARG; + else *(WS_CHANNEL_STATE *)buf = channel->state; + 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 d80f1f64cde..4f56b864271 100644 --- a/dlls/webservices/tests/channel.c +++ b/dlls/webservices/tests/channel.c @@ -117,6 +117,7 @@ static void test_WsOpenChannel(void) { HRESULT hr; WS_CHANNEL *channel; + WS_CHANNEL_STATE state; WS_ENDPOINT_ADDRESS addr; hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ); @@ -141,12 +142,22 @@ static void test_WsOpenChannel(void) hr = WsOpenChannel( channel, &addr, NULL, NULL ); ok( hr == S_OK, "got %08x\n", hr ); + state = 0xdeadbeef; + hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_STATE, &state, sizeof(state), NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( state == WS_CHANNEL_STATE_OPEN, "got %u\n", state ); + hr = WsOpenChannel( channel, &addr, NULL, NULL ); ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr ); hr = WsCloseChannel( channel, NULL, NULL ); ok( hr == S_OK, "got %08x\n", hr ); + state = 0xdeadbeef; + hr = WsGetChannelProperty( channel, WS_CHANNEL_PROPERTY_STATE, &state, sizeof(state), NULL ); + ok( hr == S_OK, "got %08x\n", hr ); + ok( state == WS_CHANNEL_STATE_CLOSED, "got %u\n", state ); + hr = WsCloseChannel( channel, NULL, NULL ); ok( hr == S_OK, "got %08x\n", hr );