Hi all,
I've made one discovery - the explicit BACKBUFFER creation (as shown in logs)
works only for IID_IDirectDraw interface, not for any newer (on my Windows
XP). I will do some more testing, add tests into a separate patch and send it
afterwards.
Regards,
Oldrich.
On Wednesday 21 July 2010 20:51:49 Oldřich Jedlička wrote:
> Old DirectX interfaces allowed creation of explicit back buffers, so move
> the restrictive check to DirectX 7 implementation.
>
> This fixes bug #9008.
> ---
> dlls/ddraw/ddraw.c | 35 ++++++++++++++++++++++++++++-------
> 1 files changed, 28 insertions(+), 7 deletions(-)
>
> diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
> index e55ac5b..9f13c8b 100644
> --- a/dlls/ddraw/ddraw.c
> +++ b/dlls/ddraw/ddraw.c
> @@ -2967,7 +2967,7 @@ static HRESULT
> ddraw_create_gdi_swapchain(IDirectDrawImpl *ddraw, IDirectDrawSur *
> DDERR_* if an error occurs
> *
>
> **************************************************************************
> ***/ -static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
> +static HRESULT WINAPI CreateSurface(IDirectDraw7 *iface,
> DDSURFACEDESC2 *DDSD, IDirectDrawSurface7 **Surf, IUnknown
> *UnkOuter) {
> IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
> @@ -3030,8 +3030,8 @@ static HRESULT WINAPI
> ddraw7_CreateSurface(IDirectDraw7 *iface, return DDERR_NOEXCLUSIVEMODE;
> }
>
> - if(DDSD->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER | DDSCAPS_BACKBUFFER))
> { - WARN("Application tried to create an explicit front or back
> buffer\n"); + if(DDSD->ddsCaps.dwCaps & DDSCAPS_FRONTBUFFER) {
> + WARN("Application tried to create an explicit front buffer\n");
> LeaveCriticalSection(&ddraw_cs);
> return DDERR_INVALIDCAPS;
> }
> @@ -3391,6 +3391,27 @@ static HRESULT WINAPI
> ddraw7_CreateSurface(IDirectDraw7 *iface, return hr;
> }
>
> +static HRESULT WINAPI ddraw7_CreateSurface(IDirectDraw7 *iface,
> + DDSURFACEDESC2 *surface_desc, IDirectDrawSurface7 **surface,
> IUnknown *outer_unknown) +{
> + TRACE("iface %p, surface_desc %p, surface %p, outer_unknown %p.\n",
> + iface, surface_desc, surface, outer_unknown);
> +
> + if(surface_desc->ddsCaps.dwCaps & (DDSCAPS_FRONTBUFFER |
> DDSCAPS_BACKBUFFER)) + {
> + if (TRACE_ON(ddraw))
> + {
> + TRACE(" (%p) Requesting surface desc :\n", iface);
> + DDRAW_dump_surface_desc(surface_desc);
> + }
> +
> + WARN("Application tried to create an explicit front or back
> buffer\n"); + return DDERR_INVALIDCAPS;
> + }
> +
> + return CreateSurface(iface, surface_desc, surface, outer_unknown);
> +}
> +
> static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface,
> DDSURFACEDESC2 *surface_desc, IDirectDrawSurface4 **surface,
> IUnknown *outer_unknown) {
> @@ -3401,7 +3422,7 @@ static HRESULT WINAPI
> ddraw4_CreateSurface(IDirectDraw4 *iface, TRACE("iface %p, surface_desc
> %p, surface %p, outer_unknown %p.\n", iface, surface_desc, surface,
> outer_unknown);
>
> - hr = ddraw7_CreateSurface((IDirectDraw7 *)ddraw, surface_desc,
> (IDirectDrawSurface7 **)surface, outer_unknown); + hr =
> CreateSurface((IDirectDraw7 *)ddraw, surface_desc, (IDirectDrawSurface7
> **)surface, outer_unknown); impl = (IDirectDrawSurfaceImpl *)*surface;
> if (SUCCEEDED(hr) && impl)
> {
> @@ -3425,7 +3446,7 @@ static HRESULT WINAPI
> ddraw3_CreateSurface(IDirectDraw3 *iface, TRACE("iface %p, surface_desc
> %p, surface %p, outer_unknown %p.\n", iface, surface_desc, surface,
> outer_unknown);
>
> - hr = ddraw7_CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2
> *)surface_desc, &surface7, outer_unknown); + hr =
> CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc,
> &surface7, outer_unknown); if (FAILED(hr))
> {
> *surface = NULL;
> @@ -3453,7 +3474,7 @@ static HRESULT WINAPI
> ddraw2_CreateSurface(IDirectDraw2 *iface, TRACE("iface %p, surface_desc
> %p, surface %p, outer_unknown %p.\n", iface, surface_desc, surface,
> outer_unknown);
>
> - hr = ddraw7_CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2
> *)surface_desc, &surface7, outer_unknown); + hr =
> CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc,
> &surface7, outer_unknown); if (FAILED(hr))
> {
> *surface = NULL;
> @@ -3483,7 +3504,7 @@ static HRESULT WINAPI
> ddraw1_CreateSurface(IDirectDraw *iface, /* Remove front buffer flag, this
> causes failure in v7, and its added to normal * primaries anyway. */
> surface_desc->ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER;
> - hr = ddraw7_CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2
> *)surface_desc, &surface7, outer_unknown); + hr =
> CreateSurface((IDirectDraw7 *)ddraw, (DDSURFACEDESC2 *)surface_desc,
> &surface7, outer_unknown); if (FAILED(hr))
> {
> *surface = NULL;