https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9f57320175fecbf3ea09f…
commit 9f57320175fecbf3ea09f6a068c41642e1fc4d8b
Author: James Tabor <james.tabor(a)reactos.org>
AuthorDate: Mon Jun 3 15:49:14 2019 -0500
Commit: James Tabor <james.tabor(a)reactos.org>
CommitDate: Mon Jun 3 15:49:14 2019 -0500
[GDI32] Meta File Fix Ups
Remove pointer hack. Safer since using wines Enhanced Meta headers with
unknown wine magic information.
---
win32ss/gdi/gdi32/objects/metafile.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/win32ss/gdi/gdi32/objects/metafile.c b/win32ss/gdi/gdi32/objects/metafile.c
index e1a51fb69f4..42bd22ec93c 100644
--- a/win32ss/gdi/gdi32/objects/metafile.c
+++ b/win32ss/gdi/gdi32/objects/metafile.c
@@ -139,16 +139,22 @@ GdiCreateLocalMetaFilePict(HANDLE hmo)
{
static const WCHAR szDisplayW[] = {
'D','I','S','P','L','A','Y','\0'
};
HENHMETAFILE hEMF;
- PENHMETAHEADER pemh = (PENHMETAHEADER)Buffer;
-
- pInfo->mm = MM_ANISOTROPIC;
- pInfo->xExt = pemh->rclFrame.right - pemh->rclFrame.left; // Width
- pInfo->yExt = pemh->rclFrame.bottom - pemh->rclFrame.top; // Height
+ ENHMETAHEADER emh;
hEMF = SetEnhMetaFileBits(nSize, Buffer);
if (hEMF == NULL)
goto Exit;
+ if (!GetEnhMetaFileHeader( hEMF, sizeof(emh), &emh ))
+ {
+ DeleteEnhMetaFile(hEMF);
+ goto Exit;
+ }
+
+ pInfo->mm = MM_ANISOTROPIC; // wine uses MM_ISOTROPIC.
+ pInfo->xExt = emh.rclFrame.right - emh.rclFrame.left; // Width
+ pInfo->yExt = emh.rclFrame.bottom - emh.rclFrame.top; // Height
+
hDC = CreateDCW(szDisplayW, NULL, NULL, NULL);
if (hDC)
{