webservices: Implement WsGetChannelProperty(WS_CHANNEL_PROPERTY_STATE).

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2021-05-17 15:36:12 +02:00 committed by Alexandre Julliard
parent 19c9969c79
commit 64254a0a80
2 changed files with 16 additions and 0 deletions

View File

@ -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 );
}

View File

@ -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 );