Commit 5e43ee25 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: Check for lpSurface=NULL in SetSurfaceDesc.

parent c15d89c8
...@@ -4259,9 +4259,9 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, ...@@ -4259,9 +4259,9 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
WARN("Invalid flags (0x%08x) set, returning DDERR_INVALIDPARAMS\n", DDSD->dwFlags); WARN("Invalid flags (0x%08x) set, returning DDERR_INVALIDPARAMS\n", DDSD->dwFlags);
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if (!(DDSD->dwFlags & DDSD_LPSURFACE)) if (!(DDSD->dwFlags & DDSD_LPSURFACE) || !DDSD->lpSurface)
{ {
WARN("DDSD_LPSURFACE is not set, returning DDERR_INVALIDPARAMS\n"); WARN("DDSD_LPSURFACE is not set or lpSurface is NULL, returning DDERR_INVALIDPARAMS\n");
return DDERR_INVALIDPARAMS; return DDERR_INVALIDPARAMS;
} }
if ((DDSD->dwFlags & DDSD_CAPS) && DDSD->ddsCaps.dwCaps) if ((DDSD->dwFlags & DDSD_CAPS) && DDSD->ddsCaps.dwCaps)
......
...@@ -4471,6 +4471,10 @@ static void test_set_surface_desc(void) ...@@ -4471,6 +4471,10 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 1); hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 1);
ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with flags=1 returned %#x.\n", hr); ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with flags=1 returned %#x.\n", hr);
ddsd.lpSurface = NULL;
hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, &ddsd, 0);
ok(hr == DDERR_INVALIDPARAMS, "Setting lpSurface=NULL returned %#x.\n", hr);
hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, NULL, 0); hr = IDirectDrawSurface3_SetSurfaceDesc(surface3, NULL, 0);
ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with NULL desc returned %#x.\n", hr); ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with NULL desc returned %#x.\n", hr);
......
...@@ -5072,6 +5072,10 @@ static void test_set_surface_desc(void) ...@@ -5072,6 +5072,10 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 1); hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 1);
ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with flags=1 returned %#x.\n", hr); ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with flags=1 returned %#x.\n", hr);
ddsd.lpSurface = NULL;
hr = IDirectDrawSurface4_SetSurfaceDesc(surface, &ddsd, 0);
ok(hr == DDERR_INVALIDPARAMS, "Setting lpSurface=NULL returned %#x.\n", hr);
hr = IDirectDrawSurface4_SetSurfaceDesc(surface, NULL, 0); hr = IDirectDrawSurface4_SetSurfaceDesc(surface, NULL, 0);
ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with NULL desc returned %#x.\n", hr); ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with NULL desc returned %#x.\n", hr);
......
...@@ -4959,6 +4959,10 @@ static void test_set_surface_desc(void) ...@@ -4959,6 +4959,10 @@ static void test_set_surface_desc(void)
hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 1); hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 1);
ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with flags=1 returned %#x.\n", hr); ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with flags=1 returned %#x.\n", hr);
ddsd.lpSurface = NULL;
hr = IDirectDrawSurface7_SetSurfaceDesc(surface, &ddsd, 0);
ok(hr == DDERR_INVALIDPARAMS, "Setting lpSurface=NULL returned %#x.\n", hr);
hr = IDirectDrawSurface7_SetSurfaceDesc(surface, NULL, 0); hr = IDirectDrawSurface7_SetSurfaceDesc(surface, NULL, 0);
ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with NULL desc returned %#x.\n", hr); ok(hr == DDERR_INVALIDPARAMS, "SetSurfaceDesc with NULL desc returned %#x.\n", hr);
......
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