Put the preprocessing flags in CPPFLAGS
[vlc/vlc-skelet.git] / vlc.win32.nsi.in
blob84e41170b34b8c220dac918a3c4ef402b9196b78
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"
105 !insertmacro MUI_LANGUAGE "Romanian"
106 !insertmacro MUI_LANGUAGE "Slovak"
107 !insertmacro MUI_LANGUAGE "Czech"
109 !insertmacro MUI_RESERVEFILE_LANGDLL
111 ; Reserve files
112 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
114 ; MUI end ------
116 ;;;;;;;;;;;;;;;;;;;
117 ; Extension lists ;
118 ;;;;;;;;;;;;;;;;;;;
120 !macro MacroAudioExtensions _action
121 !insertmacro ${_action} ".a52"
122 !insertmacro ${_action} ".aac"
123 !insertmacro ${_action} ".ac3"
124 !insertmacro ${_action} ".dts"
125 !insertmacro ${_action} ".flac"
126 !insertmacro ${_action} ".mka"
127 !insertmacro ${_action} ".mp1"
128 !insertmacro ${_action} ".mp2"
129 !insertmacro ${_action} ".mp3"
130 !insertmacro ${_action} ".ogg"
131 !insertmacro ${_action} ".spx"
132 !insertmacro ${_action} ".wav"
133 !insertmacro ${_action} ".wma"
134 !macroend
136 !macro MacroVideoExtensions _action
137 !insertmacro ${_action} ".asf"
138 !insertmacro ${_action} ".avi"
139 !insertmacro ${_action} ".divx"
140 !insertmacro ${_action} ".dv"
141 !insertmacro ${_action} ".m1v"
142 !insertmacro ${_action} ".m2v"
143 !insertmacro ${_action} ".mkv"
144 !insertmacro ${_action} ".mov"
145 !insertmacro ${_action} ".mp4"
146 !insertmacro ${_action} ".mpeg"
147 !insertmacro ${_action} ".mpeg1"
148 !insertmacro ${_action} ".mpeg2"
149 !insertmacro ${_action} ".mpeg4"
150 !insertmacro ${_action} ".mpg"
151 !insertmacro ${_action} ".mxf"
152 !insertmacro ${_action} ".ps"
153 !insertmacro ${_action} ".ts"
154 !insertmacro ${_action} ".ogm"
155 !insertmacro ${_action} ".vob"
156 !insertmacro ${_action} ".wmv"
157 !macroend
159 !macro MacroOtherExtensions _action
160 !insertmacro ${_action} ".asx"
161 !insertmacro ${_action} ".bin"
162 !insertmacro ${_action} ".cue"
163 !insertmacro ${_action} ".m3u"
164 !insertmacro ${_action} ".pls"
165 !insertmacro ${_action} ".vlc"
166 !macroend
168 !macro MacroAllExtensions _action
169 !insertmacro MacroAudioExtensions ${_action}
170 !insertmacro MacroVideoExtensions ${_action}
171 !insertmacro MacroOtherExtensions ${_action}
172 !macroend
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;
175 ; File type associations ;
176 ;;;;;;;;;;;;;;;;;;;;;;;;;;
178 Function RegisterExtension
179 ; back up old value for extension $R0 (eg. ".opt")
180 ReadRegStr $1 HKCR "$R0" ""
181 StrCmp $1 "" NoBackup
182 StrCmp $1 "VLC$R0" "NoBackup"
183 WriteRegStr HKCR "$R0" "VLC.backup" $1
184 NoBackup:
185 WriteRegStr HKCR "$R0" "" "VLC$R0"
186 ReadRegStr $0 HKCR "VLC$R0" ""
187 WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
188 WriteRegStr HKCR "VLC$R0\shell" "" "Play"
189 WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
190 WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
192 ; Vista detection
193 ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
194 StrCpy $R2 $R1 3
195 StrCmp $R2 '6.0' ForVista ToEnd
196 ForVista:
197 WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
198 ToEnd:
200 FunctionEnd
202 Function un.RegisterExtension
203 ;start of restore script
204 ReadRegStr $1 HKCR "$R0" ""
205 StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
206 ReadRegStr $1 HKCR "$R0" "VLC.backup"
207 StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
208 DeleteRegKey HKCR "$R0"
209 Goto NoOwn
210 Restore:
211 WriteRegStr HKCR "$R0" "" $1
212 DeleteRegValue HKCR "$R0" "VLC.backup"
213 NoOwn:
214 DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
215 FunctionEnd
217 !macro RegisterExtensionSection EXT
218 Section ${EXT}
219 SectionIn 1 3
220 Push $R0
221 StrCpy $R0 ${EXT}
222 Call RegisterExtension
223 Pop $R0
224 SectionEnd
225 !macroend
227 !macro UnRegisterExtensionSection EXT
228 Push $R0
229 StrCpy $R0 ${EXT}
230 Call un.RegisterExtension
231 Pop $R0
232 !macroend
234 !macro WriteRegStrSupportedTypes EXT
235 WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
236 !macroend
238 ;;;;;;;;;;;;;;;;;;;;;;;;
239 ; Context menu entries ;
240 ;;;;;;;;;;;;;;;;;;;;;;;;
242 !macro AddContextMenuExt EXT
243 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player"
244 WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --started-from-file --no-playlist-enqueue "%1"'
246 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist"
247 WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"'
248 !macroend
250 !macro AddContextMenu EXT
251 Push $R0
252 ReadRegStr $R0 HKCR ${EXT} ""
253 !insertmacro AddContextMenuExt $R0
254 Pop $R0
255 !macroend
257 !macro DeleteContextMenuExt EXT
258 DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
259 DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
260 !macroend
262 !macro DeleteContextMenu EXT
263 Push $R0
264 ReadRegStr $R0 HKCR ${EXT} ""
265 !insertmacro DeleteContextMenuExt $R0
266 Pop $R0
267 !macroend
269 ;;;;;;;;;;;;;;;;;;;;;;;;;;
270 ; Delete prefs and cache ;
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;
273 !macro delprefs
274 StrCpy $0 0
275 !define Index 'Line${__LINE__}'
276 "${Index}-Loop:"
277 ; FIXME
278 ; this will loop through all the logged users and "virtual" windows users
279 ; (it looks like users are only present in HKEY_USERS when they are logged in)
280 ClearErrors
281 EnumRegKey $1 HKU "" $0
282 StrCmp $1 "" "${Index}-End"
283 IntOp $0 $0 + 1
284 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
285 StrCmp $2 "" "${Index}-Loop"
286 RMDir /r "$2\vlc"
287 Goto "${Index}-Loop"
288 "${Index}-End:"
289 !undef Index
290 !macroend
292 Var UninstallLog
294 !macro OpenUninstallLog
295 FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
296 FileSeek $UninstallLog 0 END
297 !macroend
299 !macro CloseUninstallLog
300 FileClose $UninstallLog
301 SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
302 !macroend
304 !macro InstallFile FILEREGEX
305 File "${FILEREGEX}"
306 !define Index 'Line${__LINE__}'
307 FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
308 StrCmp $0 "" "${Index}-End"
309 "${Index}-Loop:"
310 StrCmp $1 "" "${Index}-End"
311 FileWrite $UninstallLog "$1$\r$\n"
312 FindNext $0 $1
313 Goto "${Index}-Loop"
314 "${Index}-End:"
315 !undef Index
316 !macroend
318 !macro InstallFolder FOLDER
319 File /r "${FOLDER}"
320 Push "${FOLDER}"
321 Call InstallFolderInternal
322 !macroend
324 Function InstallFolderInternal
325 Pop $9
326 !define Index 'Line${__LINE__}'
327 FindFirst $0 $1 "$INSTDIR\$9\*"
328 StrCmp $0 "" "${Index}-End"
329 "${Index}-Loop:"
330 StrCmp $1 "" "${Index}-End"
331 StrCmp $1 "." "${Index}-Next"
332 StrCmp $1 ".." "${Index}-Next"
333 IfFileExists "$9\$1\*" 0 "${Index}-Write"
334 Push $0
335 Push $9
336 Push "$9\$1"
337 Call InstallFolderInternal
338 Pop $9
339 Pop $0
340 Goto "${Index}-Next"
341 "${Index}-Write:"
342 FileWrite $UninstallLog "$9\$1$\r$\n"
343 "${Index}-Next:"
344 FindNext $0 $1
345 Goto "${Index}-Loop"
346 "${Index}-End:"
347 !undef Index
348 FunctionEnd
351 ;;;;;;;;;;;;;;;;;;;;;;
352 ; Installer sections ;
353 ;;;;;;;;;;;;;;;;;;;;;;
355 Section "Media player (required)" SEC01
356 SectionIn 1 2 3 RO
357 SetShellVarContext all
358 SetOutPath "$INSTDIR"
360 !insertmacro OpenUninstallLog
362 !insertmacro InstallFile vlc.exe
363 !insertmacro InstallFile vlc.exe.manifest
364 !ifdef LIBVLC_DLL
365 !insertmacro InstallFile ${LIBVLC_DLL}
366 !endif
367 !ifdef LIBVLC_CONTROL_DLL
368 !insertmacro InstallFile ${LIBVLC_CONTROL_DLL}
369 !endif
370 !insertmacro InstallFile *.txt
372 !insertmacro InstallFolder plugins
373 !insertmacro InstallFolder locale
374 !insertmacro InstallFolder osdmenu
375 !insertmacro InstallFolder skins
376 !insertmacro InstallFolder http
377 !insertmacro InstallFolder share
379 WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
380 "${PRODUCT_WEB_SITE}"
381 FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
382 WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
383 "${PRODUCT_WEB_SITE}/doc/"
384 FileWrite $UninstallLog "Documentation.url$\r$\n"
386 !insertmacro CloseUninstallLog
388 ; Add VLC to "recomended programs" for the following extensions
389 WriteRegStr HKCR Applications\vlc.exe "" ""
390 WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
391 WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC"
392 WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \
393 '$INSTDIR\vlc.exe --started-from-file "%1"'
394 !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
396 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player"
397 WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
398 "$INSTDIR\vlc.exe --started-from-file cdda:%1"
399 WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player"
400 WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
401 "$INSTDIR\vlc.exe --started-from-file dvd:%1"
403 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
404 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie"
405 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
406 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
407 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
408 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
410 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
411 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio"
412 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0'
413 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
414 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
415 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
416 WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
417 WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play"
418 WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \
419 '$INSTDIR\vlc.exe --started-from-file dvd:%1'
420 WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
421 WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
422 WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play"
423 WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \
424 '$INSTDIR\vlc.exe --started-from-file cdda:%1'
425 WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
427 ; Vista detection
428 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
429 StrCpy $R1 $R0 3
430 StrCmp $R1 '6.0' lbl_vista lbl_done
432 lbl_vista:
433 WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
434 WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
435 WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
437 lbl_done:
439 SectionEnd
441 Section "Start Menu Shortcut" SEC02a
442 SectionIn 1 2 3
443 CreateDirectory "$SMPROGRAMS\VideoLAN"
444 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
445 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
446 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
447 "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc:quit"
448 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
449 "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc:quit"
450 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
451 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
452 "$INSTDIR\vlc.exe" "-I skins --save-config vlc:quit"
453 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to wxWidgets (default).lnk" \
454 "$INSTDIR\vlc.exe" "-I wxwin --save-config vlc:quit"
455 CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
456 ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
457 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
458 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc:quit"
459 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
460 "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc:quit"
461 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
462 "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc:quit"
463 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
464 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc:quit"
465 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
466 "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc:quit"
467 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
468 "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc:quit"
469 CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
470 "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit"
471 CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
472 "$INSTDIR\Documentation.url"
473 CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
474 "$INSTDIR\NEWS.txt" ""
475 CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
476 "$INSTDIR\${PRODUCT_GROUP} Website.url"
477 CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
478 "$INSTDIR\vlc.exe" ""
479 SectionEnd
481 Section "Desktop Shortcut" SEC02b
482 SectionIn 1 2 3
483 CreateShortCut "$DESKTOP\VLC media player.lnk" \
484 "$INSTDIR\vlc.exe" ""
485 SectionEnd
487 Section /o "Mozilla plugin" SEC03
488 SectionIn 3
490 SetOutPath "$INSTDIR"
491 !insertmacro OpenUninstallLog
492 !insertmacro InstallFile mozilla\npvlc.dll
493 !insertmacro CloseUninstallLog
495 !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
496 WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
497 WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
498 WriteRegStr HKLM ${Moz} "Product" "VLC media player"
499 WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
500 WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
502 ; for very old version of mozilla, these lines may be needed
503 ;Push $R0
504 ;Push $R1
505 ;Push $R2
507 ;!define Index 'Line${__LINE__}'
508 ;StrCpy $R1 "0"
510 ;"${Index}-Loop:"
512 ; ; Check for Key
513 ; EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
514 ; StrCmp $R0 "" "${Index}-End"
515 ; IntOp $R1 $R1 + 1
516 ; ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
517 ; StrCmp $R2 "" "${Index}-Loop" ""
519 ; CopyFiles "$INSTDIR\npvlc.dll" "$R2"
520 ; !ifdef LIBVLC_DLL
521 ; CopyFiles ${LIBVLC_DLL} "$R2"
522 ; !endif
523 ; !ifdef LIBVLC_CONTROL_DLL
524 ; CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
525 ; !endif
526 ; Goto "${Index}-Loop"
528 ;"${Index}-End:"
529 ;!undef Index
531 SectionEnd
533 Section "ActiveX plugin" SEC04
534 SectionIn 1 3
535 SetOutPath "$INSTDIR"
536 !insertmacro OpenUninstallLog
537 !insertmacro InstallFile activex\axvlc.dll
538 !insertmacro CloseUninstallLog
539 RegDLL "$INSTDIR\axvlc.dll"
540 SectionEnd
542 SectionGroup "File type associations" SEC06
543 SectionGroup "Audio Files"
544 !insertmacro MacroAudioExtensions RegisterExtensionSection
545 SectionGroupEnd
546 SectionGroup "Video Files"
547 !insertmacro MacroVideoExtensions RegisterExtensionSection
548 SectionGroupEnd
549 SectionGroup "Other"
550 !insertmacro MacroOtherExtensions RegisterExtensionSection
551 SectionGroupEnd
552 SectionGroupEnd
554 Section /o "Context Menus" SEC05
555 SectionIn 3
556 !insertmacro MacroAllExtensions AddContextMenu
557 !insertmacro AddContextMenuExt "Directory"
558 SectionEnd
560 Section /o "Delete preferences and cache" SEC07
561 !insertmacro delprefs
562 SectionEnd
564 ; Installer section descriptions
565 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
566 !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} \
567 "The media player itself"
568 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} \
569 "Adds icons to your start menu for easy access"
570 !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} \
571 "Adds icon to your desktop for easy access"
572 !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} \
573 "The VLC Mozilla and Mozilla Firefox plugin"
574 !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} \
575 "The VLC ActiveX plugin"
576 !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} \
577 "Add context menu items ('Play With VLC' and 'Add To VLC's Playlist')"
578 !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} \
579 "Sets VLC media player as the default application for the specified file type"
580 !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} \
581 "Deletes VLC media player preferences and cache files leftover from previous installations"
582 !insertmacro MUI_FUNCTION_DESCRIPTION_END
584 Function .onInit
585 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
586 "UninstallString"
587 StrCmp $R0 "" done
589 MessageBox MB_YESNO|MB_ICONEXCLAMATION \
590 "VLC media player has already been installed. $\nDo you want to remove \
591 the previous version before installing $(^Name) ?" \
592 IDNO done
594 ;Run the uninstaller
595 ;uninst:
596 ClearErrors
597 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
598 done:
599 !insertmacro MUI_LANGDLL_DISPLAY
600 FunctionEnd
602 Section -Post
603 WriteUninstaller "$INSTDIR\uninstall.exe"
604 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
605 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
606 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
608 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
609 "DisplayName" "$(^Name)"
610 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
611 "UninstallString" "$INSTDIR\uninstall.exe"
612 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
613 "DisplayIcon" "$INSTDIR\vlc.exe"
614 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
615 "DisplayVersion" "${PRODUCT_VERSION}"
616 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
617 "URLInfoAbout" "${PRODUCT_WEB_SITE}"
618 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
619 "Publisher" "${PRODUCT_PUBLISHER}"
620 SectionEnd
622 ;;;;;;;;;;;;;;;;;;;;;;;;
623 ; Uninstaller sections ;
624 ;;;;;;;;;;;;;;;;;;;;;;;;
626 ; TrimNewlines (copied from NSIS documentation)
627 ; input, top of stack (e.g. whatever$\r$\n)
628 ; output, top of stack (replaces, with e.g. whatever)
629 ; modifies no other variables.
631 Function un.TrimNewlines
632 Exch $R0
633 Push $R1
634 Push $R2
635 StrCpy $R1 0
637 loop:
638 IntOp $R1 $R1 - 1
639 StrCpy $R2 $R0 1 $R1
640 StrCmp $R2 "$\r" loop
641 StrCmp $R2 "$\n" loop
642 IntOp $R1 $R1 + 1
643 IntCmp $R1 0 no_trim_needed
644 StrCpy $R0 $R0 $R1
646 no_trim_needed:
647 Pop $R2
648 Pop $R1
649 Exch $R0
650 FunctionEnd
652 Function un.RemoveEmptyDirs
653 Pop $9
654 !define Index 'Line${__LINE__}'
655 FindFirst $0 $1 "$INSTDIR$9*"
656 StrCmp $0 "" "${Index}-End"
657 "${Index}-Loop:"
658 StrCmp $1 "" "${Index}-End"
659 StrCmp $1 "." "${Index}-Next"
660 StrCmp $1 ".." "${Index}-Next"
661 Push $0
662 Push $1
663 Push $9
664 Push "$9$1\"
665 Call un.RemoveEmptyDirs
666 Pop $9
667 Pop $1
668 Pop $0
669 "${Index}-Remove:"
670 RMDir "$INSTDIR$9$1"
671 "${Index}-Next:"
672 FindNext $0 $1
673 Goto "${Index}-Loop"
674 "${Index}-End:"
675 FindClose $0
676 !undef Index
677 FunctionEnd
679 Section "Uninstall" SEC91
680 SectionIn 1 2 3 RO
681 SetShellVarContext all
683 !insertmacro MacroAllExtensions DeleteContextMenu
684 !insertmacro MacroAllExtensions UnRegisterExtensionSection
685 !insertmacro DeleteContextMenuExt "Directory"
687 ;remove activex plugin
688 UnRegDLL "$INSTDIR\axvlc.dll"
689 Delete /REBOOTOK "$INSTDIR\axvlc.dll"
691 ;remove mozilla plugin
692 Push $R0
693 Push $R1
694 Push $R2
696 !define Index 'Line${__LINE__}'
697 StrCpy $R1 "0"
699 "${Index}-Loop:"
701 ; Check for Key
702 EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
703 StrCmp $R0 "" "${Index}-End"
704 IntOp $R1 $R1 + 1
705 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
706 StrCmp $R2 "" "${Index}-Loop" ""
708 ; old files (0.8.5 and before) that may be lying around
709 Delete /REBOOTOK "$R2\npvlc.dll"
710 Delete /REBOOTOK "$R2\libvlc.dll"
711 Delete /REBOOTOK "$R2\vlcintf.xpt"
712 Goto "${Index}-Loop"
714 "${Index}-End:"
715 !undef Index
716 Delete /REBOOTOK "$INSTDIR\npvlc.dll"
718 RMDir "$SMPROGRAMS\VideoLAN"
719 RMDir /r $SMPROGRAMS\VideoLAN
721 FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
722 UninstallLoop:
723 ClearErrors
724 FileRead $UninstallLog $R0
725 IfErrors UninstallEnd
726 Push $R0
727 Call un.TrimNewLines
728 Pop $R0
729 Delete "$INSTDIR\$R0"
730 Goto UninstallLoop
731 UninstallEnd:
732 FileClose $UninstallLog
733 Delete "$INSTDIR\uninstall.log"
734 Delete "$INSTDIR\uninstall.exe"
735 Push "\"
736 Call un.RemoveEmptyDirs
737 RMDir "$INSTDIR"
739 DeleteRegKey HKLM Software\VideoLAN
741 DeleteRegKey HKCR Applications\vlc.exe
742 DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
743 DeleteRegKey HKCR DVD\shell\PlayWithVLC
744 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
745 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
746 DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
747 DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
748 DeleteRegKey HKLM Software\Clients\Media\VLC
749 DeleteRegKey HKCR "VLC.MediaFile"
751 DeleteRegKey HKLM \
752 "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
754 DeleteRegKey HKLM \
755 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
757 Delete "$DESKTOP\VLC media player.lnk"
759 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
760 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
761 SetAutoClose true
762 SectionEnd
764 Section /o "un.Delete preferences and cache" SEC92
765 !insertmacro delprefs
766 SectionEnd
768 ; Uninstaller section descriptions
769 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
770 !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} \
771 "Uninstall VLC media player and all its components"
772 !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} \
773 "Deletes VLC media player preferences and cache files"
774 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
776 ;Function un.onUninstSuccess
777 ; HideWindow
778 ; MessageBox MB_ICONINFORMATION|MB_OK \
779 ; "$(^Name) was successfully removed from your computer."
780 ;FunctionEnd
782 Function un.onInit
783 !insertmacro MUI_UNGETLANGUAGE
784 FunctionEnd