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