Hallo, this patch fixes to things in ole/ole2nls.c 1. (SYSTEMTIME)->wDayOfWeek is in the range 0..6 with sunday= 0 and LOCALE_SDAYNAME1 is monday. The old calculation resulted for sunday in LOCALE_SDAYNAME1-1 returned LOCALE_S2359 0x0029 /* PM designator */ 2. GetDateFormat is supposed to ckeck the range of year(?), month and date and fail outside the range. wDayOfWeek is ignored from the wDayOfWeekargument given and calculated from the date. Changelog ole/ole2nls.c:GetDateFormatA Check range and recalculate wDayOfWeek ole/ole2nls.c:OLE_GetFormatA|W Fix transformation of wDayOfWeek to LOCALE_S(ABBREV)DAYNAMEx Bye Uwe Bonnes [EMAIL PROTECTED] Free Software: If you contribute nothing, expect nothing -- --- wine-test/ole/ole2nls.c Wed Sep 27 21:31:51 2000 +++ wine-sep/ole/ole2nls.c Sun Oct 1 22:06:38 2000 @@ -2595,9 +2595,9 @@ const char ** dgfmt = _dgfmt - 1; /* report, for debugging */ - TRACE("(0x%lx,0x%lx, 0x%lx, time(d=%d,h=%d,m=%d,s=%d), fmt=%p \'%s\' , %p, len=%d)\n", + TRACE("(0x%lx,0x%lx, 0x%lx, time(y=%d m=%d wd=%d d=%d,h=%d,m=%d,s=%d), fmt=%p +\'%s\' , %p, len=%d)\n", locale, flags, tflags, - xtime->wDay, xtime->wHour, xtime->wMinute, xtime->wSecond, + xtime->wYear,xtime->wMonth,xtime->wDayOfWeek,xtime->wDay, xtime->wHour, +xtime->wMinute, xtime->wSecond, _format, _format, date, datelen); if(datelen == 0) { @@ -2658,12 +2658,12 @@ if (count == 4) { GetLocaleInfoA(locale, LOCALE_SDAYNAME1 - + xtime->wDayOfWeek - 1, + + (xtime->wDayOfWeek+6)%7, buf, sizeof(buf)); } else if (count == 3) { GetLocaleInfoA(locale, LOCALE_SABBREVDAYNAME1 - + xtime->wDayOfWeek - 1, + + (xtime->wDayOfWeek+6)%7, buf, sizeof(buf)); } else { sprintf(buf, dgfmt[count], xtime->wDay); @@ -2862,12 +2862,12 @@ if (type == 'd') { if (count == 3) { GetLocaleInfoW(locale, - LOCALE_SDAYNAME1 + xtime->wDayOfWeek -1, + LOCALE_SDAYNAME1 + (xtime->wDayOfWeek +6)%7, buf, sizeof(buf)/sizeof(WCHAR) ); } else if (count == 3) { GetLocaleInfoW(locale, LOCALE_SABBREVDAYNAME1 + - xtime->wDayOfWeek -1, + (xtime->wDayOfWeek +6)%7, buf, sizeof(buf)/sizeof(WCHAR) ); } else { wsnprintfW(buf, 5, argarr[count], xtime->wDay ); @@ -3023,6 +3023,8 @@ LPSYSTEMTIME thistime; LCID thislocale; INT ret; + FILETIME ft; + BOOL res; TRACE("(0x%04lx,0x%08lx,%p,%s,%p,%d)\n", locale,flags,xtime,format,date,datelen); @@ -3041,10 +3043,20 @@ if (xtime == NULL) { GetSystemTime(&t); - thistime = &t; } else { - thistime = xtime; + /* Silently correct wDayOfWeek by tranforming to FileTime and back again*/ + res=SystemTimeToFileTime(xtime,&ft); + /* Check year(?)/month and date for range and set ERROR_INVALID_PARAMETER on +error*/ + /*FIXME: SystemTimeToFileTime doesn't yet do that ckeck*/ + if(!res) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + FileTimeToSystemTime(&ft,&t); + }; + thistime = &t; if (format == NULL) { GetLocaleInfoA(thislocale, ((flags&DATE_LONGDATE) @@ -4156,6 +4168,7 @@ } else { thistime = xtime; + /* Check that hour,min and sec is in range */ } ret = OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat, timestr, timelen);