最新消息:

AccessControl是NSIS权限设置插件,只适用于Win2000或以上

nsis 永恒心锁 4880浏览 0评论
/*
参数说明:
<filename> 一个可用的文件夹如:"c:windows"或"\127.0.0.1sharename"
<rootkey> 常用的注册表根目录,已经进行了宏定义:HKCR - HKEY_CLASSES_ROOT|HKLM - HKEY_LOCAL_MACHINE|HKCU - HKEY_CURRENT_USER|HKU - HKEY_USERS
<regkey> 注册表要改变的键名:"SoftwareMicrosoftWindows"
<trustee> 委托人:可以是一个可用的系统用户.如:"Administrator","Everyone",或者是SID(安全标识符http://support.microsoft.com/kb/243330/en-us)
<permissions> 权限值:可以是一个权限值组合如:"GenericRead + GenericWrite"或"FullAccess"
/NOINHERIT 不继续权限.
文件权限:
ReadData+WriteData+AppendData+ReadEA+WriteEA+Execute+ReadAttributes+WriteAttributes+Delete+ReadControl+WriteDAC+WriteOwner+Synchronize+
FullAccess+GenericRead+GenericWrite+GenericExecute+NULL
文件夹权限:
ListDirectory,AddFile,AddSubdirectory,ReadEA,WriteEA,Traverse,DeleteChild,ReadAttributes,WriteAttributes,Delete,ReadControl,WriteDAC,
WriteOwner,Synchronize,FullAccess,GenericRead,GenericWrite,GenericExecute,NULL
注册表权限:
QueryValue,SetValue,CreateSubKey,EnumerateSubKeys,Notify,CreateLink,Delete,ReadControl,WriteDAC,WriteOwner,Synchronize,GenericRead,
GenericWrite,GenericExecute,FullAccess,NULL
插件用法:
GrantOnFile [/NOINHERIT] <filename> <trustee> <permissions>
GrantOnRegKey [/NOINHERIT] <rootkey> <regkey> <trustee> <permissions>
SetOnFile [/NOINHERIT] <filename> <trustee> <permissions>
SetOnRegKey [/NOINHERIT] <rootkey> <regkey> <trustee> <permissions>
ClearOnFile [/NOINHERIT] <filename> <trustee> <permissions>
ClearOnRegKey [/NOINHERIT] <rootkey> <regkey> <trustee> <permissions>
DenyOnFile [/NOINHERIT] <filename> <trustee> <permissions>
DenyOnRegKey [/NOINHERIT] <rootkey> <regkey> <trustee> <permissions>
RevokeOnFile [/NOINHERIT] <filename> <trustee> <permissions>
RevokeOnRegKey [/NOINHERIT] <rootkey> <regkey> <trustee> <permissions>
SetFileOwner <filename> <trustee>
SetRegKeyOwner <rootkey> <regkey> <trustee>
GetFileOwner <filename>
GetRegKeyOwner <rootkey> <regkey>
SetFileGroup <filename> <trustee>
SetRegKeyGroup <rootkey> <regkey> <trustee>
GetFileGroup <filename>
GetRegKeyGroup <rootkey> <regkey>
EnableFileInheritance <filename>
EnableRegKeyInheritance <rootkey> <regkey>
DisableFileInheritance <filename>
DisableRegKeyInheritance <rootkey> <regkey>
SidToName <sidstring>
NameToSid <username>
GetCurrentUserName
*/
!AddPluginDir "../Plugins"
OutFile "AccessControl.exe"
SetCompressor /SOLID lzma
!include "logiclib.nsh"
SilentInstall silent
RequestExecutionLevel highest
Var Owner
Section ""
 IfFileExists "$EXEDIRTEMPFile.txt" label1
 CreateDirectory "$EXEDIRTEMP"
 FileOpen $0 "$EXEDIRTEMPFile.txt" "w"
 FileWrite $0 "AccessControl"
 FileClose $0
 label1:
 #移除文件的权限
 AccessControl::RevokeOnFile "$EXEDIRTEMPFile.txt" "Everyone" "FullAccess"
 #增加文件的权限,修改,执行,读取,写入
 AccessControl::GrantOnFile "$EXEDIRTEMPFile.txt" "Everyone" "Delete+GenericExecute+GenericRead+GenericWrite"
 #修改文件的权限
 AccessControl::SetOnFile "$EXEDIRTEMPFile.txt" "Everyone" "GenericExecute+GenericRead+GenericWrite"
 #保留文件的权限
 AccessControl::ClearOnFile "$EXEDIRTEMPFile.txt" "Everyone" "GenericRead+GenericWrite"
 #拒绝文件的权限
 AccessControl::RevokeOnFile "$EXEDIRTEMPFile.txt" "Everyone" "FullAccess"
 AccessControl::RevokeOnFile "$EXEDIRTEMPFile.txt" "Administrator" "FullAccess"
 AccessControl::RevokeOnFile "$EXEDIRTEMPFile.txt" "Administrators" "FullAccess"
 AccessControl::DenyOnFile "$EXEDIRTEMPFile.txt" "Everyone" "FullAccess"
 AccessControl::DenyOnFile "$EXEDIRTEMPFile.txt" "Administrator" "FullAccess"
 AccessControl::DenyOnFile "$EXEDIRTEMPFile.txt" "Administrators" "FullAccess"
 #设置文件所有者
 AccessControl::SetFileOwner "$EXEDIRTEMPFile.txt" "Administrators"
 #获得文件所有者
 AccessControl::GetFileOwner "$EXEDIRTEMPFile.txt"
 #设置文件用户组
 AccessControl::SetFileGroup "$EXEDIRTEMPFile.txt" "Administrators"
 #获得文件用户组
 AccessControl::GetFileGroup "$EXEDIRTEMPFile.txt"
 #允许文件继承
 AccessControl::EnableFileInheritance "$EXEDIRTEMPFile.txt"
 #禁止文件继承
 AccessControl::DisableFileInheritance "$EXEDIRTEMPFile.txt"
#SID: S-1-1-0
#Name: Everyone
 #获得当前用户名
 AccessControl::GetCurrentUserName
 Pop $0
 #用户名转安全标志
 AccessControl::NameToSid "$0"
 Pop $0
 #安全标志转用户名
 AccessControl::SidToName "$0"
 Pop $0
 #解锁
 AccessControl::SetOnFile "$EXEDIRTEMPFile.txt" "Everyone" "FullAccess"
 AccessControl::SetOnFile "$EXEDIRTEMPFile.txt" "Administrator" "FullAccess"
 AccessControl::SetOnFile "$EXEDIRTEMPFile.txt" "Administrators" "FullAccess"
SectionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » AccessControl是NSIS权限设置插件,只适用于Win2000或以上

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址