Author: dchapyshev
Date: Sat Nov 22 07:21:33 2008
New Revision: 37554
URL:
http://svn.reactos.org/svn/reactos?rev=37554&view=rev
Log:
- Fix RtlTimeFieldsToTime. Now GetDateFormatW passed all wine tests
Modified:
trunk/reactos/dll/win32/kernel32/misc/time.c
trunk/reactos/lib/rtl/time.c
Modified: trunk/reactos/dll/win32/kernel32/misc/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/misc/ti…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/misc/time.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/misc/time.c [iso-8859-1] Sat Nov 22 07:21:33 2008
@@ -378,6 +378,8 @@
lpFileTime->dwHighDateTime = liTime.u.HighPart;
return TRUE;
}
+
+ SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
Modified: trunk/reactos/lib/rtl/time.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/time.c?rev=37554&a…
==============================================================================
--- trunk/reactos/lib/rtl/time.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/time.c [iso-8859-1] Sat Nov 22 07:21:33 2008
@@ -186,6 +186,19 @@
TimeFields,
sizeof(TIME_FIELDS));
+ if (TimeFields->Milliseconds < 0 || TimeFields->Milliseconds > 999 ||
+ TimeFields->Second < 0 || TimeFields->Second > 59 ||
+ TimeFields->Minute < 0 || TimeFields->Minute > 59 ||
+ TimeFields->Hour < 0 || TimeFields->Hour > 23 ||
+ TimeFields->Month < 1 || TimeFields->Month > 12 ||
+ TimeFields->Day < 1 ||
+ TimeFields->Day > MonthLengths[TimeFields->Month == 2 ||
+ IsLeapYear(TimeFields->Year)][TimeFields->Month - 1] ||
+ TimeFields->Year < 1601)
+ {
+ return FALSE;
+ }
+
/* Normalize the TIME_FIELDS structure here */
while (IntTimeFields.Second >= SECSPERMIN)
{