最新消息:

LockedList是NSIS图形化列表操作插件

nsis 永恒心锁 2550浏览 0评论
!AddPluginDir "../../Plugins"
!include MUI2.nsh
!include WinVer.nsh
; The locked file to test on.
!define THE_FILE $TEMPLocked.tmp
; Please lock the file for me (i.e. it isn't currently locked).
!define LOCK_THE_FILE
Name LockedListTest
OutFile LockedListTest.exe
ShowInstDetails show
!define MUI_FINISHPAGE_NOAUTOCLOSE
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
Page Custom LockedListPageShow
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
UninstPage Custom un.LockedListPageShow
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
!insertmacro MUI_LANGUAGE English
#ReserveFile `${NSISDIR}PluginsLockedList.dll`
Function .onInit
 ${Unless} ${AtLeastWinNt4}
 MessageBox MB_OK|MB_ICONSTOP `You cannot run this installer on < Win NT`
 Abort
 ${EndUnless}
 InitPluginsDir
FunctionEnd
Section `Install test` Section_InstallTest
SectionEnd
Section `Uninstall test` Section_UninstallTest
 DetailPrint `Launching uninstaller...`
 WriteUninstaller $EXEDIRLockedListUninstallTest.exe
 ExecWait `"$EXEDIRLockedListUninstallTest.exe" _?=$EXEDIR`
 Delete $EXEDIRLockedListUninstallTest.exe
SectionEnd
Function SilentSearchCallback
 Pop $R0
 Pop $R1
 Pop $R2
 DetailPrint `Id: $R0`
 DetailPrint `Path: $R1`
 DetailPrint `Description: $R2`
 Push true
FunctionEnd
Section `SilentSearch test` Section_SilentSearchTest
 DetailPrint `Testing LockedList without threading, please wait...`
 LockedList::AddFile `${THE_FILE}`
 LockedList::AddModule $PLUGINSDIRLockedList.dll
 # Begin the search now.
 GetFunctionAddress $R0 SilentSearchCallback
 LockedList::SilentSearch $R0
 DetailPrint `Searching... 100%`
SectionEnd
Section `SilentSearch asynchronous test` Section_SilentSearchThreadTest
 DetailPrint `Testing LockedList with threading, please wait...`
 LockedList::AddFile `${THE_FILE}`
 LockedList::AddModule $PLUGINSDIRLockedList.dll
 # Begin the search in a separate thread.
 GetFunctionAddress $R0 SilentSearchCallback
 LockedList::SilentSearch $R0 /async
 # Loop while the search takes place. We could do other stuff here.
 ${Do}
 LockedList::SilentWait /time 500
 Pop $R0
 ${LoopWhile} $R0 == `/wait`
 DetailPrint `Searching... 100%`
SectionEnd
Section Uninstall
SectionEnd
Function LockedListPageShow
 ${IfNot} ${SectionIsSelected} ${Section_InstallTest}
 Abort
 ${EndIf}
!ifdef LOCK_THE_FILE
 !tempfile TEMP
 !appendfile `${TEMP}` `Name LockFile$r$n`
 !appendfile `${TEMP}` `Caption "File locked for testing"$r$n`
 !appendfile `${TEMP}` `OutFile ${TEMP}.exe$r$n`
 !appendfile `${TEMP}` `XPStyle on$r$n`
 !appendfile `${TEMP}` `SilentInstall silent$r$n`
 !appendfile `${TEMP}` `Function .onInit$r$n`
 !appendfile `${TEMP}` `FileOpen $R0 "${THE_FILE}" w$r$n`
 !appendfile `${TEMP}` `MessageBox MB_OK "Click OK to unlock the file ${THE_FILE}."$r$n`
 !appendfile `${TEMP}` `FileClose $R0$r$n`
 !appendfile `${TEMP}` `Delete "${THE_FILE}"$r$n`
 !appendfile `${TEMP}` `FunctionEnd$r$n`
 !appendfile `${TEMP}` `Section$r$n`
 !appendfile `${TEMP}` `SectionEnd$r$n`
 !execute `"${NSISDIR}makensis.exe" "${TEMP}"`
 File /oname=$PLUGINSDIRLockFile.exe `${TEMP}.exe`
 !delfile `${TEMP}`
 Exec `"$PLUGINSDIRLockFile.exe"`
 Sleep 1000
 BringToFront
!endif
 !insertmacro MUI_HEADER_TEXT `LockedList install dialog` `This is a list of programs that have our files held hostage...`
 LockedList::AddFile `${THE_FILE}`
 LockedList::Dialog /ignore ``
 Pop $R0
FunctionEnd
Function un.LockedListPageShow
 !insertmacro MUI_HEADER_TEXT `LockedList uninstall dialog` `This is a list of programs that have our files held hostage...`
 LockedList::AddFile `${THE_FILE}`
 LockedList::Dialog /ignore ``
 Pop $R0
FunctionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
 !insertmacro MUI_DESCRIPTION_TEXT ${Section_InstallTest} `Tests the LockedList plug-in in this installer executable.`
 !insertmacro MUI_DESCRIPTION_TEXT ${Section_UninstallTest} `Tests the LockedList plug-in in the dummy uninstaller executable.`
 !insertmacro MUI_DESCRIPTION_TEXT ${Section_SilentSearchTest} `Calls SilentSearch and waits for it to finish.`
 !insertmacro MUI_DESCRIPTION_TEXT ${Section_SilentSearchThreadTest} `Calls SilentSearch using threading to showing progress indication.`
!insertmacro MUI_FUNCTION_DESCRIPTION_END
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » LockedList是NSIS图形化列表操作插件

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

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

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