Commit f735ffbf authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices/tests: Use wide character string literals.

parent e1b74133
...@@ -115,7 +115,6 @@ static void test_WsCreateChannel(void) ...@@ -115,7 +115,6 @@ static void test_WsCreateChannel(void)
static void test_WsOpenChannel(void) static void test_WsOpenChannel(void)
{ {
WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t'};
HRESULT hr; HRESULT hr;
WS_CHANNEL *channel; WS_CHANNEL *channel;
WS_ENDPOINT_ADDRESS addr; WS_ENDPOINT_ADDRESS addr;
...@@ -134,8 +133,8 @@ static void test_WsOpenChannel(void) ...@@ -134,8 +133,8 @@ static void test_WsOpenChannel(void)
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = ARRAY_SIZE( url ); addr.url.length = ARRAY_SIZE( L"http://localhost" ) - 1;
addr.url.chars = url; addr.url.chars = (WCHAR *)L"http://localhost";
hr = WsOpenChannel( NULL, &addr, NULL, NULL ); hr = WsOpenChannel( NULL, &addr, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
...@@ -159,7 +158,6 @@ static void test_WsOpenChannel(void) ...@@ -159,7 +158,6 @@ static void test_WsOpenChannel(void)
static void test_WsResetChannel(void) static void test_WsResetChannel(void)
{ {
WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t'};
HRESULT hr; HRESULT hr;
WS_CHANNEL *channel; WS_CHANNEL *channel;
WS_CHANNEL_STATE state; WS_CHANNEL_STATE state;
...@@ -179,8 +177,8 @@ static void test_WsResetChannel(void) ...@@ -179,8 +177,8 @@ static void test_WsResetChannel(void)
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = ARRAY_SIZE( url ); addr.url.length = ARRAY_SIZE( L"http://localhost" ) - 1;
addr.url.chars = url; addr.url.chars = (WCHAR *)L"http://localhost";
hr = WsOpenChannel( channel, &addr, NULL, NULL ); hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -274,12 +272,6 @@ static void test_WsCreateListener(void) ...@@ -274,12 +272,6 @@ static void test_WsCreateListener(void)
static void test_WsOpenListener(void) static void test_WsOpenListener(void)
{ {
WCHAR str[] =
{'n','e','t','.','t','c','p',':','/','/','+',':','2','0','1','7','/','p','a','t','h'};
WCHAR str2[] =
{'n','e','t','.','t','c','p',':','/','/','l','o','c','a','l','h','o','s','t',':','2','0','1','7'};
WCHAR str3[] =
{'n','e','t','.','t','c','p',':','/','/','1','2','7','.','0','.','0','.','1',':','2','0','1','7'};
WS_STRING url; WS_STRING url;
WS_LISTENER *listener; WS_LISTENER *listener;
HRESULT hr; HRESULT hr;
...@@ -300,9 +292,8 @@ static void test_WsOpenListener(void) ...@@ -300,9 +292,8 @@ static void test_WsOpenListener(void)
hr = WsOpenListener( listener, NULL, NULL, NULL ); hr = WsOpenListener( listener, NULL, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
url.length = ARRAY_SIZE( L"net.tcp://+:2017/path" ) - 1;
url.length = ARRAY_SIZE( str ); url.chars = (WCHAR *)L"net.tcp://+:2017/path";
url.chars = str;
hr = WsOpenListener( NULL, &url, NULL, NULL ); hr = WsOpenListener( NULL, &url, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
...@@ -320,8 +311,8 @@ static void test_WsOpenListener(void) ...@@ -320,8 +311,8 @@ static void test_WsOpenListener(void)
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL ); hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
url.length = ARRAY_SIZE( str2 ); url.length = ARRAY_SIZE( L"net.tcp://localhost:2017" ) - 1;
url.chars = str2; url.chars = (WCHAR *)L"net.tcp://localhost:2017";
hr = WsOpenListener( listener, &url, NULL, NULL ); hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -333,8 +324,8 @@ static void test_WsOpenListener(void) ...@@ -333,8 +324,8 @@ static void test_WsOpenListener(void)
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL ); hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
url.length = ARRAY_SIZE( str3 ); url.length = ARRAY_SIZE( L"net.tcp://127.0.0.1:2017" ) - 1;
url.chars = str3; url.chars = (WCHAR *)L"net.tcp://127.0.0.1:2017";
hr = WsOpenListener( listener, &url, NULL, NULL ); hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -385,9 +376,7 @@ static void test_WsCreateChannelForListener(void) ...@@ -385,9 +376,7 @@ static void test_WsCreateChannelForListener(void)
static void test_WsResetListener(void) static void test_WsResetListener(void)
{ {
WCHAR str[] = WS_STRING url = { ARRAY_SIZE( L"net.tcp://+:2017/path" ) - 1, (WCHAR *)L"net.tcp://+:2017/path" };
{'n','e','t','.','t','c','p',':','/','/','+',':','2','0','1','7','/','p','a','t','h'};
WS_STRING url = { ARRAY_SIZE( str ), str };
WS_LISTENER *listener; WS_LISTENER *listener;
WS_LISTENER_STATE state; WS_LISTENER_STATE state;
WS_LISTENER_PROPERTY prop; WS_LISTENER_PROPERTY prop;
...@@ -433,11 +422,6 @@ static void test_WsResetListener(void) ...@@ -433,11 +422,6 @@ static void test_WsResetListener(void)
WsFreeListener( listener ); WsFreeListener( listener );
} }
static const WCHAR fmt_soap_udp[] =
{'s','o','a','p','.','u','d','p',':','/','/','l','o','c','a','l','h','o','s','t',':','%','u',0};
static const WCHAR fmt_net_tcp[] =
{'n','e','t','.','t','c','p',':','/','/','l','o','c','a','l','h','o','s','t',':','%','u',0};
struct listener_info struct listener_info
{ {
int port; int port;
...@@ -494,7 +478,7 @@ static void client_message_read_write( const struct listener_info *info ) ...@@ -494,7 +478,7 @@ static void client_message_read_write( const struct listener_info *info )
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = wsprintfW( buf, fmt_soap_udp, info->port ); addr.url.length = wsprintfW( buf, L"soap.udp://localhost:%u", info->port );
addr.url.chars = buf; addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL ); hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -635,7 +619,7 @@ static void client_duplex_session( const struct listener_info *info ) ...@@ -635,7 +619,7 @@ static void client_duplex_session( const struct listener_info *info )
ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr ); ok( hr == WS_E_INVALID_OPERATION, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = wsprintfW( buf, fmt_net_tcp, info->port ); addr.url.length = wsprintfW( buf, L"net.tcp://localhost:%u", info->port );
addr.url.chars = buf; addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL ); hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -707,7 +691,7 @@ static void server_accept_channel( WS_CHANNEL *channel ) ...@@ -707,7 +691,7 @@ static void server_accept_channel( WS_CHANNEL *channel )
static void client_accept_channel( const struct listener_info *info ) static void client_accept_channel( const struct listener_info *info )
{ {
const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? fmt_net_tcp : fmt_soap_udp; const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? L"net.tcp://localhost:%u" : L"soap.udp://localhost:%u";
WS_XML_STRING localname = {9, (BYTE *)"localname"}, ns = {2, (BYTE *)"ns"}, action = {6, (BYTE *)"action"}; WS_XML_STRING localname = {9, (BYTE *)"localname"}, ns = {2, (BYTE *)"ns"}, action = {6, (BYTE *)"action"};
WCHAR buf[64]; WCHAR buf[64];
WS_LISTENER *listener; WS_LISTENER *listener;
...@@ -827,7 +811,7 @@ static void client_request_reply( const struct listener_info *info ) ...@@ -827,7 +811,7 @@ static void client_request_reply( const struct listener_info *info )
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = wsprintfW( buf, fmt_net_tcp, info->port ); addr.url.length = wsprintfW( buf, L"net.tcp://localhost:%u", info->port );
addr.url.chars = buf; addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL ); hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -867,7 +851,7 @@ static void client_request_reply( const struct listener_info *info ) ...@@ -867,7 +851,7 @@ static void client_request_reply( const struct listener_info *info )
static DWORD CALLBACK listener_proc( void *arg ) static DWORD CALLBACK listener_proc( void *arg )
{ {
struct listener_info *info = arg; struct listener_info *info = arg;
const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? fmt_net_tcp : fmt_soap_udp; const WCHAR *fmt = (info->binding == WS_TCP_CHANNEL_BINDING) ? L"net.tcp://localhost:%u" : L"soap.udp://localhost:%u";
WS_LISTENER *listener; WS_LISTENER *listener;
WS_CHANNEL *channel; WS_CHANNEL *channel;
WCHAR buf[64]; WCHAR buf[64];
...@@ -973,7 +957,6 @@ done: ...@@ -973,7 +957,6 @@ done:
static HRESULT set_firewall( enum firewall_op op ) static HRESULT set_firewall( enum firewall_op op )
{ {
static const WCHAR testW[] = {'w','e','b','s','e','r','v','i','c','e','s','_','t','e','s','t',0};
HRESULT hr, init; HRESULT hr, init;
INetFwMgr *mgr = NULL; INetFwMgr *mgr = NULL;
INetFwPolicy *policy = NULL; INetFwPolicy *policy = NULL;
...@@ -1013,7 +996,7 @@ static HRESULT set_firewall( enum firewall_op op ) ...@@ -1013,7 +996,7 @@ static HRESULT set_firewall( enum firewall_op op )
hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image ); hr = INetFwAuthorizedApplication_put_ProcessImageFileName( app, image );
if (hr != S_OK) goto done; if (hr != S_OK) goto done;
name = SysAllocString( testW ); name = SysAllocString( L"webservices_test" );
hr = INetFwAuthorizedApplication_put_Name( app, name ); hr = INetFwAuthorizedApplication_put_Name( app, name );
SysFreeString( name ); SysFreeString( name );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
......
...@@ -257,7 +257,6 @@ static void test_WsInitializeMessage(void) ...@@ -257,7 +257,6 @@ static void test_WsInitializeMessage(void)
static void test_WsAddressMessage(void) static void test_WsAddressMessage(void)
{ {
static WCHAR localhost[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/',0};
HRESULT hr; HRESULT hr;
WS_MESSAGE *msg; WS_MESSAGE *msg;
WS_ENDPOINT_ADDRESS endpoint; WS_ENDPOINT_ADDRESS endpoint;
...@@ -304,8 +303,8 @@ static void test_WsAddressMessage(void) ...@@ -304,8 +303,8 @@ static void test_WsAddressMessage(void)
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
memset( &endpoint, 0, sizeof(endpoint) ); memset( &endpoint, 0, sizeof(endpoint) );
endpoint.url.chars = localhost; endpoint.url.chars = (WCHAR *)L"http://localhost/";
endpoint.url.length = ARRAY_SIZE( localhost ); endpoint.url.length = ARRAY_SIZE( L"http://localhost/" ) - 1;
hr = WsAddressMessage( msg, &endpoint, NULL ); hr = WsAddressMessage( msg, &endpoint, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -639,12 +638,11 @@ static void test_WsSetHeader(void) ...@@ -639,12 +638,11 @@ static void test_WsSetHeader(void)
"<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>" "<a:MessageID>urn:uuid:00000000-0000-0000-0000-000000000000</a:MessageID>"
"<a:Action s:mustUnderstand=\"1\">action2</a:Action></s:Header>" "<a:Action s:mustUnderstand=\"1\">action2</a:Action></s:Header>"
"<s:Body/></s:Envelope>"; "<s:Body/></s:Envelope>";
static const WCHAR action[] = {'a','c','t','i','o','n',0};
static const WS_XML_STRING action2 = {7, (BYTE *)"action2"}; static const WS_XML_STRING action2 = {7, (BYTE *)"action2"};
HRESULT hr; HRESULT hr;
WS_MESSAGE *msg; WS_MESSAGE *msg;
WS_XML_WRITER *writer; WS_XML_WRITER *writer;
const WCHAR *ptr = action; const WCHAR *ptr = L"action";
hr = WsSetHeader( NULL, 0, 0, 0, NULL, 0, NULL ); hr = WsSetHeader( NULL, 0, 0, 0, NULL, 0, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
...@@ -848,8 +846,6 @@ static void test_WsAddCustomHeader(void) ...@@ -848,8 +846,6 @@ static void test_WsAddCustomHeader(void)
"<header2 xmlns=\"ns\">value2</header2></s:Header><s:Body/></s:Envelope>"; "<header2 xmlns=\"ns\">value2</header2></s:Header><s:Body/></s:Envelope>";
static WS_XML_STRING header = {6, (BYTE *)"header"}, ns = {2, (BYTE *)"ns"}; static WS_XML_STRING header = {6, (BYTE *)"header"}, ns = {2, (BYTE *)"ns"};
static WS_XML_STRING header2 = {7, (BYTE *)"header2"}; static WS_XML_STRING header2 = {7, (BYTE *)"header2"};
static WCHAR valueW[] = {'v','a','l','u','e',0};
static WCHAR value2W[] = {'v','a','l','u','e','2',0};
HRESULT hr; HRESULT hr;
WS_MESSAGE *msg; WS_MESSAGE *msg;
WS_ELEMENT_DESCRIPTION desc; WS_ELEMENT_DESCRIPTION desc;
...@@ -891,12 +887,12 @@ static void test_WsAddCustomHeader(void) ...@@ -891,12 +887,12 @@ static void test_WsAddCustomHeader(void)
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected2, -1, strstr(expected2, "urn:uuid:") - expected2, 46, __LINE__ ); check_output_header( msg, expected2, -1, strstr(expected2, "urn:uuid:") - expected2, 46, __LINE__ );
test.value = valueW; test.value = L"value";
hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL ); hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ ); check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
test.value = value2W; test.value = L"value2";
hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL ); hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected3, -1, strstr(expected3, "urn:uuid:") - expected3, 46, __LINE__ ); check_output_header( msg, expected3, -1, strstr(expected3, "urn:uuid:") - expected3, 46, __LINE__ );
...@@ -1243,9 +1239,8 @@ static void test_WsGetHeader(void) ...@@ -1243,9 +1239,8 @@ static void test_WsGetHeader(void)
"<Action s:mustUnderstand=\"1\" " "<Action s:mustUnderstand=\"1\" "
"xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">action</Action>" "xmlns=\"http://schemas.microsoft.com/ws/2005/05/addressing/none\">action</Action>"
"</s:Header><s:Body/></s:Envelope>"; "</s:Header><s:Body/></s:Envelope>";
static WCHAR action[] = {'a','c','t','i','o','n',0};
WS_MESSAGE *msg; WS_MESSAGE *msg;
WCHAR *ptr; const WCHAR *ptr;
HRESULT hr; HRESULT hr;
hr = WsGetHeader( NULL, 0, 0, 0, NULL, NULL, 0, NULL ); hr = WsGetHeader( NULL, 0, 0, 0, NULL, NULL, 0, NULL );
...@@ -1275,7 +1270,7 @@ static void test_WsGetHeader(void) ...@@ -1275,7 +1270,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, NULL, 0, NULL ); hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, NULL, 0, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr ); ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
ptr = action; ptr = L"action";
hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL ); hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ ); check_output_header( msg, expected, -1, strstr(expected, "urn:uuid:") - expected, 46, __LINE__ );
...@@ -1291,7 +1286,7 @@ static void test_WsGetHeader(void) ...@@ -1291,7 +1286,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL ); hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( ptr != NULL, "ptr not set\n" ); ok( ptr != NULL, "ptr not set\n" );
ok( !memcmp( ptr, action, sizeof(action) ), "wrong data\n" ); ok( !memcmp( ptr, L"action", sizeof(L"action") ), "wrong data\n" );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL ); hr = WsCreateMessage( WS_ENVELOPE_VERSION_NONE, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
...@@ -1300,7 +1295,7 @@ static void test_WsGetHeader(void) ...@@ -1300,7 +1295,7 @@ static void test_WsGetHeader(void)
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ptr = action; ptr = L"action";
hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL ); hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
if (hr == S_OK) check_output_header( msg, expected2, -1, 0, 0, __LINE__ ); if (hr == S_OK) check_output_header( msg, expected2, -1, 0, 0, __LINE__ );
...@@ -1309,7 +1304,7 @@ static void test_WsGetHeader(void) ...@@ -1309,7 +1304,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL ); hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( ptr != NULL, "ptr not set\n" ); ok( ptr != NULL, "ptr not set\n" );
ok( !memcmp( ptr, action, sizeof(action) ), "wrong data\n" ); ok( !memcmp( ptr, L"action", sizeof(L"action") ), "wrong data\n" );
WsFreeMessage( msg ); WsFreeMessage( msg );
hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL ); hr = WsCreateMessage( WS_ENVELOPE_VERSION_SOAP_1_2, WS_ADDRESSING_VERSION_TRANSPORT, NULL, 0, &msg, NULL );
...@@ -1318,7 +1313,7 @@ static void test_WsGetHeader(void) ...@@ -1318,7 +1313,7 @@ static void test_WsGetHeader(void)
hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL ); hr = WsInitializeMessage( msg, WS_REQUEST_MESSAGE, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ptr = action; ptr = L"action";
hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL ); hr = WsSetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_WRITE_REQUIRED_POINTER, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
if (hr == S_OK) check_output_header( msg, expected3, -1, 0, 0, __LINE__ ); if (hr == S_OK) check_output_header( msg, expected3, -1, 0, 0, __LINE__ );
...@@ -1327,7 +1322,7 @@ static void test_WsGetHeader(void) ...@@ -1327,7 +1322,7 @@ static void test_WsGetHeader(void)
hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL ); hr = WsGetHeader( msg, WS_ACTION_HEADER, WS_WSZ_TYPE, WS_READ_REQUIRED_POINTER, NULL, &ptr, sizeof(ptr), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( ptr != NULL, "ptr not set\n" ); ok( ptr != NULL, "ptr not set\n" );
ok( !memcmp( ptr, action, sizeof(action) ), "wrong data\n" ); ok( !memcmp( ptr, L"action", sizeof(L"action") ), "wrong data\n" );
WsFreeMessage( msg ); WsFreeMessage( msg );
} }
...@@ -1336,7 +1331,6 @@ static void test_WsGetCustomHeader(void) ...@@ -1336,7 +1331,6 @@ static void test_WsGetCustomHeader(void)
static char expected[] = static char expected[] =
"<Envelope><Header><Custom xmlns=\"ns\">value</Custom></Header><Body/></Envelope>"; "<Envelope><Header><Custom xmlns=\"ns\">value</Custom></Header><Body/></Envelope>";
static WS_XML_STRING custom = {6, (BYTE *)"Custom"}, ns = {2, (BYTE *)"ns"}; static WS_XML_STRING custom = {6, (BYTE *)"Custom"}, ns = {2, (BYTE *)"ns"};
static WCHAR valueW[] = {'v','a','l','u','e',0};
WS_ELEMENT_DESCRIPTION desc; WS_ELEMENT_DESCRIPTION desc;
WS_STRUCT_DESCRIPTION s; WS_STRUCT_DESCRIPTION s;
WS_FIELD_DESCRIPTION f, *fields[1]; WS_FIELD_DESCRIPTION f, *fields[1];
...@@ -1375,7 +1369,7 @@ static void test_WsGetCustomHeader(void) ...@@ -1375,7 +1369,7 @@ static void test_WsGetCustomHeader(void)
desc.type = WS_STRUCT_TYPE; desc.type = WS_STRUCT_TYPE;
desc.typeDescription = &s; desc.typeDescription = &s;
test.value = valueW; test.value = L"value";
hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL ); hr = WsAddCustomHeader( msg, &desc, WS_WRITE_REQUIRED_VALUE, &test, sizeof(test), 0, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
check_output_header( msg, expected, -1, 0, 0, __LINE__ ); check_output_header( msg, expected, -1, 0, 0, __LINE__ );
...@@ -1394,7 +1388,7 @@ static void test_WsGetCustomHeader(void) ...@@ -1394,7 +1388,7 @@ static void test_WsGetCustomHeader(void)
NULL, NULL ); NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( test.value != NULL, "value not set\n" ); ok( test.value != NULL, "value not set\n" );
ok( !memcmp( test.value, valueW, sizeof(valueW) ), "wrong value\n" ); ok( !memcmp( test.value, L"value", sizeof(L"value") ), "wrong value\n" );
WsFreeMessage( msg ); WsFreeMessage( msg );
} }
......
...@@ -146,7 +146,6 @@ static void test_WsCreateServiceProxyFromTemplate(void) ...@@ -146,7 +146,6 @@ static void test_WsCreateServiceProxyFromTemplate(void)
static void test_WsOpenServiceProxy(void) static void test_WsOpenServiceProxy(void)
{ {
WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/'};
HRESULT hr; HRESULT hr;
WS_SERVICE_PROXY *proxy; WS_SERVICE_PROXY *proxy;
WS_SERVICE_PROXY_STATE state; WS_SERVICE_PROXY_STATE state;
...@@ -164,8 +163,8 @@ static void test_WsOpenServiceProxy(void) ...@@ -164,8 +163,8 @@ static void test_WsOpenServiceProxy(void)
ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state ); ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = ARRAY_SIZE( url ); addr.url.length = ARRAY_SIZE( L"http://localhost/" ) - 1;
addr.url.chars = url; addr.url.chars = (WCHAR *)L"http://localhost/";
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL ); hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -187,7 +186,6 @@ static void test_WsOpenServiceProxy(void) ...@@ -187,7 +186,6 @@ static void test_WsOpenServiceProxy(void)
static void test_WsResetServiceProxy(void) static void test_WsResetServiceProxy(void)
{ {
WCHAR url[] = {'h','t','t','p',':','/','/','l','o','c','a','l','h','o','s','t','/'};
HRESULT hr; HRESULT hr;
WS_SERVICE_PROXY *proxy; WS_SERVICE_PROXY *proxy;
WS_ENDPOINT_ADDRESS addr; WS_ENDPOINT_ADDRESS addr;
...@@ -206,8 +204,8 @@ static void test_WsResetServiceProxy(void) ...@@ -206,8 +204,8 @@ static void test_WsResetServiceProxy(void)
ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state ); ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state );
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = ARRAY_SIZE( url ); addr.url.length = ARRAY_SIZE( L"http://localhost/" ) - 1;
addr.url.chars = url; addr.url.chars = (WCHAR *)L"http://localhost/";
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL ); hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
...@@ -230,8 +228,6 @@ static void test_WsResetServiceProxy(void) ...@@ -230,8 +228,6 @@ static void test_WsResetServiceProxy(void)
static HRESULT create_channel( int port, WS_CHANNEL **ret ) static HRESULT create_channel( int port, WS_CHANNEL **ret )
{ {
static const WCHAR fmt[] =
{'h','t','t','p',':','/','/','1','2','7','.','0','.','0','.','1',':','%','u',0};
WS_CHANNEL_PROPERTY prop[2]; WS_CHANNEL_PROPERTY prop[2];
WS_ENVELOPE_VERSION env_version = WS_ENVELOPE_VERSION_SOAP_1_1; WS_ENVELOPE_VERSION env_version = WS_ENVELOPE_VERSION_SOAP_1_1;
WS_ADDRESSING_VERSION addr_version = WS_ADDRESSING_VERSION_TRANSPORT; WS_ADDRESSING_VERSION addr_version = WS_ADDRESSING_VERSION_TRANSPORT;
...@@ -253,7 +249,7 @@ static HRESULT create_channel( int port, WS_CHANNEL **ret ) ...@@ -253,7 +249,7 @@ static HRESULT create_channel( int port, WS_CHANNEL **ret )
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = wsprintfW( buf, fmt, port ); addr.url.length = wsprintfW( buf, L"http://127.0.0.1:%u", port );
addr.url.chars = buf; addr.url.chars = buf;
hr = WsOpenChannel( channel, &addr, NULL, NULL ); hr = WsOpenChannel( channel, &addr, NULL, NULL );
if (hr == S_OK) *ret = channel; if (hr == S_OK) *ret = channel;
...@@ -383,8 +379,6 @@ static WS_HTTP_HEADER_MAPPING *response_header_mappings[] = ...@@ -383,8 +379,6 @@ static WS_HTTP_HEADER_MAPPING *response_header_mappings[] =
static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret ) static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret )
{ {
static const WCHAR fmt[] =
{'h','t','t','p',':','/','/','1','2','7','.','0','.','0','.','1',':','%','u','/',0};
WS_ENVELOPE_VERSION env_version; WS_ENVELOPE_VERSION env_version;
WS_ADDRESSING_VERSION addr_version; WS_ADDRESSING_VERSION addr_version;
WS_HTTP_MESSAGE_MAPPING mapping; WS_HTTP_MESSAGE_MAPPING mapping;
...@@ -421,7 +415,7 @@ static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret ) ...@@ -421,7 +415,7 @@ static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret )
if (hr != S_OK) return hr; if (hr != S_OK) return hr;
memset( &addr, 0, sizeof(addr) ); memset( &addr, 0, sizeof(addr) );
addr.url.length = wsprintfW( url, fmt, port ); addr.url.length = wsprintfW( url, L"http://127.0.0.1:%u", port );
addr.url.chars = url; addr.url.chars = url;
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL ); hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
if (hr == S_OK) *ret = proxy; if (hr == S_OK) *ret = proxy;
...@@ -485,7 +479,6 @@ static HRESULT CALLBACK send_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta ...@@ -485,7 +479,6 @@ static HRESULT CALLBACK send_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta
static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *state, WS_ERROR *error ) static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *state, WS_ERROR *error )
{ {
static const WS_XML_STRING header = {20, (BYTE *)"MappedResponseHeader"}; static const WS_XML_STRING header = {20, (BYTE *)"MappedResponseHeader"};
static const WCHAR valueW[] = {'v','a','l','u','e',0};
WCHAR *str; WCHAR *str;
HRESULT hr; HRESULT hr;
...@@ -493,13 +486,12 @@ static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta ...@@ -493,13 +486,12 @@ static HRESULT CALLBACK recv_callback( WS_MESSAGE *msg, WS_HEAP *heap, void *sta
hr = WsGetMappedHeader( msg, &header, WS_SINGLETON_HEADER, 0, WS_WSZ_TYPE, WS_READ_OPTIONAL_POINTER, heap, hr = WsGetMappedHeader( msg, &header, WS_SINGLETON_HEADER, 0, WS_WSZ_TYPE, WS_READ_OPTIONAL_POINTER, heap,
&str, sizeof(str), NULL ); &str, sizeof(str), NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( !lstrcmpW(str, valueW), "wrong value %s\n", wine_dbgstr_w(str) ); ok( !wcscmp(str, L"value"), "wrong value %s\n", wine_dbgstr_w(str) );
return S_OK; return S_OK;
} }
static void test_WsCall( int port ) static void test_WsCall( int port )
{ {
static const WCHAR testW[] = {'t','e','s','t',0}, test2W[] = {'t','e','s','t','2',0};
WS_XML_STRING str = {3, (BYTE *)"str"}; WS_XML_STRING str = {3, (BYTE *)"str"};
WS_XML_STRING req = {3, (BYTE *)"req"}; WS_XML_STRING req = {3, (BYTE *)"req"};
WS_XML_STRING resp = {4, (BYTE *)"resp"}; WS_XML_STRING resp = {4, (BYTE *)"resp"};
...@@ -584,8 +576,8 @@ static void test_WsCall( int port ) ...@@ -584,8 +576,8 @@ static void test_WsCall( int port )
ok( hr == E_INVALIDARG, "got %08x\n", hr ); ok( hr == E_INVALIDARG, "got %08x\n", hr );
in.val = 1; in.val = 1;
str_array[0] = testW; str_array[0] = L"test";
str_array[1] = test2W; str_array[1] = L"test2";
in.str = str_array; in.str = str_array;
in.count = 2; in.count = 2;
...@@ -620,7 +612,7 @@ static void test_WsCall( int port ) ...@@ -620,7 +612,7 @@ static void test_WsCall( int port )
hr = WsCall( proxy, &op, args, heap, prop, ARRAY_SIZE(prop), NULL, NULL ); hr = WsCall( proxy, &op, args, heap, prop, ARRAY_SIZE(prop), NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
ok( !lstrcmpW( out.str, testW ), "wrong data\n" ); ok( !wcscmp( out.str, L"test" ), "wrong data\n" );
ok( out.count == 2, "got %u\n", out.count ); ok( out.count == 2, "got %u\n", out.count );
ok( out.val[0] == 1, "got %u\n", out.val[0] ); ok( out.val[0] == 1, "got %u\n", out.val[0] );
ok( out.val[1] == 2, "got %u\n", out.val[1] ); ok( out.val[1] == 2, "got %u\n", out.val[1] );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment