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

Signed-off-by: Aaryaman Vasishta <jem456.vasishta@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Aaryaman Vasishta 2016-07-15 15:46:06 +05:30 committed by Alexandre Julliard
parent 40278d5b33
commit 88fc3a3ef5
2 changed files with 10 additions and 6 deletions

View File

@ -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,

View File

@ -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);