Improved installer operating system check to include Windows XP x64 Edition.
[LameXP.git] / etc / NSIS / setup.nsi
blob288be2a6c53ab5a585d06d82b541c7f7c5ebb428
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2012 LoRd_MuldeR <MuldeR2@GMX.de>
4 ; //
5 ; // This program is free software; you can redistribute it and/or modify
6 ; // it under the terms of the GNU General Public License as published by
7 ; // the Free Software Foundation; either version 2 of the License, or
8 ; // (at your option) any later version.
9 ; //
10 ; // This program is distributed in the hope that it will be useful,
11 ; // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ; // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ; // GNU General Public License for more details.
14 ; //
15 ; // You should have received a copy of the GNU General Public License along
16 ; // with this program; if not, write to the Free Software Foundation, Inc.,
17 ; // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 ; //
19 ; // http://www.gnu.org/licenses/gpl-2.0.txt
20 ; ///////////////////////////////////////////////////////////////////////////////
23 ;--------------------------------
24 ;Basic Defines
25 ;--------------------------------
27 !ifndef NSIS_UNICODE
28 !error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
29 !endif
31 !ifndef LAMEXP_VERSION
32 !error "LAMEXP_VERSION is not defined !!!"
33 !endif
34 !ifndef LAMEXP_BUILD
35 !error "LAMEXP_BUILD is not defined !!!"
36 !endif
37 !ifndef LAMEXP_INSTTYPE
38 !error "LAMEXP_INSTTYPE is not defined !!!"
39 !endif
40 !ifndef LAMEXP_PATCH
41 !error "LAMEXP_PATCH is not defined !!!"
42 !endif
43 !ifndef LAMEXP_DATE
44 !error "LAMEXP_DATE is not defined !!!"
45 !endif
46 !ifndef LAMEXP_OUTPUT_FILE
47 !error "LAMEXP_OUTPUT_FILE is not defined !!!"
48 !endif
49 !ifndef LAMEXP_SOURCE_PATH
50 !error "LAMEXP_SOURCE_PATH is not defined !!!"
51 !endif
52 !ifndef LAMEXP_UPX_PATH
53 !error "LAMEXP_UPX_PATH is not defined !!!"
54 !endif
56 ;UUID
57 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
59 ;Web-Site
60 !define MyWebSite "http://mulder.at.gg/"
63 ;--------------------------------
64 ;Check for Pre-Release
65 ;--------------------------------
67 !define LAMEXP_IS_PRERELEASE
69 !if '${LAMEXP_INSTTYPE}' == 'Final'
70 !undef LAMEXP_IS_PRERELEASE
71 !endif
72 !if '${LAMEXP_INSTTYPE}' == 'Hotfix'
73 !undef LAMEXP_IS_PRERELEASE
74 !endif
77 ;--------------------------------
78 ;Includes
79 ;--------------------------------
81 !include `MUI2.nsh`
82 !include `WinVer.nsh`
83 !include `x64.nsh`
84 !include `StdUtils.nsh`
87 ;--------------------------------
88 ;Installer Attributes
89 ;--------------------------------
91 RequestExecutionLevel admin
92 ShowInstDetails show
93 ShowUninstDetails show
94 Name "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
95 OutFile "${LAMEXP_OUTPUT_FILE}"
96 BrandingText "Date created: ${LAMEXP_DATE} [Build #${LAMEXP_BUILD}]"
97 InstallDir "$PROGRAMFILES\MuldeR\LameXP v${LAMEXP_VERSION}"
98 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
101 ;--------------------------------
102 ;Compressor
103 ;--------------------------------
105 SetCompressor /SOLID LZMA
106 SetCompressorDictSize 64
108 !packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
111 ;--------------------------------
112 ;Reserved Files
113 ;--------------------------------
115 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
116 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
117 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
118 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
119 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
120 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
121 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
122 ReserveFile "${NSISDIR}\Plugins\System.dll"
123 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
124 ReserveFile "checkproc.exe"
127 ;--------------------------------
128 ;Variables
129 ;--------------------------------
131 Var StartMenuFolder
134 ;--------------------------------
135 ;Version Info
136 ;--------------------------------
138 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
139 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
141 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
142 VIAddVersionKey "Comments" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version."
143 VIAddVersionKey "CompanyName" "Free Software Foundation"
144 VIAddVersionKey "FileDescription" "LameXP v${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
145 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD} (${LAMEXP_VERSION})"
146 VIAddVersionKey "LegalCopyright" "Copyright 2004-2012 LoRd_MuldeR"
147 VIAddVersionKey "LegalTrademarks" "GNU"
148 VIAddVersionKey "OriginalFilename" "LameXP.${LAMEXP_DATE}.exe"
149 VIAddVersionKey "ProductName" "LameXP - Audio Encoder Frontend"
150 VIAddVersionKey "ProductVersion" "${LAMEXP_VERSION}, Build #${LAMEXP_BUILD} (${LAMEXP_DATE})"
151 VIAddVersionKey "Website" "${MyWebSite}"
154 ;--------------------------------
155 ;MUI2 Interface Settings
156 ;--------------------------------
158 !define MUI_ABORTWARNING
159 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
160 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
161 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
162 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
163 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
164 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
165 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "LameXP v${LAMEXP_VERSION}"
166 !define MUI_FINISHPAGE_NOAUTOCLOSE
167 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
168 !define MUI_FINISHPAGE_RUN
169 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
170 !define MUI_FINISHPAGE_SHOWREADME
171 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
172 !define MUI_FINISHPAGE_LINK ${MyWebSite}
173 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
174 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
175 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
176 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
177 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
178 !define MUI_HEADERIMAGE
179 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
180 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
181 !define MUI_LANGDLL_ALLLANGUAGES
182 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
183 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
184 !define MUI_LANGDLL_ALWAYSSHOW
187 ;--------------------------------
188 ;MUI2 Pages
189 ;--------------------------------
191 ;Installer
192 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckForPreRelease
193 !define MUI_WELCOMEPAGE_TITLE_3LINES
194 !define MUI_FINISHPAGE_TITLE_3LINES
195 !insertmacro MUI_PAGE_WELCOME
196 !insertmacro MUI_PAGE_LICENSE "license.rtf"
197 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
198 !insertmacro MUI_PAGE_DIRECTORY
199 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
200 Page Custom LockedListShow
201 !insertmacro MUI_PAGE_INSTFILES
202 !insertmacro MUI_PAGE_FINISH
204 ;Uninstaller
205 !define MUI_WELCOMEPAGE_TITLE_3LINES
206 !define MUI_FINISHPAGE_TITLE_3LINES
207 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
208 !insertmacro MUI_UNPAGE_WELCOME
209 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
210 !insertmacro MUI_UNPAGE_CONFIRM
211 UninstPage Custom un.LockedListShow
212 !insertmacro MUI_UNPAGE_INSTFILES
213 !insertmacro MUI_UNPAGE_FINISH
216 ;--------------------------------
217 ;Languages
218 ;--------------------------------
220 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
221 !insertmacro MUI_LANGUAGE "German"
222 !insertmacro MUI_LANGUAGE "Spanish"
223 !insertmacro MUI_LANGUAGE "Russian"
224 !insertmacro MUI_LANGUAGE "Ukrainian"
226 ; !insertmacro MUI_LANGUAGE "French"
227 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
228 ; !insertmacro MUI_LANGUAGE "SimpChinese"
229 ; !insertmacro MUI_LANGUAGE "TradChinese"
230 ; !insertmacro MUI_LANGUAGE "Japanese"
231 ; !insertmacro MUI_LANGUAGE "Italian"
232 ; !insertmacro MUI_LANGUAGE "Dutch"
233 ; !insertmacro MUI_LANGUAGE "Greek"
234 ; !insertmacro MUI_LANGUAGE "Polish"
235 ; !insertmacro MUI_LANGUAGE "Hungarian"
236 ; !insertmacro MUI_LANGUAGE "Romanian"
237 ; !insertmacro MUI_LANGUAGE "Serbian"
238 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
239 ; !insertmacro MUI_LANGUAGE "Arabic"
240 ; !insertmacro MUI_LANGUAGE "Portuguese"
241 ; !insertmacro MUI_LANGUAGE "Afrikaans"
242 ; !insertmacro MUI_LANGUAGE "Malay"
243 ; !insertmacro MUI_LANGUAGE "Indonesian"
246 ;--------------------------------
247 ;Translation
248 ;--------------------------------
250 ;English
251 !include "..\Translation\Blank.nsh"
253 ;German
254 !include "..\Translation\LameXP_DE.nsh"
256 ;Spanish
257 !include "..\Translation\LameXP_ES.nsh"
259 ;Russian
260 !include "..\Translation\LameXP_RU.nsh"
262 ;Ukrainian
263 !include "..\Translation\LameXP_UK.nsh"
266 ;--------------------------------
267 ;Installer initialization
268 ;--------------------------------
270 Function .onInit
271 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
272 Pop $0
273 ${If} $0 <> 0
274 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
275 Quit
276 ${EndIf}
278 ; --------
280 # Running on Windows NT family?
281 ${IfNot} ${IsNT}
282 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
283 ExecShell "open" "http://windows.microsoft.com/"
284 Quit
285 ${EndIf}
287 # Running on Windows XP or later?
288 ${If} ${AtMostWin2000}
289 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, but your operating system is *not* supported anymore.$\nInstallation will be aborted!$\n$\nThe minimum required platform is Windows XP (Service Pack 3)."
290 ExecShell "open" "http://windows.microsoft.com/"
291 Quit
292 ${EndIf}
294 # If on Windows XP, is the required Service Pack installed?
295 ${If} ${IsWinXP}
296 ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
297 ${AndIf} ${AtMostServicePack} 2
298 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP with Service Pack 3 installed.$\nWindows XP *without* Service Pack 3 reached end-of-life on 2010-07-13.$\nCurrent Windows XP (Service Pack 3) will be supported until 2014-04-08.$\n$\nPlease install Service Pack 3 now or just run Windows Update!"
299 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 3 for Windows XP now?" IDYES`
300 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=24"
301 ${Else}
302 ExecShell "open" "http://windowsupdate.microsoft.com/"
303 ${EndIf}
304 Quit
305 ${EndIf}
306 ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
307 ${AndIf} ${AtMostServicePack} 1
308 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION "This application requires Windows XP x64 Edition with Service Pack 2 installed.$\nWindows XP x64 Edition *without* Service Pack 2 reached end-of-life on 2009-04-14.$\nCurrent Windows XP x64 Edition (Service Pack 2) will be supported until 2014-04-08.$\n$\nPlease install Service Pack 2 now or just run Windows Update!"
309 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 2 for Windows XP x64 Edition now?" IDYES`
310 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=17791"
311 ${Else}
312 ExecShell "open" "http://windowsupdate.microsoft.com/"
313 ${EndIf}
314 Quit
315 ${EndIf}
316 ${EndIf}
318 ; --------
320 ${StdUtils.GetParameter} $R0 "Update" "?"
321 ${If} "$R0" == "?"
322 !insertmacro MUI_LANGDLL_DISPLAY
323 ${EndIf}
325 ; --------
327 UserInfo::GetAccountType
328 Pop $0
329 ${If} $0 != "Admin"
330 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
331 Quit
332 ${EndIf}
334 ; --------
336 InitPluginsDir
337 File "/oname=$PLUGINSDIR\checkproc.exe" "checkproc.exe"
338 nsExec::Exec /TIMEOUT=5000 '"$PLUGINSDIR\checkproc.exe" Softonic Brothersoft Afreecodec'
339 Pop $0
340 FunctionEnd
342 Function un.onInit
343 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
344 Pop $0
345 ${If} $0 <> 0
346 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
347 Quit
348 ${EndIf}
350 ${StdUtils.GetParameter} $R0 "Force" "?"
351 ${If} "$R0" == "?"
352 !insertmacro MUI_LANGDLL_DISPLAY
353 ${EndIf}
355 ; --------
357 UserInfo::GetAccountType
358 Pop $0
359 ${If} $0 != "Admin"
360 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
361 Quit
362 ${EndIf}
363 FunctionEnd
366 ;--------------------------------
367 ;GUI initialization
368 ;--------------------------------
370 Function MyGuiInit
371 StrCpy $0 $HWNDPARENT
372 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
373 Aero::Apply
374 FunctionEnd
376 Function un.MyGuiInit
377 StrCpy $0 $HWNDPARENT
378 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
379 Aero::Apply
380 FunctionEnd
383 ;--------------------------------
384 ;Macros & Auxiliary Functions
385 ;--------------------------------
387 !macro PrintProgress Text
388 SetDetailsPrint textonly
389 DetailPrint '${Text}'
390 SetDetailsPrint listonly
391 Sleep 1000
392 !macroend
394 !macro CreateWebLink ShortcutFile TargetURL
395 Push $0
396 Push $1
397 StrCpy $0 "${ShortcutFile}"
398 StrCpy $1 "${TargetURL}"
399 Call _CreateWebLink
400 Pop $1
401 Pop $0
402 !macroend
404 Function _CreateWebLink
405 FlushINI "$0"
406 SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
407 DeleteINISec "$0" "DEFAULT"
408 DeleteINISec "$0" "InternetShortcut"
409 WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
410 WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
411 WriteINIStr "$0" "InternetShortcut" "URL" "$1"
412 WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
413 WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
414 FlushINI "$0"
415 SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
416 FunctionEnd
418 !macro GetExecutableName OutVar
419 ${StdUtils.GetParameter} ${OutVar} "Update" ""
420 ${StdUtils.TrimStr} ${OutVar}
421 ${IfThen} "${OutVar}" == "" ${|} StrCpy ${OutVar} "LameXP.exe" ${|}
422 !macroend
424 !macro DisableNextButton TmpVar
425 GetDlgItem ${TmpVar} $HWNDPARENT 1
426 EnableWindow ${TmpVar} 0
427 !macroend
430 ;--------------------------------
431 ;Install Files
432 ;--------------------------------
434 Section "-PreInit"
435 SetShellVarContext all
436 SetOutPath "$INSTDIR"
437 SectionEnd
439 Section "!Install Files"
440 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
442 Delete "$INSTDIR\Changelog.htm"
443 Delete "$INSTDIR\Changelog.html"
444 Delete "$INSTDIR\Contributors.txt"
445 Delete "$INSTDIR\Copying.txt"
446 Delete "$INSTDIR\FAQ.html"
447 Delete "$INSTDIR\Howto.html"
448 Delete "$INSTDIR\LameEnc.sys"
449 Delete "$INSTDIR\LameXP.exe"
450 Delete "$INSTDIR\LameXP.exe.sig"
451 Delete "$INSTDIR\LameXP-Portable.exe"
452 Delete "$INSTDIR\License.txt"
453 Delete "$INSTDIR\Manual.html"
454 Delete "$INSTDIR\Readme.htm"
455 Delete "$INSTDIR\ReadMe.txt"
456 Delete "$INSTDIR\PRE_RELEASE_INFO.txt"
457 Delete "$INSTDIR\Settings.cfg"
458 Delete "$INSTDIR\Translate.html"
459 Delete "$INSTDIR\Uninstall.exe"
461 !insertmacro GetExecutableName $R0
463 DeleteOldBinary:
464 ClearErrors
465 Delete "$INSTDIR\$R0"
467 ${If} ${Errors}
468 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
469 Abort "Could not delete old binary!"
470 ${EndIf}
472 File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
473 File /a `${LAMEXP_SOURCE_PATH}\*.txt`
474 File /a `${LAMEXP_SOURCE_PATH}\*.html`
475 SectionEnd
477 Section "-Write Uinstaller"
478 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
479 WriteUninstaller "$INSTDIR\Uninstall.exe"
480 SectionEnd
482 Section "-Create Shortcuts"
483 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
484 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
485 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
487 SetShellVarContext current
489 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
490 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
491 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
493 SetShellVarContext all
495 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
496 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
497 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
499 !insertmacro GetExecutableName $R0
501 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
502 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
503 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
504 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
505 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_FAQ).lnk" "$INSTDIR\FAQ.html"
506 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
507 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
509 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "http://mulder.dummwiedeutsch.de/"
510 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
511 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
512 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
514 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
515 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
516 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
517 ${EndIf}
518 !insertmacro MUI_STARTMENU_WRITE_END
519 SectionEnd
521 Section "-Update Registry"
522 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
524 !insertmacro GetExecutableName $R0
525 WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
526 WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
527 WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
528 WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP"
529 SectionEnd
531 Section "-Finished"
532 !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
534 !ifdef LAMEXP_IS_PRERELEASE
535 ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
536 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
537 ${EndIf}
538 !endif
539 SectionEnd
542 ;--------------------------------
543 ;Uninstaller
544 ;--------------------------------
546 Section "Uninstall"
547 SetOutPath "$INSTDIR"
548 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
550 ; --------------
551 ; Startmenu
552 ; --------------
554 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
555 ${IfNot} "$StartMenuFolder" == ""
556 SetShellVarContext current
557 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
558 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
559 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
560 ${EndIf}
561 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
562 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
563 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
564 RMDir "$SMPROGRAMS\$StartMenuFolder"
565 ${EndIf}
567 SetShellVarContext all
568 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
569 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
570 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
571 ${EndIf}
572 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
573 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
574 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
575 RMDir "$SMPROGRAMS\$StartMenuFolder"
576 ${EndIf}
577 ${EndIf}
579 ; --------------
580 ; Files
581 ; --------------
583 ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
584 ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
586 Delete /REBOOTOK "$INSTDIR\LameXP.exe"
587 Delete /REBOOTOK "$INSTDIR\$R0"
588 Delete /REBOOTOK "$INSTDIR\LameXP-Portable.exe"
589 Delete /REBOOTOK "$INSTDIR\LameXP.exe.sig"
590 Delete /REBOOTOK "$INSTDIR\LameXP*"
592 Delete /REBOOTOK "$INSTDIR\Changelog.htm"
593 Delete /REBOOTOK "$INSTDIR\Changelog.html"
594 Delete /REBOOTOK "$INSTDIR\Contributors.txt"
595 Delete /REBOOTOK "$INSTDIR\Copying.txt"
596 Delete /REBOOTOK "$INSTDIR\FAQ.html"
597 Delete /REBOOTOK "$INSTDIR\Howto.html"
598 Delete /REBOOTOK "$INSTDIR\LameEnc.sys"
599 Delete /REBOOTOK "$INSTDIR\License.txt"
600 Delete /REBOOTOK "$INSTDIR\Manual.html"
601 Delete /REBOOTOK "$INSTDIR\Readme.htm"
602 Delete /REBOOTOK "$INSTDIR\ReadMe.txt"
603 Delete /REBOOTOK "$INSTDIR\PRE_RELEASE_INFO.txt"
604 Delete /REBOOTOK "$INSTDIR\Settings.cfg"
605 Delete /REBOOTOK "$INSTDIR\Translate.html"
606 Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
608 RMDir "$INSTDIR"
610 ; --------------
611 ; Registry
612 ; --------------
614 DeleteRegValue HKLM "${MyRegPath}" "InstallLocation"
615 DeleteRegValue HKLM "${MyRegPath}" "ExecutableName"
616 DeleteRegValue HKLM "${MyRegPath}" "UninstallString"
617 DeleteRegValue HKLM "${MyRegPath}" "DisplayName"
618 DeleteRegValue HKLM "${MyRegPath}" "StartmenuFolder"
619 DeleteRegValue HKLM "${MyRegPath}" "SetupLanguage"
621 MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
622 Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
623 Delete "$INSTDIR\*.ini"
625 !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
626 SectionEnd
629 ;--------------------------------
630 ;Check For Update Mode
631 ;--------------------------------
633 Function CheckForUpdate
634 ${StdUtils.GetParameter} $R0 "Update" "?"
635 ${IfNotThen} "$R0" == "?" ${|} Goto EnableUpdateMode ${|}
637 ${IfThen} "$INSTDIR" == "" ${|} Return ${|}
638 ${IfThen} "$INSTDIR" == "$EXEDIR" ${|} Return ${|}
639 ${IfNotThen} ${FileExists} "$INSTDIR\LameXP.exe" ${|} Return ${|}
641 EnableUpdateMode:
643 FindWindow $R0 "#32770" "" $HWNDPARENT
644 GetDlgItem $R1 $R0 1019
645 EnableWindow $R1 0
647 FindWindow $R0 "#32770" "" $HWNDPARENT
648 GetDlgItem $R1 $R0 1001
649 EnableWindow $R1 0
650 FunctionEnd
652 Function un.CheckForcedUninstall
653 ${StdUtils.GetParameter} $R0 "Force" "?"
654 ${IfNotThen} "$R0" == "?" ${|} Abort ${|}
655 FunctionEnd
658 ;--------------------------------
659 ;Check For Pre-Release
660 ;--------------------------------
662 Function CheckForPreRelease
663 !ifdef LAMEXP_IS_PRERELEASE
664 ${StdUtils.GetParameter} $R0 "Update" "?"
665 StrCmp $R0 "?" 0 SkipPrereleaseWarning
666 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
667 Quit
668 SkipPrereleaseWarning:
669 !endif
670 FunctionEnd
673 ;--------------------------------
674 ;Locked List
675 ;--------------------------------
677 Function LockedListShow
678 !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
679 !insertmacro GetExecutableName $R0
680 LockedList::AddModule "\$R0"
681 LockedList::AddModule "\Uninstall.exe"
682 LockedList::AddModule "\Au_.exe"
683 LockedList::Dialog /autonext /heading "$(LAMEXP_LANG_LOCKEDLIST_HEADING)" /noprograms "$(LAMEXP_LANG_LOCKEDLIST_NOPROG)" /searching "$(LAMEXP_LANG_LOCKEDLIST_SEARCH)" /colheadings "$(LAMEXP_LANG_LOCKEDLIST_COLHDR1)" "$(LAMEXP_LANG_LOCKEDLIST_COLHDR2)"
684 Pop $R0
685 FunctionEnd
687 Function un.LockedListShow
688 !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
689 LockedList::AddModule "\LameXP.exe"
690 LockedList::AddModule "\Uninstall.exe"
691 LockedList::Dialog /autonext /heading "$(LAMEXP_LANG_LOCKEDLIST_HEADING)" /noprograms "$(LAMEXP_LANG_LOCKEDLIST_NOPROG)" /searching "$(LAMEXP_LANG_LOCKEDLIST_SEARCH)" /colheadings "$(LAMEXP_LANG_LOCKEDLIST_COLHDR1)" "$(LAMEXP_LANG_LOCKEDLIST_COLHDR2)"
692 Pop $R0
693 FunctionEnd
696 ;--------------------------------
697 ;Install Success
698 ;--------------------------------
700 Function RunAppFunction
701 !insertmacro DisableNextButton $R0
702 !insertmacro GetExecutableName $R0
703 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
704 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
705 FunctionEnd
707 Function ShowReadmeFunction
708 !insertmacro DisableNextButton $R0
709 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\FAQ.html" "open" ""
710 FunctionEnd