Commit f4bf9dee authored by Alexandre Julliard's avatar Alexandre Julliard

LOGBRUSH.lbHatch must be a ULONG_PTR since it can contain a handle.

parent 92a51495
......@@ -119,14 +119,14 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush )
ptr->logbrush.lbStyle = BS_PATTERN;
/* fall through */
case BS_PATTERN:
ptr->logbrush.lbHatch = (LONG)BITMAP_CopyBitmap( (HBITMAP) ptr->logbrush.lbHatch );
ptr->logbrush.lbHatch = (ULONG_PTR)BITMAP_CopyBitmap( (HBITMAP) ptr->logbrush.lbHatch );
if (!ptr->logbrush.lbHatch) goto error;
break;
case BS_DIBPATTERNPT:
ptr->logbrush.lbStyle = BS_DIBPATTERN;
ptr->logbrush.lbHatch = (LONG)dib_copy( (BITMAPINFO *) ptr->logbrush.lbHatch,
ptr->logbrush.lbColor);
ptr->logbrush.lbHatch = (ULONG_PTR)dib_copy( (BITMAPINFO *) ptr->logbrush.lbHatch,
ptr->logbrush.lbColor);
if (!ptr->logbrush.lbHatch) goto error;
break;
......@@ -247,7 +247,7 @@ HBRUSH WINAPI CreateDIBPatternBrush( HGLOBAL hbitmap, UINT coloruse )
logbrush.lbStyle = BS_DIBPATTERN;
logbrush.lbColor = coloruse;
logbrush.lbHatch = (LONG)hbitmap;
logbrush.lbHatch = (ULONG_PTR)hbitmap;
return CreateBrushIndirect( &logbrush );
}
......@@ -284,7 +284,7 @@ HBRUSH WINAPI CreateDIBPatternBrushPt( const void* data, UINT coloruse )
logbrush.lbStyle = BS_DIBPATTERNPT;
logbrush.lbColor = coloruse;
logbrush.lbHatch = (LONG) data;
logbrush.lbHatch = (ULONG_PTR)data;
return CreateBrushIndirect( &logbrush );
}
......
......@@ -873,8 +873,11 @@ BOOL WINAPI PlayEnhMetaFileRecord(
case EMR_CREATEBRUSHINDIRECT:
{
PEMRCREATEBRUSHINDIRECT pBrush = (PEMRCREATEBRUSHINDIRECT) mr;
(handletable->objectHandle)[pBrush->ihBrush] =
CreateBrushIndirect(&pBrush->lb);
LOGBRUSH brush;
brush.lbStyle = pBrush->lb.lbStyle;
brush.lbColor = pBrush->lb.lbColor;
brush.lbHatch = pBrush->lb.lbHatch;
(handletable->objectHandle)[pBrush->ihBrush] = CreateBrushIndirect(&brush);
break;
}
case EMR_EXTCREATEFONTINDIRECTW:
......
......@@ -155,7 +155,9 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush )
emr.emr.iType = EMR_CREATEBRUSHINDIRECT;
emr.emr.nSize = sizeof(emr);
emr.ihBrush = index = EMFDRV_AddHandle( dev, hBrush );
emr.lb = logbrush;
emr.lb.lbStyle = logbrush.lbStyle;
emr.lb.lbColor = logbrush.lbColor;
emr.lb.lbHatch = logbrush.lbHatch;
if(!EMFDRV_WriteRecord( dev, &emr.emr ))
index = 0;
......
......@@ -412,8 +412,8 @@ static void test_mf_PatternBrush(void)
orig_lb->lbStyle = BS_PATTERN;
orig_lb->lbColor = RGB(0, 0, 0);
orig_lb->lbHatch = (INT) CreateBitmap (8, 8, 1, 1, SAMPLE_PATTERN_BRUSH);
ok((HBITMAP *)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError());
orig_lb->lbHatch = (ULONG_PTR)CreateBitmap (8, 8, 1, 1, SAMPLE_PATTERN_BRUSH);
ok((HBITMAP)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError());
hBrush = CreateBrushIndirect (orig_lb);
ok(hBrush != 0, "CreateBrushIndirect error %ld\n", GetLastError());
......@@ -437,7 +437,7 @@ static void test_mf_PatternBrush(void)
ok( ret, "DeleteMetaFile error %ld\n", GetLastError());
ret = DeleteObject(hBrush);
ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError());
ret = DeleteObject((HBITMAP *)orig_lb->lbHatch);
ret = DeleteObject((HBITMAP)orig_lb->lbHatch);
ok( ret, "DeleteObject(HBITMAP) error %ld\n",
GetLastError());
HeapFree (GetProcessHeap(), 0, orig_lb);
......
......@@ -478,11 +478,18 @@ typedef struct
typedef struct
{
UINT lbStyle;
UINT lbStyle;
COLORREF lbColor;
INT lbHatch;
ULONG_PTR lbHatch;
} LOGBRUSH, *PLOGBRUSH, *LPLOGBRUSH;
typedef struct
{
UINT lbStyle;
COLORREF lbColor;
ULONG lbHatch;
} LOGBRUSH32, *PLOGBRUSH32, *LPLOGBRUSH32;
typedef LOGBRUSH PATTERN, *PPATTERN, *LPPATTERN;
......@@ -2117,9 +2124,9 @@ typedef struct {
} EMRBITBLT, *PEMRBITBLT;
typedef struct {
EMR emr;
DWORD ihBrush;
LOGBRUSH lb;
EMR emr;
DWORD ihBrush;
LOGBRUSH32 lb;
} EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT;
typedef struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment