Add translations from rosetta
[vlc.git] / vlc.win32.nsi.in
blob4b0b0e63fa7123f93a9a9ccc9769e76881987516
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 ($R0)"
178 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
179 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --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 ${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 --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 --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 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" a
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_GROUP} Website.url" "InternetShortcut" "URL" \
343 "${PRODUCT_WEB_SITE}"
344 FileWrite $UninstallLog "${PRODUCT_GROUP} Website.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 --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 --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 --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 --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 --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 --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 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
396 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
397 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
398 "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
399 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
400 "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
401 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
402 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
403 "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
404 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
405 "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
406 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
407 ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
408 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
409 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
410 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
411 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
412 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
413 "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
414 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
415 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
416 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
417 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
418 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
419 "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
420 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
421 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
422 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
423 "$INSTDIR\Documentation.url"
424 CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
425 "$INSTDIR\NEWS.txt" ""
426 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
427 "$INSTDIR\${PRODUCT_GROUP} Website.url"
428 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
429 "$INSTDIR\vlc.exe" ""
430 SectionEnd
432 Section "Desktop Shortcut" SEC02b
433 SectionIn 1 2 3
434 CreateShortCut "$DESKTOP\VLC media player.lnk" \
435 "$INSTDIR\vlc.exe" ""
436 SectionEnd
438 Section /o "Mozilla plugin" SEC03
439 SectionIn 3
441 SetOutPath "$INSTDIR"
442 !insertmacro OpenUninstallLog
443 !insertmacro InstallFile mozilla\npvlc.dll
444 !insertmacro CloseUninstallLog
446 !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
447 WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
448 WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
449 WriteRegStr HKLM ${Moz} "Product" "VLC media player"
450 WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
451 WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
453 ; for very old version of mozilla, these lines may be needed
454 ;Push $R0
455 ;Push $R1
456 ;Push $R2
458 ;!define Index 'Line${__LINE__}'
459 ;StrCpy $R1 "0"
461 ;"${Index}-Loop:"
463 ; ; Check for Key
464 ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
465 ; StrCmp $R0 "" "${Index}-End"
466 ; IntOp $R1 $R1 + 1
467 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
468 ; StrCmp $R2 "" "${Index}-Loop" ""
470 ; CopyFiles "$INSTDIR\npvlc.dll" "$R2"
471 ; !ifdef LIBVLC_DLL
472 ; CopyFiles ${LIBVLC_DLL} "$R2"
473 ; !endif
474 ; Goto "${Index}-Loop"
476 ;"${Index}-End:"
477 ;!undef Index
479 SectionEnd
481 Section "ActiveX plugin" SEC04
482 SectionIn 1 3
483 SetOutPath "$INSTDIR"
484 !insertmacro OpenUninstallLog
485 !insertmacro InstallFile activex\axvlc.dll
486 !insertmacro CloseUninstallLog
487 RegDLL "$INSTDIR\axvlc.dll"
488 SectionEnd
490 Section /o "Context Menus" SEC05
491 SectionIn 3
492 !insertmacro MacroAllExtensions AddContextMenu
493 !insertmacro AddContextMenu "Directory"
494 SectionEnd
496 SectionGroup "File type associations" SEC06
497 SectionGroup "Audio Files"
498 !insertmacro MacroAudioExtensions RegisterExtensionSection
499 SectionGroupEnd
500 SectionGroup "Video Files"
501 !insertmacro MacroVideoExtensions RegisterExtensionSection
502 SectionGroupEnd
503 SectionGroup "Other"
504 !insertmacro MacroOtherExtensions RegisterExtensionSection
505 SectionGroupEnd
506 SectionGroupEnd
508 Section /o "Delete preferences and cache" SEC07
509 !insertmacro delprefs
510 SectionEnd
512 ; Installer section descriptions
513 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
514 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
515 "The media player itself"
516 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
517 "Adds icons to your start menu for easy access"
518 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
519 "Adds icon to your desktop for easy access"
520 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
521 "The VLC Mozilla and Mozilla Firefox plugin"
522 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
523 "The VLC ActiveX plugin"
524 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
525 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
526 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
527 "Sets VLC media player as the default application for the specified file type"
528 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
529 "Deletes VLC media player preferences and cache files leftover from previous installations"
530 !insertmacro MUI_FUNCTION_DESCRIPTION_END
532 Function .onInit
533 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
534 "UninstallString"
535 StrCmp $R0 "" done
537 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
538 "VLC media player has already been installed. $\nDo you want to remove \
539 the previous version before installing $(^Name) ?" \
540 IDNO done
542 ;Run the uninstaller
543 ;uninst:
544 ClearErrors
545 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
546 done:
547 !insertmacro MUI_LANGDLL_DISPLAY
548 FunctionEnd
550 Section -Post
551 WriteUninstaller "$INSTDIR\uninstall.exe"
552 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
553 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
554 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
556 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
557 "DisplayName" "$(^Name)"
558 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
559 "UninstallString" "$INSTDIR\uninstall.exe"
560 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
561 "DisplayIcon" "$INSTDIR\vlc.exe"
562 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
563 "DisplayVersion" "${PRODUCT_VERSION}"
564 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
565 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
566 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
567 "Publisher" "${PRODUCT_PUBLISHER}"
568 SectionEnd
570 ;;;;;;;;;;;;;;;;;;;;;;;;
571 ; Uninstaller sections ;
572 ;;;;;;;;;;;;;;;;;;;;;;;;
574 ; TrimNewlines (copied from NSIS documentation)
575 ; input, top of stack (e.g. whatever$\r$\n)
576 ; output, top of stack (replaces, with e.g. whatever)
577 ; modifies no other variables.
579 Function un.TrimNewlines
580 Exch $R0
581 Push $R1
582 Push $R2
583 StrCpy $R1 0
585 loop:
586 IntOp $R1 $R1 - 1
587 StrCpy $R2 $R0 1 $R1
588 StrCmp $R2 "$\r" loop
589 StrCmp $R2 "$\n" loop
590 IntOp $R1 $R1 + 1
591 IntCmp $R1 0 no_trim_needed
592 StrCpy $R0 $R0 $R1
594 no_trim_needed:
595 Pop $R2
596 Pop $R1
597 Exch $R0
598 FunctionEnd
600 Function un.RemoveEmptyDirs
601 Pop $9
602 !define Index 'Line${__LINE__}'
603 FindFirst $0 $1 "$INSTDIR$9*"
604 StrCmp $0 "" "${Index}-End"
605 "${Index}-Loop:"
606 StrCmp $1 "" "${Index}-End"
607 StrCmp $1 "." "${Index}-Next"
608 StrCmp $1 ".." "${Index}-Next"
609 Push $0
610 Push $1
611 Push $9
612 Push "$9$1\"
613 Call un.RemoveEmptyDirs
614 Pop $9
615 Pop $1
616 Pop $0
617 "${Index}-Remove:"
618 RMDir "$INSTDIR$9$1"
619 "${Index}-Next:"
620 FindNext $0 $1
621 Goto "${Index}-Loop"
622 "${Index}-End:"
623 FindClose $0
624 !undef Index
625 FunctionEnd
627 Section "Uninstall" SEC91
628 SectionIn 1 2 3 RO
629 SetShellVarContext all
631 !insertmacro MacroAllExtensions DeleteContextMenu
632 !insertmacro MacroAllExtensions UnRegisterExtensionSection
633 !insertmacro DeleteContextMenu "Directory"
635 ;remove activex plugin
636 UnRegDLL "$INSTDIR\axvlc.dll"
637 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
639 ;remove mozilla plugin
640 Push $R0
641 Push $R1
642 Push $R2
644 !define Index 'Line${__LINE__}'
645 StrCpy $R1 "0"
647 "${Index}-Loop:"
649 ; Check for Key
650 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
651 StrCmp $R0 "" "${Index}-End"
652 IntOp $R1 $R1 + 1
653 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
654 StrCmp $R2 "" "${Index}-Loop" ""
656 ; old files (0.8.5 and before) that may be lying around
657 Delete /REBOOTOK "$R2\npvlc.dll"
658 Delete /REBOOTOK "$R2\libvlc.dll"
659 Delete /REBOOTOK "$R2\vlcintf.xpt"
660 Goto "${Index}-Loop"
662 "${Index}-End:"
663 !undef Index
664 Delete /REBOOTOK "$INSTDIR\npvlc.dll"
666 RMDir "$SMPROGRAMS\VideoLAN"
667 RMDir /r $SMPROGRAMS\VideoLAN
669 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
670 UninstallLoop:
671 ClearErrors
672 FileRead $UninstallLog $R0
673 IfErrors UninstallEnd
674 Push $R0
675 Call un.TrimNewLines
676 Pop $R0
677 Delete "$INSTDIR\$R0"
678 Goto UninstallLoop
679 UninstallEnd:
680 FileClose $UninstallLog
681 Delete "$INSTDIR\uninstall.log"
682 Delete "$INSTDIR\uninstall.exe"
683 Push "\"
684 Call un.RemoveEmptyDirs
685 RMDir "$INSTDIR"
687 DeleteRegKey HKLM Software\VideoLAN
689 DeleteRegKey HKCR Applications\vlc.exe
690 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
691 DeleteRegKey HKCR DVD\shell\PlayWithVLC
692 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
693 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
694 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
695 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
696 DeleteRegKey HKCR "VLC.MediaFile"
698 DeleteRegKey HKLM \
699 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
701 DeleteRegKey HKLM \
702 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
704 Delete "$DESKTOP\VLC media player.lnk"
706 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
707 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
708 SetAutoClose true
709 SectionEnd
711 Section /o "un.Delete preferences and cache" SEC92
712 !insertmacro delprefs
713 SectionEnd
715 ; Uninstaller section descriptions
716 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
717 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
718 "Uninstall VLC media player and all its components"
719 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
720 "Deletes VLC media player preferences and cache files"
721 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
723 ;Function un.onUninstSuccess
724 ; HideWindow
725 ; MessageBox MB_ICONINFORMATION|MB_OK \
726 ; "$(^Name) was successfully removed from your computer."
727 ;FunctionEnd
729 Function un.onInit
730 !insertmacro MUI_LANGDLL_DISPLAY
731 FunctionEnd