https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d0d7c5f045e0d6e0804e9…
commit d0d7c5f045e0d6e0804e9e69650ef39083acdbdf
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Tue May 28 17:23:43 2019 +0200
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Tue May 28 17:23:43 2019 +0200
[NET] Fix remaining issues with logon hours.
---
base/applications/network/net/cmdUser.c | 40 +++++++++++++++++----------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/base/applications/network/net/cmdUser.c
b/base/applications/network/net/cmdUser.c
index 1ce735ee6f..4530e28e2e 100644
--- a/base/applications/network/net/cmdUser.c
+++ b/base/applications/network/net/cmdUser.c
@@ -909,6 +909,24 @@ ParseDay(
}
+static
+DWORD
+LocalToGmtHour(
+ LONG lLocalHour,
+ LONG lBias)
+{
+ LONG lGmtHour;
+
+ lGmtHour = lLocalHour + lBias;
+ if (lGmtHour < 0)
+ lGmtHour += UNITS_PER_WEEK;
+ else if (lGmtHour > UNITS_PER_WEEK)
+ lGmtHour -= UNITS_PER_WEEK;
+
+ return (DWORD)lGmtHour;
+}
+
+
static
DWORD
ParseLogonHours(
@@ -1018,14 +1036,7 @@ ParseLogonHours(
break;
}
- /* Convert from local timezone to GMT */
- lStartHour += lBias;
- if (lStartHour < 0)
- lStartHour += UNITS_PER_WEEK;
- else if (lStartHour > UNITS_PER_WEEK)
- lStartHour -= UNITS_PER_WEEK;
-
- SetBitValue(HourBitmap, (DWORD)lStartHour);
+ SetBitValue(HourBitmap, LocalToGmtHour(lStartHour, lBias));
}
else
{
@@ -1051,19 +1062,10 @@ ParseLogonHours(
break;
}
- if (lEndHour < lStartHour)
+ if (lEndHour <= lStartHour)
lEndHour += HOURS_PER_DAY;
- else if (lEndHour == lStartHour)
- lEndHour = lStartHour + HOURS_PER_DAY;
-
- /* Convert from local timezone to GMT */
- lEndHour += lBias;
- if (lEndHour < 0)
- lEndHour += UNITS_PER_WEEK;
- else if (lEndHour > UNITS_PER_WEEK)
- lEndHour -= UNITS_PER_WEEK;
- for (i = (DWORD)lStartHour; i < (DWORD)lEndHour; i++)
+ for (i = LocalToGmtHour(lStartHour, lBias); i <
LocalToGmtHour(lEndHour, lBias); i++)
SetBitValue(HourBitmap, i);
}
else