[PATCH 1/2] ddraw/tests: Check pointer after CreateSurface without a descriptor.

Alex Henrie alexhenrie24 at gmail.com
Fri Feb 17 00:05:12 CST 2017


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ddraw/tests/dsurface.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c
index 6ecf7fe606..73e272c663 100644
--- a/dlls/ddraw/tests/dsurface.c
+++ b/dlls/ddraw/tests/dsurface.c
@@ -3063,25 +3063,31 @@ static void create_surface_test(void)
     IDirectDrawSurface4 *surface4;
     IDirectDrawSurface7 *surface7;
 
+    surface = (IDirectDrawSurface *)0xdeadbeef;
     hr = IDirectDraw_CreateSurface(lpDD, NULL, &surface, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
             " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
+    ok(surface == (IDirectDrawSurface *)0xdeadbeef, "Got unexpected surface %p\n", surface);
 
     hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw2, (void **) &ddraw2);
     ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
 
+    surface = (IDirectDrawSurface *)0xdeadbeef;
     hr = IDirectDraw2_CreateSurface(ddraw2, NULL, &surface, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
             " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
+    ok(surface == (IDirectDrawSurface *)0xdeadbeef, "Got unexpected surface %p\n", surface);
 
     IDirectDraw2_Release(ddraw2);
 
     hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw4, (void **) &ddraw4);
     ok(SUCCEEDED(hr), "QueryInterface failed, hr %#x.\n", hr);
 
+    surface4 = (IDirectDrawSurface4 *)0xdeadbeef;
     hr = IDirectDraw4_CreateSurface(ddraw4, NULL, &surface4, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
             " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
+    ok(surface4 == (IDirectDrawSurface4 *)0xdeadbeef, "Got unexpected surface %p\n", surface4);
 
     IDirectDraw4_Release(ddraw4);
 
@@ -3093,16 +3099,20 @@ static void create_surface_test(void)
     hr = pDirectDrawCreateEx(NULL, (void **) &ddraw7, &IID_IDirectDraw7, NULL);
     ok(SUCCEEDED(hr), "DirectDrawCreateEx failed, hr %#x.\n", hr);
 
+    surface7 = (IDirectDrawSurface7 *)0xdeadbeef;
     hr = IDirectDraw7_CreateSurface(ddraw7, NULL, &surface7, NULL);
     ok(hr == DDERR_NOCOOPERATIVELEVELSET, "CreateSurface(ddsd=NULL, pre-SCL) returned %#x,"
             " expected %#x.\n", hr, DDERR_NOCOOPERATIVELEVELSET);
+    ok(surface7 == (IDirectDrawSurface7 *)0xdeadbeef, "Got unexpected surface %p\n", surface7);
 
     hr = IDirectDraw7_SetCooperativeLevel(ddraw7, NULL, DDSCL_NORMAL);
     ok(hr == DD_OK, "SetCooperativeLevel failed, hr %#x.\n", hr);
 
+    surface7 = (IDirectDrawSurface7 *)0xdeadbeef;
     hr = IDirectDraw7_CreateSurface(ddraw7, NULL, &surface7, NULL);
     ok(hr == DDERR_INVALIDPARAMS, "CreateSurface(ddsd=NULL) returned %#x,"
             " expected %#x.\n", hr, DDERR_INVALIDPARAMS);
+    ok(surface7 == (IDirectDrawSurface7 *)0xdeadbeef, "Got unexpected surface %p\n", surface7);
 
     IDirectDraw7_Release(ddraw7);
 }
-- 
2.11.1




More information about the wine-patches mailing list