comctl32: datetime: Reject out of range dates in DTM_SETSYSTEMTIME.
This commit is contained in:
parent
d9445ce76b
commit
fe5471e717
|
@ -160,6 +160,17 @@ 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) {
|
||||
infoPtr->dateValid = TRUE;
|
||||
MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date);
|
||||
|
|
|
@ -509,10 +509,8 @@ static void test_dtm_set_and_get_system_time(HWND hWndDateTime)
|
|||
/* set st to invalid value */
|
||||
fill_systime_struct(&st, 0, 0, 7, 0, 24, 60, 60, 1000);
|
||||
|
||||
todo_wine {
|
||||
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st);
|
||||
expect_unsuccess(0, r);
|
||||
}
|
||||
r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st);
|
||||
expect_unsuccess(0, r);
|
||||
|
||||
ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_system_time_seq, "test_dtm_set_and_get_system_time", FALSE);
|
||||
flush_sequences(sequences, NUM_MSG_SEQUENCES);
|
||||
|
|
Loading…
Reference in New Issue