webservices: Added WsResetError().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-06-13 19:14:47 +03:00 committed by Alexandre Julliard
parent 73d9e2ebff
commit 5310f9690f
4 changed files with 77 additions and 1 deletions

View File

@ -142,6 +142,23 @@ void WINAPI WsFreeError( WS_ERROR *handle )
heap_free( error );
}
/**************************************************************************
* WsResetError [webservices.@]
*/
HRESULT WINAPI WsResetError( WS_ERROR *handle )
{
struct error *error = (struct error *)handle;
ULONG code;
TRACE( "%p\n", handle );
if (!handle) return E_INVALIDARG;
/* FIXME: release strings added with WsAddErrorString when it's implemented, reset string count */
code = 0;
return prop_set( error->prop, error->prop_count, WS_ERROR_PROPERTY_ORIGINAL_ERROR_CODE, &code, sizeof(code) );
}
static const struct prop_desc heap_props[] =
{
{ sizeof(SIZE_T), FALSE }, /* WS_HEAP_PROPERTY_MAX_SIZE */

View File

@ -3359,6 +3359,63 @@ static void test_WsReadValue(void)
WsFreeReader( reader );
}
static void test_WsResetError(void)
{
WS_ERROR_PROPERTY prop;
ULONG size, code;
WS_ERROR *error;
LANGID langid;
HRESULT hr;
hr = WsResetError( NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
error = NULL;
hr = WsCreateError( NULL, 0, &error );
ok( hr == S_OK, "got %08x\n", hr );
ok( error != NULL, "error not set\n" );
code = 0xdeadbeef;
size = sizeof(code);
hr = WsSetErrorProperty( error, WS_ERROR_PROPERTY_ORIGINAL_ERROR_CODE, &code, size );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsResetError( error );
ok( hr == S_OK, "got %08x\n", hr );
code = 0xdeadbeef;
size = sizeof(code);
hr = WsGetErrorProperty( error, WS_ERROR_PROPERTY_ORIGINAL_ERROR_CODE, &code, size );
ok( hr == S_OK, "got %08x\n", hr );
ok( !code, "got %u\n", code );
WsFreeError( error );
langid = MAKELANGID( LANG_DUTCH, SUBLANG_DEFAULT );
prop.id = WS_ERROR_PROPERTY_LANGID;
prop.value = &langid;
prop.valueSize = sizeof(langid);
hr = WsCreateError( &prop, 1, &error );
ok( hr == S_OK, "got %08x\n", hr );
langid = 0xdead;
size = sizeof(langid);
hr = WsGetErrorProperty( error, WS_ERROR_PROPERTY_LANGID, &langid, size );
ok( hr == S_OK, "got %08x\n", hr );
ok( langid == MAKELANGID( LANG_DUTCH, SUBLANG_DEFAULT ), "got %u\n", langid );
hr = WsResetError( error );
ok( hr == S_OK, "got %08x\n", hr );
langid = 0xdead;
size = sizeof(langid);
hr = WsGetErrorProperty( error, WS_ERROR_PROPERTY_LANGID, &langid, size );
ok( hr == S_OK, "got %08x\n", hr );
ok( langid == MAKELANGID( LANG_DUTCH, SUBLANG_DEFAULT ), "got %u\n", langid );
WsFreeError( error );
}
START_TEST(reader)
{
test_WsCreateError();
@ -3390,4 +3447,5 @@ START_TEST(reader)
test_double();
test_WsReadElement();
test_WsReadValue();
test_WsResetError();
}

View File

@ -134,7 +134,7 @@
@ stub WsRequestReply
@ stub WsRequestSecurityToken
@ stub WsResetChannel
@ stub WsResetError
@ stdcall WsResetError(ptr)
@ stdcall WsResetHeap(ptr ptr)
@ stub WsResetListener
@ stub WsResetMessage

View File

@ -1148,6 +1148,7 @@ HRESULT WINAPI WsReadToStartElement(WS_XML_READER*, const WS_XML_STRING*, const
HRESULT WINAPI WsReadType(WS_XML_READER*, WS_TYPE_MAPPING, WS_TYPE, const void*, WS_READ_OPTION,
WS_HEAP*, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsReadValue(WS_XML_READER*, WS_VALUE_TYPE, void*, ULONG, WS_ERROR*);
HRESULT WINAPI WsResetError(WS_ERROR*);
HRESULT WINAPI WsResetHeap(WS_HEAP*, WS_ERROR*);
HRESULT WINAPI WsSendMessage(WS_CHANNEL*, WS_MESSAGE*, const WS_MESSAGE_DESCRIPTION*, WS_WRITE_OPTION,
const void*, ULONG, const WS_ASYNC_CONTEXT*, WS_ERROR*);