From d0f75b5993d04392e4723f16cbfbcb85cc1a3afa Mon Sep 17 00:00:00 2001 From: Farshad Agah Date: Thu, 8 Mar 2007 20:48:48 -0800 Subject: [PATCH] comctl32: monthcal: Reject out of range dates in MCM_SETCURSEL. --- dlls/comctl32/monthcal.c | 2 ++ dlls/comctl32/tests/monthcal.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 53a8e5c158b..ded5c5cc382 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -1038,6 +1038,8 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam) if((infoPtr==NULL) ||(lpSel==NULL)) return FALSE; if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT) return FALSE; + if(!MONTHCAL_ValidateTime(*lpSel)) return FALSE; + infoPtr->currentMonth=lpSel->wMonth; infoPtr->currentYear=lpSel->wYear; diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 6de5be8a644..c8666f3ece8 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -206,7 +206,7 @@ static void test_monthcal_currDate(HWND hwnd) /* Overflow matters, check for wDay */ st_test.wDay += 4; res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); - todo_wine {expect(0,res);} + expect(0,res); /* correct wDay before checking for wMonth */ st_test.wDay -= 4; @@ -215,7 +215,7 @@ static void test_monthcal_currDate(HWND hwnd) /* Overflow matters, check for wMonth */ st_test.wMonth += 4; res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); - todo_wine {expect(0,res);} + expect(0,res); /* checking if gets the information right, modify st_new */ st_new.wYear += 4; @@ -231,7 +231,7 @@ static void test_monthcal_currDate(HWND hwnd) /* st_new change to st_origin, above settings with overflow */ /* should not change the current settings */ expect(st_original.wYear, st_new.wYear); - todo_wine {expect(st_original.wMonth, st_new.wMonth);} + expect(st_original.wMonth, st_new.wMonth); expect(st_original.wDay, st_new.wDay); expect(st_original.wHour, st_new.wHour); expect(st_original.wMinute, st_new.wMinute);