[1/8] webservices: Implement WS_HEAP_PROPERTY_REQUESTED_SIZE and WS_HEAP_PROPERTY_ACTUAL_SIZE.

Hans Leidekker hans at codeweavers.com
Wed Mar 8 04:25:53 CST 2017


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/webservices/reader.c       | 14 +++++++++++++-
 dlls/webservices/tests/reader.c | 21 ++++++++++++++++++---
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index 5d15f78..8d4a751 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -877,7 +877,19 @@ HRESULT WINAPI WsGetHeapProperty( WS_HEAP *handle, WS_HEAP_PROPERTY_ID id, void
     TRACE( "%p %u %p %u %p\n", handle, id, buf, size, error );
     if (error) FIXME( "ignoring error parameter\n" );
 
-    return prop_get( heap->prop, heap->prop_count, id, buf, size );
+    switch (id)
+    {
+    case WS_HEAP_PROPERTY_REQUESTED_SIZE:
+    case WS_HEAP_PROPERTY_ACTUAL_SIZE:
+    {
+        SIZE_T *heap_size = buf;
+        if (!buf || size != sizeof(heap_size)) return E_INVALIDARG;
+        *heap_size = heap->allocated;
+        return S_OK;
+    }
+    default:
+        return prop_get( heap->prop, heap->prop_count, id, buf, size );
+    }
 }
 
 /**************************************************************************
diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c
index 28a7af4..c10b581 100644
--- a/dlls/webservices/tests/reader.c
+++ b/dlls/webservices/tests/reader.c
@@ -1758,6 +1758,8 @@ static void test_WsAlloc(void)
     HRESULT hr;
     WS_HEAP *heap;
     void *ptr;
+    SIZE_T requested, actual;
+    ULONG size;
 
     hr = WsCreateHeap( 256, 0, NULL, 0, &heap, NULL );
     ok( hr == S_OK, "got %08x\n", hr );
@@ -1776,6 +1778,19 @@ static void test_WsAlloc(void)
     hr = WsAlloc( heap, 16, &ptr, NULL );
     ok( hr == S_OK, "got %08x\n", hr );
     ok( ptr != NULL, "ptr not set\n" );
+
+    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 == 16, "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 );
+    todo_wine ok( actual == 128, "got %u\n", (ULONG)actual );
+
     WsFreeHeap( heap );
 }
 
@@ -3078,13 +3093,13 @@ static void test_WsResetHeap(void)
     size = sizeof(requested);
     hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_REQUESTED_SIZE, &requested, size, NULL );
     ok( hr == S_OK, "got %08x\n", hr );
-    todo_wine ok( requested == 128, "got %u\n", (ULONG)requested );
+    ok( requested == 128, "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 );
-    todo_wine ok( actual == 128, "got %u\n", (ULONG)actual );
+    ok( actual == 128, "got %u\n", (ULONG)actual );
 
     hr = WsAlloc( heap, 1, &ptr, NULL );
     ok( hr == S_OK, "got %08x\n", hr );
@@ -3093,7 +3108,7 @@ static void test_WsResetHeap(void)
     size = sizeof(requested);
     hr = WsGetHeapProperty( heap, WS_HEAP_PROPERTY_REQUESTED_SIZE, &requested, size, NULL );
     ok( hr == S_OK, "got %08x\n", hr );
-    todo_wine ok( requested == 129, "got %u\n", (ULONG)requested );
+    ok( requested == 129, "got %u\n", (ULONG)requested );
 
     actual = 0xdeadbeef;
     size = sizeof(actual);
-- 
2.1.4




More information about the wine-patches mailing list