Commit d0f75b59 authored by Farshad Agah's avatar Farshad Agah Committed by Alexandre Julliard

comctl32: monthcal: Reject out of range dates in MCM_SETCURSEL.

parent 9a5c5178
...@@ -1038,6 +1038,8 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam) ...@@ -1038,6 +1038,8 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, LPARAM lParam)
if((infoPtr==NULL) ||(lpSel==NULL)) return FALSE; if((infoPtr==NULL) ||(lpSel==NULL)) return FALSE;
if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT) return FALSE; if(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & MCS_MULTISELECT) return FALSE;
if(!MONTHCAL_ValidateTime(*lpSel)) return FALSE;
infoPtr->currentMonth=lpSel->wMonth; infoPtr->currentMonth=lpSel->wMonth;
infoPtr->currentYear=lpSel->wYear; infoPtr->currentYear=lpSel->wYear;
......
...@@ -206,7 +206,7 @@ static void test_monthcal_currDate(HWND hwnd) ...@@ -206,7 +206,7 @@ static void test_monthcal_currDate(HWND hwnd)
/* Overflow matters, check for wDay */ /* Overflow matters, check for wDay */
st_test.wDay += 4; st_test.wDay += 4;
res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test);
todo_wine {expect(0,res);} expect(0,res);
/* correct wDay before checking for wMonth */ /* correct wDay before checking for wMonth */
st_test.wDay -= 4; st_test.wDay -= 4;
...@@ -215,7 +215,7 @@ static void test_monthcal_currDate(HWND hwnd) ...@@ -215,7 +215,7 @@ static void test_monthcal_currDate(HWND hwnd)
/* Overflow matters, check for wMonth */ /* Overflow matters, check for wMonth */
st_test.wMonth += 4; st_test.wMonth += 4;
res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st_test); 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 */ /* checking if gets the information right, modify st_new */
st_new.wYear += 4; st_new.wYear += 4;
...@@ -231,7 +231,7 @@ static void test_monthcal_currDate(HWND hwnd) ...@@ -231,7 +231,7 @@ static void test_monthcal_currDate(HWND hwnd)
/* st_new change to st_origin, above settings with overflow */ /* st_new change to st_origin, above settings with overflow */
/* should not change the current settings */ /* should not change the current settings */
expect(st_original.wYear, st_new.wYear); 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.wDay, st_new.wDay);
expect(st_original.wHour, st_new.wHour); expect(st_original.wHour, st_new.wHour);
expect(st_original.wMinute, st_new.wMinute); expect(st_original.wMinute, st_new.wMinute);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment