public struct UFILETIME
{
public uint dwLowDateTime;
public uint dwHighDateTime;
}
Notes:
Sample and signature code originally used System.Runtime.InteropServices.FILETIME, but this uses ints instead of uints (DWORDs) meaning that this line:
long hFT2 = (((long) ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
gave incorrect results due to signs.
Tips & Tricks:
Please add some!
Alternate C# process:
[DllImport("kernel32", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
private static extern int DosDateTimeToFileTime(ushort dateValue, ushort timeValue, out UInt64 fileTime);
[DllImport("kernel32", CallingConvention = CallingConvention.StdCall, SetLastError = true)]
private static extern int FileTimeToDosDateTime(ref UInt64 fileTimeInfo, out ushort dateValue, out ushort TimeValue);
void Test()
{
UInt64 data = Convert.ToUInt64(DateTime.Now.ToFileTime());
int result = 0;
ushort dateValue = 0;
ushort timeValue = 0;
result = FileTimeToDosDateTime(ref data, out dateValue, out timeValue);
data = 0;
result = DosDateTimeToFileTime(dateValue, timeValue, out data);
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).