Reactos

[GDI32] Meta File Fix Ups

Remove pointer hack. Safer since using wines Enhanced Meta headers with
unknown wine magic information.

+11 -5
+11 -5
win32ss/gdi/gdi32/objects/metafile.c
··· 139 139 { 140 140 static const WCHAR szDisplayW[] = { 'D','I','S','P','L','A','Y','\0' }; 141 141 HENHMETAFILE hEMF; 142 - PENHMETAHEADER pemh = (PENHMETAHEADER)Buffer; 143 - 144 - pInfo->mm = MM_ANISOTROPIC; 145 - pInfo->xExt = pemh->rclFrame.right - pemh->rclFrame.left; // Width 146 - pInfo->yExt = pemh->rclFrame.bottom - pemh->rclFrame.top; // Height 142 + ENHMETAHEADER emh; 147 143 148 144 hEMF = SetEnhMetaFileBits(nSize, Buffer); 149 145 if (hEMF == NULL) 150 146 goto Exit; 147 + 148 + if (!GetEnhMetaFileHeader( hEMF, sizeof(emh), &emh )) 149 + { 150 + DeleteEnhMetaFile(hEMF); 151 + goto Exit; 152 + } 153 + 154 + pInfo->mm = MM_ANISOTROPIC; // wine uses MM_ISOTROPIC. 155 + pInfo->xExt = emh.rclFrame.right - emh.rclFrame.left; // Width 156 + pInfo->yExt = emh.rclFrame.bottom - emh.rclFrame.top; // Height 151 157 152 158 hDC = CreateDCW(szDisplayW, NULL, NULL, NULL); 153 159 if (hDC)