[PATCH 5/7] ddraw: Fix IDirectDraw4_CreateSurface's invalid descriptor error code.

Alex Henrie alexhenrie24 at gmail.com
Wed Feb 15 00:53:47 CST 2017


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ddraw/ddraw.c        | 2 +-
 dlls/ddraw/tests/ddraw4.c | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 6089bf9693..ce403c6bab 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -2874,7 +2874,7 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
     {
         WARN("Application supplied invalid surface descriptor\n");
         wined3d_mutex_unlock();
-        return DDERR_INVALIDPARAMS;
+        return E_INVALIDARG;
     }
 
     if(surface_desc->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER))
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 8883b152e8..a6af23b9c8 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -2269,6 +2269,11 @@ static void test_surface_qi(void)
     hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
     ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
 
+    surface = (IDirectDrawSurface4 *)0xdeadbeef;
+    hr = IDirectDraw4_CreateSurface(ddraw, NULL, &surface, NULL);
+    ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);
+    ok(surface == (IDirectDrawSurface4 *)0xdeadbeef, "Got unexpected surface %p\n", surface);
+
     memset(&surface_desc, 0, sizeof(surface_desc));
     surface_desc.dwSize = sizeof(surface_desc);
     surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
-- 
2.11.1




More information about the wine-patches mailing list