2

I am trying to read the SACL properties of a folder.
The application will run on the Domain Controller, and it needs to read and update the SACL properties of a folder or file that is present in a member computer.
Is there any APIs available for this?
Can I use the GetNamedSecurityInfo to read the file? if yes how should the path of the file be?
Consider the domain is 'Raja.org' and the folder for which I am trying to set the SACL is 'C:\Test'
what should be the path I pass to the GetNamedSecurityInfo function?

native Dev
  • 56
  • 4

1 Answers1

0

You could use GetNamedSecurityInfo, where pObjectName would be the path to the file and ObjectType is SE_FILE_OBJECT.

SE_FILE_OBJECT

Indicates a file or directory. The name string that identifies a file or directory object can be in one of the following formats:

A relative path, such as FileName.dat or ..\FileName

An absolute path, such as FileName.dat, C:\DirectoryName\FileName.dat, or G:\RemoteDirectoryName\FileName.dat.

A UNC name, such as \ComputerName\ShareName\FileName.dat.

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20
  • This is for when the folder is shared with other users, I am asking for situations when the folder is not being shared with any other user. – native Dev Feb 22 '22 at 09:55
  • I suggest you could refer to the thread: https://stackoverflow.com/questions/14849221/how-to-get-acl-permissions-for-a-folder-for-a-specific-user-with-c – Jeaninez - MSFT Feb 23 '22 at 06:13