C++ 如何通过 win32 api 检索文件权限和所有权

2022-01-04 00:00:00 file permissions winapi c++ ownership

我一直在互联网上搜索如何使用 win32 api 检索文件的权限和所有权,但我没有答案.

I've been searching over the internet how to retrieve permissions and ownership of a file using win32 api, and yet I have no answer.

我是 win32 api 的新手,从互联网上阅读了一些指南,试图分析一些代码与此 api 相关联,但我仍然一无所知.

I'm new with the win32 api , read some guides from the internet, tried to analyze some code associating with this api and still I'm clueless.

你们能不能帮我提供一些建议或一些方向、技巧等.

Could you guys help me out with some piece of advice or some directions , tips etc.

很抱歉,我无法通过添加一些代码来更具体,我认为没有任何理由导入我自己的任何代码,因为唯一剩下的功能是检索此信息的功能,其余功能很简单(用户界面等).

I'm sorry that I can't be more specific than that by adding some code, I don't see any reason to import any code of my own since the only remaining function is the one retrieving this information and the rest is simple(User interface and etc).

推荐答案

参见 检索 NTFS 权限用 C++.但是,基本上,您调用 GetFileSecurity 获取文件的安全描述符.从中,您可以获得访问控制列表 (ACL) 以及所有者和权限.

See Retrieving NTFS Permissions with C++. But, basically, you call GetFileSecurity to get a security descriptor for the file. From that, you can get the access control list (ACL) and the owner and permissions.

相关文章