Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/tests/d3drm.c | 4 ++++ dlls/d3drm/viewport.c | 6 ++++++ 2 files changed, 10 insertions(+)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 86678193ba..67696d5583 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2153,6 +2153,8 @@ static void test_Viewport(void)
hr = IDirect3DRMViewport_Init(viewport, device1, frame, rc.left, rc.top, rc.right, rc.bottom); ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr); + hr = IDirect3DRMViewport_GetDevice(viewport, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport_Release(viewport); ref4 = get_refcount((IUnknown *)d3drm1); @@ -2241,6 +2243,8 @@ static void test_Viewport(void)
hr = IDirect3DRMViewport2_Init(viewport2, device3, frame3, rc.left, rc.top, rc.right, rc.bottom); ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr); + hr = IDirect3DRMViewport2_GetDevice(viewport2, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport2_Release(viewport2); ref4 = get_refcount((IUnknown *)d3drm1); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 51174cd59e..d049f37213 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -683,6 +683,9 @@ static HRESULT WINAPI d3drm_viewport2_GetDevice(IDirect3DRMViewport2 *iface, IDi
TRACE("iface %p, device %p.\n", iface, device);
+ if (!device) + return D3DRMERR_BADVALUE; + if (!viewport->device) return D3DRMERR_BADOBJECT;
@@ -698,6 +701,9 @@ static HRESULT WINAPI d3drm_viewport1_GetDevice(IDirect3DRMViewport *iface, IDir
TRACE("iface %p, device %p.\n\n", iface, device);
+ if (!device) + return D3DRMERR_BADVALUE; + if (!viewport->device) return D3DRMERR_BADOBJECT;
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/tests/d3drm.c | 4 ++++ dlls/d3drm/viewport.c | 3 +++ 2 files changed, 7 insertions(+)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 67696d5583..88f3db819d 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2155,6 +2155,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr); hr = IDirect3DRMViewport_GetDevice(viewport, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport_GetDirect3DViewport(viewport, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport_Release(viewport); ref4 = get_refcount((IUnknown *)d3drm1); @@ -2245,6 +2247,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr); hr = IDirect3DRMViewport2_GetDevice(viewport2, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport2_GetDirect3DViewport(viewport2, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport2_Release(viewport2); ref4 = get_refcount((IUnknown *)d3drm1); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index d049f37213..430c9d470b 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -896,6 +896,9 @@ static HRESULT WINAPI d3drm_viewport2_GetDirect3DViewport(IDirect3DRMViewport2 *
TRACE("iface %p, viewport %p.\n", iface, viewport);
+ if (!viewport) + return D3DRMERR_BADVALUE; + if (!viewport_object->d3d_viewport) return D3DRMERR_BADOBJECT;
Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/d3drm/tests/d3drm.c | 4 ++++ dlls/d3drm/viewport.c | 3 +++ 2 files changed, 7 insertions(+)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 88f3db819d..b8d0cf00d3 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -2157,6 +2157,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); hr = IDirect3DRMViewport_GetDirect3DViewport(viewport, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport_SetField(viewport, 0.0); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport_Release(viewport); ref4 = get_refcount((IUnknown *)d3drm1); @@ -2249,6 +2251,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); hr = IDirect3DRMViewport2_GetDirect3DViewport(viewport2, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); + hr = IDirect3DRMViewport2_SetField(viewport2, 0.0); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport2_Release(viewport2); ref4 = get_refcount((IUnknown *)d3drm1); diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 430c9d470b..c2fa189742 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -523,6 +523,9 @@ static HRESULT WINAPI d3drm_viewport2_SetField(IDirect3DRMViewport2 *iface, D3DV
TRACE("iface %p, field %.8e.\n", iface, field);
+ if (field <= 0.0f) + return D3DRMERR_BADVALUE; + viewport->field = field;
return D3DRM_OK;
On Fri, 5 Jul 2019 at 18:52, Jeff Smith whydoubt@gmail.com wrote:
@@ -2157,6 +2157,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); hr = IDirect3DRMViewport_GetDirect3DViewport(viewport, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
hr = IDirect3DRMViewport_SetField(viewport, 0.0);
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport_Release(viewport); ref4 = get_refcount((IUnknown *)d3drm1);
@@ -2249,6 +2251,8 @@ static void test_Viewport(void) ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr); hr = IDirect3DRMViewport2_GetDirect3DViewport(viewport2, NULL); ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
hr = IDirect3DRMViewport2_SetField(viewport2, 0.0);
ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %#x.\n", hr);
IDirect3DRMViewport2_Release(viewport2); ref4 = get_refcount((IUnknown *)d3drm1);
It's fairly minor, but please add the 'f' suffix on float constants. I also notice you're not testing negative values.