2 * Copyright 2016 Hans Leidekker for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "webservices.h"
25 #include "wine/test.h"
27 static void test_WsCreateChannel(void)
31 WS_CHANNEL_STATE state
;
32 WS_CHANNEL_PROPERTY prop
;
34 WS_ENVELOPE_VERSION env_version
;
35 WS_ADDRESSING_VERSION addr_version
;
38 hr
= WsCreateChannel( WS_CHANNEL_TYPE_REQUEST
, WS_HTTP_CHANNEL_BINDING
, NULL
, 0, NULL
, NULL
, NULL
);
39 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
42 hr
= WsCreateChannel( WS_CHANNEL_TYPE_REQUEST
, WS_HTTP_CHANNEL_BINDING
, NULL
, 0, NULL
, &channel
, NULL
);
43 ok( hr
== S_OK
, "got %08x\n", hr
);
44 ok( channel
!= NULL
, "channel not set\n" );
47 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_MAX_BUFFERED_MESSAGE_SIZE
, &size
, sizeof(size
), NULL
);
48 ok( hr
== S_OK
, "got %08x\n", hr
);
49 ok( size
== 65536, "got %u\n", size
);
51 encoding
= 0xdeadbeef;
52 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ENCODING
, &encoding
, sizeof(encoding
), NULL
);
53 ok( hr
== S_OK
, "got %08x\n", hr
);
54 ok( encoding
== WS_ENCODING_XML_UTF8
, "got %u\n", encoding
);
56 env_version
= 0xdeadbeef;
57 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ENVELOPE_VERSION
, &env_version
, sizeof(env_version
),
59 ok( hr
== S_OK
, "got %08x\n", hr
);
60 ok( env_version
== WS_ENVELOPE_VERSION_SOAP_1_2
, "got %u\n", env_version
);
62 addr_version
= 0xdeadbeef;
63 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ADDRESSING_VERSION
, &addr_version
, sizeof(addr_version
),
65 ok( hr
== S_OK
, "got %08x\n", hr
);
66 ok( addr_version
== WS_ADDRESSING_VERSION_1_0
, "got %u\n", addr_version
);
68 /* read-only property */
70 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_STATE
, &state
, sizeof(state
), NULL
);
71 ok( hr
== S_OK
, "got %08x\n", hr
);
72 ok( state
== WS_CHANNEL_STATE_CREATED
, "got %u\n", state
);
74 state
= WS_CHANNEL_STATE_CREATED
;
75 hr
= WsSetChannelProperty( channel
, WS_CHANNEL_PROPERTY_STATE
, &state
, sizeof(state
), NULL
);
76 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
78 encoding
= WS_ENCODING_XML_UTF8
;
79 hr
= WsSetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ENCODING
, &encoding
, sizeof(encoding
), NULL
);
80 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
81 WsFreeChannel( channel
);
83 encoding
= WS_ENCODING_XML_UTF16LE
;
84 prop
.id
= WS_CHANNEL_PROPERTY_ENCODING
;
85 prop
.value
= &encoding
;
86 prop
.valueSize
= sizeof(encoding
);
87 hr
= WsCreateChannel( WS_CHANNEL_TYPE_REQUEST
, WS_HTTP_CHANNEL_BINDING
, &prop
, 1, NULL
, &channel
, NULL
);
88 ok( hr
== S_OK
, "got %08x\n", hr
);
89 encoding
= 0xdeadbeef;
90 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ENCODING
, &encoding
, sizeof(encoding
), NULL
);
91 ok( hr
== S_OK
, "got %08x\n", hr
);
92 ok( encoding
== WS_ENCODING_XML_UTF16LE
, "got %u\n", encoding
);
93 WsFreeChannel( channel
);
95 hr
= WsCreateChannel( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &channel
, NULL
);
96 ok( hr
== S_OK
, "got %08x\n", hr
);
97 encoding
= 0xdeadbeef;
98 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ENCODING
, &encoding
, sizeof(encoding
), NULL
);
99 ok( hr
== S_OK
, "got %08x\n", hr
);
100 ok( encoding
== WS_ENCODING_XML_BINARY_SESSION_1
, "got %u\n", encoding
);
102 env_version
= 0xdeadbeef;
103 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ENVELOPE_VERSION
, &env_version
, sizeof(env_version
),
105 ok( hr
== S_OK
, "got %08x\n", hr
);
106 ok( env_version
== WS_ENVELOPE_VERSION_SOAP_1_2
, "got %u\n", env_version
);
108 addr_version
= 0xdeadbeef;
109 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_ADDRESSING_VERSION
, &addr_version
, sizeof(addr_version
),
111 ok( hr
== S_OK
, "got %08x\n", hr
);
112 ok( addr_version
== WS_ADDRESSING_VERSION_1_0
, "got %u\n", addr_version
);
113 WsFreeChannel( channel
);
116 static void test_WsOpenChannel(void)
120 WS_ENDPOINT_ADDRESS addr
;
122 hr
= WsCreateChannel( WS_CHANNEL_TYPE_REQUEST
, WS_HTTP_CHANNEL_BINDING
, NULL
, 0, NULL
, &channel
, NULL
);
123 ok( hr
== S_OK
, "got %08x\n", hr
);
125 hr
= WsCloseChannel( channel
, NULL
, NULL
);
126 ok( hr
== S_OK
, "got %08x\n", hr
);
127 WsFreeChannel( channel
);
129 hr
= WsCreateChannel( WS_CHANNEL_TYPE_REQUEST
, WS_HTTP_CHANNEL_BINDING
, NULL
, 0, NULL
, &channel
, NULL
);
130 ok( hr
== S_OK
, "got %08x\n", hr
);
132 hr
= WsOpenChannel( channel
, NULL
, NULL
, NULL
);
133 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
135 memset( &addr
, 0, sizeof(addr
) );
136 addr
.url
.length
= ARRAY_SIZE( L
"http://localhost" ) - 1;
137 addr
.url
.chars
= (WCHAR
*)L
"http://localhost";
138 hr
= WsOpenChannel( NULL
, &addr
, NULL
, NULL
);
139 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
141 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
142 ok( hr
== S_OK
, "got %08x\n", hr
);
144 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
145 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
147 hr
= WsCloseChannel( channel
, NULL
, NULL
);
148 ok( hr
== S_OK
, "got %08x\n", hr
);
150 hr
= WsCloseChannel( channel
, NULL
, NULL
);
151 ok( hr
== S_OK
, "got %08x\n", hr
);
153 hr
= WsCloseChannel( NULL
, NULL
, NULL
);
154 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
156 WsFreeChannel( channel
);
159 static void test_WsResetChannel(void)
163 WS_CHANNEL_STATE state
;
164 WS_CHANNEL_TYPE type
;
165 WS_ENDPOINT_ADDRESS addr
;
168 hr
= WsCreateChannel( WS_CHANNEL_TYPE_REQUEST
, WS_HTTP_CHANNEL_BINDING
, NULL
, 0, NULL
, &channel
, NULL
);
169 ok( hr
== S_OK
, "got %08x\n", hr
);
171 hr
= WsResetChannel( channel
, NULL
);
172 ok( hr
== S_OK
, "got %08x\n", hr
);
175 size
= sizeof(timeout
);
176 hr
= WsSetChannelProperty( channel
, WS_CHANNEL_PROPERTY_RESOLVE_TIMEOUT
, &timeout
, size
, NULL
);
177 ok( hr
== S_OK
, "got %08x\n", hr
);
179 memset( &addr
, 0, sizeof(addr
) );
180 addr
.url
.length
= ARRAY_SIZE( L
"http://localhost" ) - 1;
181 addr
.url
.chars
= (WCHAR
*)L
"http://localhost";
182 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
183 ok( hr
== S_OK
, "got %08x\n", hr
);
185 hr
= WsResetChannel( channel
, NULL
);
186 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
188 hr
= WsCloseChannel( channel
, NULL
, NULL
);
189 ok( hr
== S_OK
, "got %08x\n", hr
);
191 hr
= WsResetChannel( channel
, NULL
);
192 ok( hr
== S_OK
, "got %08x\n", hr
);
195 size
= sizeof(state
);
196 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_STATE
, &state
, size
, NULL
);
197 ok( hr
== S_OK
, "got %08x\n", hr
);
198 ok( state
== WS_CHANNEL_STATE_CREATED
, "got %u\n", state
);
202 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_CHANNEL_TYPE
, &type
, size
, NULL
);
203 ok( hr
== S_OK
, "got %08x\n", hr
);
204 ok( type
== WS_CHANNEL_TYPE_REQUEST
, "got %u\n", type
);
206 timeout
= 0xdeadbeef;
207 size
= sizeof(timeout
);
208 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_RESOLVE_TIMEOUT
, &timeout
, size
, NULL
);
209 ok( hr
== S_OK
, "got %08x\n", hr
);
210 ok( timeout
== 5000, "got %u\n", timeout
);
212 WsFreeChannel( channel
);
215 static void test_WsCreateListener(void)
218 WS_LISTENER
*listener
;
219 WS_CHANNEL_TYPE type
;
220 WS_CHANNEL_BINDING binding
;
221 WS_LISTENER_STATE state
;
222 WS_IP_VERSION version
;
225 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, NULL
, NULL
);
226 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
229 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &listener
, NULL
);
230 ok( hr
== S_OK
, "got %08x\n", hr
);
231 ok( listener
!= NULL
, "listener not set\n" );
234 size
= sizeof(backlog
);
235 hr
= WsSetListenerProperty( listener
, WS_LISTENER_PROPERTY_LISTEN_BACKLOG
, &backlog
, size
, NULL
);
236 todo_wine
ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
238 version
= WS_IP_VERSION_4
;
239 size
= sizeof(version
);
240 hr
= WsSetListenerProperty( listener
, WS_LISTENER_PROPERTY_IP_VERSION
, &version
, size
, NULL
);
241 todo_wine
ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
244 hr
= WsGetListenerProperty( listener
, WS_LISTENER_PROPERTY_CHANNEL_TYPE
, &type
, sizeof(type
), NULL
);
245 ok( hr
== S_OK
, "got %08x\n", hr
);
246 ok( type
== WS_CHANNEL_TYPE_DUPLEX_SESSION
, "got %u\n", type
);
248 binding
= 0xdeadbeef;
249 hr
= WsGetListenerProperty( listener
, WS_LISTENER_PROPERTY_CHANNEL_BINDING
, &binding
, sizeof(binding
), NULL
);
250 ok( hr
== S_OK
, "got %08x\n", hr
);
251 ok( binding
== WS_TCP_CHANNEL_BINDING
, "got %u\n", binding
);
254 size
= sizeof(version
);
255 hr
= WsGetListenerProperty( listener
, WS_LISTENER_PROPERTY_IP_VERSION
, &version
, size
, NULL
);
256 ok( hr
== S_OK
, "got %08x\n", hr
);
257 todo_wine
ok( version
== WS_IP_VERSION_AUTO
, "got %u\n", version
);
260 size
= sizeof(state
);
261 hr
= WsGetListenerProperty( listener
, WS_LISTENER_PROPERTY_STATE
, &state
, size
, NULL
);
262 ok( hr
== S_OK
, "got %08x\n", hr
);
263 ok( state
== WS_LISTENER_STATE_CREATED
, "got %u\n", state
);
265 state
= WS_LISTENER_STATE_CREATED
;
266 size
= sizeof(state
);
267 hr
= WsSetListenerProperty( listener
, WS_LISTENER_PROPERTY_STATE
, &state
, size
, NULL
);
268 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
270 WsFreeListener( listener
);
273 static void test_WsOpenListener(void)
276 WS_LISTENER
*listener
;
279 hr
= WsOpenListener( NULL
, NULL
, NULL
, NULL
);
280 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
282 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &listener
, NULL
);
283 ok( hr
== S_OK
, "got %08x\n", hr
);
285 hr
= WsCloseListener( listener
, NULL
, NULL
);
286 ok( hr
== S_OK
, "got %08x\n", hr
);
288 WsFreeListener( listener
);
290 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &listener
, NULL
);
291 ok( hr
== S_OK
, "got %08x\n", hr
);
293 hr
= WsOpenListener( listener
, NULL
, NULL
, NULL
);
294 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
295 url
.length
= ARRAY_SIZE( L
"net.tcp://+:2017/path" ) - 1;
296 url
.chars
= (WCHAR
*)L
"net.tcp://+:2017/path";
297 hr
= WsOpenListener( NULL
, &url
, NULL
, NULL
);
298 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
300 hr
= WsOpenListener( listener
, &url
, NULL
, NULL
);
301 ok( hr
== S_OK
, "got %08x\n", hr
);
303 hr
= WsOpenListener( listener
, &url
, NULL
, NULL
);
304 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
306 hr
= WsCloseListener( listener
, NULL
, NULL
);
307 ok( hr
== S_OK
, "got %08x\n", hr
);
309 WsFreeListener( listener
);
311 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &listener
, NULL
);
312 ok( hr
== S_OK
, "got %08x\n", hr
);
314 url
.length
= ARRAY_SIZE( L
"net.tcp://localhost:2017" ) - 1;
315 url
.chars
= (WCHAR
*)L
"net.tcp://localhost:2017";
316 hr
= WsOpenListener( listener
, &url
, NULL
, NULL
);
317 ok( hr
== S_OK
, "got %08x\n", hr
);
319 hr
= WsCloseListener( listener
, NULL
, NULL
);
320 ok( hr
== S_OK
, "got %08x\n", hr
);
322 WsFreeListener( listener
);
324 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &listener
, NULL
);
325 ok( hr
== S_OK
, "got %08x\n", hr
);
327 url
.length
= ARRAY_SIZE( L
"net.tcp://127.0.0.1:2017" ) - 1;
328 url
.chars
= (WCHAR
*)L
"net.tcp://127.0.0.1:2017";
329 hr
= WsOpenListener( listener
, &url
, NULL
, NULL
);
330 ok( hr
== S_OK
, "got %08x\n", hr
);
332 hr
= WsCloseListener( listener
, NULL
, NULL
);
333 ok( hr
== S_OK
, "got %08x\n", hr
);
335 hr
= WsCloseListener( NULL
, NULL
, NULL
);
336 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
338 WsFreeListener( listener
);
341 static void test_WsCreateChannelForListener(void)
343 WS_LISTENER
*listener
;
345 WS_CHANNEL_TYPE type
;
346 WS_CHANNEL_STATE state
;
349 hr
= WsCreateChannelForListener( NULL
, NULL
, 0, NULL
, NULL
);
350 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
352 hr
= WsCreateChannelForListener( NULL
, NULL
, 0, &channel
, NULL
);
353 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
355 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, NULL
, 0, NULL
, &listener
, NULL
);
356 ok( hr
== S_OK
, "got %08x\n", hr
);
359 hr
= WsCreateChannelForListener( listener
, NULL
, 0, &channel
, NULL
);
360 ok( hr
== S_OK
, "got %08x\n", hr
);
361 ok( channel
!= NULL
, "channel not set\n" );
364 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_CHANNEL_TYPE
, &type
, sizeof(type
), NULL
);
365 ok( hr
== S_OK
, "got %08x\n", hr
);
366 ok( type
== WS_CHANNEL_TYPE_DUPLEX_SESSION
, "got %u\n", type
);
369 hr
= WsGetChannelProperty( channel
, WS_CHANNEL_PROPERTY_STATE
, &state
, sizeof(state
), NULL
);
370 ok( hr
== S_OK
, "got %08x\n", hr
);
371 ok( state
== WS_CHANNEL_STATE_CREATED
, "got %u\n", state
);
373 WsFreeChannel( channel
);
374 WsFreeListener( listener
);
377 static void test_WsResetListener(void)
379 WS_STRING url
= { ARRAY_SIZE( L
"net.tcp://+:2017/path" ) - 1, (WCHAR
*)L
"net.tcp://+:2017/path" };
380 WS_LISTENER
*listener
;
381 WS_LISTENER_STATE state
;
382 WS_LISTENER_PROPERTY prop
;
383 ULONG size
, timeout
= 1000;
386 hr
= WsResetListener( NULL
, NULL
);
387 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
389 prop
.id
= WS_LISTENER_PROPERTY_CONNECT_TIMEOUT
;
390 prop
.value
= &timeout
;
391 prop
.valueSize
= sizeof(timeout
);
392 hr
= WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION
, WS_TCP_CHANNEL_BINDING
, &prop
, 1, NULL
, &listener
, NULL
);
393 ok( hr
== S_OK
, "got %08x\n", hr
);
395 hr
= WsResetListener( listener
, NULL
);
396 ok( hr
== S_OK
, "got %08x\n", hr
);
398 hr
= WsOpenListener( listener
, &url
, NULL
, NULL
);
399 ok( hr
== S_OK
, "got %08x\n", hr
);
401 hr
= WsResetListener( listener
, NULL
);
402 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
404 hr
= WsCloseListener( listener
, NULL
, NULL
);
405 ok( hr
== S_OK
, "got %08x\n", hr
);
407 hr
= WsResetListener( listener
, NULL
);
408 ok( hr
== S_OK
, "got %08x\n", hr
);
411 size
= sizeof(state
);
412 hr
= WsGetListenerProperty( listener
, WS_LISTENER_PROPERTY_STATE
, &state
, size
, NULL
);
413 ok( hr
== S_OK
, "got %08x\n", hr
);
414 ok( state
== WS_LISTENER_STATE_CREATED
, "got %u\n", state
);
416 timeout
= 0xdeadbeef;
417 size
= sizeof(timeout
);
418 hr
= WsGetListenerProperty( listener
, WS_LISTENER_PROPERTY_CONNECT_TIMEOUT
, &timeout
, size
, NULL
);
419 ok( hr
== S_OK
, "got %08x\n", hr
);
420 ok( timeout
== 1000, "got %u\n", timeout
);
422 WsFreeListener( listener
);
429 WS_CHANNEL_BINDING binding
;
430 WS_CHANNEL_TYPE type
;
431 void (*server_func
)( WS_CHANNEL
* );
434 static void server_message_read_write( WS_CHANNEL
*channel
)
439 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
440 ok( hr
== S_OK
, "got %08x\n", hr
);
442 hr
= WsReadMessageStart( NULL
, NULL
, NULL
, NULL
);
443 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
445 hr
= WsReadMessageStart( channel
, NULL
, NULL
, NULL
);
446 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
448 hr
= WsReadMessageStart( NULL
, msg
, NULL
, NULL
);
449 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
451 hr
= WsReadMessageStart( channel
, msg
, NULL
, NULL
);
452 ok( hr
== S_OK
, "got %08x\n", hr
);
454 hr
= WsReadMessageEnd( NULL
, NULL
, NULL
, NULL
);
455 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
457 hr
= WsReadMessageEnd( channel
, NULL
, NULL
, NULL
);
458 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
460 hr
= WsReadMessageEnd( NULL
, msg
, NULL
, NULL
);
461 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
463 hr
= WsReadMessageEnd( channel
, msg
, NULL
, NULL
);
464 ok( hr
== S_OK
, "got %08x\n", hr
);
465 WsFreeMessage( msg
);
468 static void client_message_read_write( const struct listener_info
*info
)
470 WS_ENDPOINT_ADDRESS addr
;
477 hr
= WsCreateChannel( info
->type
, info
->binding
, NULL
, 0, NULL
, &channel
, NULL
);
478 ok( hr
== S_OK
, "got %08x\n", hr
);
480 memset( &addr
, 0, sizeof(addr
) );
481 addr
.url
.length
= wsprintfW( buf
, L
"soap.udp://localhost:%u", info
->port
);
482 addr
.url
.chars
= buf
;
483 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
484 ok( hr
== S_OK
, "got %08x\n", hr
);
486 hr
= WsShutdownSessionChannel( channel
, NULL
, NULL
);
487 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
489 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
490 ok( hr
== S_OK
, "got %08x\n", hr
);
492 hr
= WsInitializeMessage( msg
, WS_REQUEST_MESSAGE
, NULL
, NULL
);
493 ok( hr
== S_OK
, "got %08x\n", hr
);
495 hr
= WsWriteMessageStart( NULL
, NULL
, NULL
, NULL
);
496 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
498 hr
= WsWriteMessageStart( channel
, NULL
, NULL
, NULL
);
499 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
501 hr
= WsWriteMessageStart( NULL
, msg
, NULL
, NULL
);
502 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
504 hr
= WsWriteMessageStart( channel
, msg
, NULL
, NULL
);
505 ok( hr
== S_OK
, "got %08x\n", hr
);
507 hr
= WsWriteMessageEnd( NULL
, NULL
, NULL
, NULL
);
508 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
510 hr
= WsWriteMessageEnd( channel
, NULL
, NULL
, NULL
);
511 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
513 hr
= WsWriteMessageEnd( NULL
, msg
, NULL
, NULL
);
514 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
516 hr
= WsWriteMessageEnd( channel
, msg
, NULL
, NULL
);
517 ok( hr
== S_OK
, "got %08x\n", hr
);
519 err
= WaitForSingleObject( info
->wait
, 3000 );
520 ok( err
== WAIT_OBJECT_0
, "wait failed %u\n", err
);
522 hr
= WsCloseChannel( channel
, NULL
, NULL
);
523 ok( hr
== S_OK
, "got %08x\n", hr
);
525 WsFreeMessage( msg
);
526 WsFreeChannel( channel
);
535 static void CALLBACK
async_callback( HRESULT hr
, WS_CALLBACK_MODEL model
, void *state
)
537 struct async_test
*test
= state
;
539 ok( hr
== S_OK
, "got %08x\n", hr
);
540 ok( model
== WS_LONG_CALLBACK
, "got %u\n", model
);
542 SetEvent( test
->wait
);
545 static void server_duplex_session( WS_CHANNEL
*channel
)
547 WS_XML_STRING action
= {6, (BYTE
*)"action"}, localname
= {9, (BYTE
*)"localname"}, ns
= {2, (BYTE
*)"ns"};
548 WS_ELEMENT_DESCRIPTION desc_body
;
549 const WS_MESSAGE_DESCRIPTION
*desc
[1];
550 WS_MESSAGE_DESCRIPTION desc_msg
;
551 struct async_test test
;
552 WS_ASYNC_CONTEXT ctx
;
553 WS_MESSAGE
*msg
, *msg2
;
557 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
558 ok( hr
== S_OK
, "got %08x\n", hr
);
560 desc_body
.elementLocalName
= &localname
;
561 desc_body
.elementNs
= &ns
;
562 desc_body
.type
= WS_INT32_TYPE
;
563 desc_body
.typeDescription
= NULL
;
564 desc_msg
.action
= &action
;
565 desc_msg
.bodyElementDescription
= &desc_body
;
569 test
.wait
= CreateEventW( NULL
, FALSE
, FALSE
, NULL
);
570 ctx
.callback
= async_callback
;
571 ctx
.callbackState
= &test
;
573 hr
= WsReceiveMessage( channel
, msg
, desc
, 1, WS_RECEIVE_OPTIONAL_MESSAGE
, WS_READ_REQUIRED_VALUE
,
574 NULL
, &val
, sizeof(val
), NULL
, &ctx
, NULL
);
575 ok( hr
== WS_S_ASYNC
|| hr
== S_OK
, "got %08x\n", hr
);
576 if (hr
== WS_S_ASYNC
)
578 WaitForSingleObject( test
.wait
, INFINITE
);
579 ok( test
.call_count
== 1, "got %u\n", test
.call_count
);
581 else ok( !test
.call_count
, "got %u\n", test
.call_count
);
583 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg2
, NULL
);
584 ok( hr
== S_OK
, "got %08x\n", hr
);
587 hr
= WsReceiveMessage( channel
, msg2
, desc
, 1, WS_RECEIVE_OPTIONAL_MESSAGE
, WS_READ_REQUIRED_VALUE
,
588 NULL
, &val
, sizeof(val
), NULL
, &ctx
, NULL
);
589 ok( hr
== WS_S_ASYNC
|| hr
== S_OK
, "got %08x\n", hr
);
590 if (hr
== WS_S_ASYNC
)
592 WaitForSingleObject( test
.wait
, INFINITE
);
593 ok( test
.call_count
== 1, "got %u\n", test
.call_count
);
595 else ok( !test
.call_count
, "got %u\n", test
.call_count
);
597 CloseHandle( test
.wait
);
598 WsFreeMessage( msg
);
599 WsFreeMessage( msg2
);
602 static void client_duplex_session( const struct listener_info
*info
)
604 WS_XML_STRING action
= {6, (BYTE
*)"action"}, localname
= {9, (BYTE
*)"localname"}, ns
= {2, (BYTE
*)"ns"};
605 WS_ELEMENT_DESCRIPTION desc_body
;
606 WS_MESSAGE_DESCRIPTION desc
;
607 WS_ENDPOINT_ADDRESS addr
;
610 WS_MESSAGE
*msg
, *msg2
;
615 hr
= WsCreateChannel( info
->type
, info
->binding
, NULL
, 0, NULL
, &channel
, NULL
);
616 ok( hr
== S_OK
, "got %08x\n", hr
);
618 hr
= WsShutdownSessionChannel( channel
, NULL
, NULL
);
619 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
621 memset( &addr
, 0, sizeof(addr
) );
622 addr
.url
.length
= wsprintfW( buf
, L
"net.tcp://localhost:%u", info
->port
);
623 addr
.url
.chars
= buf
;
624 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
625 ok( hr
== S_OK
, "got %08x\n", hr
);
627 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
628 ok( hr
== S_OK
, "got %08x\n", hr
);
630 desc_body
.elementLocalName
= &localname
;
631 desc_body
.elementNs
= &ns
;
632 desc_body
.type
= WS_INT32_TYPE
;
633 desc_body
.typeDescription
= NULL
;
634 desc
.action
= &action
;
635 desc
.bodyElementDescription
= &desc_body
;
637 hr
= WsSendMessage( channel
, msg
, &desc
, WS_WRITE_REQUIRED_VALUE
, &val
, sizeof(val
), NULL
, NULL
);
638 ok( hr
== S_OK
, "got %08x\n", hr
);
640 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg2
, NULL
);
641 ok( hr
== S_OK
, "got %08x\n", hr
);
643 hr
= WsSendMessage( channel
, msg2
, &desc
, WS_WRITE_REQUIRED_VALUE
, &val
, sizeof(val
), NULL
, NULL
);
644 ok( hr
== S_OK
, "got %08x\n", hr
);
646 err
= WaitForSingleObject( info
->wait
, 3000 );
647 ok( err
== WAIT_OBJECT_0
, "wait failed %u\n", err
);
649 hr
= WsShutdownSessionChannel( channel
, NULL
, NULL
);
650 ok( hr
== S_OK
, "got %08x\n", hr
);
652 hr
= WsShutdownSessionChannel( channel
, NULL
, NULL
);
653 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
655 hr
= WsCloseChannel( channel
, NULL
, NULL
);
656 ok( hr
== S_OK
, "got %08x\n", hr
);
658 WsFreeMessage( msg
);
659 WsFreeMessage( msg2
);
660 WsFreeChannel( channel
);
663 static void server_accept_channel( WS_CHANNEL
*channel
)
665 WS_XML_STRING localname
= {9, (BYTE
*)"localname"}, ns
= {2, (BYTE
*)"ns"}, action
= {6, (BYTE
*)"action"};
666 WS_ELEMENT_DESCRIPTION body
;
667 WS_MESSAGE_DESCRIPTION desc_resp
;
668 const WS_MESSAGE_DESCRIPTION
*desc
[1];
673 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
674 ok( hr
== S_OK
, "got %08x\n", hr
);
676 body
.elementLocalName
= &localname
;
677 body
.elementNs
= &ns
;
678 body
.type
= WS_INT32_TYPE
;
679 body
.typeDescription
= NULL
;
681 desc_resp
.action
= &action
;
682 desc_resp
.bodyElementDescription
= &body
;
683 desc
[0] = &desc_resp
;
685 hr
= WsReceiveMessage( channel
, msg
, desc
, 1, WS_RECEIVE_REQUIRED_MESSAGE
, WS_READ_REQUIRED_VALUE
,
686 NULL
, &val
, sizeof(val
), NULL
, NULL
, NULL
);
687 ok( hr
== S_OK
, "got %08x\n", hr
);
688 ok( val
== -1, "got %d\n", val
);
689 WsFreeMessage( msg
);
692 static void client_accept_channel( const struct listener_info
*info
)
694 const WCHAR
*fmt
= (info
->binding
== WS_TCP_CHANNEL_BINDING
) ? L
"net.tcp://localhost:%u" : L
"soap.udp://localhost:%u";
695 WS_XML_STRING localname
= {9, (BYTE
*)"localname"}, ns
= {2, (BYTE
*)"ns"}, action
= {6, (BYTE
*)"action"};
697 WS_LISTENER
*listener
;
700 WS_ENDPOINT_ADDRESS addr
;
701 WS_ELEMENT_DESCRIPTION body
;
702 WS_MESSAGE_DESCRIPTION desc
;
707 hr
= WsAcceptChannel( NULL
, NULL
, NULL
, NULL
);
708 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
710 hr
= WsCreateListener( info
->type
, info
->binding
, NULL
, 0, NULL
, &listener
, NULL
);
711 ok( hr
== S_OK
, "got %08x\n", hr
);
713 hr
= WsAcceptChannel( listener
, NULL
, NULL
, NULL
);
714 ok( hr
== E_INVALIDARG
, "got %08x\n", hr
);
716 hr
= WsCreateChannelForListener( listener
, NULL
, 0, &channel
, NULL
);
717 ok( hr
== S_OK
, "got %08x\n", hr
);
719 hr
= WsAcceptChannel( listener
, channel
, NULL
, NULL
);
720 ok( hr
== WS_E_INVALID_OPERATION
, "got %08x\n", hr
);
721 WsFreeChannel( channel
);
722 WsFreeListener( listener
);
724 hr
= WsCreateChannel( info
->type
, info
->binding
, NULL
, 0, NULL
, &channel
, NULL
);
725 ok( hr
== S_OK
, "got %08x\n", hr
);
727 memset( &addr
, 0, sizeof(addr
) );
728 addr
.url
.length
= wsprintfW( buf
, fmt
, info
->port
);
729 addr
.url
.chars
= buf
;
730 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
731 ok( hr
== S_OK
, "got %08x\n", hr
);
733 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
734 ok( hr
== S_OK
, "got %08x\n", hr
);
736 body
.elementLocalName
= &localname
;
737 body
.elementNs
= &ns
;
738 body
.type
= WS_INT32_TYPE
;
739 body
.typeDescription
= NULL
;
741 desc
.action
= &action
;
742 desc
.bodyElementDescription
= &body
;
744 hr
= WsSendMessage( channel
, msg
, &desc
, WS_WRITE_REQUIRED_VALUE
, &val
, sizeof(val
), NULL
, NULL
);
745 ok( hr
== S_OK
, "got %08x\n", hr
);
747 err
= WaitForSingleObject( info
->wait
, 3000 );
748 ok( err
== WAIT_OBJECT_0
, "wait failed %u\n", err
);
750 hr
= WsCloseChannel( channel
, NULL
, NULL
);
751 ok( hr
== S_OK
, "got %08x\n", hr
);
753 WsFreeMessage( msg
);
754 WsFreeChannel( channel
);
757 static void server_request_reply( WS_CHANNEL
*channel
)
759 WS_XML_STRING localname
= {9, (BYTE
*)"localname"}, ns
= {2, (BYTE
*)"ns"};
760 WS_XML_STRING req_action
= {7, (BYTE
*)"request"}, reply_action
= {5, (BYTE
*)"reply"};
761 WS_ELEMENT_DESCRIPTION body
;
762 WS_MESSAGE_DESCRIPTION in_desc
, out_desc
;
763 const WS_MESSAGE_DESCRIPTION
*desc
[1];
768 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
769 ok( hr
== S_OK
, "got %08x\n", hr
);
771 body
.elementLocalName
= &localname
;
772 body
.elementNs
= &ns
;
773 body
.type
= WS_INT32_TYPE
;
774 body
.typeDescription
= NULL
;
776 in_desc
.action
= &req_action
;
777 in_desc
.bodyElementDescription
= &body
;
780 hr
= WsReceiveMessage( channel
, msg
, desc
, 1, WS_RECEIVE_REQUIRED_MESSAGE
, WS_READ_REQUIRED_VALUE
,
781 NULL
, &val
, sizeof(val
), NULL
, NULL
, NULL
);
782 ok( hr
== S_OK
, "got %08x\n", hr
);
783 ok( val
== -1, "got %d\n", val
);
784 WsFreeMessage( msg
);
786 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &msg
, NULL
);
787 ok( hr
== S_OK
, "got %08x\n", hr
);
789 out_desc
.action
= &reply_action
;
790 out_desc
.bodyElementDescription
= &body
;
792 hr
= WsSendMessage( channel
, msg
, &out_desc
, WS_WRITE_REQUIRED_VALUE
, &val
, sizeof(val
), NULL
, NULL
);
793 ok( hr
== S_OK
, "got %08x\n", hr
);
794 WsFreeMessage( msg
);
797 static void client_request_reply( const struct listener_info
*info
)
799 WS_XML_STRING localname
= {9, (BYTE
*)"localname"}, ns
= {2, (BYTE
*)"ns"};
800 WS_XML_STRING req_action
= {7, (BYTE
*)"request"}, reply_action
= {5, (BYTE
*)"reply"};
803 WS_MESSAGE
*req
, *reply
;
804 WS_ENDPOINT_ADDRESS addr
;
805 WS_ELEMENT_DESCRIPTION body
;
806 WS_MESSAGE_DESCRIPTION req_desc
, reply_desc
;
807 INT32 val_in
= -1, val_out
= 0;
810 hr
= WsCreateChannel( info
->type
, info
->binding
, NULL
, 0, NULL
, &channel
, NULL
);
811 ok( hr
== S_OK
, "got %08x\n", hr
);
813 memset( &addr
, 0, sizeof(addr
) );
814 addr
.url
.length
= wsprintfW( buf
, L
"net.tcp://localhost:%u", info
->port
);
815 addr
.url
.chars
= buf
;
816 hr
= WsOpenChannel( channel
, &addr
, NULL
, NULL
);
817 ok( hr
== S_OK
, "got %08x\n", hr
);
819 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &req
, NULL
);
820 ok( hr
== S_OK
, "got %08x\n", hr
);
822 hr
= WsCreateMessageForChannel( channel
, NULL
, 0, &reply
, NULL
);
823 ok( hr
== S_OK
, "got %08x\n", hr
);
825 hr
= WsInitializeMessage( req
, WS_BLANK_MESSAGE
, NULL
, NULL
);
826 ok( hr
== S_OK
, "got %08x\n", hr
);
828 body
.elementLocalName
= &localname
;
829 body
.elementNs
= &ns
;
830 body
.type
= WS_INT32_TYPE
;
831 body
.typeDescription
= NULL
;
833 req_desc
.action
= &req_action
;
834 req_desc
.bodyElementDescription
= &body
;
836 reply_desc
.action
= &reply_action
;
837 reply_desc
.bodyElementDescription
= &body
;
839 hr
= WsRequestReply( channel
, req
, &req_desc
, WS_WRITE_REQUIRED_VALUE
, &val_in
, sizeof(val_in
), reply
,
840 &reply_desc
, WS_READ_REQUIRED_VALUE
, NULL
, &val_out
, sizeof(val_out
), NULL
, NULL
);
841 ok( val_out
== -1, "got %d\n", val_out
);
843 hr
= WsCloseChannel( channel
, NULL
, NULL
);
844 ok( hr
== S_OK
, "got %08x\n", hr
);
846 WsFreeMessage( req
);
847 WsFreeMessage( reply
);
848 WsFreeChannel( channel
);
851 static DWORD CALLBACK
listener_proc( void *arg
)
853 struct listener_info
*info
= arg
;
854 const WCHAR
*fmt
= (info
->binding
== WS_TCP_CHANNEL_BINDING
) ? L
"net.tcp://localhost:%u" : L
"soap.udp://localhost:%u";
855 WS_LISTENER
*listener
;
861 hr
= WsCreateListener( info
->type
, info
->binding
, NULL
, 0, NULL
, &listener
, NULL
);
862 ok( hr
== S_OK
, "got %08x\n", hr
);
864 url
.length
= wsprintfW( buf
, fmt
, info
->port
);
866 hr
= WsOpenListener( listener
, &url
, NULL
, NULL
);
867 ok( hr
== S_OK
, "got %08x\n", hr
);
869 hr
= WsCreateChannelForListener( listener
, NULL
, 0, &channel
, NULL
);
870 ok( hr
== S_OK
, "got %08x\n", hr
);
872 SetEvent( info
->wait
);
874 hr
= WsAcceptChannel( listener
, channel
, NULL
, NULL
);
875 ok( hr
== S_OK
, "got %08x\n", hr
);
877 info
->server_func( channel
);
879 SetEvent( info
->wait
);
881 hr
= WsCloseChannel( channel
, NULL
, NULL
);
882 ok( hr
== S_OK
, "got %08x\n", hr
);
883 WsFreeChannel( channel
);
885 hr
= WsCloseListener( listener
, NULL
, NULL
);
886 ok( hr
== S_OK
, "got %08x\n", hr
);
887 WsFreeListener( listener
);
892 static HANDLE
start_listener( struct listener_info
*info
)
895 HANDLE thread
= CreateThread( NULL
, 0, listener_proc
, info
, 0, NULL
);
896 ok( thread
!= NULL
, "failed to create listener thread %u\n", GetLastError() );
898 err
= WaitForSingleObject( info
->wait
, 3000 );
899 ok( err
== WAIT_OBJECT_0
, "failed to start listener %u\n", err
);
909 static BOOL
is_process_elevated(void)
912 if (OpenProcessToken( GetCurrentProcess(), TOKEN_QUERY
, &token
))
914 TOKEN_ELEVATION_TYPE type
;
918 ret
= GetTokenInformation( token
, TokenElevationType
, &type
, sizeof(type
), &size
);
919 CloseHandle( token
);
920 return (ret
&& type
== TokenElevationTypeFull
);
925 static BOOL
is_firewall_enabled(void)
928 INetFwMgr
*mgr
= NULL
;
929 INetFwPolicy
*policy
= NULL
;
930 INetFwProfile
*profile
= NULL
;
931 VARIANT_BOOL enabled
= VARIANT_FALSE
;
933 init
= CoInitializeEx( 0, COINIT_APARTMENTTHREADED
);
935 hr
= CoCreateInstance( &CLSID_NetFwMgr
, NULL
, CLSCTX_INPROC_SERVER
, &IID_INetFwMgr
,
937 ok( hr
== S_OK
, "got %08x\n", hr
);
938 if (hr
!= S_OK
) goto done
;
940 hr
= INetFwMgr_get_LocalPolicy( mgr
, &policy
);
941 ok( hr
== S_OK
, "got %08x\n", hr
);
942 if (hr
!= S_OK
) goto done
;
944 hr
= INetFwPolicy_get_CurrentProfile( policy
, &profile
);
945 if (hr
!= S_OK
) goto done
;
947 hr
= INetFwProfile_get_FirewallEnabled( profile
, &enabled
);
948 ok( hr
== S_OK
, "got %08x\n", hr
);
951 if (policy
) INetFwPolicy_Release( policy
);
952 if (profile
) INetFwProfile_Release( profile
);
953 if (mgr
) INetFwMgr_Release( mgr
);
954 if (SUCCEEDED( init
)) CoUninitialize();
955 return (enabled
== VARIANT_TRUE
);
958 static HRESULT
set_firewall( enum firewall_op op
)
961 INetFwMgr
*mgr
= NULL
;
962 INetFwPolicy
*policy
= NULL
;
963 INetFwProfile
*profile
= NULL
;
964 INetFwAuthorizedApplication
*app
= NULL
;
965 INetFwAuthorizedApplications
*apps
= NULL
;
966 BSTR name
, image
= SysAllocStringLen( NULL
, MAX_PATH
);
968 if (!GetModuleFileNameW( NULL
, image
, MAX_PATH
))
970 SysFreeString( image
);
973 init
= CoInitializeEx( 0, COINIT_APARTMENTTHREADED
);
975 hr
= CoCreateInstance( &CLSID_NetFwMgr
, NULL
, CLSCTX_INPROC_SERVER
, &IID_INetFwMgr
,
977 ok( hr
== S_OK
, "got %08x\n", hr
);
978 if (hr
!= S_OK
) goto done
;
980 hr
= INetFwMgr_get_LocalPolicy( mgr
, &policy
);
981 ok( hr
== S_OK
, "got %08x\n", hr
);
982 if (hr
!= S_OK
) goto done
;
984 hr
= INetFwPolicy_get_CurrentProfile( policy
, &profile
);
985 if (hr
!= S_OK
) goto done
;
987 hr
= INetFwProfile_get_AuthorizedApplications( profile
, &apps
);
988 ok( hr
== S_OK
, "got %08x\n", hr
);
989 if (hr
!= S_OK
) goto done
;
991 hr
= CoCreateInstance( &CLSID_NetFwAuthorizedApplication
, NULL
, CLSCTX_INPROC_SERVER
,
992 &IID_INetFwAuthorizedApplication
, (void **)&app
);
993 ok( hr
== S_OK
, "got %08x\n", hr
);
994 if (hr
!= S_OK
) goto done
;
996 hr
= INetFwAuthorizedApplication_put_ProcessImageFileName( app
, image
);
997 if (hr
!= S_OK
) goto done
;
999 name
= SysAllocString( L
"webservices_test" );
1000 hr
= INetFwAuthorizedApplication_put_Name( app
, name
);
1001 SysFreeString( name
);
1002 ok( hr
== S_OK
, "got %08x\n", hr
);
1003 if (hr
!= S_OK
) goto done
;
1006 hr
= INetFwAuthorizedApplications_Add( apps
, app
);
1007 else if (op
== APP_REMOVE
)
1008 hr
= INetFwAuthorizedApplications_Remove( apps
, image
);
1013 if (app
) INetFwAuthorizedApplication_Release( app
);
1014 if (apps
) INetFwAuthorizedApplications_Release( apps
);
1015 if (policy
) INetFwPolicy_Release( policy
);
1016 if (profile
) INetFwProfile_Release( profile
);
1017 if (mgr
) INetFwMgr_Release( mgr
);
1018 if (SUCCEEDED( init
)) CoUninitialize();
1019 SysFreeString( image
);
1025 BOOL firewall_enabled
= is_firewall_enabled();
1026 struct listener_info info
;
1030 static const struct test
1032 WS_CHANNEL_BINDING binding
;
1033 WS_CHANNEL_TYPE type
;
1034 void (*server_func
)( WS_CHANNEL
* );
1035 void (*client_func
)( const struct listener_info
* );
1039 { WS_UDP_CHANNEL_BINDING
, WS_CHANNEL_TYPE_DUPLEX
, server_message_read_write
, client_message_read_write
},
1040 { WS_TCP_CHANNEL_BINDING
, WS_CHANNEL_TYPE_DUPLEX_SESSION
, server_duplex_session
, client_duplex_session
},
1041 { WS_UDP_CHANNEL_BINDING
, WS_CHANNEL_TYPE_DUPLEX
, server_accept_channel
, client_accept_channel
},
1042 { WS_TCP_CHANNEL_BINDING
, WS_CHANNEL_TYPE_DUPLEX_SESSION
, server_accept_channel
, client_accept_channel
},
1043 { WS_TCP_CHANNEL_BINDING
, WS_CHANNEL_TYPE_DUPLEX_SESSION
, server_request_reply
, client_request_reply
},
1046 if (firewall_enabled
)
1048 if (!is_process_elevated())
1050 skip( "no privileges, skipping tests to avoid firewall dialog\n" );
1053 if ((hr
= set_firewall( APP_ADD
)) != S_OK
)
1055 skip( "can't authorize app in firewall %08x\n", hr
);
1060 test_WsCreateChannel();
1061 test_WsOpenChannel();
1062 test_WsResetChannel();
1063 test_WsCreateListener();
1064 test_WsOpenListener();
1065 test_WsCreateChannelForListener();
1066 test_WsResetListener();
1069 info
.wait
= CreateEventW( NULL
, 0, 0, NULL
);
1071 for (i
= 0; i
< ARRAY_SIZE(tests
); i
++)
1073 info
.binding
= tests
[i
].binding
;
1074 info
.type
= tests
[i
].type
;
1075 info
.server_func
= tests
[i
].server_func
;
1077 thread
= start_listener( &info
);
1078 tests
[i
].client_func( &info
);
1079 WaitForSingleObject( thread
, 3000 );
1080 CloseHandle( thread
);
1083 if (firewall_enabled
) set_firewall( APP_REMOVE
);