Commit 88fc3a3e authored by Aaryaman Vasishta's avatar Aaryaman Vasishta Committed by Alexandre Julliard

d3drm: Fix IDirect3DRMDevice{2-3}::GetDirect3DDevice2 return values on failure.

parent 40278d5b
......@@ -1267,7 +1267,8 @@ static HRESULT WINAPI d3drm_device3_GetDirect3DDevice2(IDirect3DRMDevice3 *iface
TRACE("iface %p, d3d_device %p.\n", iface, d3d_device);
IDirect3DDevice_QueryInterface(device->device, &IID_IDirect3DDevice2, (void**)d3d_device);
if (FAILED(IDirect3DDevice_QueryInterface(device->device, &IID_IDirect3DDevice2, (void**)d3d_device)))
return D3DRMERR_BADOBJECT;
return D3DRM_OK;
}
......@@ -1278,7 +1279,10 @@ static HRESULT WINAPI d3drm_device2_GetDirect3DDevice2(IDirect3DRMDevice2 *iface
TRACE("iface %p, d3d_device %p.\n", iface, d3d_device);
return d3drm_device3_GetDirect3DDevice2(&device->IDirect3DRMDevice3_iface, d3d_device);
IDirect3DDevice_QueryInterface(device->device, &IID_IDirect3DDevice2, (void**)d3d_device);
/* d3drm returns D3DRM_OK even if the call fails. */
return D3DRM_OK;
}
static HRESULT WINAPI d3drm_device3_FindPreferredTextureFormat(IDirect3DRMDevice3 *iface,
......
......@@ -3992,15 +3992,15 @@ static void test_create_device_from_d3d1(void)
hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice2, (void **)&device2);
ok(SUCCEEDED(hr), "Cannot get IDirect3DRMDevice2 Interface (hr = %x).\n", hr);
hr = IDirect3DRMDevice2_GetDirect3DDevice2(device2, &d3ddevice2);
ok(SUCCEEDED(hr), "Expected hr == DD_OK, got %x).\n", hr);
ok(SUCCEEDED(hr), "Expected hr == D3DRM_OK, got %#x.\n", hr);
ok(d3ddevice2 == NULL, "Expected d3ddevice2 == NULL, got %p.\n", d3ddevice2);
IDirect3DRMDevice2_Release(device2);
d3ddevice2 = (IDirect3DDevice2 *)0xdeadbeef;
hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice2, (void **)&device3);
ok(hr == DD_OK, "Cannot get IDirect3DRMDevice2 Interface (hr = %x).\n", hr);
hr = IDirect3DRMDevice_QueryInterface(device1, &IID_IDirect3DRMDevice3, (void **)&device3);
ok(hr == DD_OK, "Cannot get IDirect3DRMDevice3 Interface (hr = %x).\n", hr);
hr = IDirect3DRMDevice3_GetDirect3DDevice2(device3, &d3ddevice2);
ok(hr == DD_OK, "Expected hr == DD_OK, got %x).\n", hr);
ok(hr == D3DRMERR_BADOBJECT, "Expected hr == D3DRMERR_BADOBJECT, got %#x.\n", hr);
ok(d3ddevice2 == NULL, "Expected d3ddevice2 == NULL, got %p.\n", d3ddevice2);
IDirect3DRMDevice3_Release(device3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment