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:
000000000000000000000000C0FF7F000000000000Converted to binary, I get (without the line breaks of course):000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 110000001111111101111111 000000000000000000000000 000000000000000000000000Why 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 000000000000000000000000write each group of 8 in reverse order000000000000000000000000 000000000000000000000000 000000000000000000000000 000000000000000000000000 000000111111111111111110 000000000000000000000000 000000000000000000000000now 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 PMThere is widespread confusion about what time 12AM is and what time 12 PM is12:00 PM is midnight 12:00 AM is noon 12:01 AM is 1 sec past midnight 12:01 PM is 1 sec past noonHowever 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.