Commit 9061ee4e authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Implement WsGetHeapProperty.

parent 5db34f7d
......@@ -200,6 +200,15 @@ static HRESULT set_heap_prop( struct heap *heap, WS_HEAP_PROPERTY_ID id, const v
return S_OK;
}
static HRESULT get_heap_prop( struct heap *heap, WS_HEAP_PROPERTY_ID id, void *buf, ULONG size )
{
if (id >= heap->prop_count || size != heap_props[id].size)
return E_INVALIDARG;
memcpy( buf, heap->prop[id].value, heap->prop[id].valueSize );
return S_OK;
}
/**************************************************************************
* WsCreateHeap [webservices.@]
*/
......@@ -254,6 +263,20 @@ HRESULT WINAPI WsGetErrorProperty( WS_ERROR *handle, WS_ERROR_PROPERTY_ID id, vo
}
/**************************************************************************
* WsGetHeapProperty [webservices.@]
*/
HRESULT WINAPI WsGetHeapProperty( WS_HEAP *handle, WS_HEAP_PROPERTY_ID id, void *buf,
ULONG size, WS_ERROR *error )
{
struct heap *heap = (struct heap *)handle;
TRACE( "%p %u %p %u %p\n", handle, id, buf, size, error );
if (error) FIXME( "ignoring error parameter\n" );
return get_heap_prop( heap, id, buf, size );
}
/**************************************************************************
* WsSetErrorProperty [webservices.@]
*/
HRESULT WINAPI WsSetErrorProperty( WS_ERROR *handle, WS_ERROR_PROPERTY_ID id, const void *value,
......
......@@ -112,7 +112,79 @@ static void test_WsCreateError(void)
ok( hr == E_INVALIDARG, "got %08x\n", hr );
}
static void test_WsCreateHeap(void)
{
HRESULT hr;
WS_HEAP *heap;
WS_HEAP_PROPERTY prop;
SIZE_T max, trim, requested, actual;
ULONG size;
hr = WsCreateHeap( 0, 0, NULL, 0, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
heap = NULL;
hr = WsCreateHeap( 0, 0, NULL, 0, &heap, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( heap != NULL, "heap not set\n" );
WsFreeHeap( heap );
hr = WsCreateHeap( 1 << 16, 1 << 6, NULL, 0, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
heap = NULL;
hr = WsCreateHeap( 1 << 16, 0, NULL, 0, &heap, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( heap != NULL, "heap not set\n" );
WsFreeHeap( heap );
hr = WsCreateHeap( 1 << 16, 1 << 6, NULL, 0, &heap, NULL );
ok( hr == S_OK, "got %08x\n", hr );
max = 0xdeadbeef;
size = sizeof(max);
hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_MAX_SIZE, &max, size, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( max == 1 << 16, "got %u\n", (ULONG)max );
trim = 0xdeadbeef;
size = sizeof(trim);
hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_TRIM_SIZE, &trim, size, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( trim == 1 << 6, "got %u\n", (ULONG)trim );
requested = 0xdeadbeef;
size = sizeof(requested);
hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_REQUESTED_SIZE, &requested, size, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( !requested, "got %u\n", (ULONG)requested );
actual = 0xdeadbeef;
size = sizeof(actual);
hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_ACTUAL_SIZE, &actual, size, NULL );
ok( hr == S_OK, "got %08x\n", hr );
ok( !actual, "got %u\n", (ULONG)actual );
actual = 0xdeadbeef;
size = sizeof(actual);
hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_ACTUAL_SIZE + 1, &actual, size, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
ok( actual == 0xdeadbeef, "got %u\n", (ULONG)actual );
WsFreeHeap( heap );
max = 1 << 16;
prop.id = WS_HEAP_PROPERTY_MAX_SIZE;
prop.value = &max;
prop.valueSize = sizeof(max);
hr = WsCreateHeap( 1 << 16, 1 << 6, &prop, 1, &heap, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
hr = WsCreateHeap( 1 << 16, 1 << 6, NULL, 1, &heap, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
}
START_TEST(reader)
{
test_WsCreateError();
test_WsCreateHeap();
}
......@@ -68,7 +68,7 @@
@ stub WsGetFaultErrorProperty
@ stub WsGetHeader
@ stub WsGetHeaderAttributes
@ stub WsGetHeapProperty
@ stdcall WsGetHeapProperty(ptr long ptr long ptr)
@ stub WsGetListenerProperty
@ stub WsGetMappedHeader
@ stub WsGetMessageProperty
......
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