From: Alex Henrie Subject: [PATCH 1/4] ddraw: Don't write out if a ddraw1 surface of size 0 is requested. Message-Id: <20170106070800.2430-1-alexhenrie24@gmail.com> Date: Fri, 6 Jan 2017 00:07:27 -0700 Fixes https://bugs.winehq.org/show_bug.cgi?id=42159 With this patch, Sega Bug shows its intro logos, although it crashes with "Unhandled privileged instruction" immediately after that. Signed-off-by: Alex Henrie --- dlls/ddraw/ddraw.c | 3 --- dlls/ddraw/tests/ddraw1.c | 4 ++++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 6afa6dddcb..d0fa8c7e72 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2975,10 +2975,7 @@ static HRESULT WINAPI ddraw1_CreateSurface(IDirectDraw *iface, hr = ddraw_surface_create(ddraw, &surface_desc2, &impl, outer_unknown, 1); wined3d_mutex_unlock(); if (FAILED(hr)) - { - *surface = NULL; return hr; - } *surface = &impl->IDirectDrawSurface_iface; impl->ifaceToRelease = NULL; diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 4a9ed7e456..b44afa3402 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -1911,6 +1911,10 @@ 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 = IDirectDraw_CreateSurface(ddraw, &surface_desc, (IDirectDrawSurface **)0xdeadbeef, NULL); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + surface_desc.dwWidth = 512; surface_desc.dwHeight = 512; hr = IDirectDraw_CreateSurface(ddraw, &surface_desc, &surface, NULL); -- 2.11.0