[PATCH v2 3/4] ddraw: Don't write out if a ddraw4 surface of size 0 is requested.
Alex Henrie
alexhenrie24 at gmail.com
Wed Jan 25 23:20:40 CST 2017
Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
dlls/ddraw/ddraw.c | 3 ---
dlls/ddraw/tests/ddraw4.c | 8 +++++++-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 4ce638e30f..b7b917de7d 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2867,10 +2867,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
hr = ddraw_surface_create(ddraw, surface_desc, &impl, outer_unknown, 4);
wined3d_mutex_unlock();
if (FAILED(hr))
- {
- *surface = NULL;
return hr;
- }
*surface = &impl->IDirectDrawSurface4_iface;
IDirectDraw4_AddRef(iface);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 1ace50ab42..26eacdd16a 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -2231,7 +2231,7 @@ static void test_surface_qi(void)
{&IID_IUnknown, &IID_IDirectDrawSurface, S_OK },
};
- IDirectDrawSurface4 *surface;
+ IDirectDrawSurface4 *surface = (IDirectDrawSurface4 *)0xdeadbeef;
DDSURFACEDESC2 surface_desc;
IDirect3DDevice3 *device;
IDirectDraw4 *ddraw;
@@ -2265,6 +2265,12 @@ static void test_surface_qi(void)
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
+
+ hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
+ ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+ ok(surface == (IDirectDrawSurface4 *)0xdeadbeef || broken(!surface) /* 32-bit on Win8/10 */,
+ "Got unexpected surface %p.\n", surface);
+
surface_desc.dwWidth = 512;
surface_desc.dwHeight = 512;
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &surface, NULL);
--
2.11.0
More information about the wine-patches
mailing list