简体   繁体   中英

C++ How to retrieve a file permission and ownership via 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.

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).

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.

请参GetSecurityInfo 示例该示例使用GetSecurityInfoLookupAccountSid函数查找文件的所有者。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM