comctl32: datetime: Test for out of range dates in DTM_SETSYSTEMTIME only when flag=GDT_VALID.

This commit is contained in:
Kanit Therdsteerasukdi 2007-03-15 14:26:59 -07:00 committed by Alexandre Julliard
parent 6630439f86
commit 7cc0b970b6
1 changed files with 11 additions and 11 deletions

View File

@ -160,18 +160,18 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, SYSTEMTIME *lprgSysT
lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay,
lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond);
if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 ||
lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 ||
lprgSysTimeArray->wDayOfWeek > 6 ||
lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 ||
lprgSysTimeArray->wHour > 23 ||
lprgSysTimeArray->wMinute > 59 ||
lprgSysTimeArray->wSecond > 59 ||
lprgSysTimeArray->wMilliseconds > 999
)
return 0;
if (flag == GDT_VALID) {
if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 ||
lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 ||
lprgSysTimeArray->wDayOfWeek > 6 ||
lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 ||
lprgSysTimeArray->wHour > 23 ||
lprgSysTimeArray->wMinute > 59 ||
lprgSysTimeArray->wSecond > 59 ||
lprgSysTimeArray->wMilliseconds > 999
)
return 0;
infoPtr->dateValid = TRUE;
MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date));