comctl32: Fix read of uninitialized data in LISTVIEW_HeaderNotification and rename it to LISTVIEW_Notify (Valgrind).

This commit is contained in:
Alexander Scott-Johns 2011-02-17 01:24:14 +00:00 committed by Alexandre Julliard
parent 671b9a43e7
commit e2d4775233
1 changed files with 16 additions and 12 deletions

View File

@ -10129,25 +10129,31 @@ static LRESULT LISTVIEW_NCDestroy(LISTVIEW_INFO *infoPtr)
/*** /***
* DESCRIPTION: * DESCRIPTION:
* Handles notifications from header. * Handles notifications.
* *
* PARAMETER(S): * PARAMETER(S):
* [I] infoPtr : valid pointer to the listview structure * [I] infoPtr : valid pointer to the listview structure
* [I] nCtrlId : control identifier * [I] lpnmhdr : notification information
* [I] lpnmh : notification information
* *
* RETURN: * RETURN:
* Zero * Zero
*/ */
static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADERW *lpnmh) static LRESULT LISTVIEW_Notify(LISTVIEW_INFO *infoPtr, const NMHDR *lpnmhdr)
{ {
HWND hwndSelf = infoPtr->hwndSelf; HWND hwndSelf = infoPtr->hwndSelf;
const NMHEADERW *lpnmh;
TRACE("(lpnmh=%p)\n", lpnmh); TRACE("(lpnmhdr=%p)\n", lpnmhdr);
if (!lpnmh || lpnmh->iItem < 0 || lpnmh->iItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return 0; if (!lpnmhdr || lpnmhdr->hwndFrom != infoPtr->hwndHeader) return 0;
switch (lpnmh->hdr.code) /* remember: HDN_LAST < HDN_FIRST */
if (lpnmhdr->code > HDN_FIRST || lpnmhdr->code < HDN_LAST) return 0;
lpnmh = (const NMHEADERW *)lpnmhdr;
if (lpnmh->iItem < 0 || lpnmh->iItem >= DPA_GetPtrCount(infoPtr->hdpaColumns)) return 0;
switch (lpnmhdr->code)
{ {
case HDN_TRACKW: case HDN_TRACKW:
case HDN_TRACKA: case HDN_TRACKA:
@ -11456,9 +11462,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
return LISTVIEW_NCPaint(infoPtr, (HRGN)wParam); return LISTVIEW_NCPaint(infoPtr, (HRGN)wParam);
case WM_NOTIFY: case WM_NOTIFY:
if (lParam && ((LPNMHDR)lParam)->hwndFrom == infoPtr->hwndHeader) return LISTVIEW_Notify(infoPtr, (LPNMHDR)lParam);
return LISTVIEW_HeaderNotification(infoPtr, (LPNMHEADERW)lParam);
else return 0;
case WM_NOTIFYFORMAT: case WM_NOTIFYFORMAT:
return LISTVIEW_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam); return LISTVIEW_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam);