]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
cc25835177d8f037a592a2216df90ea1ffa05b22
[vlc] / extras / package / win32 / vlc.win32.nsi.in
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ; NSIS installer script for vlc ;
3 ; (http://nsis.sourceforge.net) ;
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
6 !include "languages\declaration.nsh"
7
8 !define PRODUCT_NAME "VLC media player"
9 !define VERSION @VERSION@
10 !define PRODUCT_VERSION @VERSION@
11 !define PRODUCT_GROUP "VideoLAN"
12 !define PRODUCT_PUBLISHER "VideoLAN"
13 !define PRODUCT_WEB_SITE "http://www.videolan.org/"
14 !define PRODUCT_DIR_REGKEY "Software\VideoLAN\VLC"
15 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
16 !define PRODUCT_UNINST_ROOT_KEY "HKLM"
17 !define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"
18
19 !define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
20 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_DIR_REGKEY}"
21 !define MUI_LANGDLL_REGISTRY_VALUENAME "Language"
22
23 @BUILD_ACTIVEX_TRUE@ !define INSTALL_ACTIVEX
24 @BUILD_MOZILLA_TRUE@ !define INSTALL_MOZILLA
25
26 @FILE_LIBVLCCORE_DLL@
27 @FILE_LIBVLC_DLL@
28
29 ;;;;;;;;;;;;;;;;;;;;;;;;;
30 ; General configuration ;
31 ;;;;;;;;;;;;;;;;;;;;;;;;;
32
33 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
34 OutFile ..\vlc-${VERSION}-win32.exe
35 InstallDir "$PROGRAMFILES\VideoLAN\VLC"
36 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
37 !ifdef NSIS_LZMA_COMPRESS_WHOLE
38 SetCompressor lzma
39 !else
40 SetCompressor /SOLID lzma
41 !endif
42
43 SetOverwrite ifnewer
44 CRCCheck on
45 BrandingText "${PRODUCT_GROUP} ${PRODUCT_NAME}"
46
47 InstType $Name_InstTypeRecommended
48 InstType $Name_InstTypeMinimum
49 InstType $Name_InstTypeFull
50
51 RequestExecutionLevel user
52 !addincludedir NSIS
53 !addplugindir NSIS
54 !include UAC.nsh
55
56 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 ; NSIS Modern User Interface configuration ;
58 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
59
60 ; MUI 1.67 compatible ------
61   !include "MUI.nsh"
62
63 ; MUI Settings
64   !define MUI_ABORTWARNING
65   !define MUI_ICON "vlc.ico"
66   !define MUI_UNICON "vlc.ico"
67   !define MUI_COMPONENTSPAGE_SMALLDESC
68
69 ; Installer pages
70   ; Welcome page
71     !define MUI_WELCOMEPAGE_TITLE_3LINES
72     !insertmacro MUI_PAGE_WELCOME
73   ; License page
74     !define MUI_LICENSEPAGE_BUTTON $(^NextBtn)
75     !insertmacro MUI_PAGE_LICENSE "COPYING.txt"
76   ; Components page
77     !insertmacro MUI_PAGE_COMPONENTS
78   ; Directory page
79     !insertmacro MUI_PAGE_DIRECTORY
80   ; Instfiles page
81     !insertmacro MUI_PAGE_INSTFILES
82   ; Finish page
83
84     Function ExecAppFile
85       Exec '$INSTDIR\vlc.exe'
86     FunctionEnd
87
88     Function AppRunAs
89       !insertmacro UAC.CallFunctionAsUser ExecAppFile
90     FunctionEnd
91
92     !define MUI_FINISHPAGE_RUN
93     !define MUI_FINISHPAGE_RUN_FUNCTION AppRunAs
94     !define MUI_FINISHPAGE_LINK $Link_VisitWebsite
95     !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
96     !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
97     !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
98     !define MUI_FINISHPAGE_NOREBOOTSUPPORT
99     !insertmacro MUI_PAGE_FINISH
100
101 ; Uninstaller pages
102     !insertmacro MUI_UNPAGE_CONFIRM
103     !insertmacro MUI_UNPAGE_COMPONENTS
104     !insertmacro MUI_UNPAGE_INSTFILES
105     !insertmacro MUI_UNPAGE_FINISH
106
107 ; Language files
108   !insertmacro MUI_LANGUAGE "English" # first language is the default language
109   !insertmacro MUI_LANGUAGE "French"
110   !insertmacro MUI_LANGUAGE "German"
111   !insertmacro MUI_LANGUAGE "Spanish"
112   !insertmacro MUI_LANGUAGE "SimpChinese"
113   !insertmacro MUI_LANGUAGE "TradChinese"
114   !insertmacro MUI_LANGUAGE "Japanese"
115   !insertmacro MUI_LANGUAGE "Korean"
116   !insertmacro MUI_LANGUAGE "Italian"
117   !insertmacro MUI_LANGUAGE "Dutch"
118   !insertmacro MUI_LANGUAGE "Danish"
119   !insertmacro MUI_LANGUAGE "Swedish"
120   !insertmacro MUI_LANGUAGE "Norwegian"
121   !insertmacro MUI_LANGUAGE "Finnish"
122   !insertmacro MUI_LANGUAGE "Greek"
123   !insertmacro MUI_LANGUAGE "Russian"
124   !insertmacro MUI_LANGUAGE "Portuguese"
125   !insertmacro MUI_LANGUAGE "PortugueseBR"
126   !insertmacro MUI_LANGUAGE "Arabic"
127   !insertmacro MUI_LANGUAGE "Polish"
128   !insertmacro MUI_LANGUAGE "Romanian"
129   !insertmacro MUI_LANGUAGE "Slovak"
130   !insertmacro MUI_LANGUAGE "Czech"
131   !insertmacro MUI_LANGUAGE "Hungarian"
132   !insertmacro MUI_LANGUAGE "Catalan"
133   !insertmacro MUI_LANGUAGE "Bulgarian"
134   !insertmacro MUI_LANGUAGE "Estonian"
135   !insertmacro MUI_LANGUAGE "Lithuanian"
136
137 ; Reserve files for solid compression
138   !insertmacro MUI_RESERVEFILE_LANGDLL
139   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
140
141 ; MUI end ------
142
143 ;;;;;;;;;;;;;;;;;;;;;;;
144 ; Macro and Functions ;
145 ;;;;;;;;;;;;;;;;;;;;;;;
146
147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
148 ; 1. File type associations ;
149 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150
151 ;; Function that registers one extension for VLC
152 Function RegisterExtension
153   ; back up old value for extension $R0 (eg. ".opt")
154   ReadRegStr $1 HKCR "$R0" ""
155   StrCmp $1 "" NoBackup
156     StrCmp $1 "VLC$R0" "NoBackup"
157     WriteRegStr HKCR "$R0" "VLC.backup" $1
158 NoBackup:
159   WriteRegStr HKCR "$R0" "" "VLC$R0"
160   ReadRegStr $0 HKCR "VLC$R0" ""
161   WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
162   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
163   WriteRegStr HKCR "VLC$R0\shell\Open" "" $ShellAssociation_Play
164   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
165   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
166
167 ;;; Vista Only part
168   ; Vista and above detection
169   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
170   StrCpy $R2 $R1 1
171   StrCmp $R2 '6' ForVista ToEnd
172 ForVista:
173   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
174
175 ToEnd:
176 FunctionEnd
177
178 ;; Function that registers one skin extension for VLC
179 Function RegisterSkinExtension
180   ; back up old value for extension $R0 (eg. ".opt")
181   ReadRegStr $1 HKCR "$R0" ""
182   StrCmp $1 "" NoBackup
183     StrCmp $1 "VLC$R0" "NoBackup"
184     WriteRegStr HKCR "$R0" "VLC.backup" $1
185 NoBackup:
186   WriteRegStr HKCR "$R0" "" "VLC$R0"
187   ReadRegStr $0 HKCR "VLC$R0" ""
188   WriteRegStr HKCR "VLC$R0" "" "VLC skin file ($R0)"
189   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
190   WriteRegStr HKCR "VLC$R0\shell\Open" "" ""
191   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" -Iskins --skins2-last "%1"'
192   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
193
194 ;;; Vista Only part
195   ; Vista and above detection
196   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
197   StrCpy $R2 $R1 1
198   StrCmp $R2 '6' ForVista ToEnd
199 ForVista:
200   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
201
202 ToEnd:
203 FunctionEnd
204
205 ;; Function that removes one extension that VLC owns.
206 Function un.RegisterExtension
207   ;start of restore script
208   ReadRegStr $1 HKCR "$R0" ""
209   StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
210     ; Read the old value from Backup
211     ReadRegStr $1 HKCR "$R0" "VLC.backup"
212     StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
213       DeleteRegKey HKCR "$R0"
214     Goto NoOwn
215 Restore:
216       WriteRegStr HKCR "$R0" "" $1
217       DeleteRegValue HKCR "$R0" "VLC.backup"
218 NoOwn:
219     DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
220     DeleteRegKey HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations\VLC$R0" ; for vista
221 FunctionEnd
222
223 !macro RegisterExtensionSection EXT
224   Section ${EXT}
225     SectionIn 1 3
226     Push $R0
227     StrCpy $R0 ${EXT}
228     Call RegisterExtension
229     Pop $R0
230   SectionEnd
231 !macroend
232
233 !macro RegisterSkinExtensionSection EXT
234   Section /o ${EXT}
235     SectionIn 1 3
236     Push $R0
237     StrCpy $R0 ${EXT}
238     Call RegisterSkinExtension
239     Pop $R0
240   SectionEnd
241 !macroend
242
243 !macro UnRegisterExtensionSection EXT
244   Push $R0
245   StrCpy $R0 ${EXT}
246   Call un.RegisterExtension
247   Pop $R0
248 !macroend
249
250 !macro WriteRegStrSupportedTypes EXT
251   WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
252 !macroend
253
254 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
255 ; Extension lists  Macros                    ;
256 ; Those macros calls the previous functions  ;
257 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
258
259 !macro MacroAudioExtensions _action
260   !insertmacro ${_action} ".a52"
261   !insertmacro ${_action} ".aac"
262   !insertmacro ${_action} ".ac3"
263   !insertmacro ${_action} ".adt"
264   !insertmacro ${_action} ".adts"
265   !insertmacro ${_action} ".aif"
266   !insertmacro ${_action} ".aifc"
267   !insertmacro ${_action} ".aiff"
268   !insertmacro ${_action} ".au"
269   !insertmacro ${_action} ".amr"
270   !insertmacro ${_action} ".aob"
271   !insertmacro ${_action} ".ape"
272   !insertmacro ${_action} ".cda"
273   !insertmacro ${_action} ".dts"
274   !insertmacro ${_action} ".flac"
275   !insertmacro ${_action} ".it"
276   !insertmacro ${_action} ".m4a"
277   !insertmacro ${_action} ".m4p"
278   !insertmacro ${_action} ".mid"
279   !insertmacro ${_action} ".mka"
280   !insertmacro ${_action} ".mlp"
281   !insertmacro ${_action} ".mod"
282   !insertmacro ${_action} ".mp1"
283   !insertmacro ${_action} ".mp2"
284   !insertmacro ${_action} ".mp3"
285   !insertmacro ${_action} ".mpc"
286   !insertmacro ${_action} ".oma"
287   !insertmacro ${_action} ".oga"
288   !insertmacro ${_action} ".rmi"
289   !insertmacro ${_action} ".snd"
290   !insertmacro ${_action} ".s3m"
291   !insertmacro ${_action} ".spx"
292   !insertmacro ${_action} ".tta"
293   !insertmacro ${_action} ".voc"
294   !insertmacro ${_action} ".vqf"
295   !insertmacro ${_action} ".w64"
296   !insertmacro ${_action} ".wav"
297   !insertmacro ${_action} ".wma"
298   !insertmacro ${_action} ".wv"
299   !insertmacro ${_action} ".xa"
300   !insertmacro ${_action} ".xm"
301 !macroend
302
303 !macro MacroVideoExtensions _action
304   !insertmacro ${_action} ".3g2"
305   !insertmacro ${_action} ".3gp"
306   !insertmacro ${_action} ".3gp2"
307   !insertmacro ${_action} ".3gpp"
308   !insertmacro ${_action} ".amv"
309   !insertmacro ${_action} ".asf"
310   !insertmacro ${_action} ".avi"
311   !insertmacro ${_action} ".divx"
312   !insertmacro ${_action} ".dv"
313   !insertmacro ${_action} ".flv"
314   !insertmacro ${_action} ".gxf"
315   !insertmacro ${_action} ".m1v"
316   !insertmacro ${_action} ".m2t"
317   !insertmacro ${_action} ".m2v"
318   !insertmacro ${_action} ".m2ts"
319   !insertmacro ${_action} ".m4v"
320   !insertmacro ${_action} ".mkv"
321   !insertmacro ${_action} ".mov"
322   !insertmacro ${_action} ".mp2"
323   !insertmacro ${_action} ".mp2v"
324   !insertmacro ${_action} ".mp4"
325   !insertmacro ${_action} ".mp4v"
326   !insertmacro ${_action} ".mpa"
327   !insertmacro ${_action} ".mpe"
328   !insertmacro ${_action} ".mpeg"
329   !insertmacro ${_action} ".mpeg1"
330   !insertmacro ${_action} ".mpeg2"
331   !insertmacro ${_action} ".mpeg4"
332   !insertmacro ${_action} ".mpg"
333   !insertmacro ${_action} ".mpv2"
334   !insertmacro ${_action} ".mts"
335   !insertmacro ${_action} ".mxf"
336   !insertmacro ${_action} ".nsv"
337   !insertmacro ${_action} ".nuv"
338   !insertmacro ${_action} ".ogg"
339   !insertmacro ${_action} ".ogm"
340   !insertmacro ${_action} ".ogx"
341   !insertmacro ${_action} ".ogv"
342   !insertmacro ${_action} ".ps"
343   !insertmacro ${_action} ".rec"
344   !insertmacro ${_action} ".rm"
345   !insertmacro ${_action} ".rmvb"
346   !insertmacro ${_action} ".tod"
347   !insertmacro ${_action} ".ts"
348   !insertmacro ${_action} ".tts"
349   !insertmacro ${_action} ".vob"
350   !insertmacro ${_action} ".vro"
351   !insertmacro ${_action} ".webm"
352   !insertmacro ${_action} ".wmv"
353 !macroend
354
355 !macro MacroOtherExtensions _action
356   !insertmacro ${_action} ".asx"
357   !insertmacro ${_action} ".b4s"
358   !insertmacro ${_action} ".bin"
359   !insertmacro ${_action} ".cue"
360   !insertmacro ${_action} ".ifo"
361   !insertmacro ${_action} ".m3u"
362   !insertmacro ${_action} ".m3u8"
363   !insertmacro ${_action} ".pls"
364   !insertmacro ${_action} ".ram"
365   !insertmacro ${_action} ".sdp"
366   !insertmacro ${_action} ".vlc"
367   !insertmacro ${_action} ".xspf"
368 !macroend
369
370 !macro MacroSkinExtensions _action
371   !insertmacro ${_action} ".vlt"
372   !insertmacro ${_action} ".wsz"
373 !macroend
374
375 ; One macro to rule them all
376 !macro MacroAllExtensions _action
377   !insertmacro MacroAudioExtensions ${_action}
378   !insertmacro MacroVideoExtensions ${_action}
379   !insertmacro MacroOtherExtensions ${_action}
380 !macroend
381
382 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
383 ; 2. Context menu entries ;
384 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
385
386 ; Generic function for adding the context menu for one ext.
387 !macro AddContextMenuExt EXT
388   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" $ContextMenuEntry_PlayWith
389   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --no-playlist-enqueue "%1"'
390
391   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" $ContextMenuEntry_AddToPlaylist
392   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --playlist-enqueue "%1"'
393 !macroend
394
395 !macro AddContextMenu EXT
396   Push $R0
397   ReadRegStr $R0 HKCR ${EXT} ""
398   !insertmacro AddContextMenuExt $R0
399   Pop $R0
400 !macroend
401
402 !macro DeleteContextMenuExt EXT
403   DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
404   DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
405 !macroend
406
407 !macro DeleteContextMenu EXT
408   Push $R0
409   ReadRegStr $R0 HKCR ${EXT} ""
410   !insertmacro DeleteContextMenuExt $R0
411   Pop $R0
412 !macroend
413
414 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
415 ; 3. Delete prefs           ;
416 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
417
418 !macro delprefs
419   StrCpy $0 0
420   !define Index 'Line${__LINE__}'
421   "${Index}-Loop:"
422   ; FIXME
423   ; this will loop through all the logged users and "virtual" windows users
424   ; (it looks like users are only present in HKEY_USERS when they are logged in)
425     ClearErrors
426     EnumRegKey $1 HKU "" $0
427     StrCmp $1 "" "${Index}-End"
428     IntOp $0 $0 + 1
429     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
430     StrCmp $2 "" "${Index}-Loop"
431     RMDir /r "$2\vlc"
432     Goto "${Index}-Loop"
433   "${Index}-End:"
434   !undef Index
435 !macroend
436
437 ;;;;;;;;;;;;;;;
438 ; 4. Logging  ;
439 ;;;;;;;;;;;;;;;
440 Var UninstallLog
441 !macro OpenUninstallLog
442   FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
443   FileSeek $UninstallLog 0 END
444 !macroend
445
446 !macro CloseUninstallLog
447   FileClose $UninstallLog
448   SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
449 !macroend
450
451 ;;;;;;;;;;;;;;;;;;;;
452 ; 5. Installations ;
453 ;;;;;;;;;;;;;;;;;;;;
454 !macro InstallFile FILEREGEX
455   File "${FILEREGEX}"
456   !define Index 'Line${__LINE__}'
457   FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
458   StrCmp $0 "" "${Index}-End"
459   "${Index}-Loop:"
460     StrCmp $1 "" "${Index}-End"
461     FileWrite $UninstallLog "$1$\r$\n"
462     FindNext $0 $1
463     Goto "${Index}-Loop"
464   "${Index}-End:"
465   !undef Index
466 !macroend
467
468 !macro InstallFolder FOLDER
469   File /r "${FOLDER}"
470   Push "${FOLDER}"
471   Call InstallFolderInternal
472 !macroend
473
474 Function InstallFolderInternal
475   Pop $9
476   !define Index 'Line${__LINE__}'
477   FindFirst $0 $1 "$INSTDIR\$9\*"
478   StrCmp $0 "" "${Index}-End"
479   "${Index}-Loop:"
480     StrCmp $1 "" "${Index}-End"
481     StrCmp $1 "." "${Index}-Next"
482     StrCmp $1 ".." "${Index}-Next"
483     IfFileExists "$9\$1\*" 0 "${Index}-Write"
484       Push $0
485       Push $9
486       Push "$9\$1"
487       Call InstallFolderInternal
488       Pop $9
489       Pop $0
490       Goto "${Index}-Next"
491     "${Index}-Write:"
492     FileWrite $UninstallLog "$9\$1$\r$\n"
493     "${Index}-Next:"
494     FindNext $0 $1
495     Goto "${Index}-Loop"
496   "${Index}-End:"
497   !undef Index
498 FunctionEnd
499 ;;; End of Macros
500
501
502 ;;;;;;;;;;;;;;;;;;;;;;
503 ; Installer sections ;
504 ; The CORE of the    ;
505 ; installer          ;
506 ;;;;;;;;;;;;;;;;;;;;;;
507
508 Section $Name_Section01 SEC01
509   SectionIn 1 2 3 RO
510   SetShellVarContext all
511   SetOutPath "$INSTDIR"
512
513   !insertmacro OpenUninstallLog
514
515   ; VLC.exe, libvlc.dll
516   !insertmacro InstallFile vlc.exe
517   !insertmacro InstallFile vlc.exe.manifest
518   !insertmacro InstallFile vlc-cache-gen.exe
519
520   ; All dlls
521   !insertmacro InstallFile *.dll
522
523   ; Text files
524   !insertmacro InstallFile *.txt
525
526   ; Subfolders
527   !insertmacro InstallFolder plugins
528   !insertmacro InstallFolder locale
529 @BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
530 @BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
531 @BUILD_HTTPD_TRUE@   !insertmacro InstallFolder http
532 @BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
533
534   ; Generate the cache and add it to uninstall.log
535   ExecWait "$INSTDIR\vlc-cache-gen.exe $INSTDIR\plugins"
536   FindFirst $0 $1 "$INSTDIR\plugins\*.dat"
537   FileWrite $UninstallLog "plugins\$1$\r$\n"
538   FindClose $0
539
540
541
542   ; URLs
543   WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
544     "${PRODUCT_WEB_SITE}"
545   FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
546   WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
547     "${PRODUCT_WEB_SITE}/doc/"
548   FileWrite $UninstallLog "Documentation.url$\r$\n"
549   WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" \
550     "${PRODUCT_WEB_SITE}/vlc/skins.php"
551   FileWrite $UninstallLog "New_Skins.url$\r$\n"
552
553   !insertmacro CloseUninstallLog
554
555   ; Add VLC to "recommended programs" for the following extensions
556   WriteRegStr HKCR Applications\vlc.exe "" ""
557   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
558   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
559   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" \
560     '"$INSTDIR\vlc.exe" --started-from-file "%1"'
561   !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
562
563 ; Windows default programs Registration
564   ; Vista and above detection
565   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
566   StrCpy $R1 $R0 1
567   StrCmp $R1 '6' lbl_vista lbl_done
568
569   lbl_vista:
570   WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
571   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
572   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
573   WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
574   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
575   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
576   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
577   WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
578
579   lbl_done:
580 SectionEnd
581
582 Section $Name_Section02a SEC02a
583   SectionIn 1 2 3
584   CreateDirectory "$SMPROGRAMS\VideoLAN"
585   CreateShortCut "$SMPROGRAMS\VideoLAN\Reset VLC media player preferences and cache files.lnk" \
586     "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
587   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
588     "$INSTDIR\vlc.exe" ""
589   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player skinned.lnk" \
590     "$INSTDIR\vlc.exe" "-Iskins"
591   CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
592     "$INSTDIR\Documentation.url"
593   CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
594     "$INSTDIR\NEWS.txt" ""
595   CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
596     "$INSTDIR\${PRODUCT_GROUP} Website.url"
597 SectionEnd
598
599 Section $Name_Section02b SEC02b
600   SectionIn 1 2 3
601   CreateShortCut "$DESKTOP\VLC media player.lnk" \
602     "$INSTDIR\vlc.exe" ""
603 SectionEnd
604
605 !ifdef INSTALL_MOZILLA
606 Section /o $Name_Section03 SEC03
607   SectionIn 3
608
609   SetOutPath "$INSTDIR"
610   !insertmacro OpenUninstallLog
611   !insertmacro InstallFile mozilla\npvlc.dll
612   !insertmacro InstallFile mozilla\npvlc.dll.manifest
613   !insertmacro CloseUninstallLog
614
615   !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
616   WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
617   WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
618   WriteRegStr HKLM ${Moz} "Product" "VLC media player"
619   WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
620   WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
621 SectionEnd
622 !endif
623
624 !ifdef INSTALL_ACTIVEX
625 Section $Name_Section04 SEC04
626   SectionIn 3
627
628   SetOutPath "$INSTDIR"
629   !insertmacro OpenUninstallLog
630   !insertmacro InstallFile activex\axvlc.dll
631   !insertmacro InstallFile activex\axvlc.dll.manifest
632   !insertmacro CloseUninstallLog
633   RegDLL "$INSTDIR\axvlc.dll"
634 SectionEnd
635 !endif
636
637
638 Section $Name_Section05 SEC05
639   SectionIn 1 2 3
640   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
641   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
642     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
643   WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
644   WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
645     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
646
647   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
648   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
649   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
650   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
651   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "Open"
652   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
653
654   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
655   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
656   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
657   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
658   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "Open"
659   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
660
661   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival" ""
662   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Action" $Action_OnArrivalVCDMovie
663   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
664   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeProgID" "VLC.VCDMovie"
665   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "InvokeVerb" "Open"
666   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
667
668   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival" ""
669   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Action" $Action_OnArrivalSVCDMovie
670   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
671   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeProgID" "VLC.SVCDMovie"
672   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "InvokeVerb" "Open"
673   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival" "Provider" "VideoLAN VLC media player"
674
675   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival" ""
676   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Action" $Action_OnArrivalDVDAudio
677   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
678   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeProgID" "VLC.OPENFolder"
679   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "InvokeVerb" "Open"
680   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival" "Provider" "VideoLAN VLC media player"
681
682   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival" ""
683   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Action" $Action_OnArrivalVideoFiles
684   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
685   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
686   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "InvokeVerb" "Open"
687   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival" "Provider" "VideoLAN VLC media player"
688
689   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival" ""
690   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Action" $Action_OnArrivalMusicFiles
691   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
692   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeProgID" "VLC.OPENFolder"
693   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "InvokeVerb" "Open"
694   WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival" "Provider" "VideoLAN VLC media player"
695
696   WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
697   WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
698   WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
699     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
700   WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
701
702   WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
703   WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
704   WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
705     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
706   WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
707
708   WriteRegStr HKCR "VLC.VCDMovie" "" "VLC VCD Movie"
709   WriteRegStr HKCR "VLC.VCDMovie\shell" "" "Open"
710   WriteRegStr HKCR "VLC.VCDMovie\shell\Open\command" "" \
711      '"$INSTDIR\vlc.exe" --started-from-file vcd://%1'
712   WriteRegStr HKCR "VLC.VCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
713
714   WriteRegStr HKCR "VLC.SVCDMovie" "" "VLC SVCD Movie"
715   WriteRegStr HKCR "VLC.SVCDMovie\shell" "" "Open"
716   WriteRegStr HKCR "VLC.SVCDMovie\shell\Open\command" "" \
717      '"$INSTDIR\vlc.exe" --started-from-file vcd://%1'
718   WriteRegStr HKCR "VLC.SVCDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
719
720   WriteRegStr HKCR "VLC.OPENFolder" "" "VLC Play content"
721   WriteRegStr HKCR "VLC.OPENFolder\shell" "" "Open"
722   WriteRegStr HKCR "VLC.OPENFolder\shell\Open\command" "" \
723      '"$INSTDIR\vlc.exe" %1'
724   WriteRegStr HKCR "VLC.OPENFolder\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
725
726 SectionEnd
727
728
729 SectionGroup /e !$Name_Section06 SEC06
730   SectionGroup $Name_SectionGroupAudio
731     !insertmacro MacroAudioExtensions RegisterExtensionSection
732   SectionGroupEnd
733   SectionGroup $Name_SectionGroupVideo
734     !insertmacro MacroVideoExtensions RegisterExtensionSection
735   SectionGroupEnd
736   SectionGroup $Name_SectionGroupOther
737     !insertmacro MacroOtherExtensions RegisterExtensionSection
738     !insertmacro MacroSkinExtensions RegisterSkinExtensionSection
739   SectionGroupEnd
740 SectionGroupEnd
741
742 Section $Name_Section07 SEC07
743   SectionIn 1 3
744   !insertmacro MacroAllExtensions AddContextMenu
745   !insertmacro AddContextMenuExt "Directory"
746 SectionEnd
747
748 Section $Name_Section08 SEC08
749   !insertmacro delprefs
750 SectionEnd
751
752 ; Installer section descriptions
753 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
754   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01
755   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a
756   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b
757 @BUILD_MOZILLA_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
758 @BUILD_ACTIVEX_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
759   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
760   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
761   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
762   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08
763 !insertmacro MUI_FUNCTION_DESCRIPTION_END
764
765 ;;; Start function
766 Function .onInit
767
768 UAC_Elevate:
769     UAC::RunElevated
770     StrCmp 1223 $0 UAC_ElevationAborted
771     StrCmp 0 $0 0 UAC_Err
772     StrCmp 1 $1 0 UAC_Success
773     Quit
774
775 UAC_Err:
776     MessageBox mb_iconstop "Unable to elevate, error $0"
777     Abort
778
779 UAC_ElevationAborted:
780     MessageBox mb_iconstop "This installer requires admin access, aborting!"
781     Abort
782
783 UAC_Success:
784     StrCmp 1 $3 +4
785     StrCmp 3 $1 0 UAC_ElevationAborted
786     MessageBox mb_iconstop "This installer requires admin access, try again"
787     goto UAC_Elevate
788   !insertmacro MUI_LANGDLL_DISPLAY
789
790   !include "languages\english.nsh"
791   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
792   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
793   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
794   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
795   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
796   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
797   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
798   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
799   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
800   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
801   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
802   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
803   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
804   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
805 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
806 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
807 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
808   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
809   StrCmp $LANGUAGE ${LANG_SPANISH} Estonian 0
810   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
811   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
812   French:
813   !include "languages\french.nsh"
814   Goto EndLanguageCmp
815   German:
816   !include "languages\german.nsh"
817   Goto EndLanguageCmp
818   Italian:
819   !include "languages\italian.nsh"
820   Goto EndLanguageCmp
821   Hungarian:
822   !include "languages\hungarian.nsh"
823   Goto EndLanguageCmp
824   Romanian:
825   !include "languages\romanian.nsh"
826   Goto EndLanguageCmp
827   Catalan:
828   !include "languages\catalan.nsh"
829   Goto EndLanguageCmp
830   Bulgarian:
831   !include "languages\bulgarian.nsh"
832   Goto EndLanguageCmp
833   Slovak:
834   !include "languages\slovak.nsh"
835   Goto EndLanguageCmp
836   Polish:
837   !include "languages\polish.nsh"
838   Goto EndLanguageCmp
839   Dutch:
840   !include "languages\dutch.nsh"
841   Goto EndLanguageCmp
842   Schinese:
843   !include "languages\schinese.nsh"
844   Goto EndLanguageCmp
845   Finnish:
846   !include "languages\finnish.nsh"
847   Goto EndLanguageCmp
848   Japanese:
849   !include "languages\japanese.nsh"
850   Goto EndLanguageCmp
851   Bengali:
852   !include "languages\bengali.nsh"
853   Goto EndLanguageCmp
854   Punjabi:
855   !include "languages\punjabi.nsh"
856   Goto EndLanguageCmp
857   Slovenian:
858   !include "languages\slovenian.nsh"
859   Goto EndLanguageCmp
860   Spanish:
861   !include "languages\spanish.nsh"
862   Goto EndLanguageCmp
863   Estonian:
864   !include "languages\estonian.nsh"
865   Goto EndLanguageCmp
866   Lithuanian:
867   !include "languages\lithuanian.nsh"
868   Goto EndLanguageCmp
869   Brazilian:
870   !include "languages\brazilian_portuguese.nsh"
871   EndLanguageCmp:
872
873   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
874   "UninstallString"
875   StrCmp $R0 "" done
876
877   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done
878
879   ;Run the uninstaller
880   ;uninst:
881     ClearErrors
882     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
883   done:
884
885 FunctionEnd
886
887 Function .OnInstFailed
888     UAC::Unload
889 FunctionEnd
890
891 Function .OnInstSuccess
892     UAC::Unload
893 FunctionEnd
894
895 ;; End function
896 Section -Post
897   WriteUninstaller "$INSTDIR\uninstall.exe"
898   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
899   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
900   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
901
902   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
903     "DisplayName" "$(^Name)"
904   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
905     "UninstallString" "$INSTDIR\uninstall.exe"
906   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
907     "InstallLocation" "$INSTDIR"
908   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
909     "DisplayIcon" "$INSTDIR\vlc.exe"
910   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
911     "DisplayVersion" "${PRODUCT_VERSION}"
912   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
913     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
914   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
915     "Publisher" "${PRODUCT_PUBLISHER}"
916   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
917     "VersionMajor"  "@VERSION_MAJOR@"
918   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
919     "VersionMinor" "@VERSION_MINOR@"
920 SectionEnd
921
922 ;;;;;;;;;;;;;;;;;;;;;;;;
923 ; Uninstaller sections ;
924 ;;;;;;;;;;;;;;;;;;;;;;;;
925
926 ; TrimNewlines (copied from NSIS documentation)
927 ; input, top of stack  (e.g. whatever$\r$\n)
928 ; output, top of stack (replaces, with e.g. whatever)
929 ; modifies no other variables.
930
931 Function un.TrimNewlines
932  Exch $R0
933  Push $R1
934  Push $R2
935  StrCpy $R1 0
936
937  loop:
938    IntOp $R1 $R1 - 1
939    StrCpy $R2 $R0 1 $R1
940    StrCmp $R2 "$\r" loop
941    StrCmp $R2 "$\n" loop
942    IntOp $R1 $R1 + 1
943    IntCmp $R1 0 no_trim_needed
944    StrCpy $R0 $R0 $R1
945
946  no_trim_needed:
947    Pop $R2
948    Pop $R1
949    Exch $R0
950 FunctionEnd
951
952 Function un.RemoveEmptyDirs
953   Pop $9
954   !define Index 'Line${__LINE__}'
955   FindFirst $0 $1 "$INSTDIR$9*"
956   StrCmp $0 "" "${Index}-End"
957   "${Index}-Loop:"
958     StrCmp $1 "" "${Index}-End"
959     StrCmp $1 "." "${Index}-Next"
960     StrCmp $1 ".." "${Index}-Next"
961       Push $0
962       Push $1
963       Push $9
964       Push "$9$1\"
965       Call un.RemoveEmptyDirs
966       Pop $9
967       Pop $1
968       Pop $0
969     "${Index}-Remove:"
970     RMDir "$INSTDIR$9$1"
971     "${Index}-Next:"
972     FindNext $0 $1
973     Goto "${Index}-Loop"
974   "${Index}-End:"
975   FindClose $0
976   !undef Index
977 FunctionEnd
978
979 Section "un.$Name_Section91" SEC91
980   SectionIn 1 2 3 RO
981   SetShellVarContext all
982
983   !insertmacro MacroAllExtensions DeleteContextMenu
984   !insertmacro MacroAllExtensions UnRegisterExtensionSection
985   !insertmacro MacroSkinExtensions UnRegisterExtensionSection
986   !insertmacro DeleteContextMenuExt "Directory"
987
988   ;remove activex plugin
989   UnRegDLL "$INSTDIR\axvlc.dll"
990   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
991   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
992
993   ;remove mozilla plugin
994   Push $R0
995   Push $R1
996   Push $R2
997
998   !define Index 'Line${__LINE__}'
999   StrCpy $R1 "0"
1000
1001   "${Index}-Loop:"
1002
1003     ; Check for Key
1004     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
1005     StrCmp $R0 "" "${Index}-End"
1006     IntOp $R1 $R1 + 1
1007     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
1008     StrCmp $R2 "" "${Index}-Loop" ""
1009
1010     ; old files (0.8.5 and before) that may be lying around
1011     Delete /REBOOTOK "$R2\npvlc.dll"
1012     Delete /REBOOTOK "$R2\libvlc.dll"
1013     Delete /REBOOTOK "$R2\vlcintf.xpt"
1014     Goto "${Index}-Loop"
1015
1016   "${Index}-End:"
1017   !undef Index
1018   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
1019   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
1020
1021   RMDir "$SMPROGRAMS\VideoLAN"
1022   RMDir /r $SMPROGRAMS\VideoLAN
1023
1024   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
1025   UninstallLoop:
1026     ClearErrors
1027     FileRead $UninstallLog $R0
1028     IfErrors UninstallEnd
1029     Push $R0
1030     Call un.TrimNewLines
1031     Pop $R0
1032     Delete "$INSTDIR\$R0"
1033     Goto UninstallLoop
1034   UninstallEnd:
1035   FileClose $UninstallLog
1036   Delete "$INSTDIR\uninstall.log"
1037   Delete "$INSTDIR\uninstall.exe"
1038   Push "\"
1039   Call un.RemoveEmptyDirs
1040   RMDir "$INSTDIR"
1041
1042   DeleteRegKey HKLM Software\VideoLAN
1043
1044   DeleteRegKey HKCR Applications\vlc.exe
1045   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
1046   DeleteRegKey HKCR DVD\shell\PlayWithVLC
1047   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
1048   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
1049   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
1050   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
1051   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival"
1052   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival
1053   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival"
1054   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival
1055   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival"
1056   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival
1057   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival"
1058   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival
1059   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival"
1060   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival
1061
1062   DeleteRegKey HKLM Software\Clients\Media\VLC
1063   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
1064   DeleteRegKey HKCR "VLC.MediaFile"
1065   DeleteRegKey HKCR "VLC.DVDMovie"
1066   DeleteRegKey HKCR "VLC.CDAudio"
1067   DeleteRegKey HKCR "VLC.VCDMovie"
1068   DeleteRegKey HKCR "VLC.SVCDMovie"
1069   DeleteRegKey HKCR "VLC.OPENFolder"
1070
1071
1072   DeleteRegKey HKLM \
1073     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
1074
1075   DeleteRegKey HKLM \
1076     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
1077
1078   Delete "$DESKTOP\VLC media player.lnk"
1079
1080   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
1081   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
1082   SetAutoClose true
1083 SectionEnd
1084
1085 Section /o "un.$Name_Section92" SEC92
1086   !insertmacro delprefs
1087 SectionEnd
1088
1089 ; Uninstaller section descriptions
1090 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1091   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
1092   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
1093 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1094
1095 Function un.OnUnInstFailed
1096     UAC::Unload
1097 FunctionEnd
1098
1099 Function un.OnUnInstSuccess
1100     UAC::Unload
1101     Delete "$INSTDIR\UAC.dll"
1102 FunctionEnd
1103
1104 Function un.onInit
1105
1106 UAC_Elevate:
1107     UAC::RunElevated
1108     StrCmp 1223 $0 UAC_ElevationAborted
1109     StrCmp 0 $0 0 UAC_Err
1110     StrCmp 1 $1 0 UAC_Success
1111     Quit
1112
1113 UAC_Err:
1114     MessageBox mb_iconstop "Unable to elevate, error $0"
1115     Abort
1116
1117 UAC_ElevationAborted:
1118     MessageBox mb_iconstop "This installer requires admin access, aborting!"
1119     Abort
1120
1121 UAC_Success:
1122     StrCmp 1 $3 +4
1123     StrCmp 3 $1 0 UAC_ElevationAborted
1124     MessageBox mb_iconstop "This installer requires admin access, try again"
1125     goto UAC_Elevate
1126
1127   !insertmacro MUI_UNGETLANGUAGE
1128
1129   !include "languages\english.nsh"
1130   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
1131   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
1132   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
1133   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
1134   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
1135   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
1136   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
1137   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
1138   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
1139   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
1140   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
1141   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
1142   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
1143   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
1144 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
1145 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
1146 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
1147   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
1148   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
1149   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
1150   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
1151   French:
1152   !include "languages\french.nsh"
1153   Goto EndLanguageCmp
1154   German:
1155   !include "languages\german.nsh"
1156   Goto EndLanguageCmp
1157   Italian:
1158   !include "languages\italian.nsh"
1159   Goto EndLanguageCmp
1160   Hungarian:
1161   !include "languages\hungarian.nsh"
1162   Goto EndLanguageCmp
1163   Romanian:
1164   !include "languages\romanian.nsh"
1165   Goto EndLanguageCmp
1166   Catalan:
1167   !include "languages\catalan.nsh"
1168   Goto EndLanguageCmp
1169   Bulgarian:
1170   !include "languages\bulgarian.nsh"
1171   Goto EndLanguageCmp
1172   Slovak:
1173   !include "languages\slovak.nsh"
1174   Goto EndLanguageCmp
1175   Polish:
1176   !include "languages\polish.nsh"
1177   Goto EndLanguageCmp
1178   Dutch:
1179   !include "languages\dutch.nsh"
1180   Goto EndLanguageCmp
1181   Danish:
1182   !include "languages\danish.nsh"
1183   Goto EndLanguageCmp
1184   Schinese:
1185   !include "languages\schinese.nsh"
1186   Goto EndLanguageCmp
1187   Finnish:
1188   !include "languages\finnish.nsh"
1189   Goto EndLanguageCmp
1190   Japanese:
1191   !include "languages\japanese.nsh"
1192   Goto EndLanguageCmp
1193   Bengali:
1194   !include "languages\bengali.nsh"
1195   Goto EndLanguageCmp
1196   Punjabi:
1197   !include "languages\punjabi.nsh"
1198   Goto EndLanguageCmp
1199   Slovenian:
1200   !include "languages\slovenian.nsh"
1201   Goto EndLanguageCmp
1202   Spanish:
1203   !include "languages\spanish.nsh"
1204   Goto EndLanguageCmp
1205   Estonian:
1206   !include "languages\estonian.nsh"
1207   Goto EndLanguageCmp
1208   Lithuanian:
1209   !include "languages\lithuanian.nsh"
1210   Goto EndLanguageCmp
1211   Brazilian:
1212   !include "languages\brazilian_portuguese.nsh"
1213   EndLanguageCmp:
1214
1215 FunctionEnd