ddraw: SetPrivateData(..., data = NULL, ...) is not valid.
This commit is contained in:
parent
7983d9974b
commit
ee57e19b40
|
@ -2254,6 +2254,12 @@ static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface,
|
||||||
TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n",
|
TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n",
|
||||||
iface, debugstr_guid(tag), data, size, flags);
|
iface, debugstr_guid(tag), data, size, flags);
|
||||||
|
|
||||||
|
if (!data)
|
||||||
|
{
|
||||||
|
WARN("data is NULL, returning DDERR_INVALIDPARAMS.\n");
|
||||||
|
return DDERR_INVALIDPARAMS;
|
||||||
|
}
|
||||||
|
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_private_store_set_private_data(&surface->private_store, tag, data, size, flags);
|
hr = wined3d_private_store_set_private_data(&surface->private_store, tag, data, size, flags);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
|
|
@ -6103,6 +6103,15 @@ static void test_private_data(void)
|
||||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* NULL pointers are not valid, but don't cause a crash. */
|
||||||
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, NULL,
|
||||||
|
sizeof(IUnknown *), DDSPD_IUNKNOWNPOINTER);
|
||||||
|
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, NULL, 0, 0);
|
||||||
|
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, NULL, 1, 0);
|
||||||
|
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
/* DDSPD_IUNKNOWNPOINTER needs sizeof(IUnknown *) bytes of data. */
|
/* DDSPD_IUNKNOWNPOINTER needs sizeof(IUnknown *) bytes of data. */
|
||||||
hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw,
|
hr = IDirectDrawSurface4_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw,
|
||||||
0, DDSPD_IUNKNOWNPOINTER);
|
0, DDSPD_IUNKNOWNPOINTER);
|
||||||
|
|
|
@ -5958,6 +5958,15 @@ static void test_private_data(void)
|
||||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &surface, NULL);
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
/* NULL pointers are not valid, but don't cause a crash. */
|
||||||
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, NULL,
|
||||||
|
sizeof(IUnknown *), DDSPD_IUNKNOWNPOINTER);
|
||||||
|
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, NULL, 0, 0);
|
||||||
|
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||||
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, NULL, 1, 0);
|
||||||
|
ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
/* DDSPD_IUNKNOWNPOINTER needs sizeof(IUnknown *) bytes of data. */
|
/* DDSPD_IUNKNOWNPOINTER needs sizeof(IUnknown *) bytes of data. */
|
||||||
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw,
|
hr = IDirectDrawSurface7_SetPrivateData(surface, &ddraw_private_data_test_guid, ddraw,
|
||||||
0, DDSPD_IUNKNOWNPOINTER);
|
0, DDSPD_IUNKNOWNPOINTER);
|
||||||
|
|
Loading…
Reference in New Issue