#include <lsasecur.au3>
Const $FILE_READ = 0x120089 ; access mask of 'read only'
Const $sFilePath = "E:\test"
Local $pDacl = _SeInitAcl(64)
Local $pSecurityDescriptor = _SeInitSecurityDescriptor(40)
Local $pTrustee = _SeLookupAccountName("Everyone")
_SeSetSecurityDescriptorDacl($pSecurityDescriptor, $pDacl)
_SeAddAccessAllowedAceEx($pDacl, $pTrustee, $FILE_READ, 0)
If _SeSetFileSecurity($sFilePath, $SE_INFO_DACL, $pSecurityDescriptor) Then
MsgBox(0, "OK", "Done")
Else
MsgBox(48, "Failed", "error " & @error)
EndIf
_SeHeapFree($pTrustee)
_SeHeapFree($pDacl)
_SeHeapFree($pSecurityDescriptor)
|