Do not send uninitialized data in notification to application.

This commit is contained in:
Dimitrie O. Paun 2002-10-04 17:49:29 +00:00 committed by Alexandre Julliard
parent c8ab54d158
commit 45387e3a6c
1 changed files with 13 additions and 3 deletions

View File

@ -4871,10 +4871,20 @@ static BOOL LISTVIEW_GetItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, BOOL i
/* if we need to callback, do it now */ /* if we need to callback, do it now */
if ((lpLVItem->mask & ~LVIF_STATE) || infoPtr->uCallbackMask) if ((lpLVItem->mask & ~LVIF_STATE) || infoPtr->uCallbackMask)
{ {
memcpy(&dispInfo.item, lpLVItem, sizeof(LVITEMW)); /* NOTE: copy only fields which we _know_ are initialized, some apps
dispInfo.item.stateMask &= infoPtr->uCallbackMask; * depend on the uninitialized fields being 0 */
dispInfo.item.mask = lpLVItem->mask;
dispInfo.item.iItem = lpLVItem->iItem;
dispInfo.item.iSubItem = lpLVItem->iSubItem;
if (lpLVItem->mask & LVIF_TEXT)
{
dispInfo.item.pszText = lpLVItem->pszText;
dispInfo.item.cchTextMax = lpLVItem->cchTextMax;
}
if (lpLVItem->mask & LVIF_STATE)
dispInfo.item.stateMask = lpLVItem->stateMask & infoPtr->uCallbackMask;
notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW); notify_dispinfoT(infoPtr, LVN_GETDISPINFOW, &dispInfo, isW);
memcpy(lpLVItem, &dispInfo.item, sizeof(LVITEMW)); *lpLVItem = dispInfo.item;
TRACE(" getdispinfo(1):lpLVItem=%s\n", debuglvitem_t(lpLVItem, isW)); TRACE(" getdispinfo(1):lpLVItem=%s\n", debuglvitem_t(lpLVItem, isW));
} }