* : svn:keywords
[vlc.git] / vlc.win32.nsi.in
blobeabd41d0f6e42c4b5365b35e600ae613b127b412
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 @FILE_LIBVLC_DLL@
18 ;;;;;;;;;;;;;;;;;;;;;;;;;
19 ; General configuration ;
20 ;;;;;;;;;;;;;;;;;;;;;;;;;
22 Name "${PRODUCT_GROUP} ${PRODUCT_NAME} ${PRODUCT_VERSION}"
23 OutFile ..\vlc-${VERSION}-win32.exe
24 InstallDir "$PROGRAMFILES\VideoLAN\VLC"
25 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
26 !ifdef NSIS_LZMA_COMPRESS_WHOLE
27 SetCompressor lzma
28 !else
29 SetCompressor /SOLID lzma
30 !endif
31 ;ShowInstDetails show
32 ;ShowUnInstDetails show
33 SetOverwrite ifnewer
34 CRCCheck on
36 InstType "Normal"
37 InstType "Full"
39 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
40 ; NSIS Modern User Interface configuration ;
41 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
43 ; MUI 1.67 compatible ------
44 !include "MUI.nsh"
46 ; MUI Settings
47 !define MUI_ABORTWARNING
48 !define MUI_ICON "vlc48x48.ico"
49 !define MUI_UNICON "vlc48x48.ico"
50 !define MUI_COMPONENTSPAGE_SMALLDESC
52 ; Installer pages
53 ; Welcome page
54 !define MUI_WELCOMEPAGE_TITLE_3LINES
55 !insertmacro MUI_PAGE_WELCOME
56 ; License page
57 !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
58 ; Components page
59 !insertmacro MUI_PAGE_COMPONENTS
60 ; Directory page
61 !insertmacro MUI_PAGE_DIRECTORY
62 ; Instfiles page
63 !insertmacro MUI_PAGE_INSTFILES
64 ; Finish page
65 !define MUI_FINISHPAGE_RUN "$INSTDIR\vlc.exe"
66 !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
67 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
68 !define MUI_FINISHPAGE_LINK "Visit the VideoLAN VLC media player Website"
69 !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
70 !define MUI_FINISHPAGE_NOREBOOTSUPPORT
71 !insertmacro MUI_PAGE_FINISH
73 ; Uninstaller pages
74 !insertmacro MUI_UNPAGE_CONFIRM
75 !insertmacro MUI_UNPAGE_COMPONENTS
76 !insertmacro MUI_UNPAGE_INSTFILES
77 !insertmacro MUI_UNPAGE_FINISH
79 ; Language files
80 !insertmacro MUI_LANGUAGE "English" # first language is the default language
81 !insertmacro MUI_LANGUAGE "French"
82 !insertmacro MUI_LANGUAGE "German"
83 !insertmacro MUI_LANGUAGE "Spanish"
84 !insertmacro MUI_LANGUAGE "SimpChinese"
85 !insertmacro MUI_LANGUAGE "TradChinese"
86 !insertmacro MUI_LANGUAGE "Japanese"
87 !insertmacro MUI_LANGUAGE "Korean"
88 !insertmacro MUI_LANGUAGE "Italian"
89 !insertmacro MUI_LANGUAGE "Dutch"
90 !insertmacro MUI_LANGUAGE "Danish"
91 !insertmacro MUI_LANGUAGE "Swedish"
92 !insertmacro MUI_LANGUAGE "Norwegian"
93 !insertmacro MUI_LANGUAGE "Finnish"
94 !insertmacro MUI_LANGUAGE "Greek"
95 !insertmacro MUI_LANGUAGE "Russian"
96 !insertmacro MUI_LANGUAGE "Portuguese"
97 !insertmacro MUI_LANGUAGE "Arabic"
99 !insertmacro MUI_RESERVEFILE_LANGDLL
101 ; Reserve files
102 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
104 ; MUI end ------
106 ;;;;;;;;;;;;;;;;;;;
107 ; Extension lists ;
108 ;;;;;;;;;;;;;;;;;;;
110 !macro MacroAudioExtensions _action
111 !insertmacro ${_action} ".a52"
112 !insertmacro ${_action} ".aac"
113 !insertmacro ${_action} ".ac3"
114 !insertmacro ${_action} ".dts"
115 !insertmacro ${_action} ".flac"
116 !insertmacro ${_action} ".mka"
117 !insertmacro ${_action} ".mp1"
118 !insertmacro ${_action} ".mp2"
119 !insertmacro ${_action} ".mp3"
120 !insertmacro ${_action} ".ogg"
121 !insertmacro ${_action} ".spx"
122 !insertmacro ${_action} ".wav"
123 !insertmacro ${_action} ".wma"
124 !macroend
126 !macro MacroVideoExtensions _action
127 !insertmacro ${_action} ".asf"
128 !insertmacro ${_action} ".avi"
129 !insertmacro ${_action} ".divx"
130 !insertmacro ${_action} ".dv"
131 !insertmacro ${_action} ".m1v"
132 !insertmacro ${_action} ".m2v"
133 !insertmacro ${_action} ".mkv"
134 !insertmacro ${_action} ".mov"
135 !insertmacro ${_action} ".mp4"
136 !insertmacro ${_action} ".mpeg"
137 !insertmacro ${_action} ".mpeg1"
138 !insertmacro ${_action} ".mpeg2"
139 !insertmacro ${_action} ".mpeg4"
140 !insertmacro ${_action} ".mpg"
141 !insertmacro ${_action} ".ps"
142 !insertmacro ${_action} ".ts"
143 !insertmacro ${_action} ".ogm"
144 !insertmacro ${_action} ".vob"
145 !insertmacro ${_action} ".wmv"
146 !macroend
148 !macro MacroOtherExtensions _action
149 !insertmacro ${_action} ".asx"
150 !insertmacro ${_action} ".bin"
151 !insertmacro ${_action} ".cue"
152 !insertmacro ${_action} ".m3u"
153 !insertmacro ${_action} ".pls"
154 !insertmacro ${_action} ".vlc"
155 !macroend
157 !macro MacroAllExtensions _action
158 !insertmacro MacroAudioExtensions ${_action}
159 !insertmacro MacroVideoExtensions ${_action}
160 !insertmacro MacroOtherExtensions ${_action}
161 !macroend
163 ;;;;;;;;;;;;;;;;;;;;;;;;;;
164 ; File type associations ;
165 ;;;;;;;;;;;;;;;;;;;;;;;;;;
167 Function RegisterExtension
168 ; back up old value for extension $R0 (eg. ".opt")
169 ReadRegStr $1 HKCR "$R0" ""
170 StrCmp $1 "" NoBackup
171 StrCmp $1 "VLC$R0" "NoBackup"
172 WriteRegStr HKCR "$R0" "VLC.backup" $1
173 NoBackup:
174 WriteRegStr HKCR "$R0" "" "VLC$R0"
175 ReadRegStr $0 HKCR "VLC$R0" ""
176 WriteRegStr HKCR "VLC$R0" "" "VLC media file"
177 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
178 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --one-instance-when-started-from-file "%1"'
179 WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
180 FunctionEnd
182 Function un.RegisterExtension
183 ;start of restore script
184 ReadRegStr $1 HKCR "$R0" ""
185 StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
186 ReadRegStr $1 HKCR "$R0" "VLC.backup"
187 StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
188 DeleteRegKey HKCR "$R0"
189 Goto NoOwn
190 Restore:
191 WriteRegStr HKCR "$R0" "" $1
192 DeleteRegValue HKCR "$R0" "VLC.backup"
193 NoOwn:
194 DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
195 FunctionEnd
197 !macro RegisterExtensionSection EXT
198 Section /o ${EXT}
199 SectionIn 2 3
200 Push $R0
201 StrCpy $R0 ${EXT}
202 Call RegisterExtension
203 Pop $R0
204 SectionEnd
205 !macroend
207 !macro UnRegisterExtensionSection EXT
208 Push $R0
209 StrCpy $R0 ${EXT}
210 Call un.RegisterExtension
211 Pop $R0
212 !macroend
214 !macro WriteRegStrSupportedTypes EXT
215 WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
216 !macroend
218 ;;;;;;;;;;;;;;;;;;;;;;;;
219 ; Context menu entries ;
220 ;;;;;;;;;;;;;;;;;;;;;;;;
222 !macro AddContextMenu EXT
223 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
224 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --no-playlist-enqueue "%1"'
226 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
227 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --playlist-enqueue "%1"'
228 !macroend
230 !macro DeleteContextMenu EXT
231 DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
232 DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
233 !macroend
235 ;;;;;;;;;;;;;;;;;;;;;;;;;;
236 ; Delete prefs and cache ;
237 ;;;;;;;;;;;;;;;;;;;;;;;;;;
239 !macro delprefs
240 SectionIn 2 3
241 StrCpy $0 0
242 !define Index 'Line${__LINE__}'
243 "${Index}-Loop:"
244 ; FIXME
245 ; this will loop through all the logged users and "virtual" windows users
246 ; (it looks like users are only present in HKEY_USERS when they are logged in)
247 ClearErrors
248 EnumRegKey $1 HKU "" $0
249 StrCmp $1 "" "${Index}-End"
250 IntOp $0 $0 + 1
251 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
252 StrCmp $2 "" "${Index}-Loop"
253 RMDir /r "$2\vlc"
254 Goto "${Index}-Loop"
255 "${Index}-End:"
256 !undef Index
257 !macroend
259 Var UninstallLog
261 !macro OpenUninstallLog
262 FileOpen $UninstallLog "$INSTDIR\uninstall.log" w
263 FileSeek $UninstallLog 0 END
264 !macroend
266 !macro CloseUninstallLog
267 FileClose $UninstallLog
268 SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
269 !macroend
271 !macro InstallFile FILEREGEX
272 File "${FILEREGEX}"
273 !define Index 'Line${__LINE__}'
274 FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
275 StrCmp $0 "" "${Index}-End"
276 "${Index}-Loop:"
277 StrCmp $1 "" "${Index}-End"
278 FileWrite $UninstallLog "$1$\r$\n"
279 FindNext $0 $1
280 Goto "${Index}-Loop"
281 "${Index}-End:"
282 !undef Index
283 !macroend
285 !macro InstallFolder FOLDER
286 File /r "${FOLDER}"
287 Push "${FOLDER}"
288 Call InstallFolderInternal
289 !macroend
291 Function InstallFolderInternal
292 Pop $9
293 !define Index 'Line${__LINE__}'
294 FindFirst $0 $1 "$INSTDIR\$9\*"
295 StrCmp $0 "" "${Index}-End"
296 "${Index}-Loop:"
297 StrCmp $1 "" "${Index}-End"
298 StrCmp $1 "." "${Index}-Next"
299 StrCmp $1 ".." "${Index}-Next"
300 IfFileExists "$9\$1\*" 0 "${Index}-Write"
301 Push $0
302 Push $9
303 Push "$9\$1"
304 Call InstallFolderInternal
305 Pop $9
306 Pop $0
307 Goto "${Index}-Next"
308 "${Index}-Write:"
309 FileWrite $UninstallLog "$9\$1$\r$\n"
310 "${Index}-Next:"
311 FindNext $0 $1
312 Goto "${Index}-Loop"
313 "${Index}-End:"
314 !undef Index
315 FunctionEnd
318 ;;;;;;;;;;;;;;;;;;;;;;
319 ; Installer sections ;
320 ;;;;;;;;;;;;;;;;;;;;;;
322 Section "Media player (required)" SEC01
323 SectionIn 1 2 3 RO
324 SetShellVarContext all
325 SetOutPath "$INSTDIR"
327 !insertmacro OpenUninstallLog
329 !insertmacro InstallFile vlc.exe
330 !insertmacro InstallFile vlc.exe.manifest
331 !ifdef LIBVLC_DLL
332 !insertmacro InstallFile ${LIBVLC_DLL}
333 !endif
334 !insertmacro InstallFile *.txt
336 !insertmacro InstallFolder plugins
337 !insertmacro InstallFolder locale
338 !insertmacro InstallFolder osdmenu
339 !insertmacro InstallFolder skins
340 !insertmacro InstallFolder http
342 WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" \
343 "${PRODUCT_WEB_SITE}"
344 FileWrite $UninstallLog "${PRODUCT_NAME}.url$\r$\n"
345 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
346 "${PRODUCT_WEB_SITE}/doc/"
347 FileWrite $UninstallLog "Documentation.url$\r$\n"
349 !insertmacro CloseUninstallLog
351 ; Add VLC to "recomended programs" for the following extensions
352 WriteRegStr HKCR Applications\vlc.exe "" ""
353 WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
354 WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
355 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
356 '$INSTDIR\vlc.exe --one-instance-when-started-from-file "%1"'
357 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
359 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
360 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
361 "$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1"
362 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
363 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
364 "$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1"
366 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
367 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
368 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
369 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
370 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
371 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
373 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
374 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
375 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --one-instance-when-started-from-file",0'
376 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
377 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
378 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
379 WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
380 WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
381 WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
382 '$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1'
383 WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
384 WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
385 WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
386 WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
387 '$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1'
388 WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
390 SectionEnd
392 Section "Start Menu Shortcut" SEC02a
393 SectionIn 1 2 3
394 CreateDirectory "$SMPROGRAMS\VideoLAN"
395 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
396 "$INSTDIR\vlc.exe" "--intf wx --wx-embed"
397 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player (alt).lnk" \
398 "$INSTDIR\vlc.exe" "--intf wx --no-wx-embed"
399 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player (skins).lnk" \
400 "$INSTDIR\vlc.exe" "--intf skins"
401 CreateShortCut "$SMPROGRAMS\VideoLAN\Reset VLC defaults and quit.lnk" \
402 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit "
403 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_NAME} Website.lnk" \
404 "$INSTDIR\${PRODUCT_NAME}.url"
405 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
406 "$INSTDIR\Documentation.url"
407 SectionEnd
409 Section "Desktop Shortcut" SEC02b
410 SectionIn 1 2 3
411 CreateShortCut "$DESKTOP\VLC media player.lnk" \
412 "$INSTDIR\vlc.exe" ""
413 SectionEnd
415 Section /o "Mozilla plugin" SEC03
416 SectionIn 2 3
418 !insertmacro OpenUninstallLog
419 !insertmacro InstallFolder mozilla
420 !insertmacro CloseUninstallLog
422 ; doesn't work. bug in mozilla/mozilla firefox or moz documentation (xpt file isn't loaded)
423 ; see mozilla bugs 184506 and 159445
424 ;!define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
425 ;WriteRegStr HKLM ${Moz} "Description" "VideoLAN VLC plugin for Mozilla"
426 ;WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\mozilla\npvlc.dll"
427 ;WriteRegStr HKLM ${Moz} "Product" "VLC media player"
428 ;WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
429 ;WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
430 ;WriteRegStr HKLM ${Moz} "XPTPath" "$INSTDIR\mozilla\vlcintf.xpt"
432 Push $R0
433 Push $R1
434 Push $R2
436 !define Index 'Line${__LINE__}'
437 StrCpy $R1 "0"
439 "${Index}-Loop:"
441 ; Check for Key
442 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
443 StrCmp $R0 "" "${Index}-End"
444 IntOp $R1 $R1 + 1
445 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
446 StrCmp $R2 "" "${Index}-Loop" ""
448 CopyFiles "$INSTDIR\mozilla\*" "$R2"
449 !ifdef LIBVLC_DLL
450 CopyFiles ${LIBVLC_DLL} "$R2"
451 !endif
452 Goto "${Index}-Loop"
454 "${Index}-End:"
455 !undef Index
457 SectionEnd
459 Section "ActiveX plugin" SEC04
460 SectionIn 2 3
461 SetOutPath "$INSTDIR"
462 !insertmacro OpenUninstallLog
463 !insertmacro InstallFile activex\axvlc.dll
464 !insertmacro CloseUninstallLog
465 RegDLL "$INSTDIR\axvlc.dll"
466 SectionEnd
468 Section "Context Menus" SEC05
469 SectionIn 2
470 !insertmacro MacroAllExtensions AddContextMenu
471 !insertmacro AddContextMenu "Directory"
472 SectionEnd
474 SectionGroup "File type associations" SEC06
475 SectionGroup "Audio Files"
476 !insertmacro MacroAudioExtensions RegisterExtensionSection
477 SectionGroupEnd
478 SectionGroup "Video Files"
479 !insertmacro MacroVideoExtensions RegisterExtensionSection
480 SectionGroupEnd
481 SectionGroup "Other"
482 !insertmacro MacroOtherExtensions RegisterExtensionSection
483 SectionGroupEnd
484 SectionGroupEnd
486 Section /o "Delete preferences and cache" SEC07
487 !insertmacro delprefs
488 SectionEnd
490 ; Installer section descriptions
491 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
492 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
493 "The media player itself"
494 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
495 "Adds icons to your start menu for easy access"
496 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
497 "Adds icon to your desktop for easy access"
498 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
499 "The VLC Mozilla and Mozilla Firefox plugin"
500 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
501 "The VLC ActiveX plugin"
502 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
503 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
504 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
505 "Sets VLC media player as the default application for the specified file type"
506 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
507 "Deletes VLC media player preferences and cache files leftover from previous installations"
508 !insertmacro MUI_FUNCTION_DESCRIPTION_END
510 Function .onInit
511 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
512 "UninstallString"
513 StrCmp $R0 "" done
515 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
516 "VLC media player has already been installed. $\nDo you want to remove \
517 the previous version before installing $(^Name) ?" \
518 IDNO done
520 ;Run the uninstaller
521 ;uninst:
522 ClearErrors
523 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
524 done:
525 !insertmacro MUI_LANGDLL_DISPLAY
526 FunctionEnd
528 Section -Post
529 WriteUninstaller "$INSTDIR\uninstall.exe"
530 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
531 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
532 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
534 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
535 "DisplayName" "$(^Name)"
536 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
537 "UninstallString" "$INSTDIR\uninstall.exe"
538 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
539 "DisplayIcon" "$INSTDIR\vlc.exe"
540 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
541 "DisplayVersion" "${PRODUCT_VERSION}"
542 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
543 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
544 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
545 "Publisher" "${PRODUCT_PUBLISHER}"
546 SectionEnd
548 ;;;;;;;;;;;;;;;;;;;;;;;;
549 ; Uninstaller sections ;
550 ;;;;;;;;;;;;;;;;;;;;;;;;
552 ; TrimNewlines (copied from NSIS documentation)
553 ; input, top of stack (e.g. whatever$\r$\n)
554 ; output, top of stack (replaces, with e.g. whatever)
555 ; modifies no other variables.
557 Function un.TrimNewlines
558 Exch $R0
559 Push $R1
560 Push $R2
561 StrCpy $R1 0
563 loop:
564 IntOp $R1 $R1 - 1
565 StrCpy $R2 $R0 1 $R1
566 StrCmp $R2 "$\r" loop
567 StrCmp $R2 "$\n" loop
568 IntOp $R1 $R1 + 1
569 IntCmp $R1 0 no_trim_needed
570 StrCpy $R0 $R0 $R1
572 no_trim_needed:
573 Pop $R2
574 Pop $R1
575 Exch $R0
576 FunctionEnd
578 Function un.RemoveEmptyDirs
579 Pop $9
580 !define Index 'Line${__LINE__}'
581 FindFirst $0 $1 "$INSTDIR$9*"
582 StrCmp $0 "" "${Index}-End"
583 "${Index}-Loop:"
584 StrCmp $1 "" "${Index}-End"
585 StrCmp $1 "." "${Index}-Next"
586 StrCmp $1 ".." "${Index}-Next"
587 Push $0
588 Push $1
589 Push $9
590 Push "$9$1\"
591 Call un.RemoveEmptyDirs
592 Pop $9
593 Pop $1
594 Pop $0
595 "${Index}-Remove:"
596 RMDir "$INSTDIR$9$1"
597 "${Index}-Next:"
598 FindNext $0 $1
599 Goto "${Index}-Loop"
600 "${Index}-End:"
601 FindClose $0
602 !undef Index
603 FunctionEnd
605 Section "Uninstall" SEC91
606 SectionIn 1 2 3 RO
607 SetShellVarContext all
609 !insertmacro MacroAllExtensions DeleteContextMenu
610 !insertmacro MacroAllExtensions UnRegisterExtensionSection
611 !insertmacro DeleteContextMenu "Directory"
613 UnRegDLL "$INSTDIR\axvlc.dll"
614 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
616 ;remove mozilla plugin
617 Push $R0
618 Push $R1
619 Push $R2
621 !define Index 'Line${__LINE__}'
622 StrCpy $R1 "0"
624 "${Index}-Loop:"
626 ; Check for Key
627 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
628 StrCmp $R0 "" "${Index}-End"
629 IntOp $R1 $R1 + 1
630 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
631 StrCmp $R2 "" "${Index}-Loop" ""
633 Delete "$R2\vlcintf.xpt"
634 Delete "$R2\npvlc.dll"
635 Goto "${Index}-Loop"
637 "${Index}-End:"
638 !undef Index
640 RMDir "$SMPROGRAMS\VideoLAN"
641 RMDir /r $SMPROGRAMS\VideoLAN
643 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
644 UninstallLoop:
645 ClearErrors
646 FileRead $UninstallLog $R0
647 IfErrors UninstallEnd
648 Push $R0
649 Call un.TrimNewLines
650 Pop $R0
651 Delete "$INSTDIR\$R0"
652 Goto UninstallLoop
653 UninstallEnd:
654 FileClose $UninstallLog
655 Delete "$INSTDIR\uninstall.log"
656 Delete "$INSTDIR\uninstall.exe"
657 Push "\"
658 Call un.RemoveEmptyDirs
659 RMDir "$INSTDIR"
661 DeleteRegKey HKLM Software\VideoLAN
663 DeleteRegKey HKCR Applications\vlc.exe
664 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
665 DeleteRegKey HKCR DVD\shell\PlayWithVLC
666 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
667 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
668 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
669 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
670 DeleteRegKey HKCR "VLC.MediaFile"
672 DeleteRegKey HKLM \
673 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
675 DeleteRegKey HKLM \
676 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
678 Delete "$DESKTOP\VLC media player.lnk"
680 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
681 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
682 SetAutoClose true
683 SectionEnd
685 Section /o "un.Delete preferences and cache" SEC92
686 SectionIn 2 3 RO
687 !insertmacro delprefs
688 SectionEnd
690 ; Uninstaller section descriptions
691 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
692 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
693 "Uninstall VLC media player and all its components"
694 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
695 "Deletes VLC media player preferences and cache files"
696 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
698 ;Function un.onUninstSuccess
699 ; HideWindow
700 ; MessageBox MB_ICONINFORMATION|MB_OK \
701 ; "$(^Name) was successfully removed from your computer."
702 ;FunctionEnd
704 Function un.onInit
705 !insertmacro MUI_LANGDLL_DISPLAY
706 FunctionEnd