脚本:迅雷5.7.3.389 AYU增强版

优质
小牛编辑
136浏览
2023-12-01
; 该脚本使用 HM VNISEdit 脚本编辑器向导产生
; 安装程序初始定义常量
!define PRODUCT_NAME "迅雷"
!define PRODUCT_VERSION "5.7.2.389 电脑公司版"
!define PRODUCT_PUBLISHER "A.N.DDR"
!define PRODUCT_WEB_SITE "www.xuelei.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Thunder.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

SetCompressor lzma

; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------
!include "MUI.nsh"

; MUI 预定义常量
!define MUI_ABORTWARNING
!define MUI_WELCOMEFINISHPAGE_BITMAP "start.bmp"
!define MUI_ICON "setup.ico"
!define MUI_UNICON "un.ico"

; 欢迎页面
!insertmacro MUI_PAGE_WELCOME
; 许可协议页面
!insertmacro MUI_PAGE_LICENSE "许可文件.txt"
; 安装目录选择页面
!insertmacro MUI_PAGE_DIRECTORY
; 安装过程页面
!insertmacro MUI_PAGE_INSTFILES
; 安装完成页面
#!define MUI_FINISHPAGE_RUN "$INSTDIR\AyuConfig.exe"
!insertmacro MUI_PAGE_FINISH

; 安装卸载过程页面
!insertmacro MUI_UNPAGE_INSTFILES

; 安装界面包含的语言设置
!insertmacro MUI_LANGUAGE "SimpChinese"

; 安装预释放文件
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; ------ MUI 现代界面定义结束 ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Thunder"
InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
ShowInstDetails show
ShowUnInstDetails show
BrandingText "Made by nohacks,KrnCode by Ayu and DDR"

Section "主程序" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "..\Program Files\Thunder\Thunder.exe"
File "..\Program Files\Thunder\AyuConfig.exe"

CreateDirectory "$SMPROGRAMS\迅雷"
CreateShortCut "$SMPROGRAMS\迅雷\启动迅雷.lnk" "$INSTDIR\Thunder.exe"
CreateShortCut "$SMPROGRAMS\迅雷\扩展设置.lnk" "$INSTDIR\AyuConfig.exe"
CreateShortCut "$DESKTOP\迅雷.lnk" "$INSTDIR\Thunder.exe"

File /r "..\Program Files\Thunder\*.*"



SectionEnd

Section -AdditionalIcons
# WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
# CreateShortCut "$SMPROGRAMS\迅雷\迅雷资源.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\迅雷\御载迅雷.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Thunder.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Thunder.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd


;注册DLL
section Regdll


RegDLL "$INSTDIR\ComDlls\ThunderAgent.dll"
RegDLL "$INSTDIR\ComDlls\XunLeiBHO.dll"
RegDLL "$INSTDIR\ComDlls\TDAtOnce.dll"
RegDLL "$INSTDIR\ComDlls\Faker.dll"
RegDLL "$INSTDIR\ComDlls\LinkSimulate.dll"
SectionEnd

;右健菜单
section Registry
WriteRegStr "HKLM" "SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" "Path" "$INSTDIR\Thunder.exe"
WriteRegStr "HKLM" "SOFTWARE\Thunder Network\ThunderOem\thunder_backwnd" "Version" "5.7.2.389"
WriteRegStr "HKCU" "Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" "" "$INSTDIR\Program\GetAllUrl.htm"
WriteRegDWORD "HKCU" "Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接" "Contexts" "243"
WriteRegStr "HKCU" "Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" "" "$INSTDIR\Program\GetUrl.htm"
WriteRegDWORD "HKCU" "Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载" "Contexts" "34"
SectionEnd

/******************************
* 以下是安装程序的卸载部分 *
******************************/

Section Uninstall
#Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\AyuConfig.exe"
Delete "$INSTDIR\Thunder.exe"

Delete "$SMPROGRAMS\迅雷\御载迅雷.lnk"
Delete "$SMPROGRAMS\迅雷\扩展设置.lnk"
Delete "$SMPROGRAMS\迅雷\启动迅雷.lnk"
Delete "$DESKTOP\迅雷.lnk"

RMDir "$SMPROGRAMS\迅雷"

RMDir /r "$INSTDIR\Skins"
RMDir /r "$INSTDIR\Program"
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "是否保留配置文件和历史记录?" /SD IDYES IDNO +2
Goto +2
RMDir /r "$INSTDIR\Profiles"
RMDir /r "$INSTDIR\Plugins"
RMDir /r "$INSTDIR\Languages"
RMDir /r "$INSTDIR\Components"
RMDir /r "$INSTDIR\ComDlls"

RMDir "$INSTDIR"


DeleteRegKey HKLM "SOFTWARE\Thunder Network"
DeleteRegKey HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载全部链接"
DeleteRegKey HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用迅雷下载"

unRegDLL "$INSTDIR\ComDlls\TDAtOnce_Now.dll"
unRegDLL "$INSTDIR\ComDlls\xunleiBHO_Now.dll"
unRegDLL "$INSTDIR\ComDlls\ThunderAgent.dll"
unRegDLL "$INSTDIR\ComDlls\XunLeiBHO.dll"
unRegDLL "$INSTDIR\ComDlls\TDAtOnce.dll"
unRegDLL "$INSTDIR\ComDlls\Faker.dll"
unRegDLL "$INSTDIR\ComDlls\LinkSimulate.dll"
unRegDLL "$INSTDIR\ComDlls\ThunderAgent_Now.dll"



DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd

#-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--#

Function .onInstSuccess
Exec "$INSTDIR\AyuConfig.exe"
FunctionEnd

Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name)以及其所有的组件吗?" IDYES +2
Abort
FunctionEnd

Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
FunctionEnd