mozilla: add video/divx mimetype
[vlc.git] / vlc.win32.nsi.in
blob808aded84c4e3f73849ae1d868174b308d28f3d8
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; NSIS installer script for vlc ;
3 ; (http://nsis.sourceforge.net) ;
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 !define PRODUCT_NAME "VLC media player"
7 !define PRODUCT_VERSION '${VERSION}'
8 !define PRODUCT_GROUP "VideoLAN"
9 !define PRODUCT_PUBLISHER "VideoLAN Team"
10 !define PRODUCT_WEB_SITE "http://www.videolan.org"
11 !define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
12 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
13 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
14 !define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
16 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
17 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
18 !define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
20 @FILE_LIBVLC_DLL@
21 @FILE_LIBVLC_CONTROL_DLL@
23 ;;;;;;;;;;;;;;;;;;;;;;;;;
24 ; General configuration ;
25 ;;;;;;;;;;;;;;;;;;;;;;;;;
27 Name "${PRODUCT_GROUP} ${PRODUCT_NAME} ${PRODUCT_VERSION}"
28 OutFile ..\vlc-${VERSION}-win32.exe
29 InstallDir "$PROGRAMFILES\VideoLAN\VLC"
30 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
31 !ifdef NSIS_LZMA_COMPRESS_WHOLE
32 SetCompressor lzma
33 !else
34 SetCompressor /SOLID lzma
35 !endif
36 ;ShowInstDetails show
37 ;ShowUnInstDetails show
38 SetOverwrite ifnewer
39 CRCCheck on
41 InstType "Recommended"
42 InstType "Minimum"
43 InstType "Full"
45 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ; NSIS Modern User Interface configuration ;
47 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
49 ; MUI 1.67 compatible ------
50 !include "MUI.nsh"
52 ; MUI Settings
53 !define MUI_ABORTWARNING
54 !define MUI_ICON "vlc48x48.ico"
55 !define MUI_UNICON "vlc48x48.ico"
56 !define MUI_COMPONENTSPAGE_SMALLDESC
58 ; Installer pages
59 ; Welcome page
60 !define MUI_WELCOMEPAGE_TITLE_3LINES
61 !insertmacro MUI_PAGE_WELCOME
62 ; License page
63 !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
64 ; Components page
65 !insertmacro MUI_PAGE_COMPONENTS
66 ; Directory page
67 !insertmacro MUI_PAGE_DIRECTORY
68 ; Instfiles page
69 !insertmacro MUI_PAGE_INSTFILES
70 ; Finish page
71 !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
72 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
73 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
74 !define MUI_FINISHPAGE_LINK "Visit the VideoLAN VLC media player Website"
75 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
76 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
77 !insertmacro MUI_PAGE_FINISH
79 ; Uninstaller pages
80 !insertmacro MUI_UNPAGE_CONFIRM
81 !insertmacro MUI_UNPAGE_COMPONENTS
82 !insertmacro MUI_UNPAGE_INSTFILES
83 !insertmacro MUI_UNPAGE_FINISH
85 ; Language files
86 !insertmacro MUI_LANGUAGE "English" # first language is the default language
87 !insertmacro MUI_LANGUAGE "French"
88 !insertmacro MUI_LANGUAGE "German"
89 !insertmacro MUI_LANGUAGE "Spanish"
90 !insertmacro MUI_LANGUAGE "SimpChinese"
91 !insertmacro MUI_LANGUAGE "TradChinese"
92 !insertmacro MUI_LANGUAGE "Japanese"
93 !insertmacro MUI_LANGUAGE "Korean"
94 !insertmacro MUI_LANGUAGE "Italian"
95 !insertmacro MUI_LANGUAGE "Dutch"
96 !insertmacro MUI_LANGUAGE "Danish"
97 !insertmacro MUI_LANGUAGE "Swedish"
98 !insertmacro MUI_LANGUAGE "Norwegian"
99 !insertmacro MUI_LANGUAGE "Finnish"
100 !insertmacro MUI_LANGUAGE "Greek"
101 !insertmacro MUI_LANGUAGE "Russian"
102 !insertmacro MUI_LANGUAGE "Portuguese"
103 !insertmacro MUI_LANGUAGE "Arabic"
104 !insertmacro MUI_LANGUAGE "Polish"
106 !insertmacro MUI_RESERVEFILE_LANGDLL
108 ; Reserve files
109 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
111 ; MUI end ------
113 ;;;;;;;;;;;;;;;;;;;
114 ; Extension lists ;
115 ;;;;;;;;;;;;;;;;;;;
117 !macro MacroAudioExtensions _action
118 !insertmacro ${_action} ".a52"
119 !insertmacro ${_action} ".aac"
120 !insertmacro ${_action} ".ac3"
121 !insertmacro ${_action} ".dts"
122 !insertmacro ${_action} ".flac"
123 !insertmacro ${_action} ".mka"
124 !insertmacro ${_action} ".mp1"
125 !insertmacro ${_action} ".mp2"
126 !insertmacro ${_action} ".mp3"
127 !insertmacro ${_action} ".ogg"
128 !insertmacro ${_action} ".spx"
129 !insertmacro ${_action} ".wav"
130 !insertmacro ${_action} ".wma"
131 !macroend
133 !macro MacroVideoExtensions _action
134 !insertmacro ${_action} ".asf"
135 !insertmacro ${_action} ".avi"
136 !insertmacro ${_action} ".divx"
137 !insertmacro ${_action} ".dv"
138 !insertmacro ${_action} ".m1v"
139 !insertmacro ${_action} ".m2v"
140 !insertmacro ${_action} ".mkv"
141 !insertmacro ${_action} ".mov"
142 !insertmacro ${_action} ".mp4"
143 !insertmacro ${_action} ".mpeg"
144 !insertmacro ${_action} ".mpeg1"
145 !insertmacro ${_action} ".mpeg2"
146 !insertmacro ${_action} ".mpeg4"
147 !insertmacro ${_action} ".mpg"
148 !insertmacro ${_action} ".mxf"
149 !insertmacro ${_action} ".ps"
150 !insertmacro ${_action} ".ts"
151 !insertmacro ${_action} ".ogm"
152 !insertmacro ${_action} ".vob"
153 !insertmacro ${_action} ".wmv"
154 !macroend
156 !macro MacroOtherExtensions _action
157 !insertmacro ${_action} ".asx"
158 !insertmacro ${_action} ".bin"
159 !insertmacro ${_action} ".cue"
160 !insertmacro ${_action} ".m3u"
161 !insertmacro ${_action} ".pls"
162 !insertmacro ${_action} ".vlc"
163 !macroend
165 !macro MacroAllExtensions _action
166 !insertmacro MacroAudioExtensions ${_action}
167 !insertmacro MacroVideoExtensions ${_action}
168 !insertmacro MacroOtherExtensions ${_action}
169 !macroend
171 ;;;;;;;;;;;;;;;;;;;;;;;;;;
172 ; File type associations ;
173 ;;;;;;;;;;;;;;;;;;;;;;;;;;
175 Function RegisterExtension
176 ; back up old value for extension $R0 (eg. ".opt")
177 ReadRegStr $1 HKCR "$R0" ""
178 StrCmp $1 "" NoBackup
179 StrCmp $1 "VLC$R0" "NoBackup"
180 WriteRegStr HKCR "$R0" "VLC.backup" $1
181 NoBackup:
182 WriteRegStr HKCR "$R0" "" "VLC$R0"
183 ReadRegStr $0 HKCR "VLC$R0" ""
184 WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
185 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
186 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
187 WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
188 FunctionEnd
190 Function un.RegisterExtension
191 ;start of restore script
192 ReadRegStr $1 HKCR "$R0" ""
193 StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
194 ReadRegStr $1 HKCR "$R0" "VLC.backup"
195 StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
196 DeleteRegKey HKCR "$R0"
197 Goto NoOwn
198 Restore:
199 WriteRegStr HKCR "$R0" "" $1
200 DeleteRegValue HKCR "$R0" "VLC.backup"
201 NoOwn:
202 DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
203 FunctionEnd
205 !macro RegisterExtensionSection EXT
206 Section ${EXT}
207 SectionIn 1 3
208 Push $R0
209 StrCpy $R0 ${EXT}
210 Call RegisterExtension
211 Pop $R0
212 SectionEnd
213 !macroend
215 !macro UnRegisterExtensionSection EXT
216 Push $R0
217 StrCpy $R0 ${EXT}
218 Call un.RegisterExtension
219 Pop $R0
220 !macroend
222 !macro WriteRegStrSupportedTypes EXT
223 WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
224 !macroend
226 ;;;;;;;;;;;;;;;;;;;;;;;;
227 ; Context menu entries ;
228 ;;;;;;;;;;;;;;;;;;;;;;;;
230 !macro AddContextMenuExt EXT
231 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
232 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --started-from-file --no-playlist-enqueue "%1"'
234 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
235 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"'
236 !macroend
238 !macro AddContextMenu EXT
239 Push $R0
240 ReadRegStr $R0 HKCR ${EXT} ""
241 !insertmacro AddContextMenuExt $R0
242 Pop $R0
243 !macroend
245 !macro DeleteContextMenuExt EXT
246 DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
247 DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
248 !macroend
250 !macro DeleteContextMenu EXT
251 Push $R0
252 ReadRegStr $R0 HKCR ${EXT} ""
253 !insertmacro DeleteContextMenuExt $R0
254 Pop $R0
255 !macroend
257 ;;;;;;;;;;;;;;;;;;;;;;;;;;
258 ; Delete prefs and cache ;
259 ;;;;;;;;;;;;;;;;;;;;;;;;;;
261 !macro delprefs
262 StrCpy $0 0
263 !define Index 'Line${__LINE__}'
264 "${Index}-Loop:"
265 ; FIXME
266 ; this will loop through all the logged users and "virtual" windows users
267 ; (it looks like users are only present in HKEY_USERS when they are logged in)
268 ClearErrors
269 EnumRegKey $1 HKU "" $0
270 StrCmp $1 "" "${Index}-End"
271 IntOp $0 $0 + 1
272 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
273 StrCmp $2 "" "${Index}-Loop"
274 RMDir /r "$2\vlc"
275 Goto "${Index}-Loop"
276 "${Index}-End:"
277 !undef Index
278 !macroend
280 Var UninstallLog
282 !macro OpenUninstallLog
283 FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
284 FileSeek $UninstallLog 0 END
285 !macroend
287 !macro CloseUninstallLog
288 FileClose $UninstallLog
289 SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
290 !macroend
292 !macro InstallFile FILEREGEX
293 File "${FILEREGEX}"
294 !define Index 'Line${__LINE__}'
295 FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
296 StrCmp $0 "" "${Index}-End"
297 "${Index}-Loop:"
298 StrCmp $1 "" "${Index}-End"
299 FileWrite $UninstallLog "$1$\r$\n"
300 FindNext $0 $1
301 Goto "${Index}-Loop"
302 "${Index}-End:"
303 !undef Index
304 !macroend
306 !macro InstallFolder FOLDER
307 File /r "${FOLDER}"
308 Push "${FOLDER}"
309 Call InstallFolderInternal
310 !macroend
312 Function InstallFolderInternal
313 Pop $9
314 !define Index 'Line${__LINE__}'
315 FindFirst $0 $1 "$INSTDIR\$9\*"
316 StrCmp $0 "" "${Index}-End"
317 "${Index}-Loop:"
318 StrCmp $1 "" "${Index}-End"
319 StrCmp $1 "." "${Index}-Next"
320 StrCmp $1 ".." "${Index}-Next"
321 IfFileExists "$9\$1\*" 0 "${Index}-Write"
322 Push $0
323 Push $9
324 Push "$9\$1"
325 Call InstallFolderInternal
326 Pop $9
327 Pop $0
328 Goto "${Index}-Next"
329 "${Index}-Write:"
330 FileWrite $UninstallLog "$9\$1$\r$\n"
331 "${Index}-Next:"
332 FindNext $0 $1
333 Goto "${Index}-Loop"
334 "${Index}-End:"
335 !undef Index
336 FunctionEnd
339 ;;;;;;;;;;;;;;;;;;;;;;
340 ; Installer sections ;
341 ;;;;;;;;;;;;;;;;;;;;;;
343 Section "Media player (required)" SEC01
344 SectionIn 1 2 3 RO
345 SetShellVarContext all
346 SetOutPath "$INSTDIR"
348 !insertmacro OpenUninstallLog
350 !insertmacro InstallFile vlc.exe
351 !insertmacro InstallFile vlc.exe.manifest
352 !ifdef LIBVLC_DLL
353 !insertmacro InstallFile ${LIBVLC_DLL}
354 !endif
355 !ifdef LIBVLC_CONTROL_DLL
356 !insertmacro InstallFile ${LIBVLC_CONTROL_DLL}
357 !endif
358 !insertmacro InstallFile *.txt
360 !insertmacro InstallFolder plugins
361 !insertmacro InstallFolder locale
362 !insertmacro InstallFolder osdmenu
363 !insertmacro InstallFolder skins
364 !insertmacro InstallFolder http
366 WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
367 "${PRODUCT_WEB_SITE}"
368 FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
369 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
370 "${PRODUCT_WEB_SITE}/doc/"
371 FileWrite $UninstallLog "Documentation.url$\r$\n"
373 !insertmacro CloseUninstallLog
375 ; Add VLC to "recomended programs" for the following extensions
376 WriteRegStr HKCR Applications\vlc.exe "" ""
377 WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
378 WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
379 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
380 '$INSTDIR\vlc.exe --started-from-file "%1"'
381 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
383 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
384 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
385 "$INSTDIR\vlc.exe --started-from-file cdda:%1"
386 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
387 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
388 "$INSTDIR\vlc.exe --started-from-file dvd:%1"
390 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
391 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
392 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
393 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
394 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
395 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
397 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
398 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
399 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
400 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
401 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
402 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
403 WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
404 WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
405 WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
406 '$INSTDIR\vlc.exe --started-from-file dvd:%1'
407 WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
408 WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
409 WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
410 WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
411 '$INSTDIR\vlc.exe --started-from-file cdda:%1'
412 WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
414 SectionEnd
416 Section "Start Menu Shortcut" SEC02a
417 SectionIn 1 2 3
418 CreateDirectory "$SMPROGRAMS\VideoLAN"
419 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
420 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
421 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
422 "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
423 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
424 "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
425 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
426 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
427 "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
428 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
429 "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
430 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
431 ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
432 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
433 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
434 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
435 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
436 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
437 "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
438 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
439 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
440 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
441 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
442 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
443 "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
444 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
445 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
446 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
447 "$INSTDIR\Documentation.url"
448 CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
449 "$INSTDIR\NEWS.txt" ""
450 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
451 "$INSTDIR\${PRODUCT_GROUP} Website.url"
452 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
453 "$INSTDIR\vlc.exe" ""
454 SectionEnd
456 Section "Desktop Shortcut" SEC02b
457 SectionIn 1 2 3
458 CreateShortCut "$DESKTOP\VLC media player.lnk" \
459 "$INSTDIR\vlc.exe" ""
460 SectionEnd
462 Section /o "Mozilla plugin" SEC03
463 SectionIn 3
465 SetOutPath "$INSTDIR"
466 !insertmacro OpenUninstallLog
467 !insertmacro InstallFile mozilla\npvlc.dll
468 !insertmacro CloseUninstallLog
470 !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
471 WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
472 WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
473 WriteRegStr HKLM ${Moz} "Product" "VLC media player"
474 WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
475 WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
477 ; for very old version of mozilla, these lines may be needed
478 ;Push $R0
479 ;Push $R1
480 ;Push $R2
482 ;!define Index 'Line${__LINE__}'
483 ;StrCpy $R1 "0"
485 ;"${Index}-Loop:"
487 ; ; Check for Key
488 ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
489 ; StrCmp $R0 "" "${Index}-End"
490 ; IntOp $R1 $R1 + 1
491 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
492 ; StrCmp $R2 "" "${Index}-Loop" ""
494 ; CopyFiles "$INSTDIR\npvlc.dll" "$R2"
495 ; !ifdef LIBVLC_DLL
496 ; CopyFiles ${LIBVLC_DLL} "$R2"
497 ; !endif
498 ; !ifdef LIBVLC_CONTROL_DLL
499 ; CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
500 ; !endif
501 ; Goto "${Index}-Loop"
503 ;"${Index}-End:"
504 ;!undef Index
506 SectionEnd
508 Section "ActiveX plugin" SEC04
509 SectionIn 1 3
510 SetOutPath "$INSTDIR"
511 !insertmacro OpenUninstallLog
512 !insertmacro InstallFile activex\axvlc.dll
513 !insertmacro CloseUninstallLog
514 RegDLL "$INSTDIR\axvlc.dll"
515 SectionEnd
517 SectionGroup "File type associations" SEC06
518 SectionGroup "Audio Files"
519 !insertmacro MacroAudioExtensions RegisterExtensionSection
520 SectionGroupEnd
521 SectionGroup "Video Files"
522 !insertmacro MacroVideoExtensions RegisterExtensionSection
523 SectionGroupEnd
524 SectionGroup "Other"
525 !insertmacro MacroOtherExtensions RegisterExtensionSection
526 SectionGroupEnd
527 SectionGroupEnd
529 Section /o "Context Menus" SEC05
530 SectionIn 3
531 !insertmacro MacroAllExtensions AddContextMenu
532 !insertmacro AddContextMenuExt "Directory"
533 SectionEnd
535 Section /o "Delete preferences and cache" SEC07
536 !insertmacro delprefs
537 SectionEnd
539 ; Installer section descriptions
540 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
541 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
542 "The media player itself"
543 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
544 "Adds icons to your start menu for easy access"
545 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
546 "Adds icon to your desktop for easy access"
547 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
548 "The VLC Mozilla and Mozilla Firefox plugin"
549 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
550 "The VLC ActiveX plugin"
551 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
552 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
553 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
554 "Sets VLC media player as the default application for the specified file type"
555 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
556 "Deletes VLC media player preferences and cache files leftover from previous installations"
557 !insertmacro MUI_FUNCTION_DESCRIPTION_END
559 Function .onInit
560 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
561 "UninstallString"
562 StrCmp $R0 "" done
564 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
565 "VLC media player has already been installed. $\nDo you want to remove \
566 the previous version before installing $(^Name) ?" \
567 IDNO done
569 ;Run the uninstaller
570 ;uninst:
571 ClearErrors
572 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
573 done:
574 !insertmacro MUI_LANGDLL_DISPLAY
575 FunctionEnd
577 Section -Post
578 WriteUninstaller "$INSTDIR\uninstall.exe"
579 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
580 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
581 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
583 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
584 "DisplayName" "$(^Name)"
585 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
586 "UninstallString" "$INSTDIR\uninstall.exe"
587 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
588 "DisplayIcon" "$INSTDIR\vlc.exe"
589 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
590 "DisplayVersion" "${PRODUCT_VERSION}"
591 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
592 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
593 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
594 "Publisher" "${PRODUCT_PUBLISHER}"
595 SectionEnd
597 ;;;;;;;;;;;;;;;;;;;;;;;;
598 ; Uninstaller sections ;
599 ;;;;;;;;;;;;;;;;;;;;;;;;
601 ; TrimNewlines (copied from NSIS documentation)
602 ; input, top of stack (e.g. whatever$\r$\n)
603 ; output, top of stack (replaces, with e.g. whatever)
604 ; modifies no other variables.
606 Function un.TrimNewlines
607 Exch $R0
608 Push $R1
609 Push $R2
610 StrCpy $R1 0
612 loop:
613 IntOp $R1 $R1 - 1
614 StrCpy $R2 $R0 1 $R1
615 StrCmp $R2 "$\r" loop
616 StrCmp $R2 "$\n" loop
617 IntOp $R1 $R1 + 1
618 IntCmp $R1 0 no_trim_needed
619 StrCpy $R0 $R0 $R1
621 no_trim_needed:
622 Pop $R2
623 Pop $R1
624 Exch $R0
625 FunctionEnd
627 Function un.RemoveEmptyDirs
628 Pop $9
629 !define Index 'Line${__LINE__}'
630 FindFirst $0 $1 "$INSTDIR$9*"
631 StrCmp $0 "" "${Index}-End"
632 "${Index}-Loop:"
633 StrCmp $1 "" "${Index}-End"
634 StrCmp $1 "." "${Index}-Next"
635 StrCmp $1 ".." "${Index}-Next"
636 Push $0
637 Push $1
638 Push $9
639 Push "$9$1\"
640 Call un.RemoveEmptyDirs
641 Pop $9
642 Pop $1
643 Pop $0
644 "${Index}-Remove:"
645 RMDir "$INSTDIR$9$1"
646 "${Index}-Next:"
647 FindNext $0 $1
648 Goto "${Index}-Loop"
649 "${Index}-End:"
650 FindClose $0
651 !undef Index
652 FunctionEnd
654 Section "Uninstall" SEC91
655 SectionIn 1 2 3 RO
656 SetShellVarContext all
658 !insertmacro MacroAllExtensions DeleteContextMenu
659 !insertmacro MacroAllExtensions UnRegisterExtensionSection
660 !insertmacro DeleteContextMenuExt "Directory"
662 ;remove activex plugin
663 UnRegDLL "$INSTDIR\axvlc.dll"
664 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
666 ;remove mozilla plugin
667 Push $R0
668 Push $R1
669 Push $R2
671 !define Index 'Line${__LINE__}'
672 StrCpy $R1 "0"
674 "${Index}-Loop:"
676 ; Check for Key
677 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
678 StrCmp $R0 "" "${Index}-End"
679 IntOp $R1 $R1 + 1
680 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
681 StrCmp $R2 "" "${Index}-Loop" ""
683 ; old files (0.8.5 and before) that may be lying around
684 Delete /REBOOTOK "$R2\npvlc.dll"
685 Delete /REBOOTOK "$R2\libvlc.dll"
686 Delete /REBOOTOK "$R2\vlcintf.xpt"
687 Goto "${Index}-Loop"
689 "${Index}-End:"
690 !undef Index
691 Delete /REBOOTOK "$INSTDIR\npvlc.dll"
693 RMDir "$SMPROGRAMS\VideoLAN"
694 RMDir /r $SMPROGRAMS\VideoLAN
696 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
697 UninstallLoop:
698 ClearErrors
699 FileRead $UninstallLog $R0
700 IfErrors UninstallEnd
701 Push $R0
702 Call un.TrimNewLines
703 Pop $R0
704 Delete "$INSTDIR\$R0"
705 Goto UninstallLoop
706 UninstallEnd:
707 FileClose $UninstallLog
708 Delete "$INSTDIR\uninstall.log"
709 Delete "$INSTDIR\uninstall.exe"
710 Push "\"
711 Call un.RemoveEmptyDirs
712 RMDir "$INSTDIR"
714 DeleteRegKey HKLM Software\VideoLAN
716 DeleteRegKey HKCR Applications\vlc.exe
717 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
718 DeleteRegKey HKCR DVD\shell\PlayWithVLC
719 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
720 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
721 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
722 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
723 DeleteRegKey HKCR "VLC.MediaFile"
725 DeleteRegKey HKLM \
726 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
728 DeleteRegKey HKLM \
729 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
731 Delete "$DESKTOP\VLC media player.lnk"
733 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
734 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
735 SetAutoClose true
736 SectionEnd
738 Section /o "un.Delete preferences and cache" SEC92
739 !insertmacro delprefs
740 SectionEnd
742 ; Uninstaller section descriptions
743 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
744 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
745 "Uninstall VLC media player and all its components"
746 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
747 "Deletes VLC media player preferences and cache files"
748 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
750 ;Function un.onUninstSuccess
751 ; HideWindow
752 ; MessageBox MB_ICONINFORMATION|MB_OK \
753 ; "$(^Name) was successfully removed from your computer."
754 ;FunctionEnd
756 Function un.onInit
757 !insertmacro MUI_UNGETLANGUAGE
758 FunctionEnd