From ac42c457456bfe392fff691d2ec3e054570121f0 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 18 Jun 2004 19:33:41 +0000 Subject: [PATCH] Do not allow creation of not aligned EMF records by GDI code. --- dlls/gdi/enhmfdrv/init.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/gdi/enhmfdrv/init.c b/dlls/gdi/enhmfdrv/init.c index 30b017f034a..7e037aa3d1a 100644 --- a/dlls/gdi/enhmfdrv/init.c +++ b/dlls/gdi/enhmfdrv/init.c @@ -18,6 +18,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include @@ -186,11 +187,15 @@ BOOL EMFDRV_WriteRecord( PHYSDEV dev, EMR *emr ) ENHMETAHEADER *emh; EMFDRV_PDEVICE *physDev = (EMFDRV_PDEVICE *)dev; + TRACE("record %ld, size %ld %s\n", + emr->iType, emr->nSize, physDev->hFile ? "(to disk)" : ""); + + assert( !(emr->nSize & 3) ); + physDev->emh->nBytes += emr->nSize; physDev->emh->nRecords++; if(physDev->hFile) { - TRACE("Writing record to disk\n"); if (!WriteFile(physDev->hFile, (char *)emr, emr->nSize, NULL, NULL)) return FALSE; } else {