d3drm: CreateViewport checks for non-NULL viewport pointer first.
Signed-off-by: Jeff Smith <whydoubt@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8f5b9f4d4b
commit
5ebd6117b2
|
@ -568,10 +568,12 @@ static HRESULT WINAPI d3drm1_CreateViewport(IDirect3DRM *iface, IDirect3DRMDevic
|
|||
TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
|
||||
iface, device, camera, x, y, width, height, viewport);
|
||||
|
||||
if (!device || !camera)
|
||||
return D3DRMERR_BADOBJECT;
|
||||
if (!viewport)
|
||||
return D3DRMERR_BADVALUE;
|
||||
*viewport = NULL;
|
||||
|
||||
if (!device || !camera)
|
||||
return D3DRMERR_BADOBJECT;
|
||||
|
||||
if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMDevice3, (void **)&device3)))
|
||||
return hr;
|
||||
|
@ -1090,10 +1092,12 @@ static HRESULT WINAPI d3drm2_CreateViewport(IDirect3DRM2 *iface, IDirect3DRMDevi
|
|||
TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
|
||||
iface, device, camera, x, y, width, height, viewport);
|
||||
|
||||
if (!device || !camera)
|
||||
return D3DRMERR_BADOBJECT;
|
||||
if (!viewport)
|
||||
return D3DRMERR_BADVALUE;
|
||||
*viewport = NULL;
|
||||
|
||||
if (!device || !camera)
|
||||
return D3DRMERR_BADOBJECT;
|
||||
|
||||
if (FAILED(hr = IDirect3DRMDevice_QueryInterface(device, &IID_IDirect3DRMDevice3, (void **)&device3)))
|
||||
return hr;
|
||||
|
@ -1761,10 +1765,12 @@ static HRESULT WINAPI d3drm3_CreateViewport(IDirect3DRM3 *iface, IDirect3DRMDevi
|
|||
TRACE("iface %p, device %p, camera %p, x %u, y %u, width %u, height %u, viewport %p.\n",
|
||||
iface, device, camera, x, y, width, height, viewport);
|
||||
|
||||
if (!device || !camera)
|
||||
return D3DRMERR_BADOBJECT;
|
||||
if (!viewport)
|
||||
return D3DRMERR_BADVALUE;
|
||||
*viewport = NULL;
|
||||
|
||||
if (!device || !camera)
|
||||
return D3DRMERR_BADOBJECT;
|
||||
|
||||
if (FAILED(hr = d3drm_viewport_create(&object, &d3drm->IDirect3DRM_iface)))
|
||||
return hr;
|
||||
|
|
|
@ -1863,42 +1863,72 @@ static void test_Viewport(void)
|
|||
ok(ref4 == frame_ref2, "Expected ref4 == frame_ref2, got frame_ref2 = %u, ref4 = %u.\n", frame_ref2, ref4);
|
||||
|
||||
/* Test all failures together */
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM_CreateViewport(d3drm1, NULL, frame, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM_CreateViewport(d3drm1, device1, NULL, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM_CreateViewport(d3drm1, device1, frame, rc.left, rc.top, rc.right + 1, rc.bottom + 1, &viewport);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM_CreateViewport(d3drm1, device1, frame, rc.left, rc.top, rc.right + 1, rc.bottom, &viewport);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM_CreateViewport(d3drm1, device1, frame, rc.left, rc.top, rc.right, rc.bottom + 1, &viewport);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
hr = IDirect3DRM_CreateViewport(d3drm1, device1, frame, rc.left, rc.top, rc.right, rc.bottom, NULL);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM2_CreateViewport(d3drm2, NULL, frame, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM2_CreateViewport(d3drm2, device1, NULL, rc.left, rc.top, rc.right, rc.bottom, &viewport);
|
||||
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM2_CreateViewport(d3drm2, device1, frame, rc.left, rc.top, rc.right + 1, rc.bottom + 1, &viewport);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM2_CreateViewport(d3drm2, device1, frame, rc.left, rc.top, rc.right + 1, rc.bottom, &viewport);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
viewport = (IDirect3DRMViewport *)0xdeadbeef;
|
||||
hr = IDirect3DRM2_CreateViewport(d3drm2, device1, frame, rc.left, rc.top, rc.right, rc.bottom + 1, &viewport);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport, "Expected viewport returned == NULL, got %p.\n", viewport);
|
||||
hr = IDirect3DRM2_CreateViewport(d3drm2, device1, frame, rc.left, rc.top, rc.right, rc.bottom, NULL);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
|
||||
viewport2 = (IDirect3DRMViewport2 *)0xdeadbeef;
|
||||
hr = IDirect3DRM3_CreateViewport(d3drm3, NULL, frame3, rc.left, rc.top, rc.right, rc.bottom, &viewport2);
|
||||
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
|
||||
ok(!viewport2, "Expected viewport returned == NULL, got %p.\n", viewport2);
|
||||
viewport2 = (IDirect3DRMViewport2 *)0xdeadbeef;
|
||||
hr = IDirect3DRM3_CreateViewport(d3drm3, device3, NULL, rc.left, rc.top, rc.right, rc.bottom, &viewport2);
|
||||
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
|
||||
ok(!viewport2, "Expected viewport returned == NULL, got %p.\n", viewport2);
|
||||
viewport2 = (IDirect3DRMViewport2 *)0xdeadbeef;
|
||||
hr = IDirect3DRM3_CreateViewport(d3drm3, device3, frame3, rc.left, rc.top, rc.right + 1, rc.bottom + 1, &viewport2);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport2, "Expected viewport returned == NULL, got %p.\n", viewport2);
|
||||
viewport2 = (IDirect3DRMViewport2 *)0xdeadbeef;
|
||||
hr = IDirect3DRM3_CreateViewport(d3drm3, device3, frame3, rc.left, rc.top, rc.right + 1, rc.bottom, &viewport2);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport2, "Expected viewport returned == NULL, got %p.\n", viewport2);
|
||||
viewport2 = (IDirect3DRMViewport2 *)0xdeadbeef;
|
||||
hr = IDirect3DRM3_CreateViewport(d3drm3, device3, frame3, rc.left, rc.top, rc.right, rc.bottom + 1, &viewport2);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
ok(!viewport2, "Expected viewport returned == NULL, got %p.\n", viewport2);
|
||||
hr = IDirect3DRM3_CreateViewport(d3drm3, device3, frame3, rc.left, rc.top, rc.right, rc.bottom, NULL);
|
||||
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
|
||||
|
||||
|
|
Loading…
Reference in New Issue