FileTimeToDate function
Revision as of 04:26, 28 December 2009 by Ribose (talk) (Created page with 'The FileTimeToDate function is provided by the Script Support Class to StealthBot allowing you to convert Windows file-times to [[VBScript variable#Dates|date values]…')
The FileTimeToDate function is provided by the Script Support Class to StealthBot allowing you to convert Windows file-times to date values.
Contents
Development
The FileTimeToDate function was added in version 2.7.
Documentation
'// FILETIMETODATE '// Returns a date/time from two long values, as either "value value" or value, value Public Function FileTimeToDate(ByVal strTime As Variant, Optional ByVal HighValue As Long = 0) As Date Dim FTime As FILETIME ' ... ' ... If (HighValue <> 0) Then With FTime .dwLowDateTime = CLng(Val(strTime)) .dwHighDateTime = CLng(Val(HighValue)) End With Else With FTime .dwLowDateTime = _ UnsignedToLong(CDbl(Mid$(strTime, InStr(1, strTime, " ", vbBinaryCompare) + 1))) .dwHighDateTime = _ UnsignedToLong(CDbl(Left$(strTime, InStr(1, strTime, " ", vbBinaryCompare)))) End With End If ' ... FileTimeToDate = modDateTime.FileTimeToDate(FTime) End Function
Summary
FileTimeToDate() can take the two VB Longs (32-bit numbers) in two formats and will convert them to the date type.
Syntax
If you have two DWORDs (for example from SID_CLANMEMBERINFO):
Dword1 = Buffer.GetDWORD() Dword2 = Buffer.GetDWORD() DateValue = FileTimeToDate(Dword1, Dword2)
If you have one NTSTRING (for example from SID_READUSERDATA):
FtString = Buffer.GetString() ' string in the format "##### #####" DateValue = FileTimeToDate(FtString)
Arguments
- strTime is either the first DWORD of the file time (low value) or the file time in a string with the format "HIGHNUMBER LOWNUMBER"
- HighTime is the second DWORD of the file time (high value) if the first argument was the low value.