From 77b881f9320844a24a67a70165aeb197dd50a011 Mon Sep 17 00:00:00 2001 From: Jeff Smith Date: Fri, 24 May 2019 00:41:33 -0500 Subject: [PATCH] d3drm: CreateDevice is unimplemented on Windows. Signed-off-by: Jeff Smith Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3drm/d3drm.c | 44 ++++++++++----------------- dlls/d3drm/tests/d3drm.c | 65 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+), 29 deletions(-) diff --git a/dlls/d3drm/d3drm.c b/dlls/d3drm/d3drm.c index e649bad3da5..8ef5830efbc 100644 --- a/dlls/d3drm/d3drm.c +++ b/dlls/d3drm/d3drm.c @@ -413,17 +413,13 @@ static HRESULT WINAPI d3drm1_CreateMaterial(IDirect3DRM *iface, static HRESULT WINAPI d3drm1_CreateDevice(IDirect3DRM *iface, DWORD width, DWORD height, IDirect3DRMDevice **device) { - struct d3drm_device *object; - HRESULT hr; + TRACE("iface %p, width %u, height %u, device %p.\n", iface, width, height, device); - FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; - if (FAILED(hr = d3drm_device_create(&object, iface))) - return hr; - - *device = &object->IDirect3DRMDevice_iface; - - return D3DRM_OK; + return D3DRMERR_BADDEVICE; } static HRESULT WINAPI d3drm1_CreateDeviceFromSurface(IDirect3DRM *iface, GUID *guid, @@ -969,18 +965,13 @@ static HRESULT WINAPI d3drm2_CreateMaterial(IDirect3DRM2 *iface, static HRESULT WINAPI d3drm2_CreateDevice(IDirect3DRM2 *iface, DWORD width, DWORD height, IDirect3DRMDevice2 **device) { - struct d3drm *d3drm = impl_from_IDirect3DRM2(iface); - struct d3drm_device *object; - HRESULT hr; + TRACE("iface %p, width %u, height %u, device %p.\n", iface, width, height, device); - FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; - if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface))) - return hr; - - *device = &object->IDirect3DRMDevice2_iface; - - return D3DRM_OK; + return D3DRMERR_BADDEVICE; } static HRESULT WINAPI d3drm2_CreateDeviceFromSurface(IDirect3DRM2 *iface, GUID *guid, @@ -1608,18 +1599,13 @@ static HRESULT WINAPI d3drm3_CreateMaterial(IDirect3DRM3 *iface, static HRESULT WINAPI d3drm3_CreateDevice(IDirect3DRM3 *iface, DWORD width, DWORD height, IDirect3DRMDevice3 **device) { - struct d3drm *d3drm = impl_from_IDirect3DRM3(iface); - struct d3drm_device *object; - HRESULT hr; + TRACE("iface %p, width %u, height %u, device %p.\n", iface, width, height, device); - FIXME("iface %p, width %u, height %u, device %p partial stub!\n", iface, width, height, device); + if (!device) + return D3DRMERR_BADVALUE; + *device = NULL; - if (FAILED(hr = d3drm_device_create(&object, &d3drm->IDirect3DRM_iface))) - return hr; - - *device = &object->IDirect3DRMDevice3_iface; - - return D3DRM_OK; + return D3DRMERR_BADDEVICE; } static HRESULT WINAPI d3drm3_CreateDeviceFromSurface(IDirect3DRM3 *iface, GUID *guid, diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 2fb2699f36a..cc4f8fe16a3 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -5370,6 +5370,68 @@ static void test_create_device_from_d3d3(void) DestroyWindow(window); } +static void test_create_device_1(void) +{ + IDirect3DRM *d3drm = NULL; + IDirect3DRMDevice *device = (IDirect3DRMDevice *)0xdeadbeef; + HRESULT hr; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + + hr = IDirect3DRM_CreateDevice(d3drm, 640, 480, &device); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == D3DRMERR_BADDEVICE, got %x.\n", hr); + ok(device == NULL, "Expected device returned == NULL, got %p.\n", device); + hr = IDirect3DRM_CreateDevice(d3drm, 640, 480, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + IDirect3DRM_Release(d3drm); +} + +static void test_create_device_2(void) +{ + IDirect3DRM *d3drm = NULL; + IDirect3DRM2 *d3drm2 = NULL; + IDirect3DRMDevice2 *device2 = (IDirect3DRMDevice2 *)0xdeadbeef; + HRESULT hr; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM2, (void **)&d3drm2); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM3 interface (hr = %x).\n", hr); + + hr = IDirect3DRM2_CreateDevice(d3drm2, 640, 480, &device2); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == D3DRMERR_BADDEVICE, got %x.\n", hr); + ok(device2 == NULL, "Expected device returned == NULL, got %p.\n", device2); + hr = IDirect3DRM2_CreateDevice(d3drm2, 640, 480, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + IDirect3DRM2_Release(d3drm2); + IDirect3DRM_Release(d3drm); +} + +static void test_create_device_3(void) +{ + IDirect3DRM *d3drm = NULL; + IDirect3DRM3 *d3drm3 = NULL; + IDirect3DRMDevice3 *device3 = (IDirect3DRMDevice3 *)0xdeadbeef; + HRESULT hr; + + hr = Direct3DRMCreate(&d3drm); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x).\n", hr); + hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM3, (void **)&d3drm3); + ok(hr == D3DRM_OK, "Cannot get IDirect3DRM3 interface (hr = %x).\n", hr); + + hr = IDirect3DRM3_CreateDevice(d3drm3, 640, 480, &device3); + ok(hr == D3DRMERR_BADDEVICE, "Expected hr == D3DRMERR_BADDEVICE, got %x.\n", hr); + ok(device3 == NULL, "Expected device returned == NULL, got %p.\n", device3); + hr = IDirect3DRM3_CreateDevice(d3drm3, 640, 480, NULL); + ok(hr == D3DRMERR_BADVALUE, "Expected hr == D3DRMERR_BADVALUE, got %x.\n", hr); + + IDirect3DRM3_Release(d3drm3); + IDirect3DRM_Release(d3drm); +} + static char *create_bitmap(unsigned int w, unsigned int h, BOOL palettized) { unsigned int bpp = palettized ? 8 : 24; @@ -7432,6 +7494,9 @@ START_TEST(d3drm) test_create_device_from_d3d1(); test_create_device_from_d3d2(); test_create_device_from_d3d3(); + test_create_device_1(); + test_create_device_2(); + test_create_device_3(); test_load_texture(); test_texture_qi(); test_viewport_qi();