WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

wNT
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

wntUserSetDat and Logon Hours

Keywords: 	  wntUserSetDat  Logon Hours

Question:

I'm trying to figure out how the logon hours attribute in the wntUserSetDat function works. It seems really funky, but I'm sure there's a logical explanation for how it works.

Example:

An account has all logon hours set to "deny" except Thursday, 12:00am to 5:00pm. When I get the "logon_hours" attribute using wntUserGetDat, I get:

000000000000000000000000C0FF7F000000000000
Converted to binary, I get (without the line breaks of course):
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
110000001111111101111111
000000000000000000000000
000000000000000000000000
Why are the 1s nonconsecutive? The logon hours are. I previously thought that it was a time zone matter, but there's no way to shift the bits around to make them contiguous. Help?

Answer:

Looks like a little-endian big endian disaster,

So take your binary representation...

000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
110000001111111101111111
000000000000000000000000
000000000000000000000000
write each group of 8 in reverse order
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000000000000000000000
000000111111111111111110
000000000000000000000000
000000000000000000000000
now they are contigious in this representation.
so umm that would be thurs
GMT time
6AM to 11 PM

so applying say a -6 bias
that would be
CST 12 PM to 5 PM
There is widespread confusion about what time 12AM is and what time 12 PM is
12:00 PM is midnight
12:00 AM is noon

12:01 AM is 1 sec past midnight
12:01 PM is 1 sec past noon
However there are widespread variances to this in practice, so often you will see 12AM as midnight and 12PM as noon, confusing *everything*.

There is no need to really reverse it, just check the byte in the opposite order.

To "visualize" this, write the bytes (as is) down in reverse order.


Article ID:   W15567
File Created: 2003:05:13:11:28:58
Last Updated: 2003:05:13:11:28:58