[2/5] d3d9: Test invalid buffer lock parameters

Henri Verbeet hverbeet at gmail.com
Fri Jan 29 05:21:27 CST 2010


On 29 January 2010 11:35, Stefan Dösinger <stefan at codeweavers.com> wrote:
> +static HMODULE d3d9_handle = 0;
This is redundant.

> +    hr = IDirect3DVertexBuffer9_Lock(buffer, 0, 0, (void *) &bufstart, 0);
> +    ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Lock failed, 0x%08x\n", hr);
> +    hr = IDirect3DVertexBuffer9_Unlock(buffer);
> +    ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Unlock failed, 0x%08x\n", hr);
> +
> +    hr = IDirect3DVertexBuffer9_Lock(buffer, 0, 1024, (void *) &data, 0);
> +    ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Lock failed, 0x%08x\n", hr);
> +    hr = IDirect3DVertexBuffer9_Unlock(buffer);
> +    ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Unlock failed, 0x%08x\n", hr);
> +    ok(bufstart == data, "Two locks returned different addresses: %p, %p\n", bufstart, data);
>
Why would we care if the buffer is always mapped at the same address?
Also note that the test doesn't necessarily prove this is the case.

> +    /* This happily wraps around the address space */
> +    hr = IDirect3DVertexBuffer9_Lock(buffer, ~0U, 1024, (void *) &data, 0);
> +    ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Lock(start ~0U) failed, 0x%08x\n", hr);
> +    hr = IDirect3DVertexBuffer9_Unlock(buffer);
> +    ok(hr == D3D_OK, "IDirect3DVertexBuffer9_Unlock failed, 0x%08x\n", hr);
> +    ok(bufstart -1 == data, "~0U start lock returned unexpected address: expected %p, got %p\n", bufstart - 1, data);
>
I'd expect this to break on 64 bit. Also, like the previous test, why
do we care? Do you seriously have an application that does this?



More information about the wine-devel mailing list