Applied some installer tweaks.
[simple-x264-launcher.git] / etc / setup / setup.nsi
blobef4b7ccea0d50421a72569d21eb14fd695e04cff
1 ; ///////////////////////////////////////////////////////////////////////////////
2 ; // Simple x264 Launcher
3 ; // Copyright (C) 2004-2015 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 X264_BUILD
32 !error "X264_BUILD is not defined !!!"
33 !endif
34 !ifndef X264_DATE
35 !error "X264_DATE is not defined !!!"
36 !endif
37 !ifndef X264_OUTPUT_FILE
38 !error "X264_OUTPUT_FILE is not defined !!!"
39 !endif
40 !ifndef X264_SOURCE_PATH
41 !error "X264_SOURCE_PATH is not defined !!!"
42 !endif
43 !ifndef X264_UPX_PATH
44 !error "X264_UPX_PATH is not defined !!!"
45 !endif
47 ;UUID
48 !define MyRegPath "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{986E454F-DACA-4326-A9C7-3E46C0BFFDCE}"
50 ;Web-Site
51 !define MyWebSite "http://muldersoft.com/"
54 ;--------------------------------
55 ;Includes
56 ;--------------------------------
58 !include `MUI2.nsh`
59 !include `WinVer.nsh`
60 !include `x64.nsh`
61 !include `StdUtils.nsh`
64 ;--------------------------------
65 ;Manifest
66 ;--------------------------------
68 !packhdr "$%TEMP%\~exehead.tmp" `"..\reshacker.exe" -addoverwrite "$%TEMP%\~exehead.tmp", "$%TEMP%\~exehead.tmp", "setup.manifest", 24,1,1033`
70 !delfile "..\reshacker.log"
71 !delfile "..\reshacker.ini"
74 ;--------------------------------
75 ;Installer Attributes
76 ;--------------------------------
78 RequestExecutionLevel admin
79 ShowInstDetails show
80 ShowUninstDetails show
81 Name "Simple x264/x265 Launcher [Build #${X264_BUILD}]"
82 OutFile "${X264_OUTPUT_FILE}"
83 BrandingText "Date created: ${X264_DATE} [Build #${X264_BUILD}]"
84 InstallDir "$PROGRAMFILES\MuldeR\Simple x264 Launcher v2"
85 InstallDirRegKey HKLM "${MyRegPath}" "InstallLocation"
88 ;--------------------------------
89 ;Compressor
90 ;--------------------------------
92 SetCompressor /SOLID LZMA
93 SetCompressorDictSize 64
95 #!packhdr "$%TEMP%\exehead.tmp" '"${X264_UPX_PATH}\upx.exe" --brute "$%TEMP%\exehead.tmp"'
98 ;--------------------------------
99 ;Reserved Files
100 ;--------------------------------
102 ReserveFile "${NSISDIR}\Plugins\Aero.dll"
103 ReserveFile "${NSISDIR}\Plugins\LangDLL.dll"
104 ReserveFile "${NSISDIR}\Plugins\LockedList.dll"
105 ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll"
106 ReserveFile "${NSISDIR}\Plugins\nsExec.dll"
107 ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
108 ReserveFile "${NSISDIR}\Plugins\StdUtils.dll"
109 ReserveFile "${NSISDIR}\Plugins\System.dll"
110 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
111 ReserveFile "checkproc.exe"
114 ;--------------------------------
115 ;Variables
116 ;--------------------------------
118 Var StartMenuFolder
121 ;--------------------------------
122 ;Version Info
123 ;--------------------------------
125 !searchreplace PRODUCT_VERSION_DATE "${X264_DATE}" "-" "."
126 VIProductVersion "${PRODUCT_VERSION_DATE}.${X264_BUILD}"
128 VIAddVersionKey "Author" "LoRd_MuldeR <mulder2@gmx.de>"
129 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."
130 VIAddVersionKey "CompanyName" "Free Software Foundation"
131 VIAddVersionKey "FileDescription" "Simple x264 Launcher [Build #${X264_BUILD}]"
132 VIAddVersionKey "FileVersion" "${PRODUCT_VERSION_DATE}.${X264_BUILD}"
133 VIAddVersionKey "LegalCopyright" "Copyright 2004-2015 LoRd_MuldeR"
134 VIAddVersionKey "LegalTrademarks" "GNU"
135 VIAddVersionKey "OriginalFilename" "x264_x64.${X264_DATE}.exe"
136 VIAddVersionKey "ProductName" "Simple x264 Launcher"
137 VIAddVersionKey "ProductVersion" "Build #${X264_BUILD} (${X264_DATE})"
138 VIAddVersionKey "Website" "${MyWebSite}"
141 ;--------------------------------
142 ;MUI2 Interface Settings
143 ;--------------------------------
145 !define MUI_ABORTWARNING
146 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
147 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${MyRegPath}"
148 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartmenuFolder"
149 !define MUI_LANGDLL_REGISTRY_ROOT HKLM
150 !define MUI_LANGDLL_REGISTRY_KEY "${MyRegPath}"
151 !define MUI_LANGDLL_REGISTRY_VALUENAME "SetupLanguage"
152 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "Simple x264 Launcher v2"
153 !define MUI_FINISHPAGE_NOAUTOCLOSE
154 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
155 !define MUI_FINISHPAGE_RUN
156 !define MUI_FINISHPAGE_RUN_FUNCTION RunAppFunction
157 !define MUI_FINISHPAGE_SHOWREADME
158 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReadmeFunction
159 !define MUI_FINISHPAGE_LINK ${MyWebSite}
160 !define MUI_FINISHPAGE_LINK_LOCATION ${MyWebSite}
161 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
162 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
163 !define MUI_WELCOMEFINISHPAGE_BITMAP "wizard.bmp"
164 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "wizard-un.bmp"
165 !define MUI_HEADERIMAGE
166 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
167 !define MUI_HEADERIMAGE_UNBITMAP "header-un.bmp"
168 !define MUI_LANGDLL_ALLLANGUAGES
169 !define MUI_CUSTOMFUNCTION_GUIINIT MyGuiInit
170 !define MUI_CUSTOMFUNCTION_UNGUIINIT un.MyGuiInit
171 !define MUI_LANGDLL_ALWAYSSHOW
173 ;--------------------------------
174 ;MUI2 Pages
175 ;--------------------------------
177 ;Installer
178 !define MUI_WELCOMEPAGE_TITLE_3LINES
179 !define MUI_FINISHPAGE_TITLE_3LINES
180 !insertmacro MUI_PAGE_WELCOME
181 !insertmacro MUI_PAGE_LICENSE "license.rtf"
182 !define MUI_PAGE_CUSTOMFUNCTION_SHOW CheckForUpdate
183 !insertmacro MUI_PAGE_DIRECTORY
184 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
185 Page Custom LockedListShow
186 !insertmacro MUI_PAGE_INSTFILES
187 !insertmacro MUI_PAGE_FINISH
189 ;Uninstaller
190 !define MUI_WELCOMEPAGE_TITLE_3LINES
191 !define MUI_FINISHPAGE_TITLE_3LINES
192 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
193 !insertmacro MUI_UNPAGE_WELCOME
194 !define MUI_PAGE_CUSTOMFUNCTION_PRE un.CheckForcedUninstall
195 !insertmacro MUI_UNPAGE_CONFIRM
196 UninstPage Custom un.LockedListShow
197 !insertmacro MUI_UNPAGE_INSTFILES
198 !insertmacro MUI_UNPAGE_FINISH
201 ;--------------------------------
202 ;Languages
203 ;--------------------------------
205 !insertmacro MUI_LANGUAGE "English" ;first language is the default language
207 ; !insertmacro MUI_LANGUAGE "German"
208 ; !insertmacro MUI_LANGUAGE "Spanish"
209 ; !insertmacro MUI_LANGUAGE "Russian"
210 ; !insertmacro MUI_LANGUAGE "Ukrainian"
211 ; !insertmacro MUI_LANGUAGE "Polish"
213 ; !insertmacro MUI_LANGUAGE "French"
214 ; !insertmacro MUI_LANGUAGE "SpanishInternational"
215 ; !insertmacro MUI_LANGUAGE "SimpChinese"
216 ; !insertmacro MUI_LANGUAGE "TradChinese"
217 ; !insertmacro MUI_LANGUAGE "Japanese"
218 ; !insertmacro MUI_LANGUAGE "Italian"
219 ; !insertmacro MUI_LANGUAGE "Dutch"
220 ; !insertmacro MUI_LANGUAGE "Greek"
221 ; !insertmacro MUI_LANGUAGE "Hungarian"
222 ; !insertmacro MUI_LANGUAGE "Romanian"
223 ; !insertmacro MUI_LANGUAGE "Serbian"
224 ; !insertmacro MUI_LANGUAGE "SerbianLatin"
225 ; !insertmacro MUI_LANGUAGE "Arabic"
226 ; !insertmacro MUI_LANGUAGE "Portuguese"
227 ; !insertmacro MUI_LANGUAGE "Afrikaans"
228 ; !insertmacro MUI_LANGUAGE "Malay"
229 ; !insertmacro MUI_LANGUAGE "Indonesian"
232 ;--------------------------------
233 ;Translation
234 ;--------------------------------
236 ;English
237 !include "language\en.nsh"
240 ;--------------------------------
241 ;Installer initialization
242 ;--------------------------------
244 Function .onInit
245 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
246 Pop $0
247 ${If} $0 <> 0
248 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the installer is already running!"
249 Quit
250 ${EndIf}
252 ; --------
254 # Running on Windows NT family?
255 ${IfNot} ${IsNT}
256 MessageBox MB_TOPMOST|MB_ICONSTOP "Sorry, this application does *not* support Windows 9x or Windows ME!"
257 ExecShell "open" "http://windows.microsoft.com/"
258 Quit
259 ${EndIf}
261 # Running on Windows XP or later?
262 ${If} ${AtMostWin2000}
263 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)."
264 ExecShell "open" "http://windows.microsoft.com/"
265 Quit
266 ${EndIf}
268 # If on Windows XP, is the required Service Pack installed?
269 ${If} ${IsWinXP}
270 ${IfNot} ${RunningX64} # Windows XP 32-Bit, requires Service Pack 3
271 ${AndIf} ${AtMostServicePack} 2
272 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!"
273 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 3 for Windows XP now?" IDYES`
274 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=24"
275 ${Else}
276 ExecShell "open" "http://windowsupdate.microsoft.com/"
277 ${EndIf}
278 Quit
279 ${EndIf}
280 ${If} ${RunningX64} # Windows XP 64-Bit, requires Service Pack 2
281 ${AndIf} ${AtMostServicePack} 1
282 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!"
283 ${If} ${Cmd} `MessageBox MB_TOPMOST|MB_ICONQUESTION|MB_YESNO "Do you want to download Service Pack 2 for Windows XP x64 Edition now?" IDYES`
284 ExecShell "open" "http://www.microsoft.com/en-us/download/details.aspx?id=17791"
285 ${Else}
286 ExecShell "open" "http://windowsupdate.microsoft.com/"
287 ${EndIf}
288 Quit
289 ${EndIf}
290 ${EndIf}
292 ; --------
294 ${StdUtils.GetParameter} $R0 "Update" "?"
295 ${If} "$R0" == "?"
296 !insertmacro MUI_LANGDLL_DISPLAY
297 ${EndIf}
299 ; --------
301 UserInfo::GetAccountType
302 Pop $0
303 ${If} $0 != "Admin"
304 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
305 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
306 Quit
307 ${EndIf}
309 ; --------
311 InitPluginsDir
313 File "/oname=$PLUGINSDIR\checkproc.exe" "checkproc.exe"
314 nsExec::Exec /TIMEOUT=5000 '"$PLUGINSDIR\checkproc.exe" Softonic Brothersoft Afreecodec'
315 Pop $0
316 FunctionEnd
318 Function un.onInit
319 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "{2B3D1EBF-B3B6-4E93-92B9-6853029A7162}") i .r1 ?e'
320 Pop $0
321 ${If} $0 <> 0
322 MessageBox MB_ICONSTOP|MB_TOPMOST "Sorry, the un-installer is already running!"
323 Quit
324 ${EndIf}
326 ${StdUtils.GetParameter} $R0 "Force" "?"
327 ${If} "$R0" == "?"
328 !insertmacro MUI_LANGDLL_DISPLAY
329 ${EndIf}
331 ; --------
333 UserInfo::GetAccountType
334 Pop $0
335 ${If} $0 != "Admin"
336 MessageBox MB_ICONSTOP|MB_TOPMOST "Your system requires administrative permissions in order to install this software."
337 SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
338 Quit
339 ${EndIf}
340 FunctionEnd
343 ;--------------------------------
344 ;GUI initialization
345 ;--------------------------------
347 Function MyGuiInit
348 StrCpy $0 $HWNDPARENT
349 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
350 Aero::Apply
351 FunctionEnd
353 Function un.MyGuiInit
354 StrCpy $0 $HWNDPARENT
355 System::Call "user32::SetWindowPos(i r0, i -1, i 0, i 0, i 0, i 0, i 3)"
356 Aero::Apply
357 FunctionEnd
360 ;--------------------------------
361 ;Macros & Auxiliary Functions
362 ;--------------------------------
364 !macro PrintProgress Text
365 SetDetailsPrint textonly
366 DetailPrint '${Text}'
367 SetDetailsPrint listonly
368 Sleep 1000
369 !macroend
371 !macro CreateWebLink ShortcutFile TargetURL
372 Push $0
373 Push $1
374 StrCpy $0 "${ShortcutFile}"
375 StrCpy $1 "${TargetURL}"
376 Call _CreateWebLink
377 Pop $1
378 Pop $0
379 !macroend
381 Function _CreateWebLink
382 FlushINI "$0"
383 SetFileAttributes "$0" FILE_ATTRIBUTE_NORMAL
384 DeleteINISec "$0" "DEFAULT"
385 DeleteINISec "$0" "InternetShortcut"
386 WriteINIStr "$0" "DEFAULT" "BASEURL" "$1"
387 WriteINIStr "$0" "InternetShortcut" "ORIGURL" "$1"
388 WriteINIStr "$0" "InternetShortcut" "URL" "$1"
389 WriteINIStr "$0" "InternetShortcut" "IconFile" "$SYSDIR\SHELL32.dll"
390 WriteINIStr "$0" "InternetShortcut" "IconIndex" "150"
391 FlushINI "$0"
392 SetFileAttributes "$0" FILE_ATTRIBUTE_READONLY
393 FunctionEnd
395 !macro GetExecutableName OutVar
396 ${StdUtils.GetParameter} ${OutVar} "Update" ""
397 ${StdUtils.TrimStr} ${OutVar}
398 ${IfThen} "${OutVar}" == "" ${|} StrCpy ${OutVar} "x264_launcher.exe" ${|}
399 !macroend
401 !macro DisableNextButton TmpVar
402 GetDlgItem ${TmpVar} $HWNDPARENT 1
403 EnableWindow ${TmpVar} 0
404 !macroend
407 ;--------------------------------
408 ;Install Files
409 ;--------------------------------
411 Section "-PreInit"
412 SetShellVarContext all
413 SetOutPath "$INSTDIR"
414 SectionEnd
416 Section "!Install Files"
417 !insertmacro PrintProgress "$(X264_LANG_STATUS_INSTFILES)"
419 ; Clean up leftover from an existing installation
420 Delete `$INSTDIR\*.exe`
421 Delete `$INSTDIR\*.dll`
422 Delete `$INSTDIR\*.txt`
423 Delete `$INSTDIR\*.html`
424 RMDir /r `$INSTDIR\toolset`
425 RMDir /r `$INSTDIR\imageformats`
426 RMDir /r `$INSTDIR\sources`
428 !insertmacro GetExecutableName $R0
430 DeleteOldBinary:
431 ClearErrors
432 Delete "$INSTDIR\$R0"
434 ${If} ${Errors}
435 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete old "$R0" file. Is program still running?' IDRETRY DeleteOldBinary
436 Abort "Could not delete old binary!"
437 ${EndIf}
439 SetOutPath "$INSTDIR"
440 File /a `/oname=$R0` `${X264_SOURCE_PATH}\x264_launcher.exe`
442 SetOutPath "$INSTDIR"
443 File /a `${X264_SOURCE_PATH}\*.dll`
444 File /a `${X264_SOURCE_PATH}\*.txt`
445 File /a `${X264_SOURCE_PATH}\*.html`
447 SetOutPath "$INSTDIR\imageformats"
448 File /a /r `${X264_SOURCE_PATH}\imageformats\*.*`
450 SetOutPath "$INSTDIR\toolset"
451 File /a /r `${X264_SOURCE_PATH}\toolset\*.*`
453 SetOutPath "$INSTDIR\sources"
454 File /a /r `${X264_SOURCE_PATH}\sources\*.*`
455 SectionEnd
457 Section "-Write Uinstaller"
458 !insertmacro PrintProgress "$(X264_LANG_STATUS_MAKEUNINST)"
459 WriteUninstaller "$INSTDIR\Uninstall.exe"
460 SectionEnd
462 Section "-Create Shortcuts"
463 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
464 !insertmacro PrintProgress "$(X264_LANG_STATUS_SHORTCUTS)"
465 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
467 SetShellVarContext current
469 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
470 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
471 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
473 SetShellVarContext all
475 Delete "$SMPROGRAMS\$StartMenuFolder\*.lnk"
476 Delete "$SMPROGRAMS\$StartMenuFolder\*.pif"
477 Delete "$SMPROGRAMS\$StartMenuFolder\*.url"
479 !insertmacro GetExecutableName $R0
481 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk" "$INSTDIR\$R0" "" "$INSTDIR\$R0" 0
482 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(X264_LANG_LINK_LICENSE).lnk" "$INSTDIR\LICENSE.html"
483 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(X264_LANG_LINK_MANUAL).lnk" "$INSTDIR\README.html"
484 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(X264_LANG_LINK_CHANGELOG).lnk" "$INSTDIR\HISTORY.txt"
485 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\$(X264_LANG_LINK_UNINSTALL).lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
487 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\MuldeR's Homepage.url" "${MyWebSite}"
488 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Doom9's Forum.url" "http://forum.doom9.org/"
489 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\x264.com.url" "http://x264.com/"
490 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\x265.com.url" "http://x265.org/"
491 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\Avisynth Wiki.url" "http://avisynth.nl/"
492 !insertmacro CreateWebLink "$SMPROGRAMS\$StartMenuFolder\VapourSynth.com.url" "http://www.vapoursynth.com/"
494 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk"
495 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "Simple x264 Launcher.lnk" ${StdUtils.Const.ISV_PinToTaskbar}
496 DetailPrint 'Pin: "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk" -> $R1'
497 ${EndIf}
498 !insertmacro MUI_STARTMENU_WRITE_END
499 SectionEnd
501 Section "-Update Registry"
502 !insertmacro PrintProgress "$(X264_LANG_STATUS_REGISTRY)"
504 !insertmacro GetExecutableName $R0
505 WriteRegStr HKLM "${MyRegPath}" "InstallLocation" "$INSTDIR"
506 WriteRegStr HKLM "${MyRegPath}" "ExecutableName" "$R0"
507 WriteRegStr HKLM "${MyRegPath}" "DisplayIcon" "$INSTDIR\$R0,0"
508 WriteRegStr HKLM "${MyRegPath}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
509 WriteRegStr HKLM "${MyRegPath}" "DisplayName" "Simple x264 Launcher v2"
510 WriteRegStr HKLM "${MyRegPath}" "Publisher" "LoRd_MuldeR <mulder2@gmx.de>"
511 WriteRegStr HKLM "${MyRegPath}" "DisplayVersion" "Build #${X264_BUILD} (${X264_DATE})"
512 WriteRegStr HKLM "${MyRegPath}" "URLInfoAbout" "${MyWebSite}"
513 WriteRegStr HKLM "${MyRegPath}" "URLUpdateInfo" "${MyWebSite}"
514 SectionEnd
516 Section "-Finished"
517 !insertmacro PrintProgress "$(MUI_TEXT_FINISH_TITLE)."
518 SectionEnd
521 ;--------------------------------
522 ;Uninstaller
523 ;--------------------------------
525 Section "Uninstall"
526 SetOutPath "$INSTDIR"
527 !insertmacro PrintProgress "$(X264_LANG_STATUS_UNINSTALL)"
529 ; --------------
530 ; Startmenu
531 ; --------------
533 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
534 ${IfNot} "$StartMenuFolder" == ""
535 SetShellVarContext current
536 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk"
537 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "Simple x264 Launcher.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
538 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk" -> $R1'
539 ${EndIf}
540 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
541 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
542 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
543 RMDir "$SMPROGRAMS\$StartMenuFolder"
544 ${EndIf}
546 SetShellVarContext all
547 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk"
548 ${StdUtils.InvokeShellVerb} $R1 "$SMPROGRAMS\$StartMenuFolder" "Simple x264 Launcher.lnk" ${StdUtils.Const.ISV_UnpinFromTaskbar}
549 DetailPrint 'Unpin: "$SMPROGRAMS\$StartMenuFolder\Simple x264 Launcher.lnk" -> $R1'
550 ${EndIf}
551 ${If} ${FileExists} "$SMPROGRAMS\$StartMenuFolder\*.*"
552 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.lnk"
553 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\*.url"
554 RMDir "$SMPROGRAMS\$StartMenuFolder"
555 ${EndIf}
556 ${EndIf}
558 ; --------------
559 ; Files
560 ; --------------
562 ReadRegStr $R0 HKLM "${MyRegPath}" "ExecutableName"
563 ${IfThen} "$R0" == "" ${|} StrCpy $R0 "x264_launcher.exe" ${|}
565 DeleteAppBinary:
566 ClearErrors
567 Delete `$INSTDIR\$R0`
569 ${If} ${Errors}
570 MessageBox MB_TOPMOST|MB_ICONSTOP|MB_RETRYCANCEL 'Could not delete the "$R0" file. Is program still running?' IDRETRY DeleteAppBinary
571 Abort "Could not delete application binary!"
572 ${EndIf}
574 Delete /REBOOTOK `$INSTDIR\*.exe`
575 Delete /REBOOTOK `$INSTDIR\*.dll`
576 Delete /REBOOTOK `$INSTDIR\*.txt`
577 Delete /REBOOTOK `$INSTDIR\*.html`
579 Delete /REBOOTOK `$INSTDIR\toolset\*.exe`
580 Delete /REBOOTOK `$INSTDIR\toolset\*.dll`
581 Delete /REBOOTOK `$INSTDIR\toolset\x86\*.exe`
582 Delete /REBOOTOK `$INSTDIR\toolset\x86\*.dll`
583 Delete /REBOOTOK `$INSTDIR\toolset\x64\*.exe`
584 Delete /REBOOTOK `$INSTDIR\toolset\x64\*.dll`
585 Delete /REBOOTOK `$INSTDIR\toolset\common\*.exe`
586 Delete /REBOOTOK `$INSTDIR\toolset\common\*.dll`
587 Delete /REBOOTOK `$INSTDIR\toolset\common\*.gpg`
589 Delete /REBOOTOK `$INSTDIR\imageformats\*.dll`
590 Delete /REBOOTOK `$INSTDIR\sources\*.*`
592 RMDir /r /REBOOTOK "$INSTDIR"
594 ; --------------
595 ; Registry
596 ; --------------
598 DeleteRegKey HKLM "${MyRegPath}"
599 DeleteRegKey HKCU "${MyRegPath}"
601 DeleteRegKey HKLM "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
602 DeleteRegKey HKCU "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{54dcbccb-c905-46dc-b6e6-48563d0e9e55}"
604 MessageBox MB_YESNO|MB_TOPMOST "$(X264_LANG_UNINST_PERSONAL)" IDNO +3
605 Delete "$LOCALAPPDATA\LoRd_MuldeR\Simple x264 Launcher\*.ini"
606 RMDir "$LOCALAPPDATA\LoRd_MuldeR\Simple x264 Launcher"
608 !insertmacro PrintProgress "$(MUI_UNTEXT_FINISH_TITLE)."
609 SectionEnd
612 ;--------------------------------
613 ;Check For Update Mode
614 ;--------------------------------
616 Function CheckForUpdate
617 ${StdUtils.GetParameter} $R0 "Update" "?"
618 ${IfNotThen} "$R0" == "?" ${|} Goto EnableUpdateMode ${|}
620 ${IfThen} "$INSTDIR" == "" ${|} Return ${|}
621 ${IfThen} "$INSTDIR" == "$EXEDIR" ${|} Return ${|}
622 ${IfNotThen} ${FileExists} "$INSTDIR\x264_launcher.exe" ${|} Return ${|}
624 EnableUpdateMode:
626 FindWindow $R0 "#32770" "" $HWNDPARENT
627 GetDlgItem $R1 $R0 1019
628 EnableWindow $R1 0
630 FindWindow $R0 "#32770" "" $HWNDPARENT
631 GetDlgItem $R1 $R0 1001
632 EnableWindow $R1 0
633 FunctionEnd
635 Function un.CheckForcedUninstall
636 ${StdUtils.GetParameter} $R0 "Force" "?"
637 ${IfNotThen} "$R0" == "?" ${|} Abort ${|}
638 FunctionEnd
641 ;--------------------------------
642 ;Locked List
643 ;--------------------------------
645 Function LockedListShow
646 !insertmacro MUI_HEADER_TEXT "$(X264_LANG_LOCKEDLIST_HEADER)" "$(X264_LANG_LOCKEDLIST_TEXT)"
647 !insertmacro GetExecutableName $R0
648 LockedList::AddModule "\$R0"
649 LockedList::AddModule "\Uninstall.exe"
650 LockedList::AddModule "\Au_.exe"
651 LockedList::Dialog /autonext /heading "$(X264_LANG_LOCKEDLIST_HEADING)" /noprograms "$(X264_LANG_LOCKEDLIST_NOPROG)" /searching "$(X264_LANG_LOCKEDLIST_SEARCH)" /colheadings "$(X264_LANG_LOCKEDLIST_COLHDR1)" "$(X264_LANG_LOCKEDLIST_COLHDR2)"
652 Pop $R0
653 FunctionEnd
655 Function un.LockedListShow
656 !insertmacro MUI_HEADER_TEXT "$(X264_LANG_LOCKEDLIST_HEADER)" "$(X264_LANG_LOCKEDLIST_TEXT)"
657 LockedList::AddModule "\x264_launcher.exe"
658 LockedList::AddModule "\Uninstall.exe"
659 LockedList::Dialog /autonext /heading "$(X264_LANG_LOCKEDLIST_HEADING)" /noprograms "$(X264_LANG_LOCKEDLIST_NOPROG)" /searching "$(X264_LANG_LOCKEDLIST_SEARCH)" /colheadings "$(X264_LANG_LOCKEDLIST_COLHDR1)" "$(X264_LANG_LOCKEDLIST_COLHDR2)"
660 Pop $R0
661 FunctionEnd
664 ;--------------------------------
665 ;Install Success
666 ;--------------------------------
668 Function RunAppFunction
669 !insertmacro DisableNextButton $R0
670 !insertmacro GetExecutableName $R0
671 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR" "explore" ""
672 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\$R0" "open" "--first-run"
673 FunctionEnd
675 Function ShowReadmeFunction
676 !insertmacro DisableNextButton $R0
677 ${StdUtils.ExecShellAsUser} $R1 "$INSTDIR\README.html" "open" ""
678 FunctionEnd