[PATCH 09/10] d3d8: Fix d3d8_device_GetInfo() implementation.
Matteo Bruni
mbruni at codeweavers.com
Wed Mar 14 13:53:24 CDT 2018
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
Might have an effect on bug 42118.
dlls/d3d8/device.c | 6 ++++--
dlls/d3d8/tests/device.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 17e02a3b1c6..8c3b644c136 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2187,9 +2187,11 @@ static HRESULT WINAPI d3d8_device_ValidateDevice(IDirect3DDevice8 *iface, DWORD
static HRESULT WINAPI d3d8_device_GetInfo(IDirect3DDevice8 *iface,
DWORD info_id, void *info, DWORD info_size)
{
- FIXME("iface %p, info_id %#x, info %p, info_size %u stub!\n", iface, info_id, info, info_size);
+ TRACE("iface %p, info_id %#x, info %p, info_size %u.\n", iface, info_id, info, info_size);
- return D3D_OK;
+ if (info_id < 4)
+ return E_FAIL;
+ return S_FALSE;
}
static HRESULT WINAPI d3d8_device_SetPaletteEntries(IDirect3DDevice8 *iface,
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 4d0ef714701..ce4b92ec98f 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -8701,6 +8701,44 @@ static void test_device_caps(void)
DestroyWindow(window);
}
+static void test_get_info(void)
+{
+ IDirect3DDevice8 *device;
+ IDirect3D8 *d3d;
+ BYTE info[1024];
+ ULONG refcount;
+ unsigned int i;
+ HWND window;
+ HRESULT hr;
+
+ window = CreateWindowA("static", "d3d8_test", WS_OVERLAPPEDWINDOW,
+ 0, 0, 640, 480, NULL, NULL, NULL, NULL);
+ d3d = Direct3DCreate8(D3D_SDK_VERSION);
+ ok(!!d3d, "Failed to create a D3D object.\n");
+ if (!(device = create_device(d3d, window, NULL)))
+ {
+ skip("Failed to create a D3D device.\n");
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+ return;
+ }
+
+ /* As called by Chessmaster 9000 (bug 42118). */
+ hr = IDirect3DDevice8_GetInfo(device, 4, info, 16);
+ ok(hr == S_FALSE, "Unexpected hr %#x.\n", hr);
+
+ for (i = 0; i < 256; ++i)
+ {
+ hr = IDirect3DDevice8_GetInfo(device, i, info, sizeof(info));
+ ok(hr == (i < 4 ? E_FAIL : S_FALSE), "info_id %u, unexpected hr %#x.\n", i, hr);
+ }
+
+ refcount = IDirect3DDevice8_Release(device);
+ ok(!refcount, "Device has %u references left.\n", refcount);
+ IDirect3D8_Release(d3d);
+ DestroyWindow(window);
+}
+
START_TEST(device)
{
HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll");
@@ -8811,6 +8849,7 @@ START_TEST(device)
test_clip_planes_limits();
test_swapchain_multisample_reset();
test_device_caps();
+ test_get_info();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL));
}
--
2.13.6
More information about the wine-devel
mailing list