From 09501bc1c20b82f4173a050d5dee5a7841d91f09 Mon Sep 17 00:00:00 2001 From: Christoph von Wittich Date: Mon, 27 Oct 2008 09:49:27 +0000 Subject: [PATCH] sync Shell_NotifyIconW with wine 1.1.7 svn path=/trunk/; revision=37017 --- reactos/dll/win32/shell32/systray.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/reactos/dll/win32/shell32/systray.c b/reactos/dll/win32/shell32/systray.c index 4bb26fba365..81297a78907 100644 --- a/reactos/dll/win32/shell32/systray.c +++ b/reactos/dll/win32/shell32/systray.c @@ -104,6 +104,7 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid) HWND tray; COPYDATASTRUCT cds; char *buffer = NULL; + BOOL ret; TRACE("dwMessage = %d, nid->cbSize=%d\n", dwMessage, nid->cbSize); @@ -169,7 +170,11 @@ BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PNOTIFYICONDATAW nid) GetBitmapBits(iconinfo.hbmMask, cbMaskBits, buffer); buffer += cbMaskBits; GetBitmapBits(iconinfo.hbmColor, cbColourBits, buffer); - buffer += cbColourBits; + + /* Reset pointer to allocated block so it can be freed later. + * Note that cds.lpData cannot be passed to HeapFree since it + * points to nid when no icon info is found. */ + buffer = cds.lpData; DeleteObject(iconinfo.hbmMask); DeleteObject(iconinfo.hbmColor); @@ -181,11 +186,11 @@ noicon: cds.lpData = nid; } - SendMessageW(tray, WM_COPYDATA, (WPARAM)nid->hWnd, (LPARAM)&cds); + ret = SendMessageW(tray, WM_COPYDATA, (WPARAM)nid->hWnd, (LPARAM)&cds); /* FIXME: if statement only needed because we don't support interprocess * icon handles */ HeapFree(GetProcessHeap(), 0, buffer); - return TRUE; + return ret; }