问题
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).
回答1:
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.
回答2:
See this example which finds the owner of a file using GetSecurityInfo
and LookupAccountSid
functions.
来源:https://stackoverflow.com/questions/11755422/c-how-to-retrieve-a-file-permission-and-ownership-via-win32-api