最新消息:

nsisFirewall是NSIS添加应用程序到防火墙允许规则的插件

nsis 永恒心锁 1943浏览 0评论
/*
nsisFirewall是NSIS添加应用程序到防火墙允许规则的插件
nsisFirewall允许你执行两个任务:
添加一个应用程序到系统防火墙允许规则列表.
从系统防火墙允许规则列表中移除相应的应用程序.
使用nsisFirewall最好使用RequestExecutionLevel来提高用户权限.
通常情况下你不需要检查它的返回值
运行"firewall.cpl"显示防火墙控制面板.
*/
!ifdef TARGETDIR
!addplugindir "${TARGETDIR}"
!else
!addplugindir "..bin"
!endif
RequestExecutionLevel admin
Name "Sample nsisFirewall"
OutFile "Sample.exe"
ShowInstDetails show
Section "Main program"
; Add NOTEPAD to the authorized list
nsisFirewall::AddAuthorizedApplication "$WINDIRNotepad.exe" "nsisFirewall Test"
Pop $0
IntCmp $0 0 +3
MessageBox MB_OK "A problem happened while adding program to Firewall exception list (result=$0)"
Return
Exec "rundll32.exe shell32.dll,Control_RunDLL firewall.cpl"
MessageBox MB_OK "Program added to Firewall exception list.$r$n(close the control panel before clicking OK)"
; Remove NOTEPAD from the authorized list
nsisFirewall::RemoveAuthorizedApplication "$WINDIRNotepad.exe"
Pop $0
IntCmp $0 0 +3
MessageBox MB_OK "A problem happened while removing program to Firewall exception list (result=$0)"
Return
Exec "rundll32.exe shell32.dll,Control_RunDLL firewall.cpl"
MessageBox MB_OK "Program removed to Firewall exception list"
SectionEnd
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » nsisFirewall是NSIS添加应用程序到防火墙允许规则的插件

您必须 登录 才能发表评论!