1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2; NSIS installer script for vlc ;
3; (http://nsis.sourceforge.net) ;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
6!define PRODUCT_NAME "VLC media player"
7!define VERSION @VERSION@
8!define PRODUCT_VERSION @VERSION@
9!define PRODUCT_GROUP "VideoLAN"
10!define PRODUCT_PUBLISHER "VideoLAN"
11!define PRODUCT_WEB_SITE "https://www.videolan.org/"
12!define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
13!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
14!define PRODUCT_UNINST_ROOT_KEY "HKLM"
15!define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
16
17!define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
18!define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
19!define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
20
21!define MEMENTO_REGISTRY_ROOT ${PRODUCT_UNINST_ROOT_KEY}
22!define MEMENTO_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
23
24@HAVE_WIN64_TRUE@ !define VLC_64BIT_INSTALLER
25
26ManifestDPIAware true
27Unicode true
28
29!define INSTALL_ACTIVEX
30!define INSTALL_MOZILLA
31
32Var ReinstallType
33Var ReinstallUninstallBtn
34Var PerformUpdate
35Var PreviousVersion
36Var PreviousVersionState
37Var PreviousInstallDir
38Var UninstallLog
39
40Var 32bitUninstaller
41Var 32bitPath
42
43;;;;;;;;;;;;;;;;;;;;;;;;;
44; General configuration ;
45;;;;;;;;;;;;;;;;;;;;;;;;;
46
47Name "${PRODUCT_NAME}"
48@HAVE_WIN64_FALSE@ OutFile ..\vlc-${VERSION}-win32.exe
49@HAVE_WIN64_TRUE@  OutFile ..\vlc-${VERSION}-win64.exe
50InstallDir "$@PROGRAMFILES@\VideoLAN\VLC"
51!ifdef NSIS_LZMA_COMPRESS_WHOLE
52SetCompressor lzma
53!else
54SetCompressor /SOLID lzma
55!endif
56
57SetOverwrite ifdiff
58CRCCheck on
59BrandingText "${PRODUCT_GROUP} ${PRODUCT_NAME}"
60
61InstType "$(Name_InstTypeRecommended)"
62InstType "$(Name_InstTypeMinimum)"
63InstType "$(Name_InstTypeFull)"
64
65RequestExecutionLevel admin
66!addincludedir NSIS
67!addplugindir NSIS
68!include nsProcess.nsh
69!include WinVer.nsh
70!include FileFunc.nsh
71!include MUI2.nsh
72!include Memento.nsh
73
74!insertmacro GetParameters
75!insertmacro GetOptions
76
77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
78; NSIS Modern User Interface configuration ;
79;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
80
81; MUI Settings
82  !define MUI_ABORTWARNING
83  !define MUI_ICON "vlc.ico"
84  !define MUI_UNICON "vlc.ico"
85  !define MUI_COMPONENTSPAGE_SMALLDESC
86
87  ; Banner (welcome and finish page) for installer
88  !define MUI_WELCOMEFINISHPAGE_BITMAP "NSIS/vlc_branding.bmp"
89  ; Banner for uninstaller
90  !define MUI_UNWELCOMEFINISHPAGE_BITMAP "NSIS/vlc_branding.bmp"
91
92; Installer pages
93  ; Welcome page
94    !define MUI_PAGE_CUSTOMFUNCTION_PRE PageFastUpdatePre
95    !define MUI_WELCOMEPAGE_TITLE_3LINES
96    !insertmacro MUI_PAGE_WELCOME
97  ; Optional update page
98    Page custom PageReinstall PageLeaveReinstall
99  ; License page
100    !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
101    !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(License_NextText)"
102    !define MUI_PAGE_CUSTOMFUNCTION_PRE PageSkipPre
103    !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
104  ; Components page
105    !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
106    !insertmacro MUI_PAGE_COMPONENTS
107  ; Directory page
108    !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
109    !insertmacro MUI_PAGE_DIRECTORY
110  ; Instfiles page
111    !insertmacro MUI_PAGE_INSTFILES
112  ; Finish page
113    !define MUI_PAGE_CUSTOMFUNCTION_PRE PageFastUpdatePre
114    !define MUI_FINISHPAGE_RUN
115    !define MUI_FINISHPAGE_RUN_FUNCTION AppExecAs
116    !define MUI_FINISHPAGE_LINK "$(Link_VisitWebsite)"
117    !define MUI_FINISHPAGE_LINK_LOCATION "https://www.videolan.org/vlc/"
118    !define MUI_FINISHPAGE_NOREBOOTSUPPORT
119    !insertmacro MUI_PAGE_FINISH
120
121; Uninstaller pages
122    !insertmacro MUI_UNPAGE_CONFIRM
123    !insertmacro MUI_UNPAGE_COMPONENTS
124    !insertmacro MUI_UNPAGE_INSTFILES
125    !insertmacro MUI_UNPAGE_FINISH
126
127  !addincludedir "languages"
128  !define VLC_LANGFILE_FALLBACK "EnglishExtra.nsh"
129
130; Language files (first language is default)
131  !insertmacro MUI_LANGUAGE "English"
132  !insertmacro LANGFILE_INCLUDE "EnglishExtra.nsh"
133
134  !insertmacro MUI_LANGUAGE "French"
135  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "FrenchExtra.nsh" ${VLC_LANGFILE_FALLBACK}
136  !insertmacro MUI_LANGUAGE "German"
137  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "GermanExtra.nsh" ${VLC_LANGFILE_FALLBACK}
138  !insertmacro MUI_LANGUAGE "Spanish"
139  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "SpanishExtra.nsh" ${VLC_LANGFILE_FALLBACK}
140  !insertmacro MUI_LANGUAGE "SimpChinese"
141  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "SimpChineseExtra.nsh" ${VLC_LANGFILE_FALLBACK}
142  !insertmacro MUI_LANGUAGE "TradChinese"
143  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "TradChineseExtra.nsh" ${VLC_LANGFILE_FALLBACK}
144  !insertmacro MUI_LANGUAGE "Japanese"
145  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "JapaneseExtra.nsh" ${VLC_LANGFILE_FALLBACK}
146  !insertmacro MUI_LANGUAGE "Italian"
147  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "ItalianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
148  !insertmacro MUI_LANGUAGE "Dutch"
149  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "DutchExtra.nsh" ${VLC_LANGFILE_FALLBACK}
150  !insertmacro MUI_LANGUAGE "Danish"
151  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "DanishExtra.nsh" ${VLC_LANGFILE_FALLBACK}
152  !insertmacro MUI_LANGUAGE "Swedish"
153  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "SwedishExtra.nsh" ${VLC_LANGFILE_FALLBACK}
154  !insertmacro MUI_LANGUAGE "Finnish"
155  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "FinnishExtra.nsh" ${VLC_LANGFILE_FALLBACK}
156  !insertmacro MUI_LANGUAGE "Russian"
157  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "RussianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
158  !insertmacro MUI_LANGUAGE "Portuguese"
159  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "PortugueseExtra.nsh" ${VLC_LANGFILE_FALLBACK}
160  !insertmacro MUI_LANGUAGE "PortugueseBR"
161  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "PortugueseBRExtra.nsh" ${VLC_LANGFILE_FALLBACK}
162  !insertmacro MUI_LANGUAGE "Welsh"
163  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "WelshExtra.nsh" ${VLC_LANGFILE_FALLBACK}
164  !insertmacro MUI_LANGUAGE "Uzbek"
165  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "UzbekExtra.nsh" ${VLC_LANGFILE_FALLBACK}
166  !insertmacro MUI_LANGUAGE "Ukrainian"
167  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "UkrainianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
168  !insertmacro MUI_LANGUAGE "Turkish"
169  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "TurkishExtra.nsh" ${VLC_LANGFILE_FALLBACK}
170  !insertmacro MUI_LANGUAGE "Thai"
171  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "ThaiExtra.nsh" ${VLC_LANGFILE_FALLBACK}
172  !insertmacro MUI_LANGUAGE "Norwegian"
173  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "NorwegianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
174  !insertmacro MUI_LANGUAGE "Malay"
175  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "MalayExtra.nsh" ${VLC_LANGFILE_FALLBACK}
176  !insertmacro MUI_LANGUAGE "Korean"
177  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "KoreanExtra.nsh" ${VLC_LANGFILE_FALLBACK}
178  !insertmacro MUI_LANGUAGE "Greek"
179  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "GreekExtra.nsh" ${VLC_LANGFILE_FALLBACK}
180  !insertmacro MUI_LANGUAGE "Czech"
181  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "CzechExtra.nsh" ${VLC_LANGFILE_FALLBACK}
182  !insertmacro MUI_LANGUAGE "Bosnian"
183  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "BosnianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
184  !insertmacro MUI_LANGUAGE "Arabic"
185  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "ArabicExtra.nsh" ${VLC_LANGFILE_FALLBACK}
186  !insertmacro MUI_LANGUAGE "Polish"
187  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "PolishExtra.nsh" ${VLC_LANGFILE_FALLBACK}
188  !insertmacro MUI_LANGUAGE "Romanian"
189  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "RomanianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
190  !insertmacro MUI_LANGUAGE "Slovak"
191  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "SlovakExtra.nsh" ${VLC_LANGFILE_FALLBACK}
192  !insertmacro MUI_LANGUAGE "Serbian"
193  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "SerbianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
194  !insertmacro MUI_LANGUAGE "Hungarian"
195  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "HungarianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
196  !insertmacro MUI_LANGUAGE "Catalan"
197  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "CatalanExtra.nsh" ${VLC_LANGFILE_FALLBACK}
198  !insertmacro MUI_LANGUAGE "Bulgarian"
199  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "BulgarianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
200  !insertmacro MUI_LANGUAGE "Estonian"
201  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "EstonianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
202  !insertmacro MUI_LANGUAGE "Lithuanian"
203  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "LithuanianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
204  !insertmacro MUI_LANGUAGE "Basque"
205  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "BasqueExtra.nsh" ${VLC_LANGFILE_FALLBACK}
206  !insertmacro MUI_LANGUAGE "Galician"
207  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "GalicianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
208  !insertmacro MUI_LANGUAGE "Hebrew"
209  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "HebrewExtra.nsh" ${VLC_LANGFILE_FALLBACK}
210  !insertmacro MUI_LANGUAGE "Slovenian"
211  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "SlovenianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
212  !insertmacro MUI_LANGUAGE "Afrikaans"
213  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "AfrikaansExtra.nsh" ${VLC_LANGFILE_FALLBACK}
214  !insertmacro MUI_LANGUAGE "Albanian"
215  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "AlbanianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
216  !insertmacro MUI_LANGUAGE "Croatian"
217  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "CroatianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
218  !insertmacro MUI_LANGUAGE "Icelandic"
219  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "IcelandicExtra.nsh" ${VLC_LANGFILE_FALLBACK}
220  !insertmacro MUI_LANGUAGE "Latvian"
221  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "LatvianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
222  !insertmacro MUI_LANGUAGE "Indonesian"
223  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "IndonesianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
224  !insertmacro MUI_LANGUAGE "ScotsGaelic"
225  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "ScotsGaelicExtra.nsh" ${VLC_LANGFILE_FALLBACK}
226  !insertmacro MUI_LANGUAGE "Breton"
227  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "BretonExtra.nsh" ${VLC_LANGFILE_FALLBACK}
228  !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
229  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "NorwegianNynorskExtra.nsh" ${VLC_LANGFILE_FALLBACK}
230  !insertmacro MUI_LANGUAGE "Asturian"
231  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "AsturianExtra.nsh" ${VLC_LANGFILE_FALLBACK}
232  !insertmacro MUI_LANGUAGE "Corsican"
233  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "CorsicanExtra.nsh" ${VLC_LANGFILE_FALLBACK}
234  !insertmacro MUI_LANGUAGE "Hindi"
235  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "HindiExtra.nsh" ${VLC_LANGFILE_FALLBACK}
236  !insertmacro MUI_LANGUAGE "Vietnamese"
237  !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "VietnameseExtra.nsh" ${VLC_LANGFILE_FALLBACK}
238
239; Reserve files for solid compression
240  !insertmacro MUI_RESERVEFILE_LANGDLL
241
242;;;;;;;;;;;;;;;;;;;;;;;
243; Macro and Functions ;
244;;;;;;;;;;;;;;;;;;;;;;;
245
246!include helpers\extensions.nsh
247!include helpers\install.nsh
248!include helpers\utils.nsh
249
250;;;;;;;;;;;;;;;;;;;;;;
251; Installer sections ;
252; The CORE of the    ;
253; installer          ;
254;;;;;;;;;;;;;;;;;;;;;;
255
256${MementoSection} "$(Name_Section01)" SEC01
257  SectionIn 1 2 3 RO
258  SetShellVarContext all
259  SetOutPath "$INSTDIR"
260
261  DetailPrint "$(Detail_CheckProcesses)"
262  Call CheckRunningProcesses
263
264  ; Remove 32 bit version first
265  !ifdef VLC_64BIT_INSTALLER
266  ${If} $32bitPath != ""
267    ; Run uninstaller
268    ClearErrors
269    ExecWait '"$32bitUninstaller" /S _?=$32bitPath'
270
271    ; If uninstall was not successfull, do not continue.
272    ; This happens for example if the user cancels the uninstaller.
273    ${If} ${Errors}
274      Goto skip_uninstall32_cleanup
275    ${EndIf}
276
277    ${If} ${FileExists} "$32bitUninstaller"
278      Delete "$32bitUninstaller"
279      RMDir "$32bitPath"
280    ${EndIf}
281  ${EndIf}
282  !endif
283
284skip_uninstall32_cleanup:
285
286  ; Remove previous version first, if this is update
287  ${If} $ReinstallType == "1"
288    FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
289    UninstallLoop:
290      ClearErrors
291      FileRead $UninstallLog $R0
292      IfErrors UninstallEnd
293      Push $R0
294      Call TrimNewLines
295      Pop $R0
296      Delete "$INSTDIR\$R0"
297      Goto UninstallLoop
298    UninstallEnd:
299    FileClose $UninstallLog
300    Delete "$INSTDIR\uninstall.log"
301    Delete "$INSTDIR\uninstall.exe"
302    Push "\"
303    Call RemoveEmptyDirs
304  ${EndIf}
305
306  !insertmacro OpenUninstallLog
307
308  ; VLC.exe, libvlc.dll
309  !insertmacro InstallFile vlc.exe
310  !insertmacro InstallFile vlc-cache-gen.exe
311
312  ; All dlls
313  !insertmacro InstallFile *.dll
314
315  ; Text files
316  !insertmacro InstallFile *.txt
317
318  ; Subfolders
319  !insertmacro InstallFolder plugins
320  !insertmacro InstallFolderOptional locale
321  !insertmacro InstallFolder hrtfs
322@BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
323@BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
324
325  ; Generate the cache and add it to uninstall.log
326  nsExec::ExecToStack '"$INSTDIR\vlc-cache-gen.exe" $INSTDIR\plugins'
327  FindFirst $0 $1 "$INSTDIR\plugins\*.dat"
328  FileWrite $UninstallLog "plugins\$1$\r$\n"
329  FindClose $0
330
331
332  ; URLs
333  WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
334  FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
335  WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}/doc/"
336  FileWrite $UninstallLog "Documentation.url$\r$\n"
337  WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}/vlc/skins.php"
338  FileWrite $UninstallLog "New_Skins.url$\r$\n"
339
340  !insertmacro CloseUninstallLog
341
342  ; Add VLC to "recommended programs" for the following extensions
343  WriteRegStr HKCR Applications\vlc.exe "" ""
344  WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
345  WriteRegStr HKCR Applications\vlc.exe\shell\Open "" "$(ContextMenuEntry_PlayWith)"
346  WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
347  !insertmacro MacroAllExtensions RegisterExtensionMacro
348  !insertmacro MacroSkinExtensions RegisterSkinExtensionMacro
349
350  ; Add VLC to "App Paths" to run VLC from ShellExecute/ShellExecuteEx/run dialog without giving a full path
351  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\vlc.exe" "" "$INSTDIR\vlc.exe"
352  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\vlc.exe" "Path" "$INSTDIR"
353
354  ; Windows default programs Registration
355  ; Vista and above detection
356  ${If} ${AtLeastWinVista}
357    WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
358    WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
359    WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
360    WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
361    WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
362    WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
363    WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
364    WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
365  ${EndIf}
366${MementoSectionEnd}
367
368${MementoSection} "$(Name_Section02a)" SEC02a
369  SectionIn 1 2 3
370  CreateDirectory "$SMPROGRAMS\VideoLAN"
371  CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
372    "$INSTDIR\vlc.exe" ""
373  CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player skinned.lnk" \
374    "$INSTDIR\vlc.exe" "-Iskins"
375  CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
376    "$INSTDIR\Documentation.url"
377  CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
378    "$INSTDIR\NEWS.txt" ""
379  CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
380    "$INSTDIR\${PRODUCT_GROUP} Website.url"
381  CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player - reset preferences and cache files.lnk" \
382    "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
383${MementoSectionEnd}
384
385${MementoSection} "$(Name_Section02b)" SEC02b
386  SectionIn 1 2 3
387  CreateShortCut "$DESKTOP\VLC media player.lnk" \
388    "$INSTDIR\vlc.exe" ""
389${MementoSectionEnd}
390
391SectionGroup /e "!$(Name_Section34)"
392!ifdef INSTALL_MOZILLA
393${MementoSection} "$(Name_Section03)" SEC03
394  SectionIn 1 3
395
396  SetOutPath "$INSTDIR"
397  !insertmacro OpenUninstallLog
398  !insertmacro InstallFile npvlc.dll
399  !insertmacro CloseUninstallLog
400
401  !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
402  WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
403  WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
404  WriteRegStr HKLM ${Moz} "Product" "VLC media player"
405  WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
406  WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
407${MementoSectionEnd}
408!endif
409
410!ifdef INSTALL_ACTIVEX
411${MementoSection} "$(Name_Section04)" SEC04
412  SectionIn 1 3
413
414  SetOutPath "$INSTDIR"
415  !insertmacro OpenUninstallLog
416  !insertmacro InstallFile axvlc.dll
417  !insertmacro CloseUninstallLog
418@HAVE_WIN64_FALSE@ RegDLL "$INSTDIR\axvlc.dll"
419@HAVE_WIN64_TRUE@  ExecWait 'regsvr32.exe /s "$INSTDIR\axvlc.dll"'
420${MementoSectionEnd}
421!endif
422SectionGroupEnd
423
424
425${MementoSection} "$(Name_Section05)" SEC05
426  SectionIn 1 2 3
427  WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "$(ContextMenuEntry_PlayWith)"
428  WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
429    '"$INSTDIR\vlc.exe" --started-from-file cdda:///%1'
430  WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "$(ContextMenuEntry_PlayWith)"
431  WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
432    '"$INSTDIR\vlc.exe" --started-from-file dvd:///%1'
433
434  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
435  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "$(Action_OnArrivalDVD)"
436  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
437  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
438  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "Open"
439  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
440
441  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
442  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "$(Action_OnArrivalAudioCD)"
443  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
444  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
445  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "Open"
446  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
447
448  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival" ""
449  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Action" "$(Action_OnArrivalVCDMovie)"
450  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
451  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeProgID" "VLC.VCDMovie"
452  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeVerb" "Open"
453  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
454
455  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival" ""
456  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Action" "$(Action_OnArrivalSVCDMovie)"
457  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
458  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeProgID" "VLC.SVCDMovie"
459  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeVerb" "Open"
460  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
461
462  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival" ""
463  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Action" "$(Action_OnArrivalDVDAudio)"
464  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
465  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeProgID" "VLC.OPENFolder"
466  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeVerb" "Open"
467  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Provider" "VideoLAN VLC media player"
468
469  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival" ""
470  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Action" "$(Action_OnArrivalVideoFiles)"
471  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
472  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
473  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeVerb" "Open"
474  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Provider" "VideoLAN VLC media player"
475
476  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival" ""
477  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Action" "$(Action_OnArrivalMusicFiles)"
478  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
479  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
480  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeVerb" "Open"
481  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Provider" "VideoLAN VLC media player"
482
483  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayBlurayOnArrival" "VLCPlayBlurayOnArrival" ""
484  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "Action" "$(Action_OnArrivalBluray)"
485  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
486  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "InvokeProgID" "VLC.Bluray"
487  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "InvokeVerb" "Open"
488  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "Provider" "VideoLAN VLC media player"
489
490  WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
491  WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
492  WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
493    '"$INSTDIR\vlc.exe" --started-from-file dvd:///%1'
494  WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
495
496  WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
497  WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
498  WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
499    '"$INSTDIR\vlc.exe" --started-from-file cdda:///%1'
500  WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
501
502  WriteRegStr HKCR "VLC.VCDMovie" "" "VLC VCD Movie"
503  WriteRegStr HKCR "VLC.VCDMovie\shell" "" "Open"
504  WriteRegStr HKCR "VLC.VCDMovie\shell\Open\command" "" \
505     '"$INSTDIR\vlc.exe" --started-from-file vcd:///%1'
506  WriteRegStr HKCR "VLC.VCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
507
508  WriteRegStr HKCR "VLC.SVCDMovie" "" "VLC SVCD Movie"
509  WriteRegStr HKCR "VLC.SVCDMovie\shell" "" "Open"
510  WriteRegStr HKCR "VLC.SVCDMovie\shell\Open\command" "" \
511     '"$INSTDIR\vlc.exe" --started-from-file vcd:///%1'
512  WriteRegStr HKCR "VLC.SVCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
513
514  WriteRegStr HKCR "VLC.OPENFolder" "" "VLC Play content"
515  WriteRegStr HKCR "VLC.OPENFolder\shell" "" "Open"
516  WriteRegStr HKCR "VLC.OPENFolder\shell\Open\command" "" \
517     '"$INSTDIR\vlc.exe" %1'
518  WriteRegStr HKCR "VLC.OPENFolder\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
519
520  WriteRegStr HKCR "VLC.Bluray" "" "VLC Bluray"
521  WriteRegStr HKCR "VLC.Bluray\shell" "" "Open"
522  WriteRegStr HKCR "VLC.Bluray\shell\Open\command" "" \
523    '"$INSTDIR\vlc.exe" --started-from-file bluray:///%1'
524  WriteRegStr HKCR "VLC.Bluray\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
525
526${MementoSectionEnd}
527
528
529SectionGroup /e "!$(Name_Section06)" SEC06
530  SectionGroup "$(Name_SectionGroupAudio)"
531    !insertmacro MacroAudioExtensions AssociateExtensionSection
532  SectionGroupEnd
533  SectionGroup "$(Name_SectionGroupVideo)"
534    !insertmacro MacroVideoExtensions AssociateExtensionSection
535  SectionGroupEnd
536  SectionGroup "$(Name_SectionGroupOther)"
537    !insertmacro MacroOtherExtensions AssociateExtensionSection
538    !insertmacro MacroSkinExtensions AssociateSkinExtensionSection
539    !insertmacro MacroUnassociatedExtensions AssociateExtensionUnselectedSection
540  SectionGroupEnd
541SectionGroupEnd
542
543${MementoSection} "$(Name_Section07)" SEC07
544  SectionIn 1 3
545  !insertmacro MacroAllExtensions AddContextMenu
546  !insertmacro AddContextMenuExt "Directory"
547${MementoSectionEnd}
548
549${MementoUnselectedSection} "$(Name_Section08)" SEC08
550  !insertmacro delprefs
551${MementoSectionEnd}
552
553${MementoSectionDone}
554
555; Installer section descriptions
556!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
557  !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "$(Desc_Section01)"
558  !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} "$(Desc_Section02a)"
559  !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} "$(Desc_Section02b)"
560!ifdef INSTALL_MOZILLA
561  !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "$(Desc_Section03)"
562!endif
563!ifdef INSTALL_ACTIVEX
564  !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "$(Desc_Section04)"
565!endif
566  !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "$(Desc_Section05)"
567  !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} "$(Desc_Section06)"
568  !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} "$(Desc_Section07)"
569  !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} "$(Desc_Section08)"
570!insertmacro MUI_FUNCTION_DESCRIPTION_END
571
572;;; Start function
573Function .onInit
574
575@HAVE_WIN64_TRUE@ SetRegView 64
576
577${MementoSectionRestore}
578
579@HAVE_WIN64_TRUE@ !include "x64.nsh"
580@HAVE_WIN64_TRUE@ ${Unless} ${RunningX64}
581@HAVE_WIN64_TRUE@    MessageBox MB_OK|MB_ICONSTOP "This version of VLC only runs on 64-bit operating systems.$\nPlease get the 32-bit version and try again."
582@HAVE_WIN64_TRUE@    Quit
583@HAVE_WIN64_TRUE@ ${EndUnless}
584${If} ${AtLeastWinXP}
585    ${If} ${IsWinXP}
586    ${AndIf} ${AtMostServicePack} 1
587        Goto WinTooOld
588    ${Endif}
589${Else}
590    Goto WinTooOld
591${Endif}
592
593ReadRegStr $INSTDIR HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir"
594StrCmp $INSTDIR "" 0 WinOk
595StrCpy $INSTDIR "$@PROGRAMFILES@\VideoLAN\VLC"
596Goto WinOk
597
598WinTooOld:
599    MessageBox MB_OK|MB_ICONSTOP "This version of VLC only runs on Windows XP SP2 and newer."
600    Quit
601
602WinOk:
603  ; /update argument
604  Call ParseCommandline
605
606  ; See if a other bitness VLC version exists
607  !ifdef VLC_64BIT_INSTALLER
608    SetRegView 32
609
610    Call ReadPreviousVersion
611
612    ${If} $PreviousVersion != ""
613      ReadRegStr $32bitUninstaller ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
614      ReadRegStr $32bitPath ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
615      StrCpy $PreviousVersion ""
616    ${EndIf}
617
618    SetRegView lastused
619  !endif
620
621  ; See if previous version exists
622  Call ReadPreviousVersion
623
624  ${If} $PreviousVersion == ""
625    StrCpy $PerformUpdate 0
626  ${Else}
627    Push "${VERSION}"
628    Push $PreviousVersion
629    Call VersionCompare
630
631    ${If} $PreviousVersionState != "newer"
632      StrCpy $PerformUpdate 0
633    ${EndIf}
634  ${EndIf}
635
636  !insertmacro MUI_LANGDLL_DISPLAY
637
638FunctionEnd
639
640;;; Page to upgrade / downgrade or customize the installation
641Function PageReinstall
642  ${If} $PreviousVersion == ""
643    Abort
644  ${EndIf}
645
646  ${If} $PerformUpdate == 1
647    StrCpy $ReinstallType 1
648    Abort
649  ${EndIf}
650
651  nsDialogs::Create /NOUNLOAD 1018
652  Pop $0
653
654  ${If} $PreviousVersionState == "newer"
655
656    !insertmacro MUI_HEADER_TEXT "$(Reinstall_Headline)" "$(Reinstall_HeadlineInstall)"
657    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "$(Reinstall_MessageOlder)"
658    Pop $R0
659    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "$(Reinstall_OptionUpgrade)"
660    Pop $ReinstallUninstallBtn
661    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "$(Reinstall_OptionAdvanced)"
662    Pop $R0
663
664    ${If} $ReinstallType == ""
665      StrCpy $ReinstallType 1
666    ${EndIf}
667
668  ${ElseIf} $PreviousVersionState == "older"
669
670    !insertmacro MUI_HEADER_TEXT "$(Reinstall_Headline)" "$(Reinstall_HeadlineInstall)"
671    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "$(Reinstall_MessageNewer)"
672    Pop $R0
673    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "$(Reinstall_OptionDowngrade)"
674    Pop $ReinstallUninstallBtn
675    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "$(Reinstall_OptionAdvanced)"
676    Pop $R0
677
678    ${If} $ReinstallType == ""
679      StrCpy $ReinstallType 1
680    ${EndIf}
681
682  ${ElseIf} $PreviousVersionState == "same"
683
684    !insertmacro MUI_HEADER_TEXT "$(Reinstall_Headline)" "$(Reinstall_HeadlineMaintenance)"
685    nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 "$(Reinstall_MessageSame)"
686    Pop $R0
687    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_VCENTER}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS}|${WS_GROUP}|${WS_TABSTOP} 0 10 55 100% 30 "$(Reinstall_OptionComponents)"
688    Pop $R0
689    nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 "$(Reinstall_OptionUninstall)"
690    Pop $ReinstallUninstallBtn
691
692    ${If} $ReinstallType == ""
693      StrCpy $ReinstallType 2
694    ${EndIf}
695
696  ${Else}
697
698    MessageBox MB_ICONSTOP "Unknown value of PreviousVersionState, aborting" /SD IDOK
699    Abort
700
701  ${EndIf}
702
703  ${If} $ReinstallType == "1"
704    SendMessage $ReinstallUninstallBtn ${BM_SETCHECK} 1 0
705  ${Else}
706    SendMessage $R0 ${BM_SETCHECK} 1 0
707  ${EndIf}
708
709  nsDialogs::Show
710
711FunctionEnd
712
713Function PageLeaveReinstall
714
715  SendMessage $ReinstallUninstallBtn ${BM_GETCHECK} 0 0 $R0
716  ${If} $R0 == 1
717    ; Option to uninstall old version selected
718    StrCpy $ReinstallType 1
719  ${Else}
720    ; Custom up/downgrade or add/remove/reinstall
721    StrCpy $ReinstallType 2
722  ${EndIf}
723
724  ${If} $ReinstallType == 1
725
726    ${If} $PreviousVersionState == "same"
727
728      Call RunUninstaller
729      Quit
730
731    ${EndIf}
732
733  ${EndIf}
734
735FunctionEnd
736
737Function RunUninstaller
738  ReadRegStr $R1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
739  ${If} $R1 == ""
740    Return
741  ${EndIf}
742
743  ;Run uninstaller
744  HideWindow
745  ClearErrors
746
747  ExecWait '"$R1" _?=$INSTDIR'
748
749  IfErrors no_remove_uninstaller
750
751  IfFileExists "$INSTDIR\uninstall.exe" 0 no_remove_uninstaller
752    Delete "$R1"
753    RMDir $INSTDIR
754
755  no_remove_uninstaller:
756FunctionEnd
757
758Function PageSkipPre
759  ${If} $PerformUpdate == 1
760    Abort
761  ${ElseIf} $PreviousVersion != ""
762    Abort
763  ${EndIf}
764FunctionEnd
765
766;;; Used during upgrade to skip most pages
767Function PageFastUpdatePre
768  ${If} $PerformUpdate == 1
769    Abort
770  ${EndIf}
771FunctionEnd
772
773Function PageComponentsPre
774  ClearErrors
775  ReadRegStr $0 ${MEMENTO_REGISTRY_ROOT} `${MEMENTO_REGISTRY_KEY}` MementoSectionUsed
776  ; Backward compatibility:
777  ; Don't skip the components page until Memento was able to save the user choices.
778  IfErrors done
779
780  ${If} $ReinstallType == 1
781    Abort
782  ${EndIf}
783
784done:
785FunctionEnd
786
787Function PageDirectoryPre
788  ${If} $ReinstallType != ""
789    Abort
790  ${EndIf}
791FunctionEnd
792
793Function .OnInstSuccess
794    ${MementoSectionSave}
795FunctionEnd
796
797;; End function
798Section -Post
799  WriteUninstaller "$INSTDIR\uninstall.exe"
800  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
801  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
802  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
803
804  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
805    "DisplayName" "$(^Name)"
806  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
807    "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
808  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
809    "InstallLocation" "$INSTDIR"
810  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
811    "DisplayIcon" "$INSTDIR\vlc.exe"
812  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
813    "DisplayVersion" "${PRODUCT_VERSION}"
814  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
815    "URLInfoAbout" "${PRODUCT_WEB_SITE}"
816  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
817    "Publisher" "${PRODUCT_PUBLISHER}"
818  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
819    "VersionMajor"  "@VERSION_MAJOR@"
820  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
821    "VersionMinor" "@VERSION_MINOR@"
822SectionEnd
823
824;;;;;;;;;;;;;;;;;;;;;;;;
825; Uninstaller sections ;
826;;;;;;;;;;;;;;;;;;;;;;;;
827
828Section "un.$(Name_Section91)" SEC91
829  SectionIn 1 2 3 RO
830  SetShellVarContext all
831
832  !insertmacro MacroAllExtensions DeleteContextMenu
833  !insertmacro MacroAllExtensions UnRegisterExtensionSection
834  !insertmacro MacroSkinExtensions UnRegisterExtensionSection
835  !insertmacro DeleteContextMenuExt "Directory"
836
837  ;remove activex plugin
838@HAVE_WIN64_FALSE@ UnRegDLL "$INSTDIR\axvlc.dll"
839@HAVE_WIN64_TRUE@  ExecWait 'regsvr32.exe /s /u "$INSTDIR\axvlc.dll"'
840  Delete /REBOOTOK "$INSTDIR\axvlc.dll"
841
842  ;remove mozilla plugin
843  Push $R0
844  Push $R1
845  Push $R2
846
847  !define Index 'Line${__LINE__}'
848  StrCpy $R1 "0"
849
850  "${Index}-Loop:"
851
852    ; Check for Key
853    EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
854    StrCmp $R0 "" "${Index}-End"
855    IntOp $R1 $R1 + 1
856    ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
857    StrCmp $R2 "" "${Index}-Loop" ""
858
859    ; old files (0.8.5 and before) that may be lying around
860    Delete /REBOOTOK "$R2\npvlc.dll"
861    Delete /REBOOTOK "$R2\libvlc.dll"
862    Delete /REBOOTOK "$R2\vlcintf.xpt"
863    Goto "${Index}-Loop"
864
865  "${Index}-End:"
866  !undef Index
867  Delete /REBOOTOK "$INSTDIR\npvlc.dll"
868
869  RMDir "$SMPROGRAMS\VideoLAN"
870  RMDir /r $SMPROGRAMS\VideoLAN
871
872  FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
873  UninstallLoop:
874    ClearErrors
875    FileRead $UninstallLog $R0
876    IfErrors UninstallEnd
877    Push $R0
878    Call un.TrimNewLines
879    Pop $R0
880    Delete "$INSTDIR\$R0"
881    Goto UninstallLoop
882  UninstallEnd:
883  FileClose $UninstallLog
884  Delete "$INSTDIR\uninstall.log"
885  Delete "$INSTDIR\uninstall.exe"
886  Push "\"
887  Call un.RemoveEmptyDirs
888  RMDir "$INSTDIR"
889
890  DeleteRegKey HKLM Software\VideoLAN
891
892  DeleteRegKey HKCR Applications\vlc.exe
893  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\vlc.exe"
894  DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
895  DeleteRegKey HKCR DVD\shell\PlayWithVLC
896  DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
897  DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
898  DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
899  DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
900  DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival"
901  DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival
902  DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival"
903  DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival
904  DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival"
905  DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival
906  DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival"
907  DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival
908  DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival"
909  DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival
910
911  DeleteRegKey HKLM Software\Clients\Media\VLC
912  DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
913  DeleteRegKey HKCR "VLC.MediaFile"
914  DeleteRegKey HKCR "VLC.DVDMovie"
915  DeleteRegKey HKCR "VLC.CDAudio"
916  DeleteRegKey HKCR "VLC.VCDMovie"
917  DeleteRegKey HKCR "VLC.SVCDMovie"
918  DeleteRegKey HKCR "VLC.OPENFolder"
919  DeleteRegKey HKCR "VLC.Bluray"
920
921
922  DeleteRegKey HKLM \
923    "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
924
925  DeleteRegKey HKLM \
926    "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
927
928  Delete "$DESKTOP\VLC media player.lnk"
929
930  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
931  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
932  SetAutoClose true
933SectionEnd
934
935Section /o "un.$(Name_Section92)" SEC92
936  !insertmacro delprefs
937SectionEnd
938
939; Uninstaller section descriptions
940!insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
941  !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} "$(Desc_Section91)"
942  !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} "$(Desc_Section92)"
943!insertmacro MUI_UNFUNCTION_DESCRIPTION_END
944
945Function un.onInit
946
947@HAVE_WIN64_TRUE@ SetRegView 64
948
949  !insertmacro MUI_UNGETLANGUAGE
950
951FunctionEnd
952