How to get the SACL properties of a folder in a remote machine using c++

115 Views Asked by At

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?

1

There are 1 best solutions below

2
Jeaninez - MSFT On

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.