Setup.nsi 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. ; Script generated by the HM NIS Edit Script Wizard.
  2. ; HM NIS Edit Wizard helper defines
  3. !define PRODUCT_NAME "scbc application"
  4. !define PRODUCT_VERSION "2.0.1.9"
  5. !define PRODUCT_PUBLISHER "tcl company, Inc."
  6. !define PRODUCT_WEB_SITE "http://www.tcl.com"
  7. !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\TCL Copy Tool.exe"
  8. !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
  9. !define PRODUCT_UNINST_ROOT_KEY "HKLM"
  10. Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  11. OutFile "Setup${PRODUCT_VERSION}.exe"
  12. LoadLanguageFile "${NSISDIR}\Contrib\Language files\English.nlf"
  13. LoadLanguageFile "${NSISDIR}\Contrib\Language files\SimpChinese.nlf"
  14. InstallDir "$PROGRAMFILES\scbc application"
  15. Icon "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
  16. UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
  17. InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
  18. DirText "安装程序将安装 $(^Name) 在下列文件夹。$\r$\n$\r$\n要安装在不同文件夹,单击 [浏览] 并选择其他文件夹。"
  19. LicenseText "如果你接受所有协议条款,选择 [我愿意] 继续。你必须接受协议才能安装 $(^Name)。."
  20. LicenseData "Licence.txt"
  21. ShowInstDetails show
  22. ShowUnInstDetails show
  23. ; 安装VC环境
  24. Function InstallVC
  25. Push $R0
  26. ClearErrors
  27. ;FF66E9F6-83E7-3A3E-AF14-8DE9A809A6A4 Visual C++ 2008 runtime files VC 9.0 (x86)
  28. ;9A25302D-30C0-39D9-BD6F-21E6EC160475 Visual C++ 2008 SP1 runtime files VC 9.0 SP1 (x86)
  29. ;f50edb7e-c25e-47b4-bc4f-7ec4a4d256b1 Visual C++ 2017 runtime files VC 9.0 SP1 (x86)
  30. ;ad831ec0-6a55-427f-b75b-341c827ce380 Visual C++ ??? runtime files VC 9.0 SP1 (x86)
  31. ; vs2008
  32. ;ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9A25302D-30C0-39D9-BD6F-21E6EC160475}" "Version"
  33. ; vs2017
  34. ;ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{ad831ec0-6a55-427f-b75b-341c827ce380}" "Version"
  35. ; vs2019
  36. ReadRegDword $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5bfc1380-fd35-4b85-9715-7351535d077e}" "Version"
  37. ; 检测含有vc的注册表信息是否存在
  38. IfErrors 0 VSRedistInstalled
  39. Exec "$INSTDIR\vcredist_x86.exe /q" ;若不存在,执行静默安装
  40. StrCpy $R0 "-1"
  41. ; MessageBox MB_OK $R0
  42. VSRedistInstalled:
  43. ; MessageBox MB_OK "已安装"
  44. Exch $R0
  45. ; Delete "$INSTDIR\vcredist_x86."
  46. FunctionEnd
  47. Function .onInit
  48. FunctionEnd
  49. Section "MainSection" SEC01
  50. SetOutPath "$INSTDIR"
  51. ;覆盖旧文件;
  52. SetOverwrite ifnewer
  53. File "..\..\..\..\bin\TCL Copy Tool\TCL Copy Tool.exe"
  54. File "lib\Log4C.dll"
  55. File "lib\libcurl.dll"
  56. File "lib\libeay32.dll"
  57. File "lib\ssleay32.dll"
  58. File "lib\zlibwapi.dll"
  59. File "log4crc.xml"
  60. File "vcredist_x86.exe"
  61. CreateDirectory "$SMPROGRAMS\scbc application"
  62. CreateShortCut "$SMPROGRAMS\scbc application\scbc application.lnk" "$INSTDIR\TCL Copy Tool.exe"
  63. CreateShortCut "$DESKTOP\scbc application.lnk" "$INSTDIR\TCL Copy Tool.exe"
  64. File "..\..\..\..\bin\rename\rename.exe"
  65. ;不覆盖config.ini配置文件;
  66. SetOverwrite off
  67. File "TCL Copy Tool\config.json"
  68. SetOutPath "$INSTDIR\log"
  69. SetOutPath "$INSTDIR\db"
  70. SetOutPath "$INSTDIR\DataDir"
  71. SetOutPath "$INSTDIR\DataDir\WB"
  72. SetOutPath "$INSTDIR\DataDir\CIKEY"
  73. SetOutPath "$INSTDIR\DataDir\DeviceID"
  74. SetOutPath "$INSTDIR\DataDir\ESN"
  75. SetOutPath "$INSTDIR\DataDir\HDCPKEY"
  76. SetOutPath "$INSTDIR\DataDir\HDCPKEY22"
  77. SetOutPath "$INSTDIR\DataDir\MAC"
  78. SetOutPath "$INSTDIR\DataDir\Widevine"
  79. SetOutPath "$INSTDIR\DataDir\WiDi"
  80. ;安装VC环境
  81. Call InstallVC
  82. SectionEnd
  83. Section -AdditionalIcons
  84. WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  85. CreateShortCut "$SMPROGRAMS\scbc application\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
  86. CreateShortCut "$SMPROGRAMS\scbc application\Uninstall.lnk" "$INSTDIR\uninst.exe"
  87. SectionEnd
  88. Section -Post
  89. WriteUninstaller "$INSTDIR\uninst.exe"
  90. WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\TCL Copy Tool.exe"
  91. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  92. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  93. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\TCL Copy Tool.exe"
  94. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  95. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  96. WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
  97. SectionEnd
  98. Function un.onUninstSuccess
  99. HideWindow
  100. MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
  101. FunctionEnd
  102. Function un.onInit
  103. MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,其及所有的组件?" IDYES +2
  104. Abort
  105. FunctionEnd
  106. Section Uninstall
  107. Delete "$INSTDIR\${PRODUCT_NAME}.url"
  108. Delete "$INSTDIR\uninst.exe"
  109. Delete "$INSTDIR\rename.exe"
  110. Delete "$INSTDIR\TCL Copy Tool.exe"
  111. Delete "$INSTDIR\config.json"
  112. Delete "$INSTDIR\Log4C.dll"
  113. Delete "$SMPROGRAMS\scbc application\Uninstall.lnk"
  114. Delete "$SMPROGRAMS\scbc application\Website.lnk"
  115. Delete "$DESKTOP\scbc application.lnk"
  116. Delete "$SMPROGRAMS\scbc application\scbc application.lnk"
  117. RMDir "$SMPROGRAMS\scbc application"
  118. RMDir "$INSTDIR"
  119. DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  120. DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  121. SetAutoClose true
  122. SectionEnd