How to get * change * file time in Windows?

I am trying to use FreeNAS CIFS sharing with Windows (synchronizing files from Windows to FreeNAS) and am facing a problem that robocopy.exe believes that some files need to be copied every time robocopy.exe is started (/ COPY: DAT).

My favorite Far Manager file management tool tells me that Change Time is different:

Windows file time: On windows

File time on CIFS resource supported by FreeNAS (ZFS): On CIFS share backed by FreeNAS (ZFS)

I am doing a great job of losing the “change time”, and I would be happy to reset the change time on the Windows disk, but I cannot find how I can do this programmatically.

Python os.stat(filename) st_atime, st_mtime st_ctime, , , Windows FreeNAS. " " .

API Windows 3 (, ), " " : http://msdn.microsoft.com/en-us/library/windows/desktop/ms724320(v=vs.85).aspx

-, robocopy.exe, Far Manager - 4 . , . " " ?

(Python, ++, WinAPI, , ..).

+4
1

, , , , , Far . Far NtQueryInformationFile NtSetInformationFile , FILE_BASIC_INFORMATION 4 , .

QueryInformationFile docs: http://msdn.microsoft.com/en-us/library/windows/hardware/ff567052(v=vs.85).aspx (ZwQueryInformationFile)

SetInformationFile docs: http://msdn.microsoft.com/en-us/library/windows/hardware/ff567096(v=vs.85).aspx (ZwSetInformationFile)

FILE_BASIC_INFORMATION docs: http://msdn.microsoft.com/en-us/library/windows/hardware/ff545762(v=vs.85).aspx

typedef struct _FILE_BASIC_INFORMATION {
  LARGE_INTEGER CreationTime;
  LARGE_INTEGER LastAccessTime;
  LARGE_INTEGER LastWriteTime;
  LARGE_INTEGER ChangeTime;        // <--- win!
  ULONG         FileAttributes;
} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;

, Python, , .

+4

Source: https://habr.com/ru/post/1568052/


All Articles