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