S
ssg31415926
According to MSDN, accountExpires contains: 9223372036854775807
(0x7FFFFFFFFFFFFFFF) or 0 when the account is not set to expire. All
of my accounts I've checked are set to 9223372036854775807.
Also according to MSDN
(http://msdn.microsoft.com/library/d...l/frlrfsystemdatetimeclasstofiletimetopic.asp),
the following code should retrieve the value from Active Directory.:
using ActiveDs; //(add a ref to Active DS Type Library (in COM))
using System.DirectoryServices;
System.Int64 largeInt=0;
IADsLargeInteger int64Val = (IADsLargeInteger)
ent.Properties["forceLogoff"].Value;
largeInt = int64Val.HighPart * 0x100000000 + int64Val.LowPart;
Console.WriteLine(largeInt);
where ent is a DirectoryEntry.
I've modified the code slightly and added some Debug statements:
IADsLargeInteger int64Val = (IADsLargeInteger)
this.m_DirectoryEntry.Properties[PropertyName].Value;
Debug.WriteLine("int64Val = " + int64Val.ToString());
Debug.WriteLine("int64Val.HighPart = " + int64Val.HighPart.ToString());
Debug.WriteLine("int64Val.LowPart = " + int64Val.LowPart.ToString());
largeInt = int64Val.HighPart * 0x100000000 + int64Val.LowPart;
Debug.WriteLine("LargeInt = " + largeInt.ToString());
Debug.WriteLine(String.Format("{0:x}, {1:x}, {2:x}",
int64Val.HighPart, int64Val.LowPart, largeInt));
and it produces an incorrect value. These are the results from the
Debug.WriteLine statements:
int64Val = System.__ComObject
int64Val.HighPart = 2147483647
int64Val.LowPart = -1
LargeInt = 9223372032559808511
7fffffff, ffffffff, 7ffffffeffffffff
You can see this, from the HighPart and LowPart values (formatted to
hex, above) that the correct value is retrieved. So, why aren't they
correctly combined to 7fffffffffffffff? The math looks right to me.
(0x7FFFFFFFFFFFFFFF) or 0 when the account is not set to expire. All
of my accounts I've checked are set to 9223372036854775807.
Also according to MSDN
(http://msdn.microsoft.com/library/d...l/frlrfsystemdatetimeclasstofiletimetopic.asp),
the following code should retrieve the value from Active Directory.:
using ActiveDs; //(add a ref to Active DS Type Library (in COM))
using System.DirectoryServices;
System.Int64 largeInt=0;
IADsLargeInteger int64Val = (IADsLargeInteger)
ent.Properties["forceLogoff"].Value;
largeInt = int64Val.HighPart * 0x100000000 + int64Val.LowPart;
Console.WriteLine(largeInt);
where ent is a DirectoryEntry.
I've modified the code slightly and added some Debug statements:
IADsLargeInteger int64Val = (IADsLargeInteger)
this.m_DirectoryEntry.Properties[PropertyName].Value;
Debug.WriteLine("int64Val = " + int64Val.ToString());
Debug.WriteLine("int64Val.HighPart = " + int64Val.HighPart.ToString());
Debug.WriteLine("int64Val.LowPart = " + int64Val.LowPart.ToString());
largeInt = int64Val.HighPart * 0x100000000 + int64Val.LowPart;
Debug.WriteLine("LargeInt = " + largeInt.ToString());
Debug.WriteLine(String.Format("{0:x}, {1:x}, {2:x}",
int64Val.HighPart, int64Val.LowPart, largeInt));
and it produces an incorrect value. These are the results from the
Debug.WriteLine statements:
int64Val = System.__ComObject
int64Val.HighPart = 2147483647
int64Val.LowPart = -1
LargeInt = 9223372032559808511
7fffffff, ffffffff, 7ffffffeffffffff
You can see this, from the HighPart and LowPart values (formatted to
hex, above) that the correct value is retrieved. So, why aren't they
correctly combined to 7fffffffffffffff? The math looks right to me.