typo
[vlc/vlc-skelet.git] / vlc.win32.nsi.in
blob6206b4877c6e6cb5b0687b5c60944994abbb24fb
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
365 !insertmacro InstallFolder share
367 WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
368 "${PRODUCT_WEB_SITE}"
369 FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
370 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
371 "${PRODUCT_WEB_SITE}/doc/"
372 FileWrite $UninstallLog "Documentation.url$\r$\n"
374 !insertmacro CloseUninstallLog
376 ; Add VLC to "recomended programs" for the following extensions
377 WriteRegStr HKCR Applications\vlc.exe "" ""
378 WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
379 WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
380 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
381 '$INSTDIR\vlc.exe --started-from-file "%1"'
382 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
384 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
385 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
386 "$INSTDIR\vlc.exe --started-from-file cdda:%1"
387 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
388 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
389 "$INSTDIR\vlc.exe --started-from-file dvd:%1"
391 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
392 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
393 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
394 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
395 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
396 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
398 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
399 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
400 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
401 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
402 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
403 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
404 WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
405 WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
406 WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
407 '$INSTDIR\vlc.exe --started-from-file dvd:%1'
408 WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
409 WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
410 WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
411 WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
412 '$INSTDIR\vlc.exe --started-from-file cdda:%1'
413 WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
415 SectionEnd
417 Section "Start Menu Shortcut" SEC02a
418 SectionIn 1 2 3
419 CreateDirectory "$SMPROGRAMS\VideoLAN"
420 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
421 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
422 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
423 "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
424 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
425 "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
426 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
427 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
428 "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
429 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
430 "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
431 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
432 ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
433 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
434 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
435 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
436 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
437 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
438 "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
439 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
440 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
441 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
442 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
443 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
444 "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
445 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
446 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
447 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
448 "$INSTDIR\Documentation.url"
449 CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
450 "$INSTDIR\NEWS.txt" ""
451 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
452 "$INSTDIR\${PRODUCT_GROUP} Website.url"
453 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
454 "$INSTDIR\vlc.exe" ""
455 SectionEnd
457 Section "Desktop Shortcut" SEC02b
458 SectionIn 1 2 3
459 CreateShortCut "$DESKTOP\VLC media player.lnk" \
460 "$INSTDIR\vlc.exe" ""
461 SectionEnd
463 Section /o "Mozilla plugin" SEC03
464 SectionIn 3
466 SetOutPath "$INSTDIR"
467 !insertmacro OpenUninstallLog
468 !insertmacro InstallFile mozilla\npvlc.dll
469 !insertmacro CloseUninstallLog
471 !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
472 WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
473 WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
474 WriteRegStr HKLM ${Moz} "Product" "VLC media player"
475 WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
476 WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
478 ; for very old version of mozilla, these lines may be needed
479 ;Push $R0
480 ;Push $R1
481 ;Push $R2
483 ;!define Index 'Line${__LINE__}'
484 ;StrCpy $R1 "0"
486 ;"${Index}-Loop:"
488 ; ; Check for Key
489 ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
490 ; StrCmp $R0 "" "${Index}-End"
491 ; IntOp $R1 $R1 + 1
492 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
493 ; StrCmp $R2 "" "${Index}-Loop" ""
495 ; CopyFiles "$INSTDIR\npvlc.dll" "$R2"
496 ; !ifdef LIBVLC_DLL
497 ; CopyFiles ${LIBVLC_DLL} "$R2"
498 ; !endif
499 ; !ifdef LIBVLC_CONTROL_DLL
500 ; CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
501 ; !endif
502 ; Goto "${Index}-Loop"
504 ;"${Index}-End:"
505 ;!undef Index
507 SectionEnd
509 Section "ActiveX plugin" SEC04
510 SectionIn 1 3
511 SetOutPath "$INSTDIR"
512 !insertmacro OpenUninstallLog
513 !insertmacro InstallFile activex\axvlc.dll
514 !insertmacro CloseUninstallLog
515 RegDLL "$INSTDIR\axvlc.dll"
516 SectionEnd
518 SectionGroup "File type associations" SEC06
519 SectionGroup "Audio Files"
520 !insertmacro MacroAudioExtensions RegisterExtensionSection
521 SectionGroupEnd
522 SectionGroup "Video Files"
523 !insertmacro MacroVideoExtensions RegisterExtensionSection
524 SectionGroupEnd
525 SectionGroup "Other"
526 !insertmacro MacroOtherExtensions RegisterExtensionSection
527 SectionGroupEnd
528 SectionGroupEnd
530 Section /o "Context Menus" SEC05
531 SectionIn 3
532 !insertmacro MacroAllExtensions AddContextMenu
533 !insertmacro AddContextMenuExt "Directory"
534 SectionEnd
536 Section /o "Delete preferences and cache" SEC07
537 !insertmacro delprefs
538 SectionEnd
540 ; Installer section descriptions
541 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
542 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
543 "The media player itself"
544 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
545 "Adds icons to your start menu for easy access"
546 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
547 "Adds icon to your desktop for easy access"
548 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
549 "The VLC Mozilla and Mozilla Firefox plugin"
550 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
551 "The VLC ActiveX plugin"
552 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
553 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
554 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
555 "Sets VLC media player as the default application for the specified file type"
556 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
557 "Deletes VLC media player preferences and cache files leftover from previous installations"
558 !insertmacro MUI_FUNCTION_DESCRIPTION_END
560 Function .onInit
561 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
562 "UninstallString"
563 StrCmp $R0 "" done
565 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
566 "VLC media player has already been installed. $\nDo you want to remove \
567 the previous version before installing $(^Name) ?" \
568 IDNO done
570 ;Run the uninstaller
571 ;uninst:
572 ClearErrors
573 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
574 done:
575 !insertmacro MUI_LANGDLL_DISPLAY
576 FunctionEnd
578 Section -Post
579 WriteUninstaller "$INSTDIR\uninstall.exe"
580 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
581 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
582 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
584 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
585 "DisplayName" "$(^Name)"
586 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
587 "UninstallString" "$INSTDIR\uninstall.exe"
588 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
589 "DisplayIcon" "$INSTDIR\vlc.exe"
590 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
591 "DisplayVersion" "${PRODUCT_VERSION}"
592 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
593 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
594 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
595 "Publisher" "${PRODUCT_PUBLISHER}"
596 SectionEnd
598 ;;;;;;;;;;;;;;;;;;;;;;;;
599 ; Uninstaller sections ;
600 ;;;;;;;;;;;;;;;;;;;;;;;;
602 ; TrimNewlines (copied from NSIS documentation)
603 ; input, top of stack (e.g. whatever$\r$\n)
604 ; output, top of stack (replaces, with e.g. whatever)
605 ; modifies no other variables.
607 Function un.TrimNewlines
608 Exch $R0
609 Push $R1
610 Push $R2
611 StrCpy $R1 0
613 loop:
614 IntOp $R1 $R1 - 1
615 StrCpy $R2 $R0 1 $R1
616 StrCmp $R2 "$\r" loop
617 StrCmp $R2 "$\n" loop
618 IntOp $R1 $R1 + 1
619 IntCmp $R1 0 no_trim_needed
620 StrCpy $R0 $R0 $R1
622 no_trim_needed:
623 Pop $R2
624 Pop $R1
625 Exch $R0
626 FunctionEnd
628 Function un.RemoveEmptyDirs
629 Pop $9
630 !define Index 'Line${__LINE__}'
631 FindFirst $0 $1 "$INSTDIR$9*"
632 StrCmp $0 "" "${Index}-End"
633 "${Index}-Loop:"
634 StrCmp $1 "" "${Index}-End"
635 StrCmp $1 "." "${Index}-Next"
636 StrCmp $1 ".." "${Index}-Next"
637 Push $0
638 Push $1
639 Push $9
640 Push "$9$1\"
641 Call un.RemoveEmptyDirs
642 Pop $9
643 Pop $1
644 Pop $0
645 "${Index}-Remove:"
646 RMDir "$INSTDIR$9$1"
647 "${Index}-Next:"
648 FindNext $0 $1
649 Goto "${Index}-Loop"
650 "${Index}-End:"
651 FindClose $0
652 !undef Index
653 FunctionEnd
655 Section "Uninstall" SEC91
656 SectionIn 1 2 3 RO
657 SetShellVarContext all
659 !insertmacro MacroAllExtensions DeleteContextMenu
660 !insertmacro MacroAllExtensions UnRegisterExtensionSection
661 !insertmacro DeleteContextMenuExt "Directory"
663 ;remove activex plugin
664 UnRegDLL "$INSTDIR\axvlc.dll"
665 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
667 ;remove mozilla plugin
668 Push $R0
669 Push $R1
670 Push $R2
672 !define Index 'Line${__LINE__}'
673 StrCpy $R1 "0"
675 "${Index}-Loop:"
677 ; Check for Key
678 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
679 StrCmp $R0 "" "${Index}-End"
680 IntOp $R1 $R1 + 1
681 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
682 StrCmp $R2 "" "${Index}-Loop" ""
684 ; old files (0.8.5 and before) that may be lying around
685 Delete /REBOOTOK "$R2\npvlc.dll"
686 Delete /REBOOTOK "$R2\libvlc.dll"
687 Delete /REBOOTOK "$R2\vlcintf.xpt"
688 Goto "${Index}-Loop"
690 "${Index}-End:"
691 !undef Index
692 Delete /REBOOTOK "$INSTDIR\npvlc.dll"
694 RMDir "$SMPROGRAMS\VideoLAN"
695 RMDir /r $SMPROGRAMS\VideoLAN
697 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
698 UninstallLoop:
699 ClearErrors
700 FileRead $UninstallLog $R0
701 IfErrors UninstallEnd
702 Push $R0
703 Call un.TrimNewLines
704 Pop $R0
705 Delete "$INSTDIR\$R0"
706 Goto UninstallLoop
707 UninstallEnd:
708 FileClose $UninstallLog
709 Delete "$INSTDIR\uninstall.log"
710 Delete "$INSTDIR\uninstall.exe"
711 Push "\"
712 Call un.RemoveEmptyDirs
713 RMDir "$INSTDIR"
715 DeleteRegKey HKLM Software\VideoLAN
717 DeleteRegKey HKCR Applications\vlc.exe
718 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
719 DeleteRegKey HKCR DVD\shell\PlayWithVLC
720 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
721 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
722 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
723 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
724 DeleteRegKey HKCR "VLC.MediaFile"
726 DeleteRegKey HKLM \
727 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
729 DeleteRegKey HKLM \
730 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
732 Delete "$DESKTOP\VLC media player.lnk"
734 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
735 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
736 SetAutoClose true
737 SectionEnd
739 Section /o "un.Delete preferences and cache" SEC92
740 !insertmacro delprefs
741 SectionEnd
743 ; Uninstaller section descriptions
744 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
745 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
746 "Uninstall VLC media player and all its components"
747 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
748 "Deletes VLC media player preferences and cache files"
749 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
751 ;Function un.onUninstSuccess
752 ; HideWindow
753 ; MessageBox MB_ICONINFORMATION|MB_OK \
754 ; "$(^Name) was successfully removed from your computer."
755 ;FunctionEnd
757 Function un.onInit
758 !insertmacro MUI_UNGETLANGUAGE
759 FunctionEnd