找回密码
 加入
搜索
查看: 1635|回复: 2

[系统综合] 如何用p版的UDF对文件夹设只读权限呀

[复制链接]
发表于 2013-5-17 22:35:53 | 显示全部楼层 |阅读模式
如何用p版的UDF对文件夹设只读权限呀
发表于 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)
 楼主| 发表于 2013-5-18 12:26:54 | 显示全部楼层
谢谢p版了,还有很多东西不知道怎么搞了。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-18 13:08 , Processed in 0.090803 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表