-2

I have some problem. I tried to search solving in the internet, but didn't find them (they didn't work).

The problem is...

For example I have some folder: "directory1", I must get usernames and their permissions regarding this folder..

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • Welcome to Stack Overflow. Please read [the help pages](http://stackoverflow.com/help), take the SO [tour], read [ask], as well as [this question checklist](https://codeblog.jonskeet.uk/2012/11/24/stack-overflow-question-checklist/). Lastly please learn how to [edit] your questions to improve them, like showing us a [mre] of your own attempt together with a description of the problems you have with it. – Some programmer dude Aug 08 '22 at 06:52
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Aug 08 '22 at 19:19

1 Answers1

0

Finding the Owner of a File Object in C++ example uses the GetSecurityInfo and LookupAccountSid functions to find and print the name of the owner of a file. GetSecurityInfo also can retrieve The primary group of an object, The discretionary access control list (DACL) of an object, The system access control list (SACL) of an object.

YangXiaoPo-MSFT
  • 1,589
  • 1
  • 4
  • 22
  • i tried but i dont know how to declare HANDLE for folder path – Sarukhan M Aug 08 '22 at 11:17
  • [CreateFile](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#parameters) can open a path. – YangXiaoPo-MSFT Aug 09 '22 at 01:48
  • i want to print the folder security information. if i use the createfile i got a error. create file Error = 5. – Sarukhan M Aug 09 '22 at 04:21
  • According to [CreateFile](https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfilew#directories), To open a directory using **CreateFile**, specify the **FILE_FLAG_BACKUP_SEMANTICS** flag as part of *dwFlagsAndAttributes*. – YangXiaoPo-MSFT Oct 27 '22 at 01:51