diff --git a/dlls/gdi/enhmfdrv/objects.c b/dlls/gdi/enhmfdrv/objects.c index 9d8b14d6b5d..ad843016cd7 100644 --- a/dlls/gdi/enhmfdrv/objects.c +++ b/dlls/gdi/enhmfdrv/objects.c @@ -401,16 +401,21 @@ static HPEN EMFDRV_CreatePenIndirect(PHYSDEV dev, HPEN hPen ) if (!GetObjectW( hPen, sizeof(emr.lopn), &emr.lopn )) { /* must be an extended pen */ - EXTLOGPEN elp; - if (!GetObjectW( hPen, sizeof(elp), &elp )) - { - FIXME("extended pen %p not supported\n", hPen); - return 0; - } - emr.lopn.lopnStyle = elp.elpPenStyle; - emr.lopn.lopnWidth.x = elp.elpWidth; + EXTLOGPEN *elp; + INT size = GetObjectW( hPen, 0, NULL ); + + if (!size) return 0; + + elp = HeapAlloc( GetProcessHeap(), 0, size ); + + GetObjectW( hPen, size, elp ); + /* FIXME: add support for user style pens */ + emr.lopn.lopnStyle = elp->elpPenStyle; + emr.lopn.lopnWidth.x = elp->elpWidth; emr.lopn.lopnWidth.y = 0; - emr.lopn.lopnColor = elp.elpColor; + emr.lopn.lopnColor = elp->elpColor; + + HeapFree( GetProcessHeap(), 0, elp ); } emr.emr.iType = EMR_CREATEPEN; diff --git a/dlls/gdi/mfdrv/objects.c b/dlls/gdi/mfdrv/objects.c index e0859ac59e0..a7bc229f342 100644 --- a/dlls/gdi/mfdrv/objects.c +++ b/dlls/gdi/mfdrv/objects.c @@ -406,16 +406,21 @@ HPEN MFDRV_SelectPen( PHYSDEV dev, HPEN hpen ) if (!GetObject16( HPEN_16(hpen), sizeof(logpen), &logpen )) { /* must be an extended pen */ - EXTLOGPEN elp; - if (!GetObjectW( hpen, sizeof(elp), &elp )) - { - FIXME("extended pen %p not supported\n", hpen); - return 0; - } - logpen.lopnStyle = elp.elpPenStyle; - logpen.lopnWidth.x = elp.elpWidth; + EXTLOGPEN *elp; + INT size = GetObjectW( hpen, 0, NULL ); + + if (!size) return 0; + + elp = HeapAlloc( GetProcessHeap(), 0, size ); + + GetObjectW( hpen, size, elp ); + /* FIXME: add support for user style pens */ + logpen.lopnStyle = elp->elpPenStyle; + logpen.lopnWidth.x = elp->elpWidth; logpen.lopnWidth.y = 0; - logpen.lopnColor = elp.elpColor; + logpen.lopnColor = elp->elpColor; + + HeapFree( GetProcessHeap(), 0, elp ); } index = MFDRV_CreatePenIndirect( dev, hpen, &logpen ); diff --git a/dlls/wineps/pen.c b/dlls/wineps/pen.c index 69446359bb0..60e41accbd1 100644 --- a/dlls/wineps/pen.c +++ b/dlls/wineps/pen.c @@ -44,16 +44,21 @@ HPEN PSDRV_SelectPen( PSDRV_PDEVICE *physDev, HPEN hpen ) if (!GetObjectW( hpen, sizeof(logpen), &logpen )) { /* must be an extended pen */ - EXTLOGPEN elp; - if (!GetObjectW( hpen, sizeof(elp), &elp )) - { - FIXME("extended pen %p not supported\n", hpen); - return 0; - } - logpen.lopnStyle = elp.elpPenStyle; - logpen.lopnWidth.x = elp.elpWidth; + EXTLOGPEN *elp; + INT size = GetObjectW( hpen, 0, NULL ); + + if (!size) return 0; + + elp = HeapAlloc( GetProcessHeap(), 0, size ); + + GetObjectW( hpen, size, elp ); + /* FIXME: add support for user style pens */ + logpen.lopnStyle = elp->elpPenStyle; + logpen.lopnWidth.x = elp->elpWidth; logpen.lopnWidth.y = 0; - logpen.lopnColor = elp.elpColor; + logpen.lopnColor = elp->elpColor; + + HeapFree( GetProcessHeap(), 0, elp ); } TRACE("hpen = %p colour = %08lx\n", hpen, logpen.lopnColor); diff --git a/dlls/x11drv/pen.c b/dlls/x11drv/pen.c index 26cffce4304..c0af04ec430 100644 --- a/dlls/x11drv/pen.c +++ b/dlls/x11drv/pen.c @@ -41,16 +41,21 @@ HPEN X11DRV_SelectPen( X11DRV_PDEVICE *physDev, HPEN hpen ) if (!GetObjectW( hpen, sizeof(logpen), &logpen )) { /* must be an extended pen */ - EXTLOGPEN elp; - if (!GetObjectW( hpen, sizeof(elp), &elp )) - { - FIXME("extended pen %p not supported\n", hpen); - return 0; - } - logpen.lopnStyle = elp.elpPenStyle; - logpen.lopnWidth.x = elp.elpWidth; + EXTLOGPEN *elp; + INT size = GetObjectW( hpen, 0, NULL ); + + if (!size) return 0; + + elp = HeapAlloc( GetProcessHeap(), 0, size ); + + GetObjectW( hpen, size, elp ); + /* FIXME: add support for user style pens */ + logpen.lopnStyle = elp->elpPenStyle; + logpen.lopnWidth.x = elp->elpWidth; logpen.lopnWidth.y = 0; - logpen.lopnColor = elp.elpColor; + logpen.lopnColor = elp->elpColor; + + HeapFree( GetProcessHeap(), 0, elp ); } physDev->pen.style = logpen.lopnStyle & PS_STYLE_MASK;