ole32/tests: Add a few CoGetMalloc tests.

Rob Shearman robertshearman at gmail.com
Tue Mar 3 06:48:51 CST 2009


2009/3/3 Huw Davies <huw at codeweavers.com>:
> diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
> index a332d27..9720e52 100644
> --- a/dlls/ole32/tests/compobj.c
> +++ b/dlls/ole32/tests/compobj.c
> @@ -1162,6 +1162,28 @@ static void test_CoInitializeEx(void)
>      OleUninitialize();
>  }
>
> +static void test_CoGetMalloc(void)
> +{
> +    IMalloc *malloc;
> +    HRESULT hr;
> +    void *ptr;
> +    DWORD i, size;
> +
> +    OleInitialize(NULL);
> +    hr = CoGetMalloc(1, &malloc);
> +    ok(hr == S_OK, "got %x\n", hr);
> +    for(i = 0; i < 10; i++)
> +    {
> +        ptr = IMalloc_Alloc(malloc, i);
> +        ok(ptr != NULL, "got NULL for size %d\n", i);
> +        size = IMalloc_GetSize(malloc, ptr);
> +        ok(size == i, "got %d expected %d\n", size, i);

Has this been tested on Win9x? Since HeapSize on those versions of
Windows doesn't return the same size as allocated, IMalloc_GetSize
might not either.

> +        IMalloc_Free(malloc, ptr);
> +    }
> +    IMalloc_Release(malloc);
> +    OleUninitialize();
> +}


-- 
Rob Shearman



More information about the wine-devel mailing list