xgysww 发表于 2013-5-17 22:35:53

如何用p版的UDF对文件夹设只读权限呀

如何用p版的UDF对文件夹设只读权限呀

pusofalse 发表于 2013-5-18 07:09:36

#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)

xgysww 发表于 2013-5-18 12:26:54

谢谢p版了,还有很多东西不知道怎么搞了。
页: [1]
查看完整版本: 如何用p版的UDF对文件夹设只读权限呀