Author: akhaldi
Date: Tue Nov 24 10:36:57 2015
New Revision: 70080
URL: 
http://svn.reactos.org/svn/reactos?rev=70080&view=rev
Log:
[COMCTL32] Sync with Wine Staging 1.7.55. CORE-10536
Removed:
    trunk/reactos/dll/win32/comctl32/icon.c
Modified:
    trunk/reactos/dll/win32/comctl32/CMakeLists.txt
    trunk/reactos/dll/win32/comctl32/commctrl.c
    trunk/reactos/dll/win32/comctl32/imagelist.c
    trunk/reactos/dll/win32/comctl32/listview.c
    trunk/reactos/dll/win32/comctl32/propsheet.c
    trunk/reactos/dll/win32/comctl32/rebar.c
    trunk/reactos/dll/win32/comctl32/syslink.c
    trunk/reactos/dll/win32/comctl32/theme_button.c
    trunk/reactos/dll/win32/comctl32/toolbar.c
    trunk/reactos/dll/win32/comctl32/treeview.c
    trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/dll/win32/comctl32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/CMakeLi…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/CMakeLists.txt     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/CMakeLists.txt     [iso-8859-1] Tue Nov 24 10:36:57
2015
@@ -22,7 +22,6 @@
     flatsb.c
     header.c
     hotkey.c
-    icon.c
     imagelist.c
     ipaddress.c
     listview.c
