]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
24f57656798de292dcd017c0515551cf0dedc8c2
[vlc] / extras / package / win32 / 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 Team"
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 @BUILD_ACTIVEX_TRUE@ !define INSTALL_ACTIVEX
24 @BUILD_MOZILLA_TRUE@ !define INSTALL_MOZILLA
25
26 @FILE_LIBVLCCORE_DLL@
27 @FILE_LIBVLC_DLL@
28
29 ;;;;;;;;;;;;;;;;;;;;;;;;;
30 ; General configuration ;
31 ;;;;;;;;;;;;;;;;;;;;;;;;;
32
33 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
34 OutFile ..\vlc-${VERSION}-win32.exe
35 InstallDir "$PROGRAMFILES\VideoLAN\VLC"
36 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
37 !ifdef NSIS_LZMA_COMPRESS_WHOLE
38 SetCompressor lzma
39 !else
40 SetCompressor /SOLID lzma
41 !endif
42
43 SetOverwrite ifnewer
44 CRCCheck on
45 BrandingText "${PRODUCT_GROUP} ${PRODUCT_NAME}"
46
47 InstType $Name_InstTypeRecommended
48 InstType $Name_InstTypeMinimum
49 InstType $Name_InstTypeFull
50
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
52 ; NSIS Modern User Interface configuration ;
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
54
55 ; MUI 1.67 compatible ------
56   !include "MUI.nsh"
57
58 ; MUI Settings
59   !define MUI_ABORTWARNING
60   !define MUI_ICON "vlc.ico"
61   !define MUI_UNICON "vlc.ico"
62   !define MUI_COMPONENTSPAGE_SMALLDESC
63
64 ; Installer pages
65   ; Welcome page
66     !define MUI_WELCOMEPAGE_TITLE_3LINES
67     !insertmacro MUI_PAGE_WELCOME
68   ; License page
69     !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
70   ; Components page
71     !insertmacro MUI_PAGE_COMPONENTS
72   ; Directory page
73     !insertmacro MUI_PAGE_DIRECTORY
74   ; Instfiles page
75     !insertmacro MUI_PAGE_INSTFILES
76   ; Finish page
77     !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
78     !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
79     !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
80     !define MUI_FINISHPAGE_LINK $Link_VisitWebsite
81     !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
82     !define MUI_FINISHPAGE_NOREBOOTSUPPORT
83     !insertmacro MUI_PAGE_FINISH
84
85 ; Uninstaller pages
86     !insertmacro MUI_UNPAGE_CONFIRM
87     !insertmacro MUI_UNPAGE_COMPONENTS
88     !insertmacro MUI_UNPAGE_INSTFILES
89     !insertmacro MUI_UNPAGE_FINISH
90
91 ; Language files
92   !insertmacro MUI_LANGUAGE "English" # first language is the default language
93   !insertmacro MUI_LANGUAGE "French"
94   !insertmacro MUI_LANGUAGE "German"
95   !insertmacro MUI_LANGUAGE "Spanish"
96   !insertmacro MUI_LANGUAGE "SimpChinese"
97   !insertmacro MUI_LANGUAGE "TradChinese"
98   !insertmacro MUI_LANGUAGE "Japanese"
99   !insertmacro MUI_LANGUAGE "Korean"
100   !insertmacro MUI_LANGUAGE "Italian"
101   !insertmacro MUI_LANGUAGE "Dutch"
102   !insertmacro MUI_LANGUAGE "Danish"
103   !insertmacro MUI_LANGUAGE "Swedish"
104   !insertmacro MUI_LANGUAGE "Norwegian"
105   !insertmacro MUI_LANGUAGE "Finnish"
106   !insertmacro MUI_LANGUAGE "Greek"
107   !insertmacro MUI_LANGUAGE "Russian"
108   !insertmacro MUI_LANGUAGE "Portuguese"
109   !insertmacro MUI_LANGUAGE "PortugueseBR"
110   !insertmacro MUI_LANGUAGE "Arabic"
111   !insertmacro MUI_LANGUAGE "Polish"
112   !insertmacro MUI_LANGUAGE "Romanian"
113   !insertmacro MUI_LANGUAGE "Slovak"
114   !insertmacro MUI_LANGUAGE "Czech"
115   !insertmacro MUI_LANGUAGE "Hungarian"
116   !insertmacro MUI_LANGUAGE "Catalan"
117   !insertmacro MUI_LANGUAGE "Bulgarian"
118
119 ; Reserve files for solid compression
120   !insertmacro MUI_RESERVEFILE_LANGDLL
121   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
122
123 ; MUI end ------
124
125 ;;;;;;;;;;;;;;;;;;;;;;;
126 ; Macro and Functions ;
127 ;;;;;;;;;;;;;;;;;;;;;;;
128
129 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
130 ; 1. File type associations ;
131 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132
133 ;; Function that register one extension for VLC
134 Function RegisterExtension
135   ; back up old value for extension $R0 (eg. ".opt")
136   ReadRegStr $1 HKCR "$R0" ""
137   StrCmp $1 "" NoBackup
138     StrCmp $1 "VLC$R0" "NoBackup"
139     WriteRegStr HKCR "$R0" "VLC.backup" $1
140 NoBackup:
141   WriteRegStr HKCR "$R0" "" "VLC$R0"
142   ReadRegStr $0 HKCR "VLC$R0" ""
143   WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
144   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
145   WriteRegStr HKCR "VLC$R0\shell\Open" "" $ShellAssociation_Play
146   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
147   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
148
149 ;;; Vista Only part
150   ; Vista detection
151   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
152   StrCpy $R2 $R1 3
153   StrCmp $R2 '6.0' ForVista ToEnd
154 ForVista:
155   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
156
157 ToEnd:
158 FunctionEnd
159
160 ;; Function that removes one extension that VLC owns.
161 Function un.RegisterExtension
162   ;start of restore script
163   ReadRegStr $1 HKCR "$R0" ""
164   StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
165     ; Read the old value from Backup
166     ReadRegStr $1 HKCR "$R0" "VLC.backup"
167     StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
168       DeleteRegKey HKCR "$R0"
169     Goto NoOwn
170 Restore:
171       WriteRegStr HKCR "$R0" "" $1
172       DeleteRegValue HKCR "$R0" "VLC.backup"
173 NoOwn:
174     DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
175     DeleteRegKey HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations\VLC$R0" ; for vista
176 FunctionEnd
177
178 !macro RegisterExtensionSection EXT
179   Section ${EXT}
180     SectionIn 1 3
181     Push $R0
182     StrCpy $R0 ${EXT}
183     Call RegisterExtension
184     Pop $R0
185   SectionEnd
186 !macroend
187
188 !macro UnRegisterExtensionSection EXT
189   Push $R0
190   StrCpy $R0 ${EXT}
191   Call un.RegisterExtension
192   Pop $R0
193 !macroend
194
195 !macro WriteRegStrSupportedTypes EXT
196   WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
197 !macroend
198
199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200 ; Extension lists  Macros                    ;
201 ; Those macros calls the previous functions  ;
202 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
203
204 !macro MacroAudioExtensions _action
205   !insertmacro ${_action} ".a52"
206   !insertmacro ${_action} ".aac"
207   !insertmacro ${_action} ".ac3"
208   !insertmacro ${_action} ".dts"
209   !insertmacro ${_action} ".flac"
210   !insertmacro ${_action} ".m4a"
211   !insertmacro ${_action} ".m4p"
212   !insertmacro ${_action} ".mka"
213   !insertmacro ${_action} ".mod"
214   !insertmacro ${_action} ".mp1"
215   !insertmacro ${_action} ".mp2"
216   !insertmacro ${_action} ".mp3"
217   !insertmacro ${_action} ".oma"
218   !insertmacro ${_action} ".oga"
219   !insertmacro ${_action} ".spx"
220   !insertmacro ${_action} ".wav"
221   !insertmacro ${_action} ".wma"
222   !insertmacro ${_action} ".wv"
223   !insertmacro ${_action} ".xm"
224 !macroend
225
226 !macro MacroVideoExtensions _action
227   !insertmacro ${_action} ".asf"
228   !insertmacro ${_action} ".avi"
229   !insertmacro ${_action} ".divx"
230   !insertmacro ${_action} ".dv"
231   !insertmacro ${_action} ".flv"
232   !insertmacro ${_action} ".gxf"
233   !insertmacro ${_action} ".m1v"
234   !insertmacro ${_action} ".m2v"
235   !insertmacro ${_action} ".m2ts"
236   !insertmacro ${_action} ".m4v"
237   !insertmacro ${_action} ".mkv"
238   !insertmacro ${_action} ".mov"
239   !insertmacro ${_action} ".mp4"
240   !insertmacro ${_action} ".mpeg"
241   !insertmacro ${_action} ".mpeg1"
242   !insertmacro ${_action} ".mpeg2"
243   !insertmacro ${_action} ".mpeg4"
244   !insertmacro ${_action} ".mpg"
245   !insertmacro ${_action} ".mts"
246   !insertmacro ${_action} ".mxf"
247   !insertmacro ${_action} ".nuv"
248   !insertmacro ${_action} ".ogg"
249   !insertmacro ${_action} ".ogm"
250   !insertmacro ${_action} ".ogx"
251   !insertmacro ${_action} ".ogv"
252   !insertmacro ${_action} ".rmvb"
253   !insertmacro ${_action} ".ts"
254   !insertmacro ${_action} ".vob"
255   !insertmacro ${_action} ".wmv"
256 !macroend
257
258 !macro MacroOtherExtensions _action
259   !insertmacro ${_action} ".asx"
260   !insertmacro ${_action} ".bin"
261   !insertmacro ${_action} ".cue"
262   !insertmacro ${_action} ".m3u"
263   !insertmacro ${_action} ".pls"
264   !insertmacro ${_action} ".vlc"
265   !insertmacro ${_action} ".xspf"
266 !macroend
267
268 ; One macro to rule them all
269 !macro MacroAllExtensions _action
270   !insertmacro MacroAudioExtensions ${_action}
271   !insertmacro MacroVideoExtensions ${_action}
272   !insertmacro MacroOtherExtensions ${_action}
273 !macroend
274
275 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
276 ; 2. Context menu entries ;
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
278
279 ; Generic function for adding the context menu for one ext.
280 !macro AddContextMenuExt EXT
281   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" $ContextMenuEntry_PlayWith
282   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --no-playlist-enqueue "%1"'
283
284   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" $ContextMenuEntry_AddToPlaylist
285   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --playlist-enqueue "%1"'
286 !macroend
287
288 !macro AddContextMenu EXT
289   Push $R0
290   ReadRegStr $R0 HKCR ${EXT} ""
291   !insertmacro AddContextMenuExt $R0
292   Pop $R0
293 !macroend
294
295 !macro DeleteContextMenuExt EXT
296   DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
297   DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
298 !macroend
299
300 !macro DeleteContextMenu EXT
301   Push $R0
302   ReadRegStr $R0 HKCR ${EXT} ""
303   !insertmacro DeleteContextMenuExt $R0
304   Pop $R0
305 !macroend
306
307 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
308 ; 3. Delete prefs and cache ;
309 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
310
311 !macro delprefs
312   StrCpy $0 0
313   !define Index 'Line${__LINE__}'
314   "${Index}-Loop:"
315   ; FIXME
316   ; this will loop through all the logged users and "virtual" windows users
317   ; (it looks like users are only present in HKEY_USERS when they are logged in)
318     ClearErrors
319     EnumRegKey $1 HKU "" $0
320     StrCmp $1 "" "${Index}-End"
321     IntOp $0 $0 + 1
322     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
323     StrCmp $2 "" "${Index}-Loop"
324     RMDir /r "$2\vlc"
325     Goto "${Index}-Loop"
326   "${Index}-End:"
327   !undef Index
328 !macroend
329
330 ;;;;;;;;;;;;;;;
331 ; 4. Logging  ;
332 ;;;;;;;;;;;;;;;
333 Var UninstallLog
334 !macro OpenUninstallLog
335   FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
336   FileSeek $UninstallLog 0 END
337 !macroend
338
339 !macro CloseUninstallLog
340   FileClose $UninstallLog
341   SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
342 !macroend
343
344 ;;;;;;;;;;;;;;;;;;;;
345 ; 5. Installations ;
346 ;;;;;;;;;;;;;;;;;;;;
347 !macro InstallFile FILEREGEX
348   File "${FILEREGEX}"
349   !define Index 'Line${__LINE__}'
350   FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
351   StrCmp $0 "" "${Index}-End"
352   "${Index}-Loop:"
353     StrCmp $1 "" "${Index}-End"
354     FileWrite $UninstallLog "$1$\r$\n"
355     FindNext $0 $1
356     Goto "${Index}-Loop"
357   "${Index}-End:"
358   !undef Index
359 !macroend
360
361 !macro InstallFolder FOLDER
362   File /r "${FOLDER}"
363   Push "${FOLDER}"
364   Call InstallFolderInternal
365 !macroend
366
367 Function InstallFolderInternal
368   Pop $9
369   !define Index 'Line${__LINE__}'
370   FindFirst $0 $1 "$INSTDIR\$9\*"
371   StrCmp $0 "" "${Index}-End"
372   "${Index}-Loop:"
373     StrCmp $1 "" "${Index}-End"
374     StrCmp $1 "." "${Index}-Next"
375     StrCmp $1 ".." "${Index}-Next"
376     IfFileExists "$9\$1\*" 0 "${Index}-Write"
377       Push $0
378       Push $9
379       Push "$9\$1"
380       Call InstallFolderInternal
381       Pop $9
382       Pop $0
383       Goto "${Index}-Next"
384     "${Index}-Write:"
385     FileWrite $UninstallLog "$9\$1$\r$\n"
386     "${Index}-Next:"
387     FindNext $0 $1
388     Goto "${Index}-Loop"
389   "${Index}-End:"
390   !undef Index
391 FunctionEnd
392 ;;; End of Macros
393
394
395 ;;;;;;;;;;;;;;;;;;;;;;
396 ; Installer sections ;
397 ; The CORE of the    ;
398 ; installer          ;
399 ;;;;;;;;;;;;;;;;;;;;;;
400
401 Section $Name_Section01 SEC01
402   SectionIn 1 2 3 RO
403   SetShellVarContext all
404   SetOutPath "$INSTDIR"
405
406   !insertmacro OpenUninstallLog
407
408   ; VLC.exe, libvlc.dll
409   !insertmacro InstallFile vlc.exe
410   !insertmacro InstallFile vlc.exe.manifest
411
412   ; All dlls
413   !insertmacro InstallFile *.dll
414
415   ; Text files
416   !insertmacro InstallFile *.txt
417
418   ; Subfolders
419   !insertmacro InstallFolder plugins
420   !insertmacro InstallFolder locale
421 @BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
422 @BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
423 @BUILD_HTTPD_TRUE@   !insertmacro InstallFolder http
424 @BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
425
426
427   ; URLs
428   WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
429     "${PRODUCT_WEB_SITE}"
430   FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
431   WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
432     "${PRODUCT_WEB_SITE}/doc/"
433   FileWrite $UninstallLog "Documentation.url$\r$\n"
434   WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" \
435     "${PRODUCT_WEB_SITE}/vlc/skins.php"
436   FileWrite $UninstallLog "New_Skins.url$\r$\n"
437
438   !insertmacro CloseUninstallLog
439
440   ; Add VLC to "recomended programs" for the following extensions
441   WriteRegStr HKCR Applications\vlc.exe "" ""
442   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
443   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
444   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" \
445     '"$INSTDIR\vlc.exe" --started-from-file "%1"'
446   !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
447
448 ; Vista Registration
449   ; Vista detection
450   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
451   StrCpy $R1 $R0 3
452   StrCmp $R1 '6.0' lbl_vista lbl_done
453
454   lbl_vista:
455   WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
456   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
457   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
458
459   lbl_done:
460 SectionEnd
461
462 Section $Name_Section02a SEC02a
463   SectionIn 1 2 3
464   CreateDirectory "$SMPROGRAMS\VideoLAN"
465   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
466   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
467   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
468     "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc://quit"
469   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
470     "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc://quit"
471   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
472 @BUILD_SKINS_TRUE@  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
473 @BUILD_SKINS_TRUE@    "$INSTDIR\vlc.exe" "-I skins --save-config vlc://quit"
474   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Qt (default).lnk" \
475     "$INSTDIR\vlc.exe" "-I qt --save-config vlc://quit"
476   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
477   ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
478   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
479     "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc://quit"
480   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
481     "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc://quit"
482   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
483     "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc://quit"
484   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
485     "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc://quit"
486   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
487     "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc://quit"
488   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
489     "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc://quit"
490   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
491     "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
492   CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
493     "$INSTDIR\Documentation.url"
494   CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
495     "$INSTDIR\NEWS.txt" ""
496   CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
497     "$INSTDIR\${PRODUCT_GROUP} Website.url"
498   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
499     "$INSTDIR\vlc.exe" ""
500 SectionEnd
501
502 Section $Name_Section02b SEC02b
503   SectionIn 1 2 3
504   CreateShortCut "$DESKTOP\VLC media player.lnk" \
505     "$INSTDIR\vlc.exe" ""
506 SectionEnd
507
508 !ifdef INSTALL_MOZILLA
509 Section /o $Name_Section03 SEC03
510   SectionIn 3
511
512   SetOutPath "$INSTDIR"
513   !insertmacro OpenUninstallLog
514   !insertmacro InstallFile mozilla\npvlc.dll
515   !insertmacro InstallFile mozilla\npvlc.dll.manifest
516   !insertmacro CloseUninstallLog
517
518   !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
519   WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
520   WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
521   WriteRegStr HKLM ${Moz} "Product" "VLC media player"
522   WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
523   WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
524
525  ; for very old version of mozilla, these lines may be needed
526  ;Push $R0
527  ;Push $R1
528  ;Push $R2
529
530  ;!define Index 'Line${__LINE__}'
531  ;StrCpy $R1 "0"
532
533  ;"${Index}-Loop:"
534
535  ;  ; Check for Key
536  ;  EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
537  ;  StrCmp $R0 "" "${Index}-End"
538  ;  IntOp $R1 $R1 + 1
539  ;  ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
540  ;  StrCmp $R2 "" "${Index}-Loop" ""
541
542  ;  CopyFiles "$INSTDIR\npvlc.dll" "$R2"
543  ;  !ifdef LIBVLC_DLL
544  ;  CopyFiles ${LIBVLC_DLL} "$R2"
545  ;  !endif
546  ;  !ifdef LIBVLC_CONTROL_DLL
547  ;  CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
548  ;  !endif
549  ;  Goto "${Index}-Loop"
550
551  ;"${Index}-End:"
552  ;!undef Index
553
554 SectionEnd
555 !endif
556
557 !ifdef INSTALL_ACTIVEX
558 Section $Name_Section04 SEC04
559   SectionIn 3
560   SetOutPath "$INSTDIR"
561   !insertmacro OpenUninstallLog
562   !insertmacro InstallFile activex\axvlc.dll
563   !insertmacro InstallFile activex\axvlc.dll.manifest
564   !insertmacro CloseUninstallLog
565   RegDLL "$INSTDIR\axvlc.dll"
566 SectionEnd
567 !endif
568
569
570 Section $Name_Section05 SEC05
571   SectionIn 1 2 3
572   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
573   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
574     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
575   WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
576   WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
577     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
578
579   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
580   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
581   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
582   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
583   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
584   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
585
586   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
587   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
588   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
589   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
590   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
591   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
592   WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
593   WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
594   WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
595     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
596   WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
597   WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
598   WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
599   WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
600     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
601   WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
602
603 SectionEnd
604
605
606 SectionGroup /e !$Name_Section06 SEC06
607   SectionGroup $Name_SectionGroupAudio
608     !insertmacro MacroAudioExtensions RegisterExtensionSection
609   SectionGroupEnd
610   SectionGroup $Name_SectionGroupVideo
611     !insertmacro MacroVideoExtensions RegisterExtensionSection
612   SectionGroupEnd
613   SectionGroup $Name_SectionGroupOther
614     !insertmacro MacroOtherExtensions RegisterExtensionSection
615   SectionGroupEnd
616 SectionGroupEnd
617
618 Section $Name_Section07 SEC07
619   SectionIn 1 3
620   !insertmacro MacroAllExtensions AddContextMenu
621   !insertmacro AddContextMenuExt "Directory"
622 SectionEnd
623
624 Section $Name_Section08 SEC08
625   !insertmacro delprefs
626 SectionEnd
627
628 ; Installer section descriptions
629 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
630   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01
631   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a
632   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b
633 @BUILD_MOZILLA_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
634 @BUILD_ACTIVEX_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
635   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
636   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
637   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
638   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08
639 !insertmacro MUI_FUNCTION_DESCRIPTION_END
640
641 ;;; Start function
642 Function .onInit
643   !insertmacro MUI_LANGDLL_DISPLAY
644
645   !include "languages\english.nsh"
646   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
647   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
648   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
649   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
650   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
651   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
652   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
653   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
654   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
655   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
656   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
657   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
658   French:
659   !include "languages\french.nsh"
660   Goto EndLanguageCmp
661   Italian:
662   !include "languages\italian.nsh"
663   Goto EndLanguageCmp
664   Hungarian:
665   !include "languages\hungarian.nsh"
666   Goto EndLanguageCmp
667   Romanian:
668   !include "languages\romanian.nsh"
669   Goto EndLanguageCmp
670   Catalan:
671   !include "languages\catalan.nsh"
672   Goto EndLanguageCmp
673   Bulgarian:
674   !include "languages\bulgarian.nsh"
675   Goto EndLanguageCmp
676   Slovak:
677   !include "languages\slovak.nsh"
678   Goto EndLanguageCmp
679   Polish:
680   !include "languages\polish.nsh"
681   Goto EndLanguageCmp
682   Dutch:
683   !include "languages\dutch.nsh"
684   Goto EndLanguageCmp
685   Schinese:
686   !include "languages\schinese.nsh"
687   Goto EndLanguageCmp
688   Finnish:
689   !include "languages\finnish.nsh"
690   Goto EndLanguageCmp
691   Brazilian:
692   !include "languages\brazilian_portuguese.nsh"
693   EndLanguageCmp:
694
695   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
696   "UninstallString"
697   StrCmp $R0 "" done
698
699   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done
700
701   ;Run the uninstaller
702   ;uninst:
703     ClearErrors
704     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
705   done:
706
707 FunctionEnd
708
709 ;; End function
710 Section -Post
711   WriteUninstaller "$INSTDIR\uninstall.exe"
712   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
713   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
714   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
715
716   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
717     "DisplayName" "$(^Name)"
718   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
719     "UninstallString" "$INSTDIR\uninstall.exe"
720   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
721     "DisplayIcon" "$INSTDIR\vlc.exe"
722   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
723     "DisplayVersion" "${PRODUCT_VERSION}"
724   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
725     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
726   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
727     "Publisher" "${PRODUCT_PUBLISHER}"
728 SectionEnd
729
730 ;;;;;;;;;;;;;;;;;;;;;;;;
731 ; Uninstaller sections ;
732 ;;;;;;;;;;;;;;;;;;;;;;;;
733
734 ; TrimNewlines (copied from NSIS documentation)
735 ; input, top of stack  (e.g. whatever$\r$\n)
736 ; output, top of stack (replaces, with e.g. whatever)
737 ; modifies no other variables.
738
739 Function un.TrimNewlines
740  Exch $R0
741  Push $R1
742  Push $R2
743  StrCpy $R1 0
744
745  loop:
746    IntOp $R1 $R1 - 1
747    StrCpy $R2 $R0 1 $R1
748    StrCmp $R2 "$\r" loop
749    StrCmp $R2 "$\n" loop
750    IntOp $R1 $R1 + 1
751    IntCmp $R1 0 no_trim_needed
752    StrCpy $R0 $R0 $R1
753
754  no_trim_needed:
755    Pop $R2
756    Pop $R1
757    Exch $R0
758 FunctionEnd
759
760 Function un.RemoveEmptyDirs
761   Pop $9
762   !define Index 'Line${__LINE__}'
763   FindFirst $0 $1 "$INSTDIR$9*"
764   StrCmp $0 "" "${Index}-End"
765   "${Index}-Loop:"
766     StrCmp $1 "" "${Index}-End"
767     StrCmp $1 "." "${Index}-Next"
768     StrCmp $1 ".." "${Index}-Next"
769       Push $0
770       Push $1
771       Push $9
772       Push "$9$1\"
773       Call un.RemoveEmptyDirs
774       Pop $9
775       Pop $1
776       Pop $0
777     "${Index}-Remove:"
778     RMDir "$INSTDIR$9$1"
779     "${Index}-Next:"
780     FindNext $0 $1
781     Goto "${Index}-Loop"
782   "${Index}-End:"
783   FindClose $0
784   !undef Index
785 FunctionEnd
786
787 Section "un.$Name_Section91" SEC91
788   SectionIn 1 2 3 RO
789   SetShellVarContext all
790
791   !insertmacro MacroAllExtensions DeleteContextMenu
792   !insertmacro MacroAllExtensions UnRegisterExtensionSection
793   !insertmacro DeleteContextMenuExt "Directory"
794
795   ;remove activex plugin
796   UnRegDLL "$INSTDIR\axvlc.dll"
797   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
798   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
799
800   ;remove mozilla plugin
801   Push $R0
802   Push $R1
803   Push $R2
804
805   !define Index 'Line${__LINE__}'
806   StrCpy $R1 "0"
807
808   "${Index}-Loop:"
809
810     ; Check for Key
811     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
812     StrCmp $R0 "" "${Index}-End"
813     IntOp $R1 $R1 + 1
814     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
815     StrCmp $R2 "" "${Index}-Loop" ""
816
817     ; old files (0.8.5 and before) that may be lying around
818     Delete /REBOOTOK "$R2\npvlc.dll"
819     Delete /REBOOTOK "$R2\libvlc.dll"
820     Delete /REBOOTOK "$R2\vlcintf.xpt"
821     Goto "${Index}-Loop"
822
823   "${Index}-End:"
824   !undef Index
825   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
826   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
827
828   RMDir "$SMPROGRAMS\VideoLAN"
829   RMDir /r $SMPROGRAMS\VideoLAN
830
831   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
832   UninstallLoop:
833     ClearErrors
834     FileRead $UninstallLog $R0
835     IfErrors UninstallEnd
836     Push $R0
837     Call un.TrimNewLines
838     Pop $R0
839     Delete "$INSTDIR\$R0"
840     Goto UninstallLoop
841   UninstallEnd:
842   FileClose $UninstallLog
843   Delete "$INSTDIR\uninstall.log"
844   Delete "$INSTDIR\uninstall.exe"
845   Push "\"
846   Call un.RemoveEmptyDirs
847   RMDir "$INSTDIR"
848
849   DeleteRegKey HKLM Software\VideoLAN
850
851   DeleteRegKey HKCR Applications\vlc.exe
852   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
853   DeleteRegKey HKCR DVD\shell\PlayWithVLC
854   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
855   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
856   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
857   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
858   DeleteRegKey HKLM Software\Clients\Media\VLC
859   DeleteRegKey HKCR "VLC.MediaFile"
860
861   DeleteRegKey HKLM \
862     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
863
864   DeleteRegKey HKLM \
865     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
866
867   Delete "$DESKTOP\VLC media player.lnk"
868
869   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
870   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
871   SetAutoClose true
872 SectionEnd
873
874 Section /o "un.$Name_Section92" SEC92
875   !insertmacro delprefs
876 SectionEnd
877
878 ; Uninstaller section descriptions
879 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
880   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
881   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
882 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
883
884 ;Function un.onUninstSuccess
885 ;  HideWindow
886 ;  MessageBox MB_ICONINFORMATION|MB_OK \
887 ;    "$(^Name) was successfully removed from your computer."
888 ;FunctionEnd
889
890 Function un.onInit
891   !insertmacro MUI_UNGETLANGUAGE
892
893   !include "languages\english.nsh"
894   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
895   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
896   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
897   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
898   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
899   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
900   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
901   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
902   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
903   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
904   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
905   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
906   French:
907   !include "languages\french.nsh"
908   Goto EndLanguageCmp
909   Italian:
910   !include "languages\italian.nsh"
911   Goto EndLanguageCmp
912   Hungarian:
913   !include "languages\hungarian.nsh"
914   Goto EndLanguageCmp
915   Romanian:
916   !include "languages\romanian.nsh"
917   Goto EndLanguageCmp
918   Catalan:
919   !include "languages\catalan.nsh"
920   Goto EndLanguageCmp
921   Bulgarian:
922   !include "languages\bulgarian.nsh"
923   Goto EndLanguageCmp
924   Slovak:
925   !include "languages\slovak.nsh"
926   Goto EndLanguageCmp
927   Polish:
928   !include "languages\polish.nsh"
929   Goto EndLanguageCmp
930   Dutch:
931   !include "languages\dutch.nsh"
932   Goto EndLanguageCmp
933   Schinese:
934   !include "languages\schinese.nsh"
935   Goto EndLanguageCmp
936   Finnish:
937   !include "languages\finnish.nsh"
938   Goto EndLanguageCmp
939   Brazilian:
940   !include "languages\brazilian_portuguese.nsh"
941   EndLanguageCmp:
942
943 FunctionEnd