From 52296dbdbf5b2137f19ae0582bab6bcba2317bdb Mon Sep 17 00:00:00 2001 From: Jesse Allen Date: Tue, 10 Oct 2006 09:06:28 -0700 Subject: [PATCH] ddraw: Fix for DDSURFACEDESC param in CreateSurface. --- dlls/ddraw/ddraw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index 341d936cea5..5b72aa5e508 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2136,7 +2136,8 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface, } /* According to the msdn this flag is ignored by CreateSurface */ - DDSD->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; + if (DDSD->dwSize >= sizeof(DDSURFACEDESC2)) + DDSD->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; /* Modify some flags */ memset(&desc2, 0, sizeof(desc2)); @@ -2314,7 +2315,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface, desc2.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; } /* Set the DDSCAPS2_MIPMAPSUBLEVEL flag on mipmap sublevels according to the msdn */ - if(DDSD->ddsCaps.dwCaps & DDSCAPS_MIPMAP) + if((DDSD->ddsCaps.dwCaps & DDSCAPS_MIPMAP)&&(DDSD->dwSize >= sizeof(DDSURFACEDESC2))) { desc2.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL; }