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