Modified: trunk/reactos/dll/win32/comctl32/commctrl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/commctr…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/commctrl.c [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -3,6 +3,7 @@
  *
  * Copyright 1997 Dimitrie O. Paun
  * Copyright 1998,2000 Eric Kohl
+ * Copyright 2014-2015 Michael Müller
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -1811,10 +1812,49 @@
 /***********************************************************************
  * LoadIconWithScaleDown [COMCTL32.@]
  */
-HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, PCWSTR name, int cx, int cy, HICON
*icon)
-{
-    FIXME("stub: %p %s %d %d %p\n", hinst, wine_dbgstr_w(name), cx, cy, icon);
-    return E_NOTIMPL;
+HRESULT WINAPI LoadIconWithScaleDown(HINSTANCE hinst, const WCHAR *name, int cx, int cy,
HICON *icon)
+{
+    TRACE("(%p, %s, %d, %d, %p)\n", hinst, debugstr_w(name), cx, cy, icon);
+
+    *icon = NULL;
+
+    if (!name)
+        return E_INVALIDARG;
+
+    *icon = LoadImageW(hinst, name, IMAGE_ICON, cx, cy,
+                       (hinst || IS_INTRESOURCE(name)) ? 0 : LR_LOADFROMFILE);
+    if (!*icon)
+        return HRESULT_FROM_WIN32(GetLastError());
+
+    return S_OK;
+}
+
+/***********************************************************************
+ * LoadIconMetric [COMCTL32.@]
+ */
+HRESULT WINAPI LoadIconMetric(HINSTANCE hinst, const WCHAR *name, int size, HICON *icon)
+{
+    int cx, cy;
+
+    TRACE("(%p, %s, %d, %p)\n", hinst, debugstr_w(name), size, icon);
+
+    if (size == LIM_SMALL)
+    {
+        cx = GetSystemMetrics(SM_CXSMICON);
+        cy = GetSystemMetrics(SM_CYSMICON);
+    }
+    else if (size == LIM_LARGE)
+    {
+        cx = GetSystemMetrics(SM_CXICON);
+        cy = GetSystemMetrics(SM_CYICON);
+    }
+    else
+    {
+        *icon = NULL;
+        return E_INVALIDARG;
+    }
+
+    return LoadIconWithScaleDown(hinst, name, cx, cy, icon);
 }
 /***********************************************************************
Removed: trunk/reactos/dll/win32/comctl32/icon.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/icon.c?…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/icon.c     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/icon.c     (removed)
@@ -1,59 +0,0 @@
-/*
- * Comctl32 Icon functions
- *
- * Copyright 2014 Michael Müller
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#include "comctl32.h"
-
-WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
-
-HRESULT WINAPI
-LoadIconMetric (HINSTANCE hinst, PCWSTR name, INT size, HICON *icon)
-{
-    INT width, height;
-
-    TRACE("(%p %s %d %p)\n", hinst, debugstr_w(name), size, icon);
-
-    if (!icon)
-        return E_INVALIDARG;
-
-    /* windows sets it to zero in a case of failure */
-    *icon = NULL;
-
-    if (!name)
-        return E_INVALIDARG;
-
-    if (size == LIM_SMALL)
-    {
-        width  = GetSystemMetrics( SM_CXSMICON );
-        height = GetSystemMetrics( SM_CYSMICON );
-    }
-    else if (size == LIM_LARGE)
-    {
-        width  = GetSystemMetrics( SM_CXICON );
-        height = GetSystemMetrics( SM_CYICON );
-    }
-    else
-        return E_INVALIDARG;
-
-    *icon = LoadImageW( hinst, name, IMAGE_ICON, width, height, LR_SHARED );
-    if (*icon)
-        return S_OK;
-
-    return HRESULT_FROM_WIN32(GetLastError());
-}
Modified: trunk/reactos/dll/win32/comctl32/imagelist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/imageli…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/imagelist.c        [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/imagelist.c        [iso-8859-1] Tue Nov 24 10:36:57
2015
@@ -3615,7 +3615,7 @@
     IUnknown *punk, int iDrag, int dxHotspot, int dyHotspot)
 {
     IImageList *iml2 = NULL;
-    HRESULT ret;
+    BOOL ret;
     if (!punk)
         return E_FAIL;
Modified: trunk/reactos/dll/win32/comctl32/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/listvie…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/listview.c [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -63,9 +63,9 @@
  *   -- if list is sorted by item text LISTVIEW_InsertItemT could use
  *      binary search to calculate item index (e.g. DPA_Search()).
  *      This requires sorted state to be reliably tracked in item modifiers.
- *   -- we should keep an ordered array of coordinates in iconic mode
- *      this would allow to frame items (iterator_frameditems),
- *      and find nearest item (LVFI_NEARESTXY) a lot more efficiently
+ *   -- we should keep an ordered array of coordinates in iconic mode.
+ *      This would allow framing items (iterator_frameditems),
+ *      and finding the nearest item (LVFI_NEARESTXY) a lot more efficiently.
  *
  * Flags
  *   -- LVIF_COLUMNS
@@ -571,7 +571,7 @@
     int len, size = DEBUG_BUFFER_SIZE;
     if (pScrollInfo == NULL) return "(null)";
-    len = snprintf(buf, size, "{cbSize=%d, ", pScrollInfo->cbSize);
+    len = snprintf(buf, size, "{cbSize=%u, ", pScrollInfo->cbSize);
     if (len == -1) goto end; buf += len; size -= len;
     if (pScrollInfo->fMask & SIF_RANGE)
        len = snprintf(buf, size, "nMin=%d, nMax=%d, ", pScrollInfo->nMin,
pScrollInfo->nMax);
@@ -4122,6 +4122,7 @@
     /* see if we are supposed to be tracking mouse hovering */
     if (LISTVIEW_IsHotTracking(infoPtr)) {
         TRACKMOUSEEVENT trackinfo;
+        DWORD flags;
         trackinfo.cbSize = sizeof(TRACKMOUSEEVENT);
         trackinfo.dwFlags = TME_QUERY;
@@ -4129,8 +4130,12 @@
         /* see if we are already tracking this hwnd */
         _TrackMouseEvent(&trackinfo);
-        if(!(trackinfo.dwFlags & TME_HOVER) || trackinfo.hwndTrack !=
infoPtr->hwndSelf) {
-            trackinfo.dwFlags     = TME_HOVER;
+        flags = TME_LEAVE;
+        if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
+            flags |= TME_HOVER;
+
+        if((trackinfo.dwFlags & flags) != flags || trackinfo.hwndTrack !=
infoPtr->hwndSelf) {
+            trackinfo.dwFlags     = flags;
             trackinfo.dwHoverTime = infoPtr->dwHoverTime;
             trackinfo.hwndTrack   = infoPtr->hwndSelf;
@@ -5683,11 +5688,11 @@
     }
     /* update the other column info */
-    LISTVIEW_UpdateItemSize(infoPtr);
     if(DPA_GetPtrCount(infoPtr->hdpaColumns) == 0)
         LISTVIEW_InvalidateList(infoPtr);
     else
         LISTVIEW_ScrollColumns(infoPtr, nColumn, -(rcCol.right - rcCol.left));
+    LISTVIEW_UpdateItemSize(infoPtr);
     return TRUE;
 }
@@ -7855,10 +7860,18 @@
     item.iItem = nItem;
     if (infoPtr->dwLvExStyle & LVS_EX_CHECKBOXES)
     {
-        item.mask |= LVIF_STATE;
-        item.stateMask |= LVIS_STATEIMAGEMASK;
-        item.state &= ~LVIS_STATEIMAGEMASK;
-        item.state |= INDEXTOSTATEIMAGEMASK(1);
+        if (item.mask & LVIF_STATE)
+        {
+            item.stateMask |= LVIS_STATEIMAGEMASK;
+            item.state &= ~LVIS_STATEIMAGEMASK;
+            item.state |= INDEXTOSTATEIMAGEMASK(1);
+        }
+        else
+        {
+            item.mask |= LVIF_STATE;
+            item.stateMask = LVIS_STATEIMAGEMASK;
+            item.state = INDEXTOSTATEIMAGEMASK(1);
+        }
     }
     if (!set_main_item(infoPtr, &item, TRUE, isW, &has_changed)) goto undo;
Modified: trunk/reactos/dll/win32/comctl32/propsheet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/propshe…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/propsheet.c        [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/propsheet.c        [iso-8859-1] Tue Nov 24 10:36:57
2015
@@ -156,6 +156,7 @@
 static PADDING_INFO PROPSHEET_GetPaddingInfoWizard(HWND hwndDlg, const PropSheetInfo*
psInfo);
 static BOOL PROPSHEET_DoCommand(HWND hwnd, WORD wID);
 static BOOL PROPSHEET_RemovePage(HWND hwndDlg, int index, HPROPSHEETPAGE hpage);
+static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter,
HPROPSHEETPAGE hpage);
 static INT_PTR CALLBACK
 PROPSHEET_DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -2243,60 +2244,9 @@
 static BOOL PROPSHEET_AddPage(HWND hwndDlg,
                               HPROPSHEETPAGE hpage)
 {
-  PropPageInfo * ppi;
   PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
-  HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
-  TCITEMW item;
-  LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
-
   TRACE("hpage %p\n", hpage);
-  /*
-   * Allocate and fill in a new PropPageInfo entry.
-   */
-  ppi = ReAlloc(psInfo->proppage, sizeof(PropPageInfo) * (psInfo->nPages + 1));
-  if (!ppi)
-      return FALSE;
-
-  psInfo->proppage = ppi;
-  if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, psInfo->nPages, FALSE))
-      return FALSE;
-
-  psInfo->proppage[psInfo->nPages].hpage = hpage;
-
-  if (ppsp->dwFlags & PSP_PREMATURE)
-  {
-     /* Create the page but don't show it */
-     if(!PROPSHEET_CreatePage(hwndDlg, psInfo->nPages, psInfo, ppsp))
-         return FALSE;
-  }
-
-  /*
-   * Add a new tab to the tab control.
-   */
-  item.mask = TCIF_TEXT;
-  item.pszText = (LPWSTR) psInfo->proppage[psInfo->nPages].pszText;
-  item.cchTextMax = MAX_TABTEXT_LENGTH;
-
-  if (psInfo->hImageList)
-  {
-    SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
-  }
-
-  if ( psInfo->proppage[psInfo->nPages].hasIcon )
-  {
-    item.mask |= TCIF_IMAGE;
-    item.iImage = psInfo->nPages;
-  }
-
-  SendMessageW(hwndTabControl, TCM_INSERTITEMW, psInfo->nPages + 1,
-               (LPARAM)&item);
-
-  psInfo->nPages++;
-
-  /* If it is the only page - show it */
-  if(psInfo->nPages == 1)
-     PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
-  return TRUE;
+  return PROPSHEET_InsertPage(hwndDlg, (HPROPSHEETPAGE)(ULONG_PTR)psInfo->nPages,
hpage);
 }
 /******************************************************************************
@@ -2484,11 +2434,99 @@
  */
 static BOOL PROPSHEET_InsertPage(HWND hwndDlg, HPROPSHEETPAGE hpageInsertAfter,
HPROPSHEETPAGE hpage)
 {
-    if (IS_INTRESOURCE(hpageInsertAfter))
-        FIXME("(%p, %d, %p): stub\n", hwndDlg, LOWORD(hpageInsertAfter),
hpage);
-    else
-        FIXME("(%p, %p, %p): stub\n", hwndDlg, hpageInsertAfter, hpage);
-    return FALSE;
+  PropSheetInfo * psInfo = GetPropW(hwndDlg, PropSheetInfoStr);
+  PropPageInfo * ppi, * prev_ppi = psInfo->proppage;
+  HWND hwndTabControl = GetDlgItem(hwndDlg, IDC_TABCONTROL);
+  LPCPROPSHEETPAGEW ppsp = (LPCPROPSHEETPAGEW)hpage;
+  TCITEMW item;
+  int index;
+
+  TRACE("hwndDlg %p, hpageInsertAfter %p, hpage %p\n", hwndDlg,
hpageInsertAfter, hpage);
+
+  if (IS_INTRESOURCE(hpageInsertAfter))
+    index = LOWORD(hpageInsertAfter);
+  else
+  {
+    index = PROPSHEET_GetPageIndex(hpageInsertAfter, psInfo, -1);
+    if (index < 0)
+    {
+      TRACE("Could not find page to insert after!\n");
+      return FALSE;
+    }
+    index++;
+  }
+
+  if (index > psInfo->nPages)
+    index = psInfo->nPages;
+
+  /*
+   * Allocate a new PropPageInfo entry.
+   */
+  ppi = Alloc(sizeof(PropPageInfo) * (psInfo->nPages + 1));
+  if (!ppi)
+      return FALSE;
+
+  /*
+   * Fill in a new PropPageInfo entry.
+   */
+  if (index > 0)
+    memcpy(ppi, prev_ppi, index * sizeof(PropPageInfo));
+  memset(&ppi[index], 0, sizeof(PropPageInfo));
+  if (index < psInfo->nPages)
+    memcpy(&ppi[index + 1], &prev_ppi[index], (psInfo->nPages - index) *
sizeof(PropPageInfo));
+  psInfo->proppage = ppi;
+
+  if (!PROPSHEET_CollectPageInfo(ppsp, psInfo, index, FALSE))
+  {
+     psInfo->proppage = prev_ppi;
+     Free(ppi);
+     return FALSE;
+  }
+
+  psInfo->proppage[index].hpage = hpage;
+
+  if (ppsp->dwFlags & PSP_PREMATURE)
+  {
+     /* Create the page but don't show it */
+     if(!PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppsp))
+     {
+        psInfo->proppage = prev_ppi;
+        Free(ppi);
+        return FALSE;
+     }
+  }
+
+  Free(prev_ppi);
+  psInfo->nPages++;
+  if (index <= psInfo->active_page)
+    psInfo->active_page++;
+
+  /*
+   * Add a new tab to the tab control.
+   */
+  item.mask = TCIF_TEXT;
+  item.pszText = (LPWSTR) psInfo->proppage[index].pszText;
+  item.cchTextMax = MAX_TABTEXT_LENGTH;
+
+  if (psInfo->hImageList)
+  {
+    SendMessageW(hwndTabControl, TCM_SETIMAGELIST, 0, (LPARAM)psInfo->hImageList);
+  }
+
+  if (psInfo->proppage[index].hasIcon)
+  {
+    item.mask |= TCIF_IMAGE;
+    item.iImage = index;
+  }
+
+  SendMessageW(hwndTabControl, TCM_INSERTITEMW, index,
+               (LPARAM)&item);
+
+  /* If it is the only page - show it */
+  if (psInfo->nPages == 1)
+     PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
+
+  return TRUE;
 }
 /******************************************************************************
@@ -2717,6 +2755,7 @@
     MSG msg;
     INT ret = -1;
     HWND hwnd = psInfo->hwnd;
+    HWND parent = psInfo->ppshheader.hwndParent;
     while(IsWindow(hwnd) && !psInfo->ended && (ret =
GetMessageW(&msg, NULL, 0, 0)))
     {
@@ -2739,6 +2778,9 @@
     if(ret != -1)
         ret = psInfo->result;
+    if(parent)
+        EnableWindow(parent, TRUE);
+
     DestroyWindow(hwnd);
     return ret;
 }
@@ -2765,10 +2807,7 @@
   }
   bRet = PROPSHEET_CreateDialog(psInfo);
   if(!psInfo->isModeless)
-  {
       bRet = do_loop(psInfo);
-      if (parent) EnableWindow(parent, TRUE);
-  }
   return bRet;
 }
Modified: trunk/reactos/dll/win32/comctl32/rebar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/rebar.c…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/rebar.c    [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/rebar.c    [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -2337,7 +2337,7 @@
     if (lprbbi->fMask & RBBIM_CHILDSIZE) {
        lprbbi->cxMinChild = lpBand->cxMinChild;
        lprbbi->cyMinChild = lpBand->cyMinChild;
-        /* to make tests pass we follow Windows behaviour and allow to read these fields
only
+        /* to make tests pass we follow Windows' behaviour and allow reading these
fields only
          * for RBBS_VARIABLEHEIGHTS bands */
         if (lprbbi->cbSize >= REBARBANDINFOW_V6_SIZE && (lpBand->fStyle
& RBBS_VARIABLEHEIGHT)) {
            lprbbi->cyChild    = lpBand->cyChild;
Modified: trunk/reactos/dll/win32/comctl32/syslink.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/syslink…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/syslink.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/syslink.c  [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -1377,7 +1377,7 @@
     for(Current = infoPtr->Items; Current != NULL; Current = Current->Next)
     {
         if((Current->Type == slLink) && SYSLINK_PtInDocItem(Current, *pt)
&&
-           (!MustBeEnabled || (MustBeEnabled && (Current->u.Link.state &
LIS_ENABLED))))
+           (!MustBeEnabled || (Current->u.Link.state & LIS_ENABLED)))
         {
             if(LinkId != NULL)
             {
Modified: trunk/reactos/dll/win32/comctl32/theme_button.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/theme_b…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/theme_button.c     [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/theme_button.c     [iso-8859-1] Tue Nov 24 10:36:57
2015
@@ -306,9 +306,6 @@
     ButtonState drawState;
     pfThemedPaint paint = btnThemedPaintFunc[ dwStyle & BUTTON_TYPE ];
-    if(!paint)
-        return FALSE;
-
     if(IsWindowEnabled(hwnd))
     {
         if(state & BST_PUSHED) drawState = STATE_PRESSED;
@@ -319,7 +316,7 @@
     else drawState = STATE_DISABLED;
     hDC = hParamDC ? hParamDC : BeginPaint(hwnd, &ps);
-    paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS);
+    if (paint) paint(theme, hwnd, hDC, drawState, dtFlags, state & BST_FOCUS);
     if (!hParamDC) EndPaint(hwnd, &ps);
     return TRUE;
 }
@@ -406,6 +403,14 @@
         break;
     }
+    case BM_SETCHECK:
+    case BM_SETSTATE:
+        theme = GetWindowTheme(hwnd);
+        if (theme) {
+            InvalidateRect(hwnd, NULL, FALSE);
+        }
+        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
+
     default:
        /* Call old proc */
        return THEMING_CallOriginalClass(hwnd, msg, wParam, lParam);
Modified: trunk/reactos/dll/win32/comctl32/toolbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/toolbar…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/toolbar.c  [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/toolbar.c  [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -3238,7 +3238,7 @@
     bChecked = (btnPtr->fsState & TBSTATE_CHECKED) != 0;
-    if (LOWORD(lParam) == FALSE)
+    if (!LOWORD(lParam))
        btnPtr->fsState &= ~TBSTATE_CHECKED;
     else {
        if (btnPtr->fsStyle & BTNS_GROUP) {
@@ -3370,7 +3370,7 @@
     bState = btnPtr->fsState & TBSTATE_ENABLED;
     /* update the toolbar button state */
-    if(LOWORD(lParam) == FALSE) {
+    if(!LOWORD(lParam)) {
        btnPtr->fsState &= ~(TBSTATE_ENABLED | TBSTATE_PRESSED);
     } else {
        btnPtr->fsState |= TBSTATE_ENABLED;
@@ -5309,15 +5309,12 @@
     return ret;
 }
-/* UNDOCUMENTED MESSAGE: This appears to set some kind of size. Perhaps it
- * is the maximum size of the toolbar? */
-static LRESULT TOOLBAR_Unkwn45D(HWND hwnd, WPARAM wParam, LPARAM lParam)
+static LRESULT TOOLBAR_SetBoundingSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     SIZE * pSize = (SIZE*)lParam;
     FIXME("hwnd=%p, wParam=0x%08lx, size.cx=%d, size.cy=%d stub!\n", hwnd,
wParam, pSize->cx, pSize->cy);
     return 0;
 }
-
 /* This is an extended version of the TB_SETHOTITEM message. It allows the
  * caller to specify a reason why the hot item changed (rather than just the
@@ -5690,95 +5687,92 @@
     nHit = TOOLBAR_InternalHitTest (infoPtr, &pt, &button);
     if (button)
+    {
         btnPtr = &infoPtr->buttons[nHit];
-    if (button && bDragKeyPressed && (infoPtr->dwStyle &
CCS_ADJUSTABLE))
-    {
-        infoPtr->nButtonDrag = nHit;
-        SetCapture (infoPtr->hwndSelf);
-
-        /* If drag cursor has not been loaded, load it.
-         * Note: it doesn't need to be freed */
-        if (!hCursorDrag)
-            hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON);
-        SetCursor(hCursorDrag);
-    }
-    else if (button)
-    {
-       RECT arrowRect;
-       infoPtr->nOldHit = nHit;
-
-       CopyRect(&arrowRect, &btnPtr->rect);
-       arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right - DDARROW_WIDTH);
-
-       /* for EX_DRAWDDARROWS style,  click must be in the drop-down arrow rect */
-       if ((btnPtr->fsState & TBSTATE_ENABLED) &&
-            ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
-             ((btnPtr->fsStyle & BTNS_DROPDOWN) &&
-              ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) &&
PtInRect(&arrowRect, pt)) ||
-              (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
-       {
-           LRESULT res;
-
-           /* draw in pressed state */
-           if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
-               btnPtr->fsState |= TBSTATE_PRESSED;
-           else
-               btnPtr->bDropDownPressed = TRUE;
-           RedrawWindow(infoPtr->hwndSelf,&btnPtr->rect,0,
-                       RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
-
-           memset(&nmtb, 0, sizeof(nmtb));
-           nmtb.iItem = btnPtr->idCommand;
-           nmtb.rcButton = btnPtr->rect;
-           res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr,
-                                 TBN_DROPDOWN);
-           TRACE("TBN_DROPDOWN responded with %ld\n", res);
-
-            if (res != TBDDRET_TREATPRESSED)
+        if (bDragKeyPressed && (infoPtr->dwStyle & CCS_ADJUSTABLE))
+        {
+            infoPtr->nButtonDrag = nHit;
+            SetCapture (infoPtr->hwndSelf);
+
+            /* If drag cursor has not been loaded, load it.
+             * Note: it doesn't need to be freed */
+            if (!hCursorDrag)
+                hCursorDrag = LoadCursorW(COMCTL32_hModule, (LPCWSTR)IDC_MOVEBUTTON);
+            SetCursor(hCursorDrag);
+        }
+        else
+        {
+            RECT arrowRect;
+            infoPtr->nOldHit = nHit;
+
+            CopyRect(&arrowRect, &btnPtr->rect);
+            arrowRect.left = max(btnPtr->rect.left, btnPtr->rect.right -
DDARROW_WIDTH);
+
+            /* for EX_DRAWDDARROWS style,  click must be in the drop-down arrow rect */
+            if ((btnPtr->fsState & TBSTATE_ENABLED) &&
+                 ((btnPtr->fsStyle & BTNS_WHOLEDROPDOWN) ||
+                  ((btnPtr->fsStyle & BTNS_DROPDOWN) &&
+                   ((TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle) &&
PtInRect(&arrowRect, pt)) ||
+                   (!TOOLBAR_HasDropDownArrows(infoPtr->dwExStyle))))))
             {
-                MSG msg;
-
-                /* redraw button in unpressed state */
-               if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
-                           btnPtr->fsState &= ~TBSTATE_PRESSED;
-                       else
-                           btnPtr->bDropDownPressed = FALSE;
+                LRESULT res;
+
+                /* draw in pressed state */
+                if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
+                    btnPtr->fsState |= TBSTATE_PRESSED;
+                else
+                    btnPtr->bDropDownPressed = TRUE;
+                RedrawWindow(infoPtr->hwndSelf, &btnPtr->rect, 0,
RDW_ERASE|RDW_INVALIDATE|RDW_UPDATENOW);
+
+                memset(&nmtb, 0, sizeof(nmtb));
+                nmtb.iItem = btnPtr->idCommand;
+                nmtb.rcButton = btnPtr->rect;
+                res = TOOLBAR_SendNotify ((NMHDR *) &nmtb, infoPtr, TBN_DROPDOWN);
+                TRACE("TBN_DROPDOWN responded with %ld\n", res);
+
+                if (res != TBDDRET_TREATPRESSED)
+                {
+                    MSG msg;
+
+                    /* redraw button in unpressed state */
+                    if (btnPtr->fsStyle & BTNS_WHOLEDROPDOWN)
+                        btnPtr->fsState &= ~TBSTATE_PRESSED;
+                    else
+                        btnPtr->bDropDownPressed = FALSE;
+                    InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
+
+                    /* find and set hot item */
+                    GetCursorPos(&pt);
+                    ScreenToClient(infoPtr->hwndSelf, &pt);
+                    nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
+                    if (!infoPtr->bAnchor || button)
+                        TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
+
+                    /* remove any left mouse button down or double-click messages
+                     * so that we can get a toggle effect on the button */
+                    while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN,
WM_LBUTTONDOWN, PM_REMOVE) ||
+                           PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK,
WM_LBUTTONDBLCLK, PM_REMOVE))
+                        ;
+
+                    return 0;
+                }
+                /* otherwise drop through and process as pushed */
+            }
+            infoPtr->bCaptured = TRUE;
+            infoPtr->nButtonDown = nHit;
+            infoPtr->bDragOutSent = FALSE;
+
+            btnPtr->fsState |= TBSTATE_PRESSED;
+
+            TOOLBAR_SetHotItemEx(infoPtr, nHit, HICF_MOUSE | HICF_LMOUSE);
+
+            if (btnPtr->fsState & TBSTATE_ENABLED)
                 InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
-
-                /* find and set hot item */
-                GetCursorPos(&pt);
-                ScreenToClient(infoPtr->hwndSelf, &pt);
-                nHit = TOOLBAR_InternalHitTest(infoPtr, &pt, &button);
-                if (!infoPtr->bAnchor || button)
-                    TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE,
HICF_MOUSE | HICF_LMOUSE);
-
-                /* remove any left mouse button down or double-click messages
-                 * so that we can get a toggle effect on the button */
-                while (PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDOWN,
WM_LBUTTONDOWN, PM_REMOVE) ||
-                       PeekMessageW(&msg, infoPtr->hwndSelf, WM_LBUTTONDBLCLK,
WM_LBUTTONDBLCLK, PM_REMOVE))
-                    ;
-
-               return 0;
-            }
-           /* otherwise drop through and process as pushed */
-               }
-       infoPtr->bCaptured = TRUE;
-       infoPtr->nButtonDown = nHit;
-       infoPtr->bDragOutSent = FALSE;
-
-       btnPtr->fsState |= TBSTATE_PRESSED;
-
-        TOOLBAR_SetHotItemEx(infoPtr, button ? nHit : TOOLBAR_NOWHERE, HICF_MOUSE |
HICF_LMOUSE);
-
-        if (btnPtr->fsState & TBSTATE_ENABLED)
-           InvalidateRect(infoPtr->hwndSelf, &btnPtr->rect, TRUE);
-       UpdateWindow(infoPtr->hwndSelf);
-       SetCapture (infoPtr->hwndSelf);
-    }
-
-    if (button)
-    {
+            UpdateWindow(infoPtr->hwndSelf);
+            SetCapture (infoPtr->hwndSelf);
+        }
+
         memset(&nmtb, 0, sizeof(nmtb));
         nmtb.iItem = btnPtr->idCommand;
         TOOLBAR_SendNotify((NMHDR *)&nmtb, infoPtr, TBN_BEGINDRAG);
@@ -6902,8 +6896,8 @@
        case TB_SETUNICODEFORMAT:
            return TOOLBAR_SetUnicodeFormat (infoPtr, wParam);
-       case TB_UNKWN45D:
-           return TOOLBAR_Unkwn45D(hwnd, wParam, lParam);
+       case TB_SETBOUNDINGSIZE:
+           return TOOLBAR_SetBoundingSize(hwnd, wParam, lParam);
        case TB_SETHOTITEM2:
            return TOOLBAR_SetHotItem2 (infoPtr, wParam, lParam);
Modified: trunk/reactos/dll/win32/comctl32/treeview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/comctl32/treevie…
==============================================================================
--- trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/comctl32/treeview.c [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -42,6 +42,8 @@
 #include "comctl32.h"
+#include <wine/exception.h>
+
 WINE_DEFAULT_DEBUG_CHANNEL(treeview);
 /* internal structures */
@@ -2046,11 +2048,20 @@
     if (!TREEVIEW_ValidItem(infoPtr, item))
     {
+        BOOL valid_item = FALSE;
         if (!item) return FALSE;
-        TRACE("got item from different tree %p, called from %p\n",
item->infoPtr, infoPtr);
-        infoPtr = item->infoPtr;
-        if (!TREEVIEW_ValidItem(infoPtr, item)) return FALSE;
+        __TRY
+        {
+            infoPtr = item->infoPtr;
+            TRACE("got item from different tree %p, called from %p\n",
item->infoPtr, infoPtr);
+            valid_item = TREEVIEW_ValidItem(infoPtr, item);
+        }
+        __EXCEPT_PAGE_FAULT
+        {
+        }
+        __ENDTRY
+        if (!valid_item) return FALSE;
     }
     TREEVIEW_UpdateDispInfo(infoPtr, item, tvItem->mask);
Modified: trunk/reactos/media/doc/README.WINE
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
==============================================================================
--- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original)
+++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Tue Nov 24 10:36:57 2015
@@ -54,7 +54,7 @@
 reactos/dll/win32/cabinet             # Synced to WineStaging-1.7.47
 reactos/dll/win32/clusapi             # Synced to WineStaging-1.7.47
 reactos/dll/win32/comcat              # Synced to WineStaging-1.7.47
-reactos/dll/win32/comctl32            # Synced to WineStaging-1.7.47
+reactos/dll/win32/comctl32            # Synced to WineStaging-1.7.55
 reactos/dll/win32/comdlg32            # Synced to WineStaging-1.7.47
 reactos/dll/win32/compstui            # Synced to WineStaging-1.7.47
 reactos/dll/win32/credui              # Synced to WineStaging-1.7.55