[PATCH 1/6] Block WM_SETTEXT message

Nikolay Sivov bunglehead at gmail.com
Thu Oct 8 13:05:13 CDT 2009


---
 dlls/comctl32/datetime.c       |    3 +++
 dlls/comctl32/tests/datetime.c |   20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c
index 097e442..5cda4c0 100644
--- a/dlls/comctl32/datetime.c
+++ b/dlls/comctl32/datetime.c
@@ -1399,6 +1399,9 @@ DATETIME_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
     case WM_GETFONT:
         return (LRESULT) infoPtr->hFont;
 
+    case WM_SETTEXT:
+        return CB_ERR;
+
     default:
 	if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
 		ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c
index a0f12f0..7cd08a0 100644
--- a/dlls/comctl32/tests/datetime.c
+++ b/dlls/comctl32/tests/datetime.c
@@ -668,6 +668,25 @@ static void test_dtm_set_and_get_system_time(void)
     DestroyWindow(hWnd);
 }
 
+static void test_wm_set_get_text(void)
+{
+    static const CHAR a_str[] = "a";
+    char buff[10];
+    HWND hWnd;
+    LRESULT ret;
+
+    hWnd = create_datetime_control(0);
+
+    ret = SendMessage(hWnd, WM_SETTEXT, 0, (LPARAM)a_str);
+    expect(CB_ERR, ret);
+
+    buff[0] = 0;
+    ret = SendMessage(hWnd, WM_GETTEXT, sizeof(buff), (LPARAM)buff);
+    ok(strcmp(buff, a_str) != 0, "Expected text not to change, got %s\n", buff);
+
+    DestroyWindow(hWnd);
+}
+
 START_TEST(datetime)
 {
     HMODULE hComctl32;
@@ -694,4 +713,5 @@ START_TEST(datetime)
     test_dtm_set_and_get_range();
     test_dtm_set_range_swap_min_max();
     test_dtm_set_and_get_system_time();
+    test_wm_set_get_text();
 }
-- 
1.5.6.5


--=-9RvVZiVMdcApawDp4D17--




More information about the wine-patches mailing list