Function FtToDt(AFT:_FILETIME):TDateTime;<br>Var<br> LocalFT : _FILETIME;<br> SysT : _SystemTime;<br>begin<br> FileTimeToLocalFileTime(AFT, LocalFT);<br> FileTimeToSystemTime(LocalFT, SysT);<br> Result := SystemTimeToDateTime(SysT);<br>end;<br><br>Function DtToFt(ADT:TDateTime):_FILETIME;<br>Var<br> SysT : _SystemTime;<br> LocalFT : _FILETIME;<br>begin<br> DateTimeToSystemTime(ADT, SysT);<br> SystemTimeToFileTime(SysT, LocalFT);<br> LocalFileTimeToFileTime(LocalFT, Result);<br>end;<br><br>Function ReadFileLWTime(AFile:String):TDateTime;<br>var<br> hFileOld :THandle;<br> LastWriteTime :_FileTime;<br>begin<br> Result := 0;<br><br> hFileOld :=CreateFile(Pchar(AFile),generic_read,file_share_read,nil, <br> open_existing,FILE_ATTRIBUTE_NORMAL,Cardinal(nil));<br> if (hFileOld=INVALID_HANDLE_VALUE) then exit;<br><br> GetFileTime(hFileOld,nil,nil,@LastWriteTime);<br><br> CloseHandle(hFileOld);<br><br> Result := FtToDt(LastWriteTime);<br>end;<br><br>procedure SetFileLWTime(AFile:String; ADateTime:TDateTime);<br>Var<br> hFileNew :THandle;<br> LastWriteTime :_FileTime;<br>begin<br> hFileNew :=createFile(PChar(AFile),generic_write,file_share_write,nil,<br> open_existing,FILE_ATTRIBUTE_NORMAL,Cardinal(nil));<br> if (hFileNew=INVALID_HANDLE_VALUE) then exit;<br><br> LastWriteTime := DtToFt(ADateTime);<br><br> SetFileTime(hFileNew,nil,nil,@LastWriteTime);<br><br> CloseHandle(hFileNew);<br>end;