GetFileInformationByHandleEx()FileBasicInfo.ChangeTime问题与Windows 2008R2上的目录 [英] GetFileInformationByHandleEx() FileBasicInfo.ChangeTime issue with directories on Windows 2008R2

查看:193
本文介绍了GetFileInformationByHandleEx()FileBasicInfo.ChangeTime问题与Windows 2008R2上的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试使用GetFileInformationByHandleEx()调用和ChangeTime属性检测目录上的ACL安全性更改。它适用于常规文件。但是,对于目录,似乎在2008R2上更改acl后,ChangeTime属性未更新
。在Windows 2012上,文件和目录的行为都没问题。

I'm trying to detect ACL security changes on directories with the GetFileInformationByHandleEx() call and the ChangeTime attribute. It works well with regular files. However, for directories, it seems that the ChangeTime attribute is not updated after a acl change on 2008R2. On Windows 2012 behavior is OK with both files and directories.

我正在使用icacls.exe更改ACL

I'm changing the ACLs with the icacls.exe

c:\windows\SysWOW64\icacls.exe testACL\dir1 /grant "NT AUTHORITY\NETWORK:(d,wdac)"

I'使用如下代码获取属性:

I'm getting the attributes with a code that looks like:

HANDLE h = CreateFileW((pwszBuf, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (h != INVALID_HANDLE_VALUE) {

FILE_BASIC_INFO file_basic_info;

FILE_BASIC_INFO file_basic_info;

if(GetFileInformationByHandleEx(h,FileBasicInfo, & file_basic_info,sizeof(file_basic_info))){
//使用file_basic_info.ChangeTime
}
closeHandle(h);
}

if (GetFileInformationByHandleEx(h, FileBasicInfo, &file_basic_info, sizeof(file_basic_info))) { // use of file_basic_info.ChangeTime } closeHandle(h); }

当我查看数字时,似乎它们是正确的(没有疯狂的值),但是在A之后没有更新ChangeTime CL更改。

When I look the numbers, it seems that they are correct (no crazy values), but the ChangeTime is not updated after the ACL change.

我想知道它是否在2008R2和2012之间修复了,如果我们可以解决其他API的问题。

I wonder if it's something that was fixed between 2008R2 and 2012, and if we can have a workaround with an other API.

谢谢

最好的问候,

Eric




推荐答案

嗨Eric,

感谢您在此发帖。

关于其他API,您是否尝试使用
GetFileInformationByHandle
方法。

About the other API, did you try to use the GetFileInformationByHandle method.

>>"在2008R2上更改acl后似乎没有更新ChangeTime属性。 "

您确定ACL.exe是否成功执行了? 如果不是,则不更新changetime属性。

Are you sure that the ACL.exe executes successfully?  If no, the changetime attribute is not updated.

>>"我想知道它是否在2008R2和2012之间得到修复  

支持的最低服务器是Windows Server  2008 [桌面应用程序]。

The minimum supported server is windows Server 2008 [desktop apps].

>>"在Windows 2012上,文件和目录的行为都没有问题 "

根据我的搜索,我无法找到相关信息
连接网站
,接受错误问题,如果您认为这是一个错误,您可以在连接网站上发布该问题。

Based on my search, I cannot find relevant information on connect web site that accepts bug issue, If you think that it is a bug, you could post the issue on connect website.

最好的问候,

Hart


这篇关于GetFileInformationByHandleEx()FileBasicInfo.ChangeTime问题与Windows 2008R2上的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