winamp_lang_packs.nsi 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. !define PRODUCT_NAME "Winamp Language Packs"
  2. !define PRODUCT_VERSION "v1.7"
  3. ;!define PRODUCT_SUB_VERSION "1177"
  4. !define WINAMP "Winamp"
  5. !define MUI_COMPONENTSPAGE_SMALLDESC "Select which Language Packs to install"
  6. !define MUI_FINISHPAGE_RUN_TEXT "Run Winamp"
  7. !define /date MyTIMESTAMP "%Y/%m/%d at %H:%M:%S"
  8. !define Minimal_Version "5.9"
  9. !define UNINSTALLER "Uninstall_Winamp_Lang_Packs.exe"
  10. !define UNINSTALL "Winamp Language Packs"
  11. ;Set Compression
  12. SetCompress force
  13. SetCompressor /solid lzma
  14. ; MUI 2.0 compatible ------
  15. !include "MUI2.nsh"
  16. !include "sections.nsh"
  17. !include "LogicLib.nsh"
  18. !include "WordFunc.nsh"
  19. !include "WinVer.nsh"
  20. XPStyle on
  21. BrandingText "${PRODUCT_NAME} -- built on ${MyTIMESTAMP}"
  22. ; detect winamp path from uninstall string if available
  23. InstallDirRegKey HKLM \
  24. "Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
  25. "UninstallString"
  26. ;Request Administrator Privileges
  27. RequestExecutionLevel admin
  28. ; MUI Settings
  29. !define MUI_ABORTWARNING
  30. !define MUI_HEADERIMAGE
  31. !define MUI_HEADERIMAGE_BITMAP "graphics\wabanner.bmp"
  32. !define MUI_HEADERTEXT
  33. !define MUI_ICON "graphics\install.ico"
  34. !define MUI_UNICON "graphics\uninstall.ico"
  35. !define MUI_WELCOMEFINISHPAGE_BITMAP "graphics\welcome55.bmp"
  36. ;Run Custom Function On Start For Winamp Checks
  37. !define MUI_CUSTOMFUNCTION_GUIINIT My_GUIInit
  38. ;Version information for Windows Explorer
  39. VIProductVersion "1.7.0.0"
  40. VIAddVersionKey "ProductName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  41. VIAddVersionKey "Comments" "Winamp Language Packs Installer"
  42. VIAddVersionKey "LegalCopyright" ""
  43. VIAddVersionKey "Company" "Winamp SA"
  44. VIAddVersionKey "FileDescription" "${PRODUCT_NAME} ${PRODUCT_VERSION} Installer"
  45. VIAddVersionKey "FileVersion" "1.7.0.0"
  46. ; Welcome page
  47. !define MUI_WELCOMEPAGE_TITLE "${PRODUCT_NAME}"
  48. !define MUI_WELCOMEPAGE_TEXT "This package contains the following Language Packs:$\r$\n \
  49. • Dutch (Nederlands)$\r$\n \
  50. • French (Français)$\r$\n \
  51. • German (Deutsch)$\r$\n \
  52. • Hungarian (Magyar)$\r$\n \
  53. • Italian$\r$\n \
  54. • Indonesian (id-id)$\r$\n \
  55. • Japanese (ja-jp)$\r$\n \
  56. • Portuguese (pt-br)$\r$\n \
  57. • Romanian (ro-ro)$\r$\n \
  58. • Russian (Русский)$\r$\n \
  59. • Spanish (es-us)$\r$\n \
  60. • Swedish (sv-se)$\r$\n \
  61. • Turkish (Türkçe)$\r$\n \
  62. • Czech (cz-cz)$\r$\n \
  63. • Korean (ko-kr)$\r$\n \
  64. • Chinese (zh-cn | zh-tw)$\r$\n"
  65. !insertmacro MUI_PAGE_WELCOME
  66. ; Directory page
  67. !define MUI_TEXT_DIRECTORY_TITLE "${PRODUCT_NAME}"
  68. !define MUI_TEXT_DIRECTORY_SUBTITLE "Choose Folder"
  69. DirText "Please select your Winamp path below; the installer will usually detect your Winamp installation path automatically (you will be able to proceed when Winamp is detected):"
  70. !insertmacro MUI_PAGE_DIRECTORY
  71. ; Instfiles components
  72. !define MUI_TEXT_COMPONENTS_TITLE "${PRODUCT_NAME}"
  73. !define MUI_TEXT_COMPONENTS_SUBTITLE "Choose Components"
  74. !define MUI_INNERTEXT_COMPONENTS_DESCRIPTION_TITLE "Available Language Packs"
  75. !define MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO "Expand to deselect individual language packs"
  76. !insertmacro MUI_PAGE_COMPONENTS
  77. ; Instfiles page
  78. !define MUI_TEXT_INSTALLING_TITLE "${PRODUCT_NAME}"
  79. !define MUI_TEXT_INSTALLING_SUBTITLE "Installing..."
  80. !insertmacro MUI_PAGE_INSTFILES
  81. ; Finish page
  82. !define MUI_TEXT_FINISH_TITLE "${PRODUCT_NAME}"
  83. !define MUI_TEXT_FINISH_SUBTITLE "Done"
  84. !define MUI_FINISHPAGE_RUN "$INSTDIR\winamp.exe"
  85. !insertmacro MUI_PAGE_FINISH
  86. ; Uninstaller
  87. !define MUI_UNWELCOMEFINISHPAGE_BITMAP "graphics\welcome55.bmp"
  88. !define MUI_UNWELCOMEPAGE_TEXT "This wizard will guide you through the uninstallation of ${PRODUCT_NAME}.$\n$\nBefore starting the uninstallation, make sure $WINAMP is not running.$\n$\nClick Next to continue."
  89. !insertmacro MUI_UNPAGE_WELCOME
  90. !insertmacro MUI_UNPAGE_CONFIRM
  91. !insertmacro MUI_UNPAGE_INSTFILES
  92. !define MUI_UNFINISHPAGE_TEXT "${PRODUCT_NAME} has been uninstalled from your $WINAMP installation.$\n$\nClick Finish to close this wizard."
  93. !insertmacro MUI_UNPAGE_FINISH
  94. ; Language files
  95. !insertmacro MUI_LANGUAGE "English"
  96. ; MUI end ------
  97. Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
  98. OutFile "Winamp_Language_Packs_v1.7.exe"
  99. InstallDir "$PROGRAMFILES\Winamp\"
  100. ShowInstDetails hide
  101. ; Page components
  102. SectionGroup "Winamp Language Packs" SEC01
  103. Section "German (Deutsch)" SEC011
  104. SetOutPath "$INSTDIR\Lang"
  105. SetOverwrite on
  106. File "..\..\resources\languages\Winamp-de-de.wlz"
  107. SectionEnd
  108. Section "Dutch (Nederlands)" SEC012
  109. SetOutPath "$INSTDIR\Lang"
  110. SetOverwrite on
  111. File "..\..\resources\languages\Winamp-nl-nl.wlz"
  112. SectionEnd
  113. Section "French (Français)" SEC013
  114. SetOutPath "$INSTDIR\Lang"
  115. SetOverwrite on
  116. File "..\..\resources\languages\Winamp-fr-fr.wlz"
  117. SectionEnd
  118. Section "Hungarian (Magyar)" SEC014
  119. SetOutPath "$INSTDIR\Lang"
  120. SetOverwrite on
  121. File "..\..\resources\languages\Winamp-hu-hu.wlz"
  122. SectionEnd
  123. Section "Italian (it-it)" SEC015
  124. SetOutPath "$INSTDIR\Lang"
  125. SetOverwrite on
  126. File "..\..\resources\languages\Winamp-it-it.wlz"
  127. SectionEnd
  128. Section "Japanese (ja-jp)" SEC016
  129. SetOutPath "$INSTDIR\Lang"
  130. SetOverwrite on
  131. File "..\..\resources\languages\Winamp-ja-jp.wlz"
  132. SectionEnd
  133. Section "Korean (ko-kr)" SEC017
  134. SetOutPath "$INSTDIR\Lang"
  135. SetOverwrite on
  136. File "..\..\resources\languages\Winamp-ko-kr.wlz"
  137. SectionEnd
  138. ;Section "Polish (Polski)" SEC018
  139. ;SetOutPath "$INSTDIR\Lang"
  140. ;SetOverwrite on
  141. ;File "..\..\resources\languages\Winamp-pl-pl.wlz"
  142. ;SectionEnd
  143. Section "Portuguese (pt-br)" SEC019
  144. SetOutPath "$INSTDIR\Lang"
  145. SetOverwrite on
  146. File "..\..\resources\languages\Winamp-pt-br.wlz"
  147. SectionEnd
  148. Section "Romanian (ro-ro)" SEC0110
  149. SetOutPath "$INSTDIR\Lang"
  150. SetOverwrite on
  151. File "..\..\resources\languages\Winamp-ro-ro.wlz"
  152. SectionEnd
  153. Section "Russian (Русский)" SEC0111
  154. SetOutPath "$INSTDIR\Lang"
  155. SetOverwrite on
  156. File "..\..\resources\languages\Winamp-ru-ru.wlz"
  157. SectionEnd
  158. Section "Spanish (es-us)" SEC0112
  159. SetOutPath "$INSTDIR\Lang"
  160. SetOverwrite on
  161. File "..\..\resources\languages\Winamp-es-us.wlz"
  162. SectionEnd
  163. Section "Swedish (sv-se)" SEC0113
  164. SetOutPath "$INSTDIR\Lang"
  165. SetOverwrite on
  166. File "..\..\resources\languages\Winamp-sv-se.wlz"
  167. SectionEnd
  168. Section "Turkish (Türkçe)" SEC0114
  169. SetOutPath "$INSTDIR\Lang"
  170. SetOverwrite on
  171. File "..\..\resources\languages\Winamp-tr-tr.wlz"
  172. SectionEnd
  173. Section "Czech (cz-cz)" SEC0118
  174. SetOutPath "$INSTDIR\Lang"
  175. SetOverwrite on
  176. File "..\..\resources\languages\Winamp-cz-cz.wlz"
  177. SectionEnd
  178. Section "Indonesian (id-id)" SEC0115
  179. SetOutPath "$INSTDIR\Lang"
  180. SetOverwrite on
  181. File "..\..\resources\languages\Winamp-id-id.wlz"
  182. SectionEnd
  183. Section "Chinese (zh-cn)" SEC0116
  184. SetOutPath "$INSTDIR\Lang"
  185. SetOverwrite on
  186. File "..\..\resources\languages\Winamp-zh-cn.wlz"
  187. SectionEnd
  188. Section "Chinese/Taiwanese (zh-tw)" SEC0117
  189. SetOutPath "$INSTDIR\Lang"
  190. SetOverwrite on
  191. File "..\..\resources\languages\Winamp-zh-tw.wlz"
  192. SectionEnd
  193. SectionGroupEnd
  194. Section
  195. ; Write the uninstall keys for Windows
  196. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "DisplayName" "Winamp Language Packs"
  197. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "UninstallString" "$\"$INSTDIR\${UNINSTALLER}$\""
  198. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "NoModify" 1
  199. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "NoRepair" 1
  200. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "Publisher" "Winamp SA"
  201. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "HelpLink" "http://forums.winamp.com/forumdisplay.php?f=169"
  202. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "InstallLocation" "$INSTDIR\Lang"
  203. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "DisplayVersion" "${PRODUCT_VERSION}"
  204. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "URLInfoAbout" "http://forums.winamp.com/forumdisplay.php?f=8"
  205. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "URLUpdateInfo" "https://www.winamp.com"
  206. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "DisplayIcon" "$\"$INSTDIR\${UNINSTALLER}$\""
  207. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "QuietUninstallString" "$\"$INSTDIR\${UNINSTALLER}$\" /S"
  208. ; Call GetInstalledSize
  209. ; WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}" "EstimatedSize" "$GetInstalledSize.total"
  210. WriteUninstaller "$INSTDIR\${UNINSTALLER}"
  211. SectionEnd
  212. Section "Uninstall"
  213. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINSTALL}"
  214. Delete "$INSTDIR\Lang\Winamp-de-de.wlz"
  215. Delete "$INSTDIR\Lang\Winamp-es-us.wlz"
  216. Delete "$INSTDIR\Lang\Winamp-it-it.wlz"
  217. Delete "$INSTDIR\Lang\Winamp-hu-hu.wlz"
  218. Delete "$INSTDIR\Lang\Winamp-id-id.wlz"
  219. Delete "$INSTDIR\Lang\Winamp-cz-cz.wlz"
  220. Delete "$INSTDIR\Lang\Winamp-ru-ru.wlz"
  221. Delete "$INSTDIR\Lang\Winamp-ro-ro.wlz"
  222. Delete "$INSTDIR\Lang\Winamp-fr-fr.wlz"
  223. Delete "$INSTDIR\Lang\Winamp-pt-br.wlz"
  224. Delete "$INSTDIR\Lang\Winamp-ja-jp.wlz"
  225. Delete "$INSTDIR\Lang\Winamp-sv-se.wlz"
  226. Delete "$INSTDIR\Lang\Winamp-zh-cn.wlz"
  227. Delete "$INSTDIR\Lang\Winamp-ko-kr.wlz"
  228. Delete "$INSTDIR\Lang\Winamp-zh-tw.wlz"
  229. Delete "$INSTDIR\Lang\Winamp-nl-nl.wlz"
  230. Delete "$INSTDIR\Lang\Winamp-tr-tr.wlz"
  231. ;Delete "$INSTDIR\Lang\Winamp-pl-pl.wlz"
  232. Delete "$INSTDIR\${UNINSTALLER}"
  233. SectionEnd
  234. Function GetFileVersion
  235. !define GetFileVersion `!insertmacro GetFileVersionCall`
  236. !macro GetFileVersionCall _FILE _RESULT
  237. Push `${_FILE}`
  238. Call GetFileVersion
  239. Pop ${_RESULT}
  240. !macroend
  241. Exch $0
  242. Push $1
  243. Push $2
  244. Push $3
  245. Push $4
  246. Push $5
  247. Push $6
  248. ClearErrors
  249. GetDllVersion '$0' $1 $2
  250. IfErrors error
  251. IntOp $3 $1 / 0x00010000
  252. IntOp $4 $1 & 0x0000FFFF
  253. IntOp $5 $2 / 0x00010000
  254. IntOp $6 $2 & 0x0000FFFF
  255. StrCpy $0 '$3.$4.$5.$6'
  256. goto end
  257. error:
  258. SetErrors
  259. StrCpy $0 ''
  260. end:
  261. Pop $6
  262. Pop $5
  263. Pop $4
  264. Pop $3
  265. Pop $2
  266. Pop $1
  267. Exch $0
  268. FunctionEnd
  269. Function CheckWinampVersion
  270. ${GetFileVersion} "$INSTDIR\winamp.exe" $R0 ; Get Winamp.exe version information, $R0 = Actual Version
  271. ${if} $R0 != "" ; check if Version info is not empty
  272. ${VersionCompare} $R0 ${Minimal_Version} $R1 ; $R1 = Result $R1=0 Versions are equal, $R1=1 Version1 is newer, $R1=2 Version2 is newer
  273. ${if} $R1 = "2"
  274. MessageBox MB_OK "Winamp Language Packs require at least Winamp ${Minimal_Version} or above.$\r$\nPlease update your Winamp version before you can install this update.$\r$\nInstallation will now be aborted."
  275. Quit
  276. ${EndIf}
  277. ${Else}
  278. MessageBox MB_OK "Winamp wasn't detected on this system.$\r$\nPlease install the latest Winamp version from Winamp.com$\r$\nbefore you can install this update.$\r$\nInstallation will now be aborted." ; version info is empty, something goes wrong. Display message and exit
  279. Quit
  280. ${EndIf}
  281. FunctionEnd
  282. Function CheckWinampInstallation
  283. ;MessageBox MB_OK "$INSTDIR\winamp.exe"
  284. ${If} ${FileExists} "$INSTDIR\winamp.exe" ;check if Winamp.exe exists
  285. ;
  286. ${Else}
  287. MessageBox MB_OK "Winamp wasn't detected on this system.$\r$\nPlease install the latest Winamp version from Winamp.com$\r$\nbefore you can install this plugin update.$\r$\nInstallation will now be aborted." ;no winamp.exe
  288. Quit
  289. ${EndIf}
  290. FunctionEnd
  291. ;Detect WindowsVersion and running Winamp instances
  292. Function .onInit
  293. ; check windows version
  294. ${If} ${IsWin95}
  295. ${OrIf} ${IsWinNT4}
  296. ${OrIf} ${IsWin98}
  297. ${OrIf} ${IsWinME}
  298. ${OrIf} ${IsWin2000}
  299. ${OrIf} ${IsWinXP}
  300. MessageBox MB_OK|MB_ICONEXCLAMATION "Windows version too old!$\r$\nThis update will not run on Windows 9x/NT4/ME/2k/XP.$\r$\nInstallation will now be aborted."
  301. Quit
  302. ${EndIf}
  303. /*
  304. ${If} ${IsWinXP}
  305. ${OrIf} ${IsWin2003}
  306. MessageBox MB_OK|MB_ICONEXCLAMATION "This update is not recommended for Windows XP.$\r$\n$\r$\nInstallation will now be aborted."
  307. Quit
  308. ${EndIf}
  309. */
  310. !define WINAMP_FILE_EXIT 40001
  311. !ifdef INTERCEPT_MULTIPLE_INSTANCES
  312. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "WinampMbApiSetup") i .r1 ?e'
  313. Pop $R0
  314. StrCmp $R0 0 noprevinst
  315. ReadRegStr $R0 HKCU "${PLUGIN_INSTREGKEY}" "WindowHandle"
  316. System::Call 'user32::SetForegroundWindow(i $R0) i ?e'
  317. Abort
  318. noprevinst:
  319. !endif
  320. FindWindow $R0 "Winamp v1.x"
  321. IntCmp $R0 0 ok
  322. MessageBox MB_YESNO|MB_ICONEXCLAMATION "Please close all instances of Winamp before installing this update!$\r$\n\
  323. Close Winamp now?" IDYES checkagain IDNO no
  324. checkagain:
  325. FindWindow $R0 "Winamp v1.x"
  326. IntCmp $R0 0 ok
  327. SendMessage $R0 ${WM_COMMAND} ${WINAMP_FILE_EXIT} 0
  328. Goto checkagain
  329. no:
  330. ; quit installer
  331. ok:
  332. FunctionEnd
  333. Function My_GUIInit
  334. Call CheckWinampInstallation
  335. Call CheckWinampVersion
  336. FunctionEnd