Commit 2caa797e authored by Alexander Dorofeyev's avatar Alexander Dorofeyev Committed by Alexandre Julliard

ddraw: Set surface to NULL on failure in GetAttachedSurface.

parent 9183b472
...@@ -540,6 +540,8 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface, ...@@ -540,6 +540,8 @@ IDirectDrawSurfaceImpl_GetAttachedSurface(IDirectDrawSurface7 *iface,
TRACE("(%p) Didn't find a valid surface\n", This); TRACE("(%p) Didn't find a valid surface\n", This);
LeaveCriticalSection(&ddraw_cs); LeaveCriticalSection(&ddraw_cs);
*Surface = NULL;
return DDERR_NOTFOUND; return DDERR_NOTFOUND;
} }
......
...@@ -228,9 +228,8 @@ IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This, ...@@ -228,9 +228,8 @@ IDirectDrawSurface3Impl_GetAttachedSurface(LPDIRECTDRAWSURFACE3 This,
hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps, hr = IDirectDrawSurface7_GetAttachedSurface(CONVERT(This), &caps,
&pAttached7); &pAttached7);
if (FAILED(hr)) return hr; if (FAILED(hr)) *ppAttached = NULL;
else *ppAttached = CONVERT_REV(pAttached7);
*ppAttached = CONVERT_REV(pAttached7);
return hr; return hr;
} }
......
...@@ -1012,6 +1012,7 @@ static void EnumTest(void) ...@@ -1012,6 +1012,7 @@ static void EnumTest(void)
ok(rc == DD_OK, "GetAttachedSurface returned %08x\n", rc); ok(rc == DD_OK, "GetAttachedSurface returned %08x\n", rc);
rc = IDirectDrawSurface_GetAttachedSurface(ctx.expected[2], &ddsd.ddsCaps, &ctx.expected[3]); rc = IDirectDrawSurface_GetAttachedSurface(ctx.expected[2], &ddsd.ddsCaps, &ctx.expected[3]);
ok(rc == DDERR_NOTFOUND, "GetAttachedSurface returned %08x\n", rc); ok(rc == DDERR_NOTFOUND, "GetAttachedSurface returned %08x\n", rc);
ok(!ctx.expected[3], "expected NULL pointer\n");
ctx.count = 0; ctx.count = 0;
rc = IDirectDraw_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &ddsd, (void *) &ctx, enumCB); rc = IDirectDraw_EnumSurfaces(lpDD, DDENUMSURFACES_DOESEXIST | DDENUMSURFACES_ALL, &ddsd, (void *) &ctx, enumCB);
...@@ -1077,6 +1078,9 @@ static void AttachmentTest7(void) ...@@ -1077,6 +1078,9 @@ static void AttachmentTest7(void)
ok(num == 0, "Second mip level has %d surfaces attached, expected 1\n", num); ok(num == 0, "Second mip level has %d surfaces attached, expected 1\n", num);
/* Done level 2 */ /* Done level 2 */
/* Mip level 3 is still needed */ /* Mip level 3 is still needed */
hr = IDirectDrawSurface7_GetAttachedSurface(surface3, &caps, &surface4);
ok(hr == DDERR_NOTFOUND, "GetAttachedSurface returned %08x\n", hr);
ok(!surface4, "expected NULL pointer\n");
/* Try to attach a 16x16 miplevel - Should not work as far I can see */ /* Try to attach a 16x16 miplevel - Should not work as far I can see */
memset(&ddsd, 0, sizeof(ddsd)); memset(&ddsd, 0, sizeof(ddsd));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment