From 5ec48e76ad0a285b046b1af41b552ab697bc8344 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 9 Feb 2017 12:52:38 +0100 Subject: [PATCH] d3d8: Do not modify the "texture" pointer for D3DFMT_UNKNOWN in d3d8_device_CreateTexture(). Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d8/device.c | 3 +++ dlls/d3d8/tests/device.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index 805694b8536..989c1b00c0f 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -791,6 +791,9 @@ static HRESULT WINAPI d3d8_device_CreateTexture(IDirect3DDevice8 *iface, TRACE("iface %p, width %u, height %u, levels %u, usage %#x, format %#x, pool %#x, texture %p.\n", iface, width, height, levels, usage, format, pool, texture); + if (!format) + return D3DERR_INVALIDCALL; + *texture = NULL; object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if (!object) diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index da67fb3fb43..c05c9f20de8 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -8230,7 +8230,7 @@ static void test_format_unknown(void) hr = IDirect3DDevice8_CreateTexture(device, 64, 64, 1, 0, D3DFMT_UNKNOWN, D3DPOOL_DEFAULT, (IDirect3DTexture8 **)&iface); ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); - todo_wine ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); + ok(iface == (void *)0xdeadbeef, "Got unexpected iface %p.\n", iface); iface = (void *)0xdeadbeef; hr = IDirect3DDevice8_CreateCubeTexture(device, 64, 1, 0,