OSDN Git Service

Updated web-site URL.
[lamexp/LameXP.git] / etc / NSIS / setup.nsi
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // LameXP - Audio Encoder Front-End
3 ; // Copyright (C) 2004-2013 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 ; ///////////////////////////////////////////////////////////////////////////////
21
22
23 ;--------------------------------
24 ;Basic Defines
25 ;--------------------------------
26
27 !ifndef NSIS_UNICODE
28   !error "NSIS_UNICODE is undefined, please compile with Unicode NSIS !!!"
29 !endif
30
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
55
56 ;UUID
57 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{FBD7A67D-D700-4043-B54F-DD106D00F308}"
58
59 ;Web-Site
60 !define MyWebSite "http://muldersoft.com/"
61
62
63 ;--------------------------------
64 ;Check for Pre-Release
65 ;--------------------------------
66
67 !define LAMEXP_IS_PRERELEASE
68
69 !if '${LAMEXP_INSTTYPE}' == 'Final'
70   !undef LAMEXP_IS_PRERELEASE
71 !endif
72 !if '${LAMEXP_INSTTYPE}' == 'Hotfix'
73   !undef LAMEXP_IS_PRERELEASE
74 !endif
75
76
77 ;--------------------------------
78 ;Includes
79 ;--------------------------------
80
81 !include `MUI2.nsh`
82 !include `WinVer.nsh`
83 !include `x64.nsh`
84 !include `StdUtils.nsh`
85
86
87 ;--------------------------------
88 ;Installer Attributes
89 ;--------------------------------
90
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"
99
100
101 ;--------------------------------
102 ;Compressor
103 ;--------------------------------
104
105 SetCompressor /SOLID LZMA
106 SetCompressorDictSize 64
107
108 !packhdr "$%TEMP%\exehead.tmp" '"${LAMEXP_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
109
110
111 ;--------------------------------
112 ;Reserved Files
113 ;--------------------------------
114
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"
125
126
127 ;--------------------------------
128 ;Variables
129 ;--------------------------------
130
131 Var StartMenuFolder
132
133
134 ;--------------------------------
135 ;Version Info
136 ;--------------------------------
137
138 !searchreplace PRODUCT_VERSION_DATE "${LAMEXP_DATE}" "-" "."
139 VIProductVersion "${PRODUCT_VERSION_DATE}.${LAMEXP_BUILD}"
140
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-2013 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}"
152
153
154 ;--------------------------------
155 ;MUI2 Interface Settings
156 ;--------------------------------
157
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
185
186
187 ;--------------------------------
188 ;MUI2 Pages
189 ;--------------------------------
190
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
203
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
214
215
216 ;--------------------------------
217 ;Languages
218 ;--------------------------------
219  
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"
225
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"
244
245
246 ;--------------------------------
247 ;Translation
248 ;--------------------------------
249
250 ;English
251 !include "..\Translation\Blank.nsh"
252
253 ;German
254 !include "..\Translation\LameXP_DE.nsh"
255
256 ;Spanish
257 !include "..\Translation\LameXP_ES.nsh"
258
259 ;Russian
260 !include "..\Translation\LameXP_RU.nsh"
261
262 ;Ukrainian
263 !include "..\Translation\LameXP_UK.nsh"
264
265
266 ;--------------------------------
267 ;Installer initialization
268 ;--------------------------------
269
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}
277
278         ; --------
279         
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}
286
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}
293
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}
317
318         ; --------
319
320         ${StdUtils.GetParameter} $R0 "Update" "?"
321         ${If} "$R0" == "?"
322                 !insertmacro MUI_LANGDLL_DISPLAY
323         ${EndIf}
324
325         ; --------
326
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                 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
332                 Quit
333         ${EndIf}
334         
335         ; --------
336
337         InitPluginsDir
338         File "/oname=$PLUGINSDIR\checkproc.exe" "checkproc.exe"
339         nsExec::Exec /TIMEOUT=5000 '"$PLUGINSDIR\checkproc.exe" Softonic Brothersoft Afreecodec'
340         Pop $0
341 FunctionEnd
342
343 Function un.onInit
344         System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
345         Pop $0
346         ${If} $0 <> 0
347                 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
348                 Quit
349         ${EndIf}
350
351         ${StdUtils.GetParameter} $R0 "Force" "?"
352         ${If} "$R0" == "?"
353                 !insertmacro MUI_LANGDLL_DISPLAY
354         ${EndIf}
355         
356         ; --------
357
358         UserInfo::GetAccountType
359         Pop $0
360         ${If} $0 != "Admin"
361                 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
362                 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
363                 Quit
364         ${EndIf}
365 FunctionEnd
366
367
368 ;--------------------------------
369 ;GUI initialization
370 ;--------------------------------
371
372 Function MyGuiInit
373         StrCpy $0 $HWNDPARENT
374         System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
375         Aero::Apply
376 FunctionEnd
377
378 Function un.MyGuiInit
379         StrCpy $0 $HWNDPARENT
380         System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
381         Aero::Apply
382 FunctionEnd
383
384
385 ;--------------------------------
386 ;Macros & Auxiliary Functions
387 ;--------------------------------
388
389 !macro PrintProgress Text
390         SetDetailsPrint textonly
391         DetailPrint '${Text}'
392         SetDetailsPrint listonly
393         Sleep 1000
394 !macroend
395
396 !macro CreateWebLink ShortcutFile TargetURL
397         Push $0
398         Push $1
399         StrCpy $0 "${ShortcutFile}"
400         StrCpy $1 "${TargetURL}"
401         Call _CreateWebLink
402         Pop $1
403         Pop $0
404 !macroend
405
406 Function _CreateWebLink
407         FlushINI "$0"
408         SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
409         DeleteINISec "$0" "DEFAULT"
410         DeleteINISec "$0" "InternetShortcut"
411         WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
412         WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
413         WriteINIStr "$0" "InternetShortcut" "URL" "$1"
414         WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
415         WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
416         FlushINI "$0"
417         SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
418 FunctionEnd
419
420 !macro GetExecutableName OutVar
421         ${StdUtils.GetParameter} ${OutVar} "Update" ""
422         ${StdUtils.TrimStr} ${OutVar}
423         ${IfThen} "${OutVar}" == "" ${|} StrCpy ${OutVar} "LameXP.exe" ${|}
424 !macroend
425
426 !macro DisableNextButton TmpVar
427         GetDlgItem ${TmpVar} $HWNDPARENT 1
428         EnableWindow ${TmpVar} 0
429 !macroend
430
431
432 ;--------------------------------
433 ;Install Files
434 ;--------------------------------
435
436 Section "-PreInit"
437         SetShellVarContext all
438         SetOutPath "$INSTDIR"
439 SectionEnd
440
441 Section "!Install Files"
442         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_INSTFILES)"
443
444         Delete "$INSTDIR\Changelog.htm"
445         Delete "$INSTDIR\Changelog.html"
446         Delete "$INSTDIR\Contributors.txt"
447         Delete "$INSTDIR\Copying.txt"
448         Delete "$INSTDIR\FAQ.html"
449         Delete "$INSTDIR\Howto.html"
450         Delete "$INSTDIR\LameEnc.sys"
451         Delete "$INSTDIR\LameXP.exe"
452         Delete "$INSTDIR\LameXP.exe.sig"
453         Delete "$INSTDIR\LameXP-Portable.exe"
454         Delete "$INSTDIR\License.txt"
455         Delete "$INSTDIR\Manual.html"
456         Delete "$INSTDIR\Readme.htm"
457         Delete "$INSTDIR\ReadMe.txt"
458         Delete "$INSTDIR\PRE_RELEASE_INFO.txt"
459         Delete "$INSTDIR\Settings.cfg"
460         Delete "$INSTDIR\Translate.html"
461         Delete "$INSTDIR\Uninstall.exe"
462
463         !insertmacro GetExecutableName $R0
464
465         DeleteOldBinary:
466         ClearErrors
467         Delete "$INSTDIR\$R0"
468         
469         ${If} ${Errors}
470                 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is LameXP still running?' IDRETRY DeleteOldBinary
471                 Abort "Could not delete old binary!"
472         ${EndIf}
473         
474         File /a `/oname=$R0` `${LAMEXP_SOURCE_PATH}\LameXP.exe`
475         File /a `${LAMEXP_SOURCE_PATH}\*.txt`
476         File /a `${LAMEXP_SOURCE_PATH}\*.html`
477 SectionEnd
478
479 Section "-Write Uinstaller"
480         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_MAKEUNINST)"
481         WriteUninstaller "$INSTDIR\Uninstall.exe"
482 SectionEnd
483
484 Section "-Create Shortcuts"
485         !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
486                 !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_SHORTCUTS)"
487                 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
488                 
489                 SetShellVarContext current
490                 
491                 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
492                 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
493                 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
494                 
495                 SetShellVarContext all
496                 
497                 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
498                 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
499                 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
500
501                 !insertmacro GetExecutableName $R0
502                 
503                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
504                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_LICENSE).lnk" "$INSTDIR\License.txt"
505                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\Changelog.html"
506                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_TRANSLATE).lnk" "$INSTDIR\Translate.html"
507                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_FAQ).lnk" "$INSTDIR\FAQ.html"
508                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_MANUAL).lnk" "$INSTDIR\Manual.html"
509                 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(LAMEXP_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
510                 
511                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Official LameXP Homepage.url" "http://mulder.dummwiedeutsch.de/"
512                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
513                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\RareWares.org.url" "http://rarewares.org/"
514                 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Hydrogenaudio Forums.url" "http://www.hydrogenaudio.org/"
515
516                 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
517                         ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
518                         DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
519                 ${EndIf}
520         !insertmacro MUI_STARTMENU_WRITE_END
521 SectionEnd
522
523 Section "-Update Registry"
524         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_REGISTRY)"
525
526         !insertmacro GetExecutableName $R0
527         WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
528         WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
529         WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
530         WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
531         WriteRegStr HKLM "${MyRegPath}" "DisplayName" "LameXP v${LAMEXP_VERSION}"
532         WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
533         WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "${LAMEXP_VERSION} ${LAMEXP_INSTTYPE}-${LAMEXP_PATCH} [Build #${LAMEXP_BUILD}]"
534         WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
535         WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
536 SectionEnd
537
538 Section "-Finished"
539         !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
540
541 !ifdef LAMEXP_IS_PRERELEASE
542         ${If} ${FileExists} "$INSTDIR\PRE_RELEASE_INFO.txt"
543                 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\PRE_RELEASE_INFO.txt" "open" ""
544         ${EndIf}
545 !endif
546 SectionEnd
547
548
549 ;--------------------------------
550 ;Uninstaller
551 ;--------------------------------
552
553 Section "Uninstall"
554         SetOutPath "$INSTDIR"
555         !insertmacro PrintProgress "$(LAMEXP_LANG_STATUS_UNINSTALL)"
556
557         ; --------------
558         ; Startmenu
559         ; --------------
560         
561         !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
562         ${IfNot} "$StartMenuFolder" == ""
563                 SetShellVarContext current
564                 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
565                         ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
566                         DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
567                 ${EndIf}
568                 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
569                         Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
570                         Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
571                         RMDir "$SMPROGRAMS\$StartMenuFolder"
572                 ${EndIf}
573                 
574                 SetShellVarContext all
575                 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk"
576                         ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "LameXP.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
577                         DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\LameXP.lnk" -> $R1'
578                 ${EndIf}
579                 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
580                         Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
581                         Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
582                         RMDir "$SMPROGRAMS\$StartMenuFolder"
583                 ${EndIf}
584         ${EndIf}
585
586         ; --------------
587         ; Files
588         ; --------------
589
590         ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
591         ${IfThen} "$R0" == "" ${|} StrCpy $R0 "LameXP.exe" ${|}
592
593         Delete /REBOOTOK "$INSTDIR\LameXP.exe"
594         Delete /REBOOTOK "$INSTDIR\$R0"
595         Delete /REBOOTOK "$INSTDIR\LameXP-Portable.exe"
596         Delete /REBOOTOK "$INSTDIR\LameXP.exe.sig"
597         Delete /REBOOTOK "$INSTDIR\LameXP*"
598         
599         Delete /REBOOTOK "$INSTDIR\Changelog.htm"
600         Delete /REBOOTOK "$INSTDIR\Changelog.html"
601         Delete /REBOOTOK "$INSTDIR\Contributors.txt"
602         Delete /REBOOTOK "$INSTDIR\Copying.txt"
603         Delete /REBOOTOK "$INSTDIR\FAQ.html"
604         Delete /REBOOTOK "$INSTDIR\Howto.html"
605         Delete /REBOOTOK "$INSTDIR\LameEnc.sys"
606         Delete /REBOOTOK "$INSTDIR\License.txt"
607         Delete /REBOOTOK "$INSTDIR\Manual.html"
608         Delete /REBOOTOK "$INSTDIR\Readme.htm"
609         Delete /REBOOTOK "$INSTDIR\ReadMe.txt"
610         Delete /REBOOTOK "$INSTDIR\PRE_RELEASE_INFO.txt"
611         Delete /REBOOTOK "$INSTDIR\Settings.cfg"
612         Delete /REBOOTOK "$INSTDIR\Translate.html"
613         Delete /REBOOTOK "$INSTDIR\Uninstall.exe"
614
615         RMDir "$INSTDIR"
616
617         ; --------------
618         ; Registry
619         ; --------------
620         
621         DeleteRegKey HKLM "${MyRegPath}"
622         DeleteRegKey HKCU "${MyRegPath}"
623
624         DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
625         DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
626         
627         MessageBox MB_YESNO|MB_TOPMOST "$(LAMEXP_LANG_UNINST_PERSONAL)" IDNO +3
628         Delete "$LOCALAPPDATA\LoRd_MuldeR\LameXP - Audio Encoder Front-End\config.ini"
629         Delete "$INSTDIR\*.ini"
630
631         !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
632 SectionEnd
633
634
635 ;--------------------------------
636 ;Check For Update Mode
637 ;--------------------------------
638
639 Function CheckForUpdate
640         ${StdUtils.GetParameter} $R0 "Update" "?"
641         ${IfNotThen} "$R0" == "?" ${|} Goto EnableUpdateMode ${|}
642
643         ${IfThen} "$INSTDIR" == "" ${|} Return ${|}
644         ${IfThen} "$INSTDIR" == "$EXEDIR" ${|} Return ${|}
645         ${IfNotThen} ${FileExists} "$INSTDIR\LameXP.exe" ${|} Return ${|}
646
647         EnableUpdateMode:
648
649         FindWindow $R0 "#32770" "" $HWNDPARENT
650         GetDlgItem $R1 $R0 1019
651         EnableWindow $R1 0
652
653         FindWindow $R0 "#32770" "" $HWNDPARENT
654         GetDlgItem $R1 $R0 1001
655         EnableWindow $R1 0
656 FunctionEnd
657
658 Function un.CheckForcedUninstall
659         ${StdUtils.GetParameter} $R0 "Force" "?"
660         ${IfNotThen} "$R0" == "?" ${|} Abort ${|}
661 FunctionEnd
662
663
664 ;--------------------------------
665 ;Check For Pre-Release
666 ;--------------------------------
667
668 Function CheckForPreRelease
669         !ifdef LAMEXP_IS_PRERELEASE
670                 ${StdUtils.GetParameter} $R0 "Update" "?"
671                 StrCmp $R0 "?" 0 SkipPrereleaseWarning
672                 MessageBox MB_TOPMOST|MB_ICONEXCLAMATION|MB_OKCANCEL "$(LAMEXP_LANG_PRERELEASE_WARNING)" /SD IDOK IDOK +2
673                 Quit
674                 SkipPrereleaseWarning:
675         !endif
676 FunctionEnd
677
678
679 ;--------------------------------
680 ;Locked List
681 ;--------------------------------
682
683 Function LockedListShow
684         !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
685         !insertmacro GetExecutableName $R0
686         LockedList::AddModule "\$R0"
687         LockedList::AddModule "\Uninstall.exe"
688         LockedList::AddModule "\Au_.exe"
689         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)"
690         Pop $R0
691 FunctionEnd
692
693 Function un.LockedListShow
694         !insertmacro MUI_HEADER_TEXT "$(LAMEXP_LANG_LOCKEDLIST_HEADER)" "$(LAMEXP_LANG_LOCKEDLIST_TEXT)"
695         LockedList::AddModule "\LameXP.exe"
696         LockedList::AddModule "\Uninstall.exe"
697         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)"
698         Pop $R0
699 FunctionEnd
700
701
702 ;--------------------------------
703 ;Install Success
704 ;--------------------------------
705
706 Function RunAppFunction
707         !insertmacro DisableNextButton $R0
708         !insertmacro GetExecutableName $R0
709         ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
710         ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
711 FunctionEnd
712
713 Function ShowReadmeFunction
714         !insertmacro DisableNextButton $R0
715         ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\FAQ.html" "open" ""
716 FunctionEnd