https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e1e79f248b354f0a0f257…
commit e1e79f248b354f0a0f257b8001932704e3eee7a5
Author: James Tabor <james.tabor(a)reactos.org>
AuthorDate: Sun Nov 26 14:48:06 2017 -0600
[GDI] Fix metafile crashes and null driver issues.
Patch by Jérôme Gardou modified by me.
CORE-14023 : Fix SetWorldTransform for metafiles #137
Includes CORE-12832 and CORE-13627.
---
win32ss/gdi/gdi32/include/gdi32p.h | 1 +
win32ss/gdi/gdi32/objects/coord.c | 9 ++++++++-
win32ss/gdi/gdi32/wine/enhmetafile.c | 1 -
win32ss/gdi/gdi32/wine/gdi_private.h | 4 ++--
win32ss/gdi/gdi32/wine/rosglue.c | 21 +++++++++++++++------
5 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/win32ss/gdi/gdi32/include/gdi32p.h b/win32ss/gdi/gdi32/include/gdi32p.h
index 773192df76..dddbfd74b3 100644
--- a/win32ss/gdi/gdi32/include/gdi32p.h
+++ b/win32ss/gdi/gdi32/include/gdi32p.h
@@ -633,6 +633,7 @@ typedef enum _DCFUNC
DCFUNC_SetViewportOrgEx,
DCFUNC_SetWindowExtEx,
DCFUNC_SetWindowOrgEx,
+ DCFUNC_SetWorldTransform,
DCFUNC_StretchBlt,
DCFUNC_StrokeAndFillPath,
DCFUNC_StrokePath,
diff --git a/win32ss/gdi/gdi32/objects/coord.c b/win32ss/gdi/gdi32/objects/coord.c
index 2caa575352..dd74b33946 100644
--- a/win32ss/gdi/gdi32/objects/coord.c
+++ b/win32ss/gdi/gdi32/objects/coord.c
@@ -318,7 +318,14 @@ ModifyWorldTransform(
if (GDI_HANDLE_GET_TYPE(hdc) == GDILoObjType_LO_METADC16_TYPE)
return FALSE;
- HANDLE_METADC(BOOL, ModifyWorldTransform, FALSE, hdc, pxform, dwMode);
+ if (dwMode == MWT_SET)
+ {
+ HANDLE_METADC(BOOL, SetWorldTransform, FALSE, hdc, pxform);
+ }
+ else
+ {
+ HANDLE_METADC(BOOL, ModifyWorldTransform, FALSE, hdc, pxform, dwMode);
+ }
/* Get the DC attribute */
pdcattr = GdiGetDcAttr(hdc);
diff --git a/win32ss/gdi/gdi32/wine/enhmetafile.c b/win32ss/gdi/gdi32/wine/enhmetafile.c
index 2358a86f46..07faf2a24d 100644
--- a/win32ss/gdi/gdi32/wine/enhmetafile.c
+++ b/win32ss/gdi/gdi32/wine/enhmetafile.c
@@ -546,7 +546,6 @@ static void EMF_Update_MF_Xform(HDC hdc, const enum_emh_data *info)
if (!SetWorldTransform(hdc, &final_trans))
{
- __debugbreak();
ERR("World transform failed!\n");
}
}
diff --git a/win32ss/gdi/gdi32/wine/gdi_private.h b/win32ss/gdi/gdi32/wine/gdi_private.h
index 2857095d86..0bce298918 100644
--- a/win32ss/gdi/gdi32/wine/gdi_private.h
+++ b/win32ss/gdi/gdi32/wine/gdi_private.h
@@ -180,10 +180,10 @@ HGDIOBJ WINAPI GdiFixUpHandle(HGDIOBJ hGdiObj);
extern void push_dc_driver_ros(PHYSDEV *dev, PHYSDEV physdev, const struct gdi_dc_funcs
*funcs);
#define push_dc_driver push_dc_driver_ros
-
+#if 0
BOOL WINAPI SetWorldTransformForMetafile(HDC hdc, const XFORM *pxform);
#define SetWorldTransform SetWorldTransformForMetafile
-
+#endif
#ifdef _M_ARM
#define DbgRaiseAssertionFailure() __emit(0xdefc)
#else
diff --git a/win32ss/gdi/gdi32/wine/rosglue.c b/win32ss/gdi/gdi32/wine/rosglue.c
index fbf26fe0d9..230510148f 100644
--- a/win32ss/gdi/gdi32/wine/rosglue.c
+++ b/win32ss/gdi/gdi32/wine/rosglue.c
@@ -42,6 +42,10 @@ static INT NULL_ExtSelectClipRgn(PHYSDEV dev, HRGN hrgn, INT iMode) {
return 1
static INT NULL_IntersectClipRect(PHYSDEV dev, INT left, INT top, INT right, INT
bottom) { return 1; }
static INT NULL_OffsetClipRgn(PHYSDEV dev, INT x, INT y) { return SIMPLEREGION; }
static INT NULL_ExcludeClipRect(PHYSDEV dev, INT left, INT top, INT right, INT bottom)
{ return 1; }
+static BOOL NULL_ExtTextOutW(PHYSDEV dev, INT x, INT y, UINT fuOptions, const RECT
*lprc, LPCWSTR lpString, UINT cwc, const INT *lpDx) { return TRUE; }
+static BOOL NULL_ModifyWorldTransform( PHYSDEV dev, const XFORM* xform, DWORD mode ) {
return TRUE; }
+static BOOL NULL_SetWorldTransform( PHYSDEV dev, const XFORM* xform ) { return TRUE; }
+static BOOL NULL_PolyPolyline(PHYSDEV dev, const POINT *pt, const DWORD *lpt, DWORD cw)
{ return TRUE; }
static const struct gdi_dc_funcs DummyPhysDevFuncs =
{
@@ -73,7 +77,7 @@ static const struct gdi_dc_funcs DummyPhysDevFuncs =
(PVOID)NULL_Unused, //INT (*pExtEscape)(PHYSDEV,INT,INT,LPCVOID,INT,LPVOID);
(PVOID)NULL_Unused, //BOOL (*pExtFloodFill)(PHYSDEV,INT,INT,COLORREF,UINT);
NULL_ExtSelectClipRgn, //INT (*pExtSelectClipRgn)(PHYSDEV,HRGN,INT);
- (PVOID)NULL_Unused, //BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const
RECT*,LPCWSTR,UINT,const INT*);
+ NULL_ExtTextOutW, //BOOL (*pExtTextOut)(PHYSDEV,INT,INT,UINT,const
RECT*,LPCWSTR,UINT,const INT*);
nulldrv_FillPath, //BOOL (*pFillPath)(PHYSDEV);
(PVOID)NULL_Unused, //BOOL (*pFillRgn)(PHYSDEV,HRGN,HBRUSH);
nulldrv_FlattenPath, //BOOL (*pFlattenPath)(PHYSDEV);
@@ -108,7 +112,7 @@ static const struct gdi_dc_funcs DummyPhysDevFuncs =
NULL_IntersectClipRect, //INT (*pIntersectClipRect)(PHYSDEV,INT,INT,INT,INT);
(PVOID)NULL_Unused, //BOOL (*pInvertRgn)(PHYSDEV,HRGN);
(PVOID)NULL_Unused, //BOOL (*pLineTo)(PHYSDEV,INT,INT);
- (PVOID)NULL_Unused, //BOOL (*pModifyWorldTransform)(PHYSDEV,const XFORM*,DWORD);
+ NULL_ModifyWorldTransform, //BOOL (*pModifyWorldTransform)(PHYSDEV,const
XFORM*,DWORD);
(PVOID)NULL_Unused, //BOOL (*pMoveTo)(PHYSDEV,INT,INT);
NULL_OffsetClipRgn, //INT (*pOffsetClipRgn)(PHYSDEV,INT,INT);
(PVOID)NULL_Unused, //BOOL (*pOffsetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
@@ -120,7 +124,7 @@ static const struct gdi_dc_funcs DummyPhysDevFuncs =
(PVOID)NULL_Unused, //BOOL (*pPolyBezierTo)(PHYSDEV,const POINT*,DWORD);
(PVOID)NULL_Unused, //BOOL (*pPolyDraw)(PHYSDEV,const POINT*,const BYTE
*,DWORD);
(PVOID)NULL_Unused, //BOOL (*pPolyPolygon)(PHYSDEV,const POINT*,const
INT*,UINT);
- (PVOID)NULL_Unused, //BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const
DWORD*,DWORD);
+ NULL_PolyPolyline, //BOOL (*pPolyPolyline)(PHYSDEV,const POINT*,const
DWORD*,DWORD);
(PVOID)NULL_Unused, //BOOL (*pPolygon)(PHYSDEV,const POINT*,INT);
(PVOID)NULL_Unused, //BOOL (*pPolyline)(PHYSDEV,const POINT*,INT);
(PVOID)NULL_Unused, //BOOL (*pPolylineTo)(PHYSDEV,const POINT*,INT);
@@ -165,7 +169,7 @@ static const struct gdi_dc_funcs DummyPhysDevFuncs =
NULL_SetViewportOrgEx, //BOOL (*pSetViewportOrgEx)(PHYSDEV,INT,INT,POINT*);
NULL_SetWindowExtEx, //BOOL (*pSetWindowExtEx)(PHYSDEV,INT,INT,SIZE*);
NULL_SetWindowOrgEx, //BOOL (*pSetWindowOrgEx)(PHYSDEV,INT,INT,POINT*);
- (PVOID)NULL_Unused, //BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*);
+ NULL_SetWorldTransform, //BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*);
(PVOID)NULL_Unused, //INT (*pStartDoc)(PHYSDEV,const DOCINFOW*);
(PVOID)NULL_Unused, //INT (*pStartPage)(PHYSDEV);
(PVOID)NULL_Unused, //BOOL (*pStretchBlt)(PHYSDEV,struct
bitblt_coords*,PHYSDEV,struct bitblt_coords*,DWORD);
@@ -534,7 +538,7 @@ DeleteColorSpace(
{
return NtGdiDeleteColorSpace(hcs);
}
-
+#if 0
BOOL
WINAPI
SetWorldTransformForMetafile(
@@ -561,7 +565,7 @@ SetWorldTransformForMetafile(
return SetWorldTransform(hdc, pxform);
}
-
+#endif
void
__cdecl
_assert (
@@ -1044,6 +1048,11 @@ DRIVER_Dispatch(
_va_arg_n(argptr, INT, 0), // X
_va_arg_n(argptr, INT, 1), // Y
_va_arg_n(argptr, LPPOINT, 2)); //
lpPoint
+
+ case DCFUNC_SetWorldTransform:
+ return physdev->funcs->pSetWorldTransform(physdev,
+ va_arg(argptr, const XFORM*));
+
case DCFUNC_StretchBlt:
return DRIVER_StretchBlt(physdev,
physdev->hdc,