gpt4 book ai didi

c - 在windows中查找文件的权限

转载 作者:可可西里 更新时间:2023-11-01 11:14:48 25 4
gpt4 key购买 nike

我在 Linux 工作。在Linux中通过stat函数,我们可以提取一个文件的权限。

同样,我们如何在windows中提取文件的权限。

msdn 中的_stat 函数声明权限位在stat 缓冲区中设置。但它没有给出如何提取它们。

http://msdn.microsoft.com/en-us/library/14h5k7ff%28VS.71%29.aspx

最佳答案

struct stat 结构包含 Windows 上的任何文件权限信息。 Windows 安全性要复杂得多,您需要 GetFileSecurity() 来检索文件的 DACL。在 Windows 程序中很少这样做,您通常会让 Windows 评估有效权限并处理“您不能这样做”错误返回。来自 GetLastError() 的 ERROR_ACCESS_DENIED。

关于c - 在windows中查找文件的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3449465/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com