Commit 3e20458a authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/imagelist: Get rid of magic field, use vtable pointer instead. Keep original layout.

parent 1b966267
...@@ -81,11 +81,7 @@ static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0 }; ...@@ -81,11 +81,7 @@ static INTERNALDRAG InternalDrag = { 0, 0, 0, 0, 0, 0, FALSE, 0 };
static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT width); static HBITMAP ImageList_CreateImage(HDC hdc, HIMAGELIST himl, UINT count, UINT width);
static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID iid, void** ppv); static HRESULT ImageListImpl_CreateInstance(const IUnknown *pUnkOuter, REFIID iid, void** ppv);
static inline BOOL is_valid(HIMAGELIST himl);
static inline BOOL is_valid(HIMAGELIST himl)
{
return himl && himl->magic == IMAGELIST_MAGIC;
}
/* /*
* An imagelist with N images is tiled like this: * An imagelist with N images is tiled like this:
...@@ -607,7 +603,6 @@ ImageList_Create (INT cx, INT cy, UINT flags, ...@@ -607,7 +603,6 @@ ImageList_Create (INT cx, INT cy, UINT flags,
cGrow = (cGrow < 4) ? 4 : (cGrow + 3) & ~3; cGrow = (cGrow < 4) ? 4 : (cGrow + 3) & ~3;
himl->magic = IMAGELIST_MAGIC;
himl->cx = cx; himl->cx = cx;
himl->cy = cy; himl->cy = cy;
himl->flags = flags; himl->flags = flags;
...@@ -3320,6 +3315,11 @@ static const IImageListVtbl ImageListImpl_Vtbl = { ...@@ -3320,6 +3315,11 @@ static const IImageListVtbl ImageListImpl_Vtbl = {
ImageListImpl_GetOverlayImage ImageListImpl_GetOverlayImage
}; };
static inline BOOL is_valid(HIMAGELIST himl)
{
return himl && himl->lpVtbl == &ImageListImpl_Vtbl;
}
/************************************************************************* /*************************************************************************
* HIMAGELIST_QueryInterface [COMCTL32.@] * HIMAGELIST_QueryInterface [COMCTL32.@]
* *
......
...@@ -30,31 +30,31 @@ ...@@ -30,31 +30,31 @@
struct _IMAGELIST struct _IMAGELIST
{ {
const struct IImageListVtbl *lpVtbl; /* 00: IImageList vtable */ const struct IImageListVtbl *lpVtbl; /* 00: IImageList vtable */
LONG ref; /* 04: reference count */
DWORD magic; /* 08: 'SAMX' */ INT cCurImage; /* 04: ImageCount */
INT cCurImage; /* 0C: ImageCount */ INT cMaxImage; /* 08: maximages */
INT cMaxImage; /* 10: maximages */ INT cGrow; /* 0C: cGrow */
INT cGrow; /* 14: cGrow */ INT cx; /* 10: cx */
INT cx; /* 18: cx */ INT cy; /* 14: cy */
INT cy; /* 1C: cy */
DWORD x4; DWORD x4;
UINT flags; /* 24: flags */ UINT flags; /* 1C: flags */
COLORREF clrFg; /* 28: foreground color */ COLORREF clrFg; /* 20: foreground color */
COLORREF clrBk; /* 2C: background color */ COLORREF clrBk; /* 24: background color */
HBITMAP hbmImage; /* 30: images Bitmap */ HBITMAP hbmImage; /* 28: images Bitmap */
HBITMAP hbmMask; /* 34: masks Bitmap */ HBITMAP hbmMask; /* 2C: masks Bitmap */
HDC hdcImage; /* 38: images MemDC */ HDC hdcImage; /* 30: images MemDC */
HDC hdcMask; /* 3C: masks MemDC */ HDC hdcMask; /* 34: masks MemDC */
INT nOvlIdx[15]; /* 40: overlay images index */ INT nOvlIdx[15]; /* 38: overlay images index */
/* not yet found out */ /* not yet found out */
HBRUSH hbrBlend25; HBRUSH hbrBlend25;
HBRUSH hbrBlend50; HBRUSH hbrBlend50;
INT cInitial; INT cInitial;
UINT uBitsPixel; UINT uBitsPixel;
LONG ref; /* reference count */
}; };
#define IMAGELIST_MAGIC 0x53414D58 #define IMAGELIST_MAGIC 0x53414D58
......
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