最新消息:

NsUnzip是NSIS支持密码解码zip压缩文件的插件

nsis 永恒心锁 3285浏览 0评论
/*
NsUnzip是NSIS支持密码解码zip压缩文件的插件
NsUnzip是类似于Nsisunz的提取ZIP压缩包文件的解压插件,但是nsUnzip还支持解压加密过的压缩文件,功能十分实用.
*/
!AddPluginDir "."
Name "Unzip32"
OutFile "Unzip32.exe"
!addplugindir "."
!include "WinMessages.nsh"
Var BANNER
Var COUNT
Var ARCHIVE
Function .onInit
#Simple unpack
nsUnzip::Extract "Test1.zip" /d=Test /END
Pop $0
MessageBox MB_OK "Simple unpack.$nResult: $0"
#With password ask
GetFunctionAddress $0 PasswordCallback
nsUnzip::Extract "Test2.zip" /d=Test /callP=$0 /END
Pop $0
MessageBox MB_OK "Unpack with password.$nResult: $0"
#List archive
GetFunctionAddress $0 VerboseCallback
nsUnzip::Extract "Test3.zip" /d=Test /callV=$0 /END
Pop $0
MessageBox MB_OK "List archive.$nResult: $0"
#With progress
Banner::show /NOUNLOAD "Preparing.."
Banner::getWindow /NOUNLOAD
Pop $0
GetDlgItem $BANNER $0 1030
GetFunctionAddress $0 ServiceCallback
nsUnzip::Extract "Test4.zip" /d=Test /callS=$0 /END
Pop $0
Banner::destroy
MessageBox MB_OK "Unpack with progress.$nResult: $0"
Quit
FunctionEnd
Function PasswordCallback
Pop $0 ;Archive name
#Show password dialog.
nsUnzip::GetPassword /NOUNLOAD "nsUnzip plugin" 'Password (correct: "123")' "$0" "OK" "Cancel"
Pop $0
Push $0 #Archive password
FunctionEnd
Function VerboseCallback
Pop $0 ;File name
Pop $1 ;Uncompressed size
Pop $2 ;Compressed size
Pop $3 ;CRC: ff00ff00
Pop $4 ;Compress ratio
Pop $5 ;File date: "dd.MM.yy"
Pop $6 ;File time: "hh:mm"
Pop $7 ;Method: "Stored", "Shrunk", "Reduce1", "Reduce2", "Reduce3", "Reduce4", "Implode", "Token", "Defl:#", "Def64#", "ImplDCL", "PKres11", "BZip2", "Unk:###"
Pop $8 ;Encrypted: "E" or not " "
MessageBox MB_OK "$$0={$0}$n$$1={$1}$n$$2={$2}$n$$3={$3}$n$$4={$4}$n$$5={$5}$n$$6={$6}$n$$7={$7}$n$$8={$8}"
FunctionEnd
Function ServiceCallback
Pop $0 ;Archive name
Pop $1 ;Archive size
Pop $2 ;Entry file name
Pop $3 ;Entry uncompressed size
Pop $4 ;Entry compressed size
Pop $5 ;Entry CRC: ff00ff00
#Calculate percentage
StrCmp $ARCHIVE $0 +3
StrCpy $COUNT 0
StrCpy $ARCHIVE $0
IntOp $COUNT $COUNT + $4
IntOp $R0 $COUNT * 100
IntOp $R0 $R0 / $1
SendMessage $BANNER ${WM_SETTEXT} 0 `STR:Extracting: "$0"... $R0%`
Sleep 1000
#Use "SetErrors" for stop extracting
FunctionEnd
Section
SectionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » NsUnzip是NSIS支持密码解码zip压缩文件的插件

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