'right clicking on the file' 是否更新其上次访问时间?

Does 'right clicking on the file' update its last access time?

我需要检查文件的上次访问 time.I 已使用 'GetFileTime' 读取上次访问时间,请注意,这需要文件 handle 作为第一个参数。这意味着在我将句柄传递给 GetFileTime 之前,我需要创建句柄。所以我使用 CreateFile(MyFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);

创建了句柄

因此,我没有得到与从文件属性 General Tab 中看到的 Accessed: 相同的最后访问时间。这是预期的吗?或者我做错了什么?

相反,当我最后一次右键单击文件以检查其属性时,我得到了最近的时间,但这不会影响 General Tab 属性中的 Accessed: 字段。

Note: I have enabled last access time update in windows server. This code is part of my apache's authz module (mod_authz.so). Enlighten me.

使用GetFileAttributesEx 检索文件上次访问时间。它采用文件名而不是 HANDLE.

BOOL WINAPI GetFileAttributesEx(
  _In_  LPCTSTR                lpFileName,
  _In_  GET_FILEEX_INFO_LEVELS fInfoLevelId,
  _Out_ LPVOID                 lpFileInformation
);

由于我在这里没有得到快速回复,所以我在 serverfault 上发布了这个问题 - 答案解释得很清楚。

这是来自 doc 的声明。

Not all file systems can record creation and last access times, and not all file systems record them in the same manner. For example, the resolution of create time on FAT is 10 milliseconds, while write time has a resolution of 2 seconds and access time has a resolution of 1 day, so it is really the access date. The NTFS file system delays updates to the last access time for a file by up to 1 hour after the last access.

据此我觉得不应依赖文件的上次访问时间,除非您正在寻找更新一致性。

My experience:

But however, the APIs GetFileTime or GetFileAttributesEx do give you the expected output. It is just that this cannot be visualized from file Properties for Accessed: field under General tab.

I Don't know the reason for such a behavior this why I asked this question.