[PATCH] comctl32: don't print ERRs for reflected messages

Mikołaj Zalewski mikolaj at zalewski.pl
Mon Jul 21 17:18:09 CDT 2008


---
 dlls/comctl32/animate.c    |    2 +-
 dlls/comctl32/comboex.c    |    2 +-
 dlls/comctl32/comctl32.h   |    1 +
 dlls/comctl32/commctrl.c   |   44 ++++++++++++++++++++++++++++++++++++++++++++
 dlls/comctl32/datetime.c   |    2 +-
 dlls/comctl32/flatsb.c     |    2 +-
 dlls/comctl32/header.c     |    2 +-
 dlls/comctl32/hotkey.c     |    2 +-
 dlls/comctl32/ipaddress.c  |    2 +-
 dlls/comctl32/listview.c   |    2 +-
 dlls/comctl32/monthcal.c   |    2 +-
 dlls/comctl32/nativefont.c |    2 +-
 dlls/comctl32/progress.c   |    2 +-
 dlls/comctl32/rebar.c      |    2 +-
 dlls/comctl32/status.c     |    2 +-
 dlls/comctl32/syslink.c    |    2 +-
 dlls/comctl32/tab.c        |    2 +-
 dlls/comctl32/toolbar.c    |    2 +-
 dlls/comctl32/tooltips.c   |    2 +-
 dlls/comctl32/trackbar.c   |    2 +-
 dlls/comctl32/treeview.c   |    2 +-
 dlls/comctl32/updown.c     |    2 +-
 22 files changed, 65 insertions(+), 20 deletions(-)

diff --git a/dlls/comctl32/animate.c b/dlls/comctl32/animate.c
index a567cb3..0dd25f8 100644
--- a/dlls/comctl32/animate.c
+++ b/dlls/comctl32/animate.c
@@ -962,7 +962,7 @@ static LRESULT WINAPI ANIMATE_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LP
 	return DefWindowProcW(hWnd, uMsg, wParam, lParam);
 
     default:
-	if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 	    ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
 
 	return DefWindowProcW(hWnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/comboex.c b/dlls/comctl32/comboex.c
index afd4f82..1c9b202 100644
--- a/dlls/comctl32/comboex.c
+++ b/dlls/comctl32/comboex.c
@@ -2310,7 +2310,7 @@ COMBOEX_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
             return 0;
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",uMsg,wParam,lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
     }
diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h
index da9243f..2c8e538 100644
--- a/dlls/comctl32/comctl32.h
+++ b/dlls/comctl32/comctl32.h
@@ -149,6 +149,7 @@ VOID COMCTL32_RefreshSysColors(void);
 void COMCTL32_DrawInsertMark(HDC hDC, const RECT *lpRect, COLORREF clrInsertMark, BOOL bHorizontal);
 void COMCTL32_EnsureBitmapSize(HBITMAP *pBitmap, int cxMinWidth, int cyMinHeight, COLORREF crBackground);
 void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm);
+BOOL COMCTL32_IsReflectedMessage(UINT uMsg);
 INT  Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen);
 INT  Str_GetPtrAtoW (LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen);
 BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc);
diff --git a/dlls/comctl32/commctrl.c b/dlls/comctl32/commctrl.c
index 1863dbf..050a018 100644
--- a/dlls/comctl32/commctrl.c
+++ b/dlls/comctl32/commctrl.c
@@ -1572,6 +1572,50 @@ void COMCTL32_GetFontMetrics(HFONT hFont, TEXTMETRICW *ptm)
     ReleaseDC(NULL, hdc);
 }
 
+#ifndef OCM__BASE      /* avoid including olectl.h */
+#define OCM__BASE (WM_USER+0x1c00)
+#endif
+
+/***********************************************************************
+ * COMCTL32_IsReflectedMessage [internal]
+ *
+ * Some parents reflect notify messages - for some messages sent by the child,
+ * they send it back with the message code increased by OCM__BASE (0x2000).
+ * This allows better subclassing of controls. We don't need to handle such
+ * messages but we don't want to print ERRs for them, so this helper function
+ * identifies them.
+ *
+ * Some of the codes are in the CCM_FIRST..CCM_LAST range, but there is no
+ * colision with defined CCM_ codes.
+ */
+BOOL COMCTL32_IsReflectedMessage(UINT uMsg)
+{
+    switch (uMsg)
+    {
+        case OCM__BASE + WM_COMMAND:
+        case OCM__BASE + WM_CTLCOLORBTN:
+        case OCM__BASE + WM_CTLCOLOREDIT:
+        case OCM__BASE + WM_CTLCOLORDLG:
+        case OCM__BASE + WM_CTLCOLORLISTBOX:
+        case OCM__BASE + WM_CTLCOLORMSGBOX:
+        case OCM__BASE + WM_CTLCOLORSCROLLBAR:
+        case OCM__BASE + WM_CTLCOLORSTATIC:
+        case OCM__BASE + WM_DRAWITEM:
+        case OCM__BASE + WM_MEASUREITEM:
+        case OCM__BASE + WM_DELETEITEM:
+        case OCM__BASE + WM_VKEYTOITEM:
+        case OCM__BASE + WM_CHARTOITEM:
+        case OCM__BASE + WM_COMPAREITEM:
+        case OCM__BASE + WM_HSCROLL:
+        case OCM__BASE + WM_VSCROLL:
+        case OCM__BASE + WM_PARENTNOTIFY:
+        case OCM__BASE + WM_NOTIFY:
+            return TRUE;
+        default:
+            return FALSE;
+    }
+}
+
 /***********************************************************************
  * MirrorIcon [COMCTL32.414]
  *
diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index b46c495..e73faf6 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -1381,7 +1381,7 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         return (LRESULT) infoPtr->hFont;
 
     default:
-	if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
 		     uMsg, wParam, lParam);
 	return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/flatsb.c b/dlls/comctl32/flatsb.c
index 080aff9..cabcdfc 100644
--- a/dlls/comctl32/flatsb.c
+++ b/dlls/comctl32/flatsb.c
@@ -257,7 +257,7 @@ FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return FlatSB_Destroy (hwnd, wParam, lParam);
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
                     uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/header.c b/dlls/comctl32/header.c
index 3d16310..496df62 100644
--- a/dlls/comctl32/header.c
+++ b/dlls/comctl32/header.c
@@ -2125,7 +2125,7 @@ HEADER_WindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             return HEADER_SetRedraw(hwnd, wParam, lParam);
 
         default:
-            if ((msg >= WM_USER) && (msg < WM_APP))
+            if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
 		ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
 		     msg, wParam, lParam );
 	    return DefWindowProcW(hwnd, msg, wParam, lParam);
diff --git a/dlls/comctl32/hotkey.c b/dlls/comctl32/hotkey.c
index 8a56fd3..6e7591a 100644
--- a/dlls/comctl32/hotkey.c
+++ b/dlls/comctl32/hotkey.c
@@ -528,7 +528,7 @@ HOTKEY_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return HOTKEY_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
 		     uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/ipaddress.c b/dlls/comctl32/ipaddress.c
index c29406f..0c02daf 100644
--- a/dlls/comctl32/ipaddress.c
+++ b/dlls/comctl32/ipaddress.c
@@ -590,7 +590,7 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return IPADDRESS_IsBlank (infoPtr);
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
     }
diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
index 6b16a7b..213b569 100644
--- a/dlls/comctl32/listview.c
+++ b/dlls/comctl32/listview.c
@@ -10033,7 +10033,7 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 /*	case WM_WININICHANGE: */
 
   default:
-    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
       ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
 
   fwd_msg:
diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c
index f3d54b1..9ca6fcc 100644
--- a/dlls/comctl32/monthcal.c
+++ b/dlls/comctl32/monthcal.c
@@ -2072,7 +2072,7 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     return MONTHCAL_Destroy(infoPtr);
 
   default:
-    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
       ERR( "unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
     return DefWindowProcW(hwnd, uMsg, wParam, lParam);
   }
diff --git a/dlls/comctl32/nativefont.c b/dlls/comctl32/nativefont.c
index a599a2a..22bf2df 100644
--- a/dlls/comctl32/nativefont.c
+++ b/dlls/comctl32/nativefont.c
@@ -101,7 +101,7 @@ NATIVEFONT_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
 		     uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/progress.c b/dlls/comctl32/progress.c
index d3b7ded..d29fec5 100644
--- a/dlls/comctl32/progress.c
+++ b/dlls/comctl32/progress.c
@@ -722,7 +722,7 @@ static LRESULT WINAPI ProgressWindowProc(HWND hwnd, UINT message,
 	return infoPtr->Marquee;
 
     default:
-        if ((message >= WM_USER) && (message < WM_APP))
+        if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message))
 	    ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam );
         return DefWindowProcW( hwnd, message, wParam, lParam );
     }
diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c
index 16f6b9c..e2b8c4f 100644
--- a/dlls/comctl32/rebar.c
+++ b/dlls/comctl32/rebar.c
@@ -3733,7 +3733,7 @@ REBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return REBAR_WindowPosChanged (infoPtr, wParam, lParam);
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
 		     uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/status.c b/dlls/comctl32/status.c
index 1b97b41..60827e4 100644
--- a/dlls/comctl32/status.c
+++ b/dlls/comctl32/status.c
@@ -1343,7 +1343,7 @@ StatusWindowProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
             return theme_changed (infoPtr);
 
 	default:
-	    if ((msg >= WM_USER) && (msg < WM_APP))
+	    if ((msg >= WM_USER) && (msg < WM_APP) && !COMCTL32_IsReflectedMessage(msg))
 		ERR("unknown msg %04x wp=%04lx lp=%08lx\n",
 		     msg, wParam, lParam);
 	    return DefWindowProcW (hwnd, msg, wParam, lParam);
diff --git a/dlls/comctl32/syslink.c b/dlls/comctl32/syslink.c
index a1b8aff..a78a00c 100644
--- a/dlls/comctl32/syslink.c
+++ b/dlls/comctl32/syslink.c
@@ -1750,7 +1750,7 @@ static LRESULT WINAPI SysLinkWindowProc(HWND hwnd, UINT message,
 
     default:
 HandleDefaultMessage:
-        if ((message >= WM_USER) && (message < WM_APP))
+        if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message))
         {
             ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam );
         }
diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 62047e5..725cc10 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -3269,7 +3269,7 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
       return TAB_NCCalcSize(hwnd, wParam, lParam);
 
     default:
-      if (uMsg >= WM_USER && uMsg < WM_APP)
+      if (uMsg >= WM_USER && uMsg < WM_APP && !COMCTL32_IsReflectedMessage(uMsg))
 	WARN("unknown msg %04x wp=%08lx lp=%08lx\n",
 	     uMsg, wParam, lParam);
       break;
diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c
index bd37e19..15e65b3 100644
--- a/dlls/comctl32/toolbar.c
+++ b/dlls/comctl32/toolbar.c
@@ -7046,7 +7046,7 @@ ToolbarWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
 		     uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/tooltips.c b/dlls/comctl32/tooltips.c
index 5368835..f7e538b 100644
--- a/dlls/comctl32/tooltips.c
+++ b/dlls/comctl32/tooltips.c
@@ -2843,7 +2843,7 @@ TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 	    return TOOLTIPS_WinIniChange (hwnd, wParam, lParam);
 
 	default:
-	    if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	    if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
 		     uMsg, wParam, lParam);
 	    return DefWindowProcW (hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/trackbar.c b/dlls/comctl32/trackbar.c
index 67cf32d..d540f00 100644
--- a/dlls/comctl32/trackbar.c
+++ b/dlls/comctl32/trackbar.c
@@ -1911,7 +1911,7 @@ TRACKBAR_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
         return TRACKBAR_InitializeThumb (infoPtr);
 
     default:
-        if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+        if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
             ERR("unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
         return DefWindowProcW (hwnd, uMsg, wParam, lParam);
     }
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index f2f0eb9..51e11bf 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -5705,7 +5705,7 @@ TREEVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
     default:
 	/* This mostly catches MFC and Delphi messages. :( */
-	if ((uMsg >= WM_USER) && (uMsg < WM_APP))
+	if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 	    TRACE("Unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam);
 def:
 	return DefWindowProcW(hwnd, uMsg, wParam, lParam);
diff --git a/dlls/comctl32/updown.c b/dlls/comctl32/updown.c
index a62e221..a971afa 100644
--- a/dlls/comctl32/updown.c
+++ b/dlls/comctl32/updown.c
@@ -1082,7 +1082,7 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
 	    return temp;
 
 	default:
-	    if ((message >= WM_USER) && (message < WM_APP))
+	    if ((message >= WM_USER) && (message < WM_APP) && !COMCTL32_IsReflectedMessage(message))
 		ERR("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam);
 	    return DefWindowProcW (hwnd, message, wParam, lParam);
     }
-- 
1.5.4


--------------030806090205020204030500--



More information about the wine-patches mailing list