NSIS: Enable HiDPI support
[vlc.git] / extras / package / win32 / NSIS / vlc.win32.nsi.in
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; NSIS installer script for vlc ;
3 ; (http://nsis.sourceforge.net) ;
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
6 !include "languages\declaration.nsh"
7
8 !define PRODUCT_NAME "VLC media player"
9 !define VERSION @VERSION@
10 !define PRODUCT_VERSION @VERSION@
11 !define PRODUCT_GROUP "VideoLAN"
12 !define PRODUCT_PUBLISHER "VideoLAN"
13 !define PRODUCT_WEB_SITE "http://www.videolan.org/"
14 !define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
15 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
16 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
17 !define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
18
19 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
20 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
21 !define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
22
23 !define MEMENTO_REGISTRY_ROOT ${PRODUCT_UNINST_ROOT_KEY}
24 !define MEMENTO_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
25
26 !if ! 0x3000000 >= ${NSIS_PACKEDVERSION}
27   ManifestDPIAware true
28 !endif
29
30 !define INSTALL_ACTIVEX
31 !define INSTALL_MOZILLA
32
33 Var ReinstallType
34 Var ReinstallUninstallBtn
35 Var PerformUpdate
36 Var PreviousVersion
37 Var PreviousVersionState
38 Var PreviousInstallDir
39 Var UninstallLog
40
41 ;;;;;;;;;;;;;;;;;;;;;;;;;
42 ; General configuration ;
43 ;;;;;;;;;;;;;;;;;;;;;;;;;
44
45 Name "${PRODUCT_NAME}"
46 @HAVE_WIN64_FALSE@ OutFile ..\vlc-${VERSION}-win32.exe
47 @HAVE_WIN64_TRUE@  OutFile ..\vlc-${VERSION}-win64.exe
48 InstallDir "$@PROGRAMFILES@\VideoLAN\VLC"
49 !ifdef NSIS_LZMA_COMPRESS_WHOLE
50 SetCompressor lzma
51 !else
52 SetCompressor /SOLID lzma
53 !endif
54
55 SetOverwrite ifdiff
56 CRCCheck on
57 BrandingText "${PRODUCT_GROUP} ${PRODUCT_NAME}"
58
59 InstType $Name_InstTypeRecommended
60 InstType $Name_InstTypeMinimum
61 InstType $Name_InstTypeFull
62
63 RequestExecutionLevel admin
64 !addincludedir NSIS
65 !addplugindir NSIS
66 !include UAC.nsh
67 !include nsProcess.nsh
68 !include WinVer.nsh
69 !include FileFunc.nsh
70 !include MUI2.nsh
71 !include Memento.nsh
72
73 !insertmacro GetParameters
74 !insertmacro GetOptions
75
76 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77 ; NSIS Modern User Interface configuration ;
78 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
79
80 ; MUI Settings
81   !define MUI_ABORTWARNING
82   !define MUI_ICON "vlc.ico"
83   !define MUI_UNICON "vlc.ico"
84   !define MUI_COMPONENTSPAGE_SMALLDESC
85
86 ; Installer pages
87   ; Welcome page
88     !define MUI_PAGE_CUSTOMFUNCTION_PRE PageFastUpdatePre
89     !define MUI_WELCOMEPAGE_TITLE_3LINES
90     !insertmacro MUI_PAGE_WELCOME
91   ; Optional update page
92     Page custom PageReinstall PageLeaveReinstall
93   ; License page
94     !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
95     !define MUI_LICENSEPAGE_TEXT_BOTTOM $License_NextText
96     !define MUI_PAGE_CUSTOMFUNCTION_PRE PageSkipPre
97     !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
98   ; Components page
99     !define MUI_PAGE_CUSTOMFUNCTION_PRE PageComponentsPre
100     !insertmacro MUI_PAGE_COMPONENTS
101   ; Directory page
102     !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
103     !insertmacro MUI_PAGE_DIRECTORY
104   ; Instfiles page
105     !insertmacro MUI_PAGE_INSTFILES
106   ; Finish page
107     !define MUI_PAGE_CUSTOMFUNCTION_PRE PageFastUpdatePre
108     !define MUI_FINISHPAGE_RUN
109     !define MUI_FINISHPAGE_RUN_FUNCTION AppExecAs
110     !define MUI_FINISHPAGE_LINK $Link_VisitWebsite
111     !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
112     !define MUI_FINISHPAGE_NOREBOOTSUPPORT
113     !insertmacro MUI_PAGE_FINISH
114
115 ; Uninstaller pages
116     !insertmacro MUI_UNPAGE_CONFIRM
117     !insertmacro MUI_UNPAGE_COMPONENTS
118     !insertmacro MUI_UNPAGE_INSTFILES
119     !insertmacro MUI_UNPAGE_FINISH
120
121 ; Language files
122   !insertmacro MUI_LANGUAGE "English" # first language is the default language
123   !insertmacro MUI_LANGUAGE "French"
124   !insertmacro MUI_LANGUAGE "German"
125   !insertmacro MUI_LANGUAGE "Spanish"
126   !insertmacro MUI_LANGUAGE "SimpChinese"
127   !insertmacro MUI_LANGUAGE "TradChinese"
128   !insertmacro MUI_LANGUAGE "Japanese"
129   !insertmacro MUI_LANGUAGE "Italian"
130   !insertmacro MUI_LANGUAGE "Dutch"
131   !insertmacro MUI_LANGUAGE "Danish"
132   !insertmacro MUI_LANGUAGE "Swedish"
133   !insertmacro MUI_LANGUAGE "Finnish"
134   !insertmacro MUI_LANGUAGE "Russian"
135   !insertmacro MUI_LANGUAGE "Portuguese"
136   !insertmacro MUI_LANGUAGE "PortugueseBR"
137   !insertmacro MUI_LANGUAGE "Welsh"
138   !insertmacro MUI_LANGUAGE "Uzbek"
139   !insertmacro MUI_LANGUAGE "Ukrainian"
140   !insertmacro MUI_LANGUAGE "Turkish"
141   !insertmacro MUI_LANGUAGE "Thai"
142 ;  !insertmacro MUI_LANGUAGE "Sinhala"
143 ;  !insertmacro MUI_LANGUAGE "Scottish_Gaelic"
144   !insertmacro MUI_LANGUAGE "Norwegian"
145   !insertmacro MUI_LANGUAGE "Malay"
146   !insertmacro MUI_LANGUAGE "Korean"
147 ;  !insertmacro MUI_LANGUAGE "Khmer"
148   !insertmacro MUI_LANGUAGE "Greek"
149 ;  !insertmacro MUI_LANGUAGE "English_United_Kingdom"
150   !insertmacro MUI_LANGUAGE "Czech"
151   !insertmacro MUI_LANGUAGE "Bosnian"
152   !insertmacro MUI_LANGUAGE "Arabic"
153   !insertmacro MUI_LANGUAGE "Polish"
154   !insertmacro MUI_LANGUAGE "Romanian"
155   !insertmacro MUI_LANGUAGE "Slovak"
156   !insertmacro MUI_LANGUAGE "Serbian"
157   !insertmacro MUI_LANGUAGE "Hungarian"
158   !insertmacro MUI_LANGUAGE "Catalan"
159   !insertmacro MUI_LANGUAGE "Bulgarian"
160   !insertmacro MUI_LANGUAGE "Estonian"
161   !insertmacro MUI_LANGUAGE "Lithuanian"
162   !insertmacro MUI_LANGUAGE "Basque"
163   !insertmacro MUI_LANGUAGE "Galician"
164   !insertmacro MUI_LANGUAGE "Hebrew"
165   !insertmacro MUI_LANGUAGE "Slovenian"
166
167 ; Reserve files for solid compression
168   !insertmacro MUI_RESERVEFILE_LANGDLL
169
170 ;;;;;;;;;;;;;;;;;;;;;;;
171 ; Macro and Functions ;
172 ;;;;;;;;;;;;;;;;;;;;;;;
173
174 !include helpers\extensions.nsh
175 !include helpers\install.nsh
176 !include helpers\utils.nsh
177
178 ;;;;;;;;;;;;;;;;;;;;;;
179 ; Installer sections ;
180 ; The CORE of the    ;
181 ; installer          ;
182 ;;;;;;;;;;;;;;;;;;;;;;
183
184 ${MementoSection} $Name_Section01 SEC01
185   SectionIn 1 2 3 RO
186   SetShellVarContext all
187   SetOutPath "$INSTDIR"
188
189   DetailPrint $Detail_CheckProcesses
190   Call CheckRunningProcesses
191
192   !insertmacro OpenUninstallLog
193
194   ; VLC.exe, libvlc.dll
195   !insertmacro InstallFile vlc.exe
196   !insertmacro InstallFile vlc-cache-gen.exe
197
198   ; All dlls
199   !insertmacro InstallFile *.dll
200
201   ; Text files
202   !insertmacro InstallFile *.txt
203
204   ; Subfolders
205   !insertmacro InstallFolder plugins
206   !insertmacro InstallFolder locale
207 @BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
208 @BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
209
210   ; Generate the cache and add it to uninstall.log
211   nsExec::ExecToStack '"$INSTDIR\vlc-cache-gen.exe" $INSTDIR\plugins'
212   FindFirst $0 $1 "$INSTDIR\plugins\*.dat"
213   FileWrite $UninstallLog "plugins\$1$\r$\n"
214   FindClose $0
215
216
217   ; URLs
218   WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
219   FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
220   WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}/doc/"
221   FileWrite $UninstallLog "Documentation.url$\r$\n"
222   WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}/vlc/skins.php"
223   FileWrite $UninstallLog "New_Skins.url$\r$\n"
224
225   !insertmacro CloseUninstallLog
226
227   ; Add VLC to "recommended programs" for the following extensions
228   WriteRegStr HKCR Applications\vlc.exe "" ""
229   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
230   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
231   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
232   !insertmacro MacroAllExtensions RegisterExtensionMacro
233   !insertmacro MacroSkinExtensions RegisterSkinExtensionMacro
234
235   ; Add VLC to "App Paths" to run VLC from ShellExecute/ShellExecuteEx/run dialog without giving a full path
236   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\vlc.exe" "" "$INSTDIR\vlc.exe"
237   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\vlc.exe" "Path" "$INSTDIR"
238
239   ; Windows default programs Registration
240   ; Vista and above detection
241   ${If} ${AtLeastWinVista}
242     WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
243     WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
244     WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
245     WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
246     WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
247     WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
248     WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
249     WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
250   ${EndIf}
251 ${MementoSectionEnd}
252
253 ${MementoSection} $Name_Section02a SEC02a
254   SectionIn 1 2 3
255   CreateDirectory "$SMPROGRAMS\VideoLAN"
256   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
257     "$INSTDIR\vlc.exe" ""
258   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player skinned.lnk" \
259     "$INSTDIR\vlc.exe" "-Iskins"
260   CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
261     "$INSTDIR\Documentation.url"
262   CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
263     "$INSTDIR\NEWS.txt" ""
264   CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
265     "$INSTDIR\${PRODUCT_GROUP} Website.url"
266   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player - reset preferences and cache files.lnk" \
267     "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
268 ${MementoSectionEnd}
269
270 ${MementoSection} $Name_Section02b SEC02b
271   SectionIn 1 2 3
272   CreateShortCut "$DESKTOP\VLC media player.lnk" \
273     "$INSTDIR\vlc.exe" ""
274 ${MementoSectionEnd}
275
276 SectionGroup /e !$Name_Section34
277 !ifdef INSTALL_MOZILLA
278 ${MementoSection} $Name_Section03 SEC03
279   SectionIn 1 3
280
281   SetOutPath "$INSTDIR"
282   !insertmacro OpenUninstallLog
283   !insertmacro InstallFile npvlc.dll
284   !insertmacro CloseUninstallLog
285
286   !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
287   WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
288   WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
289   WriteRegStr HKLM ${Moz} "Product" "VLC media player"
290   WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
291   WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
292 ${MementoSectionEnd}
293 !endif
294
295 !ifdef INSTALL_ACTIVEX
296 ${MementoSection} $Name_Section04 SEC04
297   SectionIn 1 3
298
299   SetOutPath "$INSTDIR"
300   !insertmacro OpenUninstallLog
301   !insertmacro InstallFile axvlc.dll
302   !insertmacro CloseUninstallLog
303 @HAVE_WIN64_FALSE@ RegDLL "$INSTDIR\axvlc.dll"
304 @HAVE_WIN64_TRUE@  ExecWait 'regsvr32.exe /s "$INSTDIR\axvlc.dll"'
305 ${MementoSectionEnd}
306 !endif
307 SectionGroupEnd
308
309
310 ${MementoSection} $Name_Section05 SEC05
311   SectionIn 1 2 3
312   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
313   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
314     '"$INSTDIR\vlc.exe" --started-from-file cdda:///%1'
315   WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
316   WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
317     '"$INSTDIR\vlc.exe" --started-from-file dvd:///%1'
318
319   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
320   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
321   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
322   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
323   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "Open"
324   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
325
326   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
327   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
328   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
329   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
330   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "Open"
331   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
332
333   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival" ""
334   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Action" $Action_OnArrivalVCDMovie
335   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
336   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeProgID" "VLC.VCDMovie"
337   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeVerb" "Open"
338   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
339
340   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival" ""
341   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Action" $Action_OnArrivalSVCDMovie
342   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
343   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeProgID" "VLC.SVCDMovie"
344   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeVerb" "Open"
345   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
346
347   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival" ""
348   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Action" $Action_OnArrivalDVDAudio
349   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
350   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeProgID" "VLC.OPENFolder"
351   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeVerb" "Open"
352   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Provider" "VideoLAN VLC media player"
353
354   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival" ""
355   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Action" $Action_OnArrivalVideoFiles
356   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
357   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
358   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeVerb" "Open"
359   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Provider" "VideoLAN VLC media player"
360
361   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival" ""
362   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Action" $Action_OnArrivalMusicFiles
363   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
364   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
365   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeVerb" "Open"
366   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Provider" "VideoLAN VLC media player"
367
368   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayBlurayOnArrival" "VLCPlayBlurayOnArrival" ""
369   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "Action" $Action_OnArrivalBluray
370   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
371   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "InvokeProgID" "VLC.Bluray"
372   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "InvokeVerb" "Open"
373   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayBlurayOnArrival" "Provider" "VideoLAN VLC media player"
374
375   WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
376   WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
377   WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
378     '"$INSTDIR\vlc.exe" --started-from-file dvd:///%1'
379   WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
380
381   WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
382   WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
383   WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
384     '"$INSTDIR\vlc.exe" --started-from-file cdda:///%1'
385   WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
386
387   WriteRegStr HKCR "VLC.VCDMovie" "" "VLC VCD Movie"
388   WriteRegStr HKCR "VLC.VCDMovie\shell" "" "Open"
389   WriteRegStr HKCR "VLC.VCDMovie\shell\Open\command" "" \
390      '"$INSTDIR\vlc.exe" --started-from-file vcd:///%1'
391   WriteRegStr HKCR "VLC.VCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
392
393   WriteRegStr HKCR "VLC.SVCDMovie" "" "VLC SVCD Movie"
394   WriteRegStr HKCR "VLC.SVCDMovie\shell" "" "Open"
395   WriteRegStr HKCR "VLC.SVCDMovie\shell\Open\command" "" \
396      '"$INSTDIR\vlc.exe" --started-from-file vcd:///%1'
397   WriteRegStr HKCR "VLC.SVCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
398
399   WriteRegStr HKCR "VLC.OPENFolder" "" "VLC Play content"
400   WriteRegStr HKCR "VLC.OPENFolder\shell" "" "Open"
401   WriteRegStr HKCR "VLC.OPENFolder\shell\Open\command" "" \
402      '"$INSTDIR\vlc.exe" %1'
403   WriteRegStr HKCR "VLC.OPENFolder\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
404
405   WriteRegStr HKCR "VLC.Bluray" "" "VLC Bluray"
406   WriteRegStr HKCR "VLC.Bluray\shell" "" "Open"
407   WriteRegStr HKCR "VLC.Bluray\shell\Open\command" "" \
408     '"$INSTDIR\vlc.exe" --started-from-file bluray:///%1'
409   WriteRegStr HKCR "VLC.Bluray\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
410
411 ${MementoSectionEnd}
412
413
414 SectionGroup /e !$Name_Section06 SEC06
415   SectionGroup $Name_SectionGroupAudio
416     !insertmacro MacroAudioExtensions AssociateExtensionSection
417   SectionGroupEnd
418   SectionGroup $Name_SectionGroupVideo
419     !insertmacro MacroVideoExtensions AssociateExtensionSection
420   SectionGroupEnd
421   SectionGroup $Name_SectionGroupOther
422     !insertmacro MacroOtherExtensions AssociateExtensionSection
423     !insertmacro MacroSkinExtensions AssociateSkinExtensionSection
424     !insertmacro MacroUnassociatedExtensions AssociateExtensionUnselectedSection
425   SectionGroupEnd
426 SectionGroupEnd
427
428 ${MementoSection} $Name_Section07 SEC07
429   SectionIn 1 3
430   !insertmacro MacroAllExtensions AddContextMenu
431   !insertmacro AddContextMenuExt "Directory"
432 ${MementoSectionEnd}
433
434 ${MementoUnselectedSection} $Name_Section08 SEC08
435   !insertmacro delprefs
436 ${MementoSectionEnd}
437
438 ${MementoSectionDone}
439
440 ; Installer section descriptions
441 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
442   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01
443   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a
444   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b
445 !ifdef INSTALL_MOZILLA
446   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
447 !endif
448 !ifdef INSTALL_ACTIVEX
449   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
450 !endif
451   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
452   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
453   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
454   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08
455 !insertmacro MUI_FUNCTION_DESCRIPTION_END
456
457 ;;; Start function
458 Function .onInit
459
460 @HAVE_WIN64_TRUE@ SetRegView 64
461
462 ${MementoSectionRestore}
463
464 @HAVE_WIN64_TRUE@ !include "x64.nsh"
465 @HAVE_WIN64_TRUE@ ${Unless} ${RunningX64}
466 @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."
467 @HAVE_WIN64_TRUE@    Quit
468 @HAVE_WIN64_TRUE@ ${EndUnless}
469 ${If} ${AtLeastWinXP}
470     ${If} ${IsWinXP}
471     ${AndIf} ${AtMostServicePack} 1
472         Goto WinTooOld
473     ${Endif}
474 ${Else}
475     Goto WinTooOld
476 ${Endif}
477
478 ReadRegStr $INSTDIR HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir"
479 StrCmp $INSTDIR "" 0 UAC_Elevate
480 StrCpy $INSTDIR "$@PROGRAMFILES@\VideoLAN\VLC"
481
482 UAC_Elevate:
483     UAC::RunElevated
484     StrCmp 1223 $0 UAC_ElevationAborted
485     StrCmp 0 $0 0 UAC_Err
486     StrCmp 1 $1 0 UAC_Success
487     Quit
488
489 UAC_Err:
490     MessageBox mb_iconstop "Unable to elevate, error $0$\nPlease try to run this installer with admin privileges."
491     Abort
492
493 UAC_ElevationAborted:
494     MessageBox mb_iconstop "This installer requires admin privileges, aborting!"
495     Abort
496
497 WinTooOld:
498     MessageBox MB_OK|MB_ICONSTOP "This version of VLC only runs on Windows XP SP2 and newer."
499     Quit
500
501 UAC_Success:
502     StrCmp 1 $3 +4
503     StrCmp 3 $1 0 UAC_ElevationAborted
504     MessageBox mb_iconstop "This installer requires admin privileges, try again."
505     goto UAC_Elevate
506
507   ; /update argument
508   Call ParseCommandline
509
510   ; See if previous version exists
511   Call ReadPreviousVersion
512
513   ${If} $PreviousVersion == ""
514     StrCpy $PerformUpdate 0
515   ${Else}
516     Push "${VERSION}"
517     Push $PreviousVersion
518     Call VersionCompare
519
520     ${If} $PreviousVersionState != "newer"
521       StrCpy $PerformUpdate 0
522     ${EndIf}
523   ${EndIf}
524
525   !insertmacro MUI_LANGDLL_DISPLAY
526
527   !include "languages\english.nsh"
528   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
529   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
530   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
531   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
532   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
533   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
534   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
535   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
536   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
537   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
538   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
539   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
540   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
541   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
542 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
543 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
544   StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
545   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
546   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
547   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
548   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
549   StrCmp $LANGUAGE ${LANG_SERBIAN} Serbian 0
550   StrCmp $LANGUAGE ${LANG_RUSSIAN} Russian 0
551   StrCmp $LANGUAGE ${LANG_HEBREW} Hebrew 0
552   StrCmp $LANGUAGE ${LANG_GALICIAN} Galician 0
553   StrCmp $LANGUAGE ${LANG_SWEDISH} Swedish 0
554   StrCmp $LANGUAGE ${LANG_ARABIC} Arabic 0
555   StrCmp $LANGUAGE ${LANG_BOSNIAN} Bosnian 0
556   StrCmp $LANGUAGE ${LANG_CZECH} Czech 0
557 ;  StrCmp $LANGUAGE ${LANG_ENGLISH_UNITED_KINGDOM} English_United_Kingdom 0
558   StrCmp $LANGUAGE ${LANG_GREEK} Greek 0
559 ;  StrCmp $LANGUAGE ${LANG_KHMER} Khmer 0
560   StrCmp $LANGUAGE ${LANG_KOREAN} Korean 0
561   StrCmp $LANGUAGE ${LANG_MALAY} Malay 0
562   StrCmp $LANGUAGE ${LANG_NORWEGIAN} Norwegian 0
563 ;  StrCmp $LANGUAGE ${LANG_SCOTTISH_GAELIC} Scottish_Gaelic 0
564 ;  StrCmp $LANGUAGE ${LANG_SINHALA} Sinhala 0
565   StrCmp $LANGUAGE ${LANG_THAI} Thai 0
566   StrCmp $LANGUAGE ${LANG_TRADCHINESE} TradChinese 0
567   StrCmp $LANGUAGE ${LANG_TURKISH} Turkish 0
568   StrCmp $LANGUAGE ${LANG_UKRAINIAN} Ukrainian 0
569   StrCmp $LANGUAGE ${LANG_UZBEK} Uzbek 0
570   StrCmp $LANGUAGE ${LANG_WELSH} Welsh 0
571   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
572   French:
573   !include "languages\french.nsh"
574   Goto EndLanguageCmp
575   German:
576   !include "languages\german.nsh"
577   Goto EndLanguageCmp
578   Italian:
579   !include "languages\italian.nsh"
580   Goto EndLanguageCmp
581   Hungarian:
582   !include "languages\hungarian.nsh"
583   Goto EndLanguageCmp
584   Romanian:
585   !include "languages\romanian.nsh"
586   Goto EndLanguageCmp
587   Catalan:
588   !include "languages\catalan.nsh"
589   Goto EndLanguageCmp
590   Bulgarian:
591   !include "languages\bulgarian.nsh"
592   Goto EndLanguageCmp
593   Slovak:
594   !include "languages\slovak.nsh"
595   Goto EndLanguageCmp
596   Polish:
597   !include "languages\polish.nsh"
598   Goto EndLanguageCmp
599   Dutch:
600   !include "languages\dutch.nsh"
601   Goto EndLanguageCmp
602   Danish:
603   !include "languages\danish.nsh"
604   Goto EndLanguageCmp
605   Schinese:
606   !include "languages\schinese.nsh"
607   Goto EndLanguageCmp
608   Finnish:
609   !include "languages\finnish.nsh"
610   Goto EndLanguageCmp
611   Japanese:
612   !include "languages\japanese.nsh"
613   Goto EndLanguageCmp
614 ;  Bengali:
615 ;  !include "languages\bengali.nsh"
616 ;  Goto EndLanguageCmp
617 ;  Punjabi:
618 ;  !include "languages\punjabi.nsh"
619 ;  Goto EndLanguageCmp
620   Slovenian:
621   !include "languages\slovenian.nsh"
622   Goto EndLanguageCmp
623   Spanish:
624   !include "languages\spanish.nsh"
625   Goto EndLanguageCmp
626   Estonian:
627   !include "languages\estonian.nsh"
628   Goto EndLanguageCmp
629   Lithuanian:
630   !include "languages\lithuanian.nsh"
631   Goto EndLanguageCmp
632   Basque:
633   !include "languages\basque.nsh"
634   Goto EndLanguageCmp
635   Serbian:
636   !include "languages\serbian.nsh"
637   Goto EndLanguageCmp
638   Russian:
639   !include "languages\Russian.nsh"
640   Goto EndLanguageCmp
641   Hebrew:
642   !include "languages\hebrew.nsh"
643   Goto EndLanguageCmp
644   Galician:
645   !include "languages\galician.nsh"
646   Goto EndLanguageCmp
647   Swedish:
648   !include "languages\swedish.nsh"
649   Goto EndLanguageCmp
650   Arabic:
651   !include "languages\arabic.nsh"
652   Goto EndLanguageCmp
653   Bosnian:
654   !include "languages\bosnian.nsh"
655   Goto EndLanguageCmp
656   Czech:
657   !include "languages\czech.nsh"
658   Goto EndLanguageCmp
659 ;  English_United_Kingdom:
660 ;  !include "languages\english_united_kingdom.nsh"
661 ;  Goto EndLanguageCmp
662   Greek:
663   !include "languages\greek.nsh"
664   Goto EndLanguageCmp
665 ;  Khmer:
666 ;  !include "languages\khmer.nsh"
667 ;  Goto EndLanguageCmp
668   Korean:
669   !include "languages\korean.nsh"
670   Goto EndLanguageCmp
671   Malay:
672   !include "languages\malay.nsh"
673   Goto EndLanguageCmp
674   Norwegian:
675   !include "languages\norwegian.nsh"
676   Goto EndLanguageCmp
677 ;  Scottish_Gaelic:
678 ;  !include "languages\scottish_gaelic.nsh"
679 ;  Goto EndLanguageCmp
680 ;  Sinhala:
681 ;  !include "languages\sinhala.nsh"
682 ;  Goto EndLanguageCmp
683   Thai:
684   !include "languages\thai.nsh"
685   Goto EndLanguageCmp
686   TradChinese:
687   !include "languages\tradchinese.nsh"
688   Goto EndLanguageCmp
689   Turkish:
690   !include "languages\turkish.nsh"
691   Goto EndLanguageCmp
692   Ukrainian:
693   !include "languages\ukrainian.nsh"
694   Goto EndLanguageCmp
695   Uzbek:
696   !include "languages\uzbek.nsh"
697   Goto EndLanguageCmp
698   Welsh:
699   !include "languages\welsh.nsh"
700   Goto EndLanguageCmp
701   Brazilian:
702   !include "languages\brazilian_portuguese.nsh"
703   EndLanguageCmp:
704
705 FunctionEnd
706
707 ;;; Page to upgrade / downgrade or customize the installation
708 Function PageReinstall
709   ${If} $PreviousVersion == ""
710     Abort
711   ${EndIf}
712
713   ${If} $PerformUpdate == 1
714     StrCpy $ReinstallType 1
715     Abort
716   ${EndIf}
717
718   nsDialogs::Create /NOUNLOAD 1018
719   Pop $0
720
721   ${If} $PreviousVersionState == "newer"
722
723     !insertmacro MUI_HEADER_TEXT $Reinstall_Headline $Reinstall_HeadlineInstall
724     nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 $Reinstall_MessageOlder
725     Pop $R0
726     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
727     Pop $ReinstallUninstallBtn
728     nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 $Reinstall_OptionAdvanced
729     Pop $R0
730
731     ${If} $ReinstallType == ""
732       StrCpy $ReinstallType 1
733     ${EndIf}
734
735   ${ElseIf} $PreviousVersionState == "older"
736
737     !insertmacro MUI_HEADER_TEXT $Reinstall_Headline $Reinstall_HeadlineInstall
738     nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 $Reinstall_MessageNewer
739     Pop $R0
740     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
741     Pop $ReinstallUninstallBtn
742     nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 $Reinstall_OptionAdvanced
743     Pop $R0
744
745     ${If} $ReinstallType == ""
746       StrCpy $ReinstallType 1
747     ${EndIf}
748
749   ${ElseIf} $PreviousVersionState == "same"
750
751     !insertmacro MUI_HEADER_TEXT $Reinstall_Headline $Reinstall_HeadlineMaintenance
752     nsDialogs::CreateItem /NOUNLOAD STATIC ${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 0 0 100% 40 $Reinstall_MessageSame
753     Pop $R0
754     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
755     Pop $R0
756     nsDialogs::CreateItem /NOUNLOAD BUTTON ${BS_AUTORADIOBUTTON}|${BS_TOP}|${BS_MULTILINE}|${WS_VISIBLE}|${WS_CHILD}|${WS_CLIPSIBLINGS} 0 10 85 100% 50 $Reinstall_OptionUninstall
757     Pop $ReinstallUninstallBtn
758
759     ${If} $ReinstallType == ""
760       StrCpy $ReinstallType 2
761     ${EndIf}
762
763   ${Else}
764
765     MessageBox MB_ICONSTOP "Unknown value of PreviousVersionState, aborting" /SD IDOK
766     Abort
767
768   ${EndIf}
769
770   ${If} $ReinstallType == "1"
771     SendMessage $ReinstallUninstallBtn ${BM_SETCHECK} 1 0
772   ${Else}
773     SendMessage $R0 ${BM_SETCHECK} 1 0
774   ${EndIf}
775
776   nsDialogs::Show
777
778 FunctionEnd
779
780 Function PageLeaveReinstall
781
782   SendMessage $ReinstallUninstallBtn ${BM_GETCHECK} 0 0 $R0
783   ${If} $R0 == 1
784     ; Option to uninstall old version selected
785     StrCpy $ReinstallType 1
786   ${Else}
787     ; Custom up/downgrade or add/remove/reinstall
788     StrCpy $ReinstallType 2
789   ${EndIf}
790
791   ${If} $ReinstallType == 1
792
793     ${If} $PreviousVersionState == "same"
794
795       Call RunUninstaller
796       Quit
797
798     ${EndIf}
799
800   ${EndIf}
801
802 FunctionEnd
803
804 Function RunUninstaller
805   ReadRegStr $R1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
806   ${If} $R1 == ""
807     Return
808   ${EndIf}
809
810   ;Run uninstaller
811   HideWindow
812   ClearErrors
813
814   ExecWait '"$R1" _?=$INSTDIR'
815
816   IfErrors no_remove_uninstaller
817
818   IfFileExists "$INSTDIR\uninstall.exe" 0 no_remove_uninstaller
819     Delete "$R1"
820     RMDir $INSTDIR
821
822   no_remove_uninstaller:
823 FunctionEnd
824
825 Function PageSkipPre
826   ${If} $PerformUpdate == 1
827     Abort
828   ${ElseIf} $PreviousVersion != ""
829     Abort
830   ${EndIf}
831 FunctionEnd
832
833 ;;; Used during upgrade to skip most pages
834 Function PageFastUpdatePre
835   ${If} $PerformUpdate == 1
836     Abort
837   ${EndIf}
838 FunctionEnd
839
840 Function PageComponentsPre
841   ClearErrors
842   ReadRegStr $0 ${MEMENTO_REGISTRY_ROOT} `${MEMENTO_REGISTRY_KEY}` MementoSectionUsed
843   ; Backward compatibility:
844   ; Don't skip the components page until Memento was able to save the user choices.
845   IfErrors done
846
847   ${If} $ReinstallType == 1
848     Abort
849   ${EndIf}
850
851 done:
852 FunctionEnd
853
854 Function PageDirectoryPre
855   ${If} $ReinstallType != ""
856     Abort
857   ${EndIf}
858 FunctionEnd
859
860 Function .OnInstFailed
861     UAC::Unload
862 FunctionEnd
863
864 Function .OnInstSuccess
865     ${MementoSectionSave}
866     UAC::Unload
867 FunctionEnd
868
869 ;; End function
870 Section -Post
871   WriteUninstaller "$INSTDIR\uninstall.exe"
872   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
873   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
874   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
875
876   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
877     "DisplayName" "$(^Name)"
878   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
879     "UninstallString" "$INSTDIR\uninstall.exe"
880   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
881     "InstallLocation" "$INSTDIR"
882   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
883     "DisplayIcon" "$INSTDIR\vlc.exe"
884   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
885     "DisplayVersion" "${PRODUCT_VERSION}"
886   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
887     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
888   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
889     "Publisher" "${PRODUCT_PUBLISHER}"
890   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
891     "VersionMajor"  "@VERSION_MAJOR@"
892   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
893     "VersionMinor" "@VERSION_MINOR@"
894 SectionEnd
895
896 ;;;;;;;;;;;;;;;;;;;;;;;;
897 ; Uninstaller sections ;
898 ;;;;;;;;;;;;;;;;;;;;;;;;
899
900 Section "un.$Name_Section91" SEC91
901   SectionIn 1 2 3 RO
902   SetShellVarContext all
903
904   !insertmacro MacroAllExtensions DeleteContextMenu
905   !insertmacro MacroAllExtensions UnRegisterExtensionSection
906   !insertmacro MacroSkinExtensions UnRegisterExtensionSection
907   !insertmacro DeleteContextMenuExt "Directory"
908
909   ;remove activex plugin
910 @HAVE_WIN64_FALSE@ UnRegDLL "$INSTDIR\axvlc.dll"
911 @HAVE_WIN64_TRUE@  ExecWait 'regsvr32.exe /s /u "$INSTDIR\axvlc.dll"'
912   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
913
914   ;remove mozilla plugin
915   Push $R0
916   Push $R1
917   Push $R2
918
919   !define Index 'Line${__LINE__}'
920   StrCpy $R1 "0"
921
922   "${Index}-Loop:"
923
924     ; Check for Key
925     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
926     StrCmp $R0 "" "${Index}-End"
927     IntOp $R1 $R1 + 1
928     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
929     StrCmp $R2 "" "${Index}-Loop" ""
930
931     ; old files (0.8.5 and before) that may be lying around
932     Delete /REBOOTOK "$R2\npvlc.dll"
933     Delete /REBOOTOK "$R2\libvlc.dll"
934     Delete /REBOOTOK "$R2\vlcintf.xpt"
935     Goto "${Index}-Loop"
936
937   "${Index}-End:"
938   !undef Index
939   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
940
941   RMDir "$SMPROGRAMS\VideoLAN"
942   RMDir /r $SMPROGRAMS\VideoLAN
943
944   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
945   UninstallLoop:
946     ClearErrors
947     FileRead $UninstallLog $R0
948     IfErrors UninstallEnd
949     Push $R0
950     Call un.TrimNewLines
951     Pop $R0
952     Delete "$INSTDIR\$R0"
953     Goto UninstallLoop
954   UninstallEnd:
955   FileClose $UninstallLog
956   Delete "$INSTDIR\uninstall.log"
957   Delete "$INSTDIR\uninstall.exe"
958   Push "\"
959   Call un.RemoveEmptyDirs
960   RMDir "$INSTDIR"
961
962   DeleteRegKey HKLM Software\VideoLAN
963
964   DeleteRegKey HKCR Applications\vlc.exe
965   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\vlc.exe"
966   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
967   DeleteRegKey HKCR DVD\shell\PlayWithVLC
968   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
969   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
970   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
971   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
972   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival"
973   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival
974   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival"
975   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival
976   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival"
977   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival
978   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival"
979   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival
980   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival"
981   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival
982
983   DeleteRegKey HKLM Software\Clients\Media\VLC
984   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
985   DeleteRegKey HKCR "VLC.MediaFile"
986   DeleteRegKey HKCR "VLC.DVDMovie"
987   DeleteRegKey HKCR "VLC.CDAudio"
988   DeleteRegKey HKCR "VLC.VCDMovie"
989   DeleteRegKey HKCR "VLC.SVCDMovie"
990   DeleteRegKey HKCR "VLC.OPENFolder"
991   DeleteRegKey HKCR "VLC.Bluray"
992
993
994   DeleteRegKey HKLM \
995     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
996
997   DeleteRegKey HKLM \
998     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
999
1000   Delete "$DESKTOP\VLC media player.lnk"
1001
1002   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
1003   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
1004   SetAutoClose true
1005 SectionEnd
1006
1007 Section /o "un.$Name_Section92" SEC92
1008   !insertmacro delprefs
1009 SectionEnd
1010
1011 ; Uninstaller section descriptions
1012 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1013   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
1014   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
1015 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1016
1017 Function un.OnUnInstFailed
1018     UAC::Unload
1019 FunctionEnd
1020
1021 Function un.OnUnInstSuccess
1022     UAC::Unload
1023     Delete "$INSTDIR\UAC.dll"
1024 FunctionEnd
1025
1026 Function un.onInit
1027
1028 UAC_Elevate:
1029     UAC::RunElevated
1030     StrCmp 1223 $0 UAC_ElevationAborted
1031     StrCmp 0 $0 0 UAC_Err
1032     StrCmp 1 $1 0 UAC_Success
1033     Quit
1034
1035 UAC_Err:
1036     MessageBox mb_iconstop "Unable to elevate, error $0$\nPlease try to run this installer with admin privileges."
1037     Abort
1038
1039 UAC_ElevationAborted:
1040     MessageBox mb_iconstop "This installer requires admin privileges, aborting!"
1041     Abort
1042
1043 UAC_Success:
1044 @HAVE_WIN64_TRUE@ SetRegView 64
1045     StrCmp 1 $3 +4
1046     StrCmp 3 $1 0 UAC_ElevationAborted
1047     MessageBox mb_iconstop "This installer requires admin privileges, try again."
1048     goto UAC_Elevate
1049
1050   !insertmacro MUI_UNGETLANGUAGE
1051
1052   !include "languages\english.nsh"
1053   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
1054   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
1055   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
1056   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
1057   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
1058   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
1059   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
1060   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
1061   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
1062   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
1063   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
1064   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
1065   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
1066   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
1067 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
1068 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
1069   StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
1070   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
1071   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
1072   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
1073   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
1074   StrCmp $LANGUAGE ${LANG_SERBIAN} Serbian 0
1075   StrCmp $LANGUAGE ${LANG_RUSSIAN} Russian 0
1076   StrCmp $LANGUAGE ${LANG_HEBREW} Hebrew 0
1077   StrCmp $LANGUAGE ${LANG_GALICIAN} Galician 0
1078   StrCmp $LANGUAGE ${LANG_SWEDISH} Swedish 0
1079   StrCmp $LANGUAGE ${LANG_ARABIC} Arabic 0
1080   StrCmp $LANGUAGE ${LANG_BOSNIAN} Bosnian 0
1081   StrCmp $LANGUAGE ${LANG_CZECH} Czech 0
1082 ;  StrCmp $LANGUAGE ${LANG_ENGLISH_UNITED_KINGDOM} English_United_Kingdom 0
1083   StrCmp $LANGUAGE ${LANG_GREEK} Greek 0
1084 ;  StrCmp $LANGUAGE ${LANG_KHMER} Khmer 0
1085   StrCmp $LANGUAGE ${LANG_KOREAN} Korean 0
1086   StrCmp $LANGUAGE ${LANG_MALAY} Malay 0
1087   StrCmp $LANGUAGE ${LANG_NORWEGIAN} Norwegian 0
1088 ;  StrCmp $LANGUAGE ${LANG_SCOTTISH_GAELIC} Scottish_Gaelic 0
1089 ;  StrCmp $LANGUAGE ${LANG_SINHALA} Sinhala 0
1090   StrCmp $LANGUAGE ${LANG_THAI} Thai 0
1091   StrCmp $LANGUAGE ${LANG_TRADCHINESE} TradChinese 0
1092   StrCmp $LANGUAGE ${LANG_TURKISH} Turkish 0
1093   StrCmp $LANGUAGE ${LANG_UKRAINIAN} Ukrainian 0
1094   StrCmp $LANGUAGE ${LANG_UZBEK} Uzbek 0
1095   StrCmp $LANGUAGE ${LANG_WELSH} Welsh 0
1096   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
1097   French:
1098   !include "languages\french.nsh"
1099   Goto EndLanguageCmp
1100   German:
1101   !include "languages\german.nsh"
1102   Goto EndLanguageCmp
1103   Italian:
1104   !include "languages\italian.nsh"
1105   Goto EndLanguageCmp
1106   Hungarian:
1107   !include "languages\hungarian.nsh"
1108   Goto EndLanguageCmp
1109   Romanian:
1110   !include "languages\romanian.nsh"
1111   Goto EndLanguageCmp
1112   Catalan:
1113   !include "languages\catalan.nsh"
1114   Goto EndLanguageCmp
1115   Bulgarian:
1116   !include "languages\bulgarian.nsh"
1117   Goto EndLanguageCmp
1118   Slovak:
1119   !include "languages\slovak.nsh"
1120   Goto EndLanguageCmp
1121   Polish:
1122   !include "languages\polish.nsh"
1123   Goto EndLanguageCmp
1124   Dutch:
1125   !include "languages\dutch.nsh"
1126   Goto EndLanguageCmp
1127   Danish:
1128   !include "languages\danish.nsh"
1129   Goto EndLanguageCmp
1130   Schinese:
1131   !include "languages\schinese.nsh"
1132   Goto EndLanguageCmp
1133   Finnish:
1134   !include "languages\finnish.nsh"
1135   Goto EndLanguageCmp
1136   Japanese:
1137   !include "languages\japanese.nsh"
1138   Goto EndLanguageCmp
1139 ;  Bengali:
1140 ;  !include "languages\bengali.nsh"
1141 ;  Goto EndLanguageCmp
1142 ;  Punjabi:
1143 ;  !include "languages\punjabi.nsh"
1144 ;  Goto EndLanguageCmp
1145   Slovenian:
1146   !include "languages\slovenian.nsh"
1147   Goto EndLanguageCmp
1148   Spanish:
1149   !include "languages\spanish.nsh"
1150   Goto EndLanguageCmp
1151   Estonian:
1152   !include "languages\estonian.nsh"
1153   Goto EndLanguageCmp
1154   Lithuanian:
1155   !include "languages\lithuanian.nsh"
1156   Goto EndLanguageCmp
1157   Basque:
1158   !include "languages\basque.nsh"
1159   Goto EndLanguageCmp
1160   Serbian:
1161   !include "languages\serbian.nsh"
1162   Goto EndLanguageCmp
1163   Russian:
1164   !include "languages\russian.nsh"
1165   Goto EndLanguageCmp
1166   Hebrew:
1167   !include "languages\hebrew.nsh"
1168   Goto EndLanguageCmp
1169   Galician:
1170   !include "languages\galician.nsh"
1171   Goto EndLanguageCmp
1172   Swedish:
1173   !include "languages\swedish.nsh"
1174   Goto EndLanguageCmp
1175   Arabic:
1176   !include "languages\arabic.nsh"
1177   Goto EndLanguageCmp
1178   Bosnian:
1179   !include "languages\bosnian.nsh"
1180   Goto EndLanguageCmp
1181   Czech:
1182   !include "languages\czech.nsh"
1183   Goto EndLanguageCmp
1184 ;  English_United_Kingdom:
1185 ;  !include "languages\english_united_kingdom.nsh"
1186 ;  Goto EndLanguageCmp
1187   Greek:
1188   !include "languages\greek.nsh"
1189   Goto EndLanguageCmp
1190 ;  Khmer:
1191 ;  !include "languages\khmer.nsh"
1192 ;  Goto EndLanguageCmp
1193   Korean:
1194   !include "languages\korean.nsh"
1195   Goto EndLanguageCmp
1196   Malay:
1197   !include "languages\malay.nsh"
1198   Goto EndLanguageCmp
1199   Norwegian:
1200   !include "languages\norwegian.nsh"
1201   Goto EndLanguageCmp
1202 ;  Scottish_Gaelic:
1203 ;  !include "languages\scottish_gaelic.nsh"
1204 ;  Goto EndLanguageCmp
1205 ;  Sinhala:
1206 ;  !include "languages\sinhala.nsh"
1207 ;  Goto EndLanguageCmp
1208   Thai:
1209   !include "languages\thai.nsh"
1210   Goto EndLanguageCmp
1211   TradChinese:
1212   !include "languages\tradchinese.nsh"
1213   Goto EndLanguageCmp
1214   Turkish:
1215   !include "languages\turkish.nsh"
1216   Goto EndLanguageCmp
1217   Ukrainian:
1218   !include "languages\ukrainian.nsh"
1219   Goto EndLanguageCmp
1220   Uzbek:
1221   !include "languages\uzbek.nsh"
1222   Goto EndLanguageCmp
1223   Welsh:
1224   !include "languages\welsh.nsh"
1225   Goto EndLanguageCmp
1226   Brazilian:
1227   !include "languages\brazilian_portuguese.nsh"
1228   EndLanguageCmp:
1229
1230 FunctionEnd