comctl32: Use current month and year when checking day of month.

This commit is contained in:
Vincent Povirk 2011-03-31 13:55:24 -05:00 committed by Alexandre Julliard
parent 02480a902e
commit 4d1fca24be
2 changed files with 11 additions and 1 deletions

View File

@ -167,7 +167,8 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *sy
if (flag == GDT_VALID) {
if (systime->wYear < 1601 || systime->wYear > 30827 ||
systime->wMonth < 1 || systime->wMonth > 12 ||
systime->wDay < 1 || systime->wDay > 31 ||
systime->wDay < 1 ||
systime->wDay > MONTHCAL_MonthLength(systime->wMonth, systime->wYear) ||
systime->wHour > 23 ||
systime->wMinute > 59 ||
systime->wSecond > 59 ||

View File

@ -600,6 +600,15 @@ static void test_dtm_set_and_get_system_time(void)
r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt);
expect(GDT_VALID, r);
expect_systime(&ref, &getSt);
/* day invalid for current month */
st = ref;
st.wDay = 30;
st.wMonth = 2;
r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st);
expect(0, r);
r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt);
expect(GDT_VALID, r);
expect_systime(&ref, &getSt);
/* day of week isn't validated */
st = ref;
st.wDayOfWeek = 10;