Check the mask flags in the item structure to determine how much

memory to read/write.
This commit is contained in:
Adam Gundy 2003-05-02 20:14:33 +00:00 committed by Alexandre Julliard
parent e2ae56e0b9
commit 06d610ec9b
2 changed files with 34 additions and 4 deletions

View File

@ -4911,7 +4911,21 @@ static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL i
dispInfo.item.stateMask = lpLVItem->stateMask & infoPtr->uCallbackMask; dispInfo.item.stateMask = lpLVItem->stateMask & infoPtr->uCallbackMask;
notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW); notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW);
dispInfo.item.stateMask = lpLVItem->stateMask; dispInfo.item.stateMask = lpLVItem->stateMask;
*lpLVItem = dispInfo.item; if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS))
{
/* full size structure expected - _WIN32IE >= 0x560 */
*lpLVItem = dispInfo.item;
}
else if (lpLVItem->mask & LVIF_INDENT)
{
/* indent member expected - _WIN32IE >= 0x300 */
memcpy(lpLVItem, &dispInfo.item, offsetof( LVITEMW, iGroupId ));
}
else
{
/* minimal structure expected */
memcpy(lpLVItem, &dispInfo.item, offsetof( LVITEMW, iIndent ));
}
TRACE(" getdispinfo(1):lpLVItem=%s\n", debuglvitem_t(lpLVItem, isW)); TRACE(" getdispinfo(1):lpLVItem=%s\n", debuglvitem_t(lpLVItem, isW));
} }
@ -5910,9 +5924,23 @@ static INT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, const LVITEMW *lpLVItem,
nItem = DPA_InsertPtr( infoPtr->hdpaItems, nItem, hdpaSubItems ); nItem = DPA_InsertPtr( infoPtr->hdpaItems, nItem, hdpaSubItems );
if (nItem == -1) goto fail; if (nItem == -1) goto fail;
infoPtr->nItemCount++; infoPtr->nItemCount++;
/* set the item attributes */ /* set the item attributes */
item = *lpLVItem; if (lpLVItem->mask & (LVIF_GROUPID|LVIF_COLUMNS))
{
/* full size structure expected - _WIN32IE >= 0x560 */
item = *lpLVItem;
}
else if (lpLVItem->mask & LVIF_INDENT)
{
/* indent member expected - _WIN32IE >= 0x300 */
memcpy(&item, lpLVItem, offsetof( LVITEMW, iGroupId ));
}
else
{
/* minimal structure expected */
memcpy(&item, lpLVItem, offsetof( LVITEMW, iIndent ));
}
item.iItem = nItem; item.iItem = nItem;
item.state &= ~LVIS_STATEIMAGEMASK; item.state &= ~LVIS_STATEIMAGEMASK;
if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo; if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo;

View File

@ -2716,6 +2716,8 @@ static const WCHAR WC_LISTVIEWW[] = { 'S','y','s',
#define LVIF_PARAM 0x0004 #define LVIF_PARAM 0x0004
#define LVIF_STATE 0x0008 #define LVIF_STATE 0x0008
#define LVIF_INDENT 0x0010 #define LVIF_INDENT 0x0010
#define LVIF_GROUPID 0x0100
#define LVIF_COLUMNS 0x0200
#define LVIF_NORECOMPUTE 0x0800 #define LVIF_NORECOMPUTE 0x0800
#define LVIF_DI_SETITEM 0x1000 #define LVIF_DI_SETITEM 0x1000