RtlCutoverTimeToSystemTime(): The 4th argument determines whether the cutover time of the current year or the next cutover time is calculated.

svn path=/trunk/; revision=12864
This commit is contained in:
Eric Kohl 2005-01-07 12:58:46 +00:00
parent d6f646a37f
commit a366210998
2 changed files with 55 additions and 39 deletions

View file

@ -882,7 +882,7 @@ BOOLEAN STDCALL
RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
OUT PLARGE_INTEGER SystemTime,
IN PLARGE_INTEGER CurrentTime,
IN ULONG Unknown);
IN BOOLEAN ThisYearsCutoverOnly);
NTSTATUS STDCALL
RtlDecompressBuffer(IN USHORT CompressionFormat,

View file

@ -74,7 +74,7 @@ BOOLEAN STDCALL
RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
OUT PLARGE_INTEGER SystemTime,
IN PLARGE_INTEGER CurrentTime,
IN ULONG Unknown)
IN BOOLEAN ThisYearsCutoverOnly)
{
TIME_FIELDS AdjustedTimeFields;
TIME_FIELDS CurrentTimeFields;
@ -82,6 +82,7 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
LARGE_INTEGER CutoverSystemTime;
CSHORT MonthLength;
CSHORT Days;
BOOLEAN NextYearsCutover = FALSE;
/* Check fixed cutover time */
if (CutoverTimeFields->Year != 0)
@ -105,8 +106,13 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
RtlTimeToTimeFields(CurrentTime, &CurrentTimeFields);
while (TRUE)
{
/* Compute the cutover time of the first day of the current month */
AdjustedTimeFields.Year = CurrentTimeFields.Year;
if (NextYearsCutover == TRUE)
AdjustedTimeFields.Year++;
AdjustedTimeFields.Month = CutoverTimeFields->Month;
AdjustedTimeFields.Day = 1;
AdjustedTimeFields.Hour = CutoverTimeFields->Hour;
@ -144,6 +150,16 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime))
return FALSE;
if (ThisYearsCutoverOnly == TRUE ||
NextYearsCutover == TRUE ||
CutoverSystemTime.QuadPart >= CurrentTime->QuadPart)
{
break;
}
NextYearsCutover = TRUE;
}
SystemTime->QuadPart = CutoverSystemTime.QuadPart;
return TRUE;