diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index c21dec1c2a3..726ce7babe1 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2492,6 +2492,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface, extra_surfaces = DDSD->dwBackBufferCount; desc2.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; /* It's not a front buffer */ desc2.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; + desc2.dwBackBufferCount = 0; } hr = DD_OK; diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 8e0857e182c..c0e84befbf4 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1154,9 +1154,9 @@ static void AttachmentTest7(void) HRESULT hr; IDirectDraw7 *dd7; IDirectDrawSurface7 *surface1, *surface2, *surface3, *surface4; - DDSURFACEDESC2 ddsd; + DDSURFACEDESC2 ddsd, ddsd2; UINT num; - DDSCAPS2 caps = {DDSCAPS_TEXTURE, 0, 0, 0}; + DDSCAPS2 caps = {DDSCAPS_TEXTURE, 0, 0, 0}, caps2 = {DDSCAPS_BACKBUFFER,0,0,0}; HWND window = CreateWindow( "static", "ddraw_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL ); hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7); @@ -1253,6 +1253,14 @@ static void AttachmentTest7(void) hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface1, NULL); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); + /* backbuffer surfaces must not have dwBackBufferCount set */ + ddsd2.dwSize = sizeof(ddsd2); + hr = IDirectDrawSurface7_GetAttachedSurface(surface1, &caps2, &surface2); + ok(hr==DD_OK,"GetAttachedSurface returned: %x\n", hr); + hr = IDirectDrawSurface7_GetSurfaceDesc(surface2, &ddsd2); + ok(hr==DD_OK,"GetSurfaceDesc returned: %x\n", hr); + ok(ddsd2.dwBackBufferCount==0,"backbuffer surface has dwBackBufferCount==%u\n", ddsd2.dwBackBufferCount); + num = 0; IDirectDrawSurface7_EnumAttachedSurfaces(surface1, &num, SurfaceCounter); ok(num == 1, "Primary surface has %d surfaces attached, expected 1\n", num);