]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
Activate Russian l10n in NSIS installer
[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_RUSSSIAN} Russian 0
822   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
823   French:
824   !include "languages\french.nsh"
825   Goto EndLanguageCmp
826   German:
827   !include "languages\german.nsh"
828   Goto EndLanguageCmp
829   Italian:
830   !include "languages\italian.nsh"
831   Goto EndLanguageCmp
832   Hungarian:
833   !include "languages\hungarian.nsh"
834   Goto EndLanguageCmp
835   Romanian:
836   !include "languages\romanian.nsh"
837   Goto EndLanguageCmp
838   Catalan:
839   !include "languages\catalan.nsh"
840   Goto EndLanguageCmp
841   Bulgarian:
842   !include "languages\bulgarian.nsh"
843   Goto EndLanguageCmp
844   Slovak:
845   !include "languages\slovak.nsh"
846   Goto EndLanguageCmp
847   Polish:
848   !include "languages\polish.nsh"
849   Goto EndLanguageCmp
850   Dutch:
851   !include "languages\dutch.nsh"
852   Goto EndLanguageCmp
853   Danish:
854   !include "languages\danish.nsh"
855   Goto EndLanguageCmp
856   Schinese:
857   !include "languages\schinese.nsh"
858   Goto EndLanguageCmp
859   Finnish:
860   !include "languages\finnish.nsh"
861   Goto EndLanguageCmp
862   Japanese:
863   !include "languages\japanese.nsh"
864   Goto EndLanguageCmp
865   Bengali:
866   !include "languages\bengali.nsh"
867   Goto EndLanguageCmp
868   Punjabi:
869   !include "languages\punjabi.nsh"
870   Goto EndLanguageCmp
871   Slovenian:
872   !include "languages\slovenian.nsh"
873   Goto EndLanguageCmp
874   Spanish:
875   !include "languages\spanish.nsh"
876   Goto EndLanguageCmp
877   Estonian:
878   !include "languages\estonian.nsh"
879   Goto EndLanguageCmp
880   Lithuanian:
881   !include "languages\lithuanian.nsh"
882   Goto EndLanguageCmp
883   Basque:
884   !include "languages\basque.nsh"
885   Goto EndLanguageCmp
886   Serbian:
887   !include "languages\serbian.nsh"
888   Goto EndLanguageCmp
889   Russian:
890   !include "languages\Russian.nsh"
891   Goto EndLanguageCmp
892   Brazilian:
893   !include "languages\brazilian_portuguese.nsh"
894   EndLanguageCmp:
895
896   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
897   "UninstallString"
898   StrCmp $R0 "" done
899
900   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled /SD IDNO IDNO done
901
902   ;Run the uninstaller
903   ;uninst:
904     ClearErrors
905     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
906   done:
907
908 FunctionEnd
909
910 Function .OnInstFailed
911     UAC::Unload
912 FunctionEnd
913
914 Function .OnInstSuccess
915     UAC::Unload
916 FunctionEnd
917
918 ;; End function
919 Section -Post
920   WriteUninstaller "$INSTDIR\uninstall.exe"
921   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
922   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
923   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
924
925   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
926     "DisplayName" "$(^Name)"
927   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
928     "UninstallString" "$INSTDIR\uninstall.exe"
929   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
930     "InstallLocation" "$INSTDIR"
931   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
932     "DisplayIcon" "$INSTDIR\vlc.exe"
933   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
934     "DisplayVersion" "${PRODUCT_VERSION}"
935   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
936     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
937   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
938     "Publisher" "${PRODUCT_PUBLISHER}"
939   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
940     "VersionMajor"  "@VERSION_MAJOR@"
941   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
942     "VersionMinor" "@VERSION_MINOR@"
943 SectionEnd
944
945 ;;;;;;;;;;;;;;;;;;;;;;;;
946 ; Uninstaller sections ;
947 ;;;;;;;;;;;;;;;;;;;;;;;;
948
949 ; TrimNewlines (copied from NSIS documentation)
950 ; input, top of stack  (e.g. whatever$\r$\n)
951 ; output, top of stack (replaces, with e.g. whatever)
952 ; modifies no other variables.
953
954 Function un.TrimNewlines
955  Exch $R0
956  Push $R1
957  Push $R2
958  StrCpy $R1 0
959
960  loop:
961    IntOp $R1 $R1 - 1
962    StrCpy $R2 $R0 1 $R1
963    StrCmp $R2 "$\r" loop
964    StrCmp $R2 "$\n" loop
965    IntOp $R1 $R1 + 1
966    IntCmp $R1 0 no_trim_needed
967    StrCpy $R0 $R0 $R1
968
969  no_trim_needed:
970    Pop $R2
971    Pop $R1
972    Exch $R0
973 FunctionEnd
974
975 Function un.RemoveEmptyDirs
976   Pop $9
977   !define Index 'Line${__LINE__}'
978   FindFirst $0 $1 "$INSTDIR$9*"
979   StrCmp $0 "" "${Index}-End"
980   "${Index}-Loop:"
981     StrCmp $1 "" "${Index}-End"
982     StrCmp $1 "." "${Index}-Next"
983     StrCmp $1 ".." "${Index}-Next"
984       Push $0
985       Push $1
986       Push $9
987       Push "$9$1\"
988       Call un.RemoveEmptyDirs
989       Pop $9
990       Pop $1
991       Pop $0
992     "${Index}-Remove:"
993     RMDir "$INSTDIR$9$1"
994     "${Index}-Next:"
995     FindNext $0 $1
996     Goto "${Index}-Loop"
997   "${Index}-End:"
998   FindClose $0
999   !undef Index
1000 FunctionEnd
1001
1002 Section "un.$Name_Section91" SEC91
1003   SectionIn 1 2 3 RO
1004   SetShellVarContext all
1005
1006   !insertmacro MacroAllExtensions DeleteContextMenu
1007   !insertmacro MacroAllExtensions UnRegisterExtensionSection
1008   !insertmacro MacroSkinExtensions UnRegisterExtensionSection
1009   !insertmacro DeleteContextMenuExt "Directory"
1010
1011   ;remove activex plugin
1012   UnRegDLL "$INSTDIR\axvlc.dll"
1013   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
1014   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
1015
1016   ;remove mozilla plugin
1017   Push $R0
1018   Push $R1
1019   Push $R2
1020
1021   !define Index 'Line${__LINE__}'
1022   StrCpy $R1 "0"
1023
1024   "${Index}-Loop:"
1025
1026     ; Check for Key
1027     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
1028     StrCmp $R0 "" "${Index}-End"
1029     IntOp $R1 $R1 + 1
1030     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
1031     StrCmp $R2 "" "${Index}-Loop" ""
1032
1033     ; old files (0.8.5 and before) that may be lying around
1034     Delete /REBOOTOK "$R2\npvlc.dll"
1035     Delete /REBOOTOK "$R2\libvlc.dll"
1036     Delete /REBOOTOK "$R2\vlcintf.xpt"
1037     Goto "${Index}-Loop"
1038
1039   "${Index}-End:"
1040   !undef Index
1041   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
1042   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
1043
1044   RMDir "$SMPROGRAMS\VideoLAN"
1045   RMDir /r $SMPROGRAMS\VideoLAN
1046
1047   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
1048   UninstallLoop:
1049     ClearErrors
1050     FileRead $UninstallLog $R0
1051     IfErrors UninstallEnd
1052     Push $R0
1053     Call un.TrimNewLines
1054     Pop $R0
1055     Delete "$INSTDIR\$R0"
1056     Goto UninstallLoop
1057   UninstallEnd:
1058   FileClose $UninstallLog
1059   Delete "$INSTDIR\uninstall.log"
1060   Delete "$INSTDIR\uninstall.exe"
1061   Push "\"
1062   Call un.RemoveEmptyDirs
1063   RMDir "$INSTDIR"
1064
1065   DeleteRegKey HKLM Software\VideoLAN
1066
1067   DeleteRegKey HKCR Applications\vlc.exe
1068   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
1069   DeleteRegKey HKCR DVD\shell\PlayWithVLC
1070   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
1071   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
1072   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
1073   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
1074   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoCDMovieOnArrival" "VLCPlayVCDMovieOnArrival"
1075   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVCDMovieOnArrival
1076   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlaySuperVideoCDMovieOnArrival" "VLCPlaySVCDMovieOnArrival"
1077   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlaySVCDMovieOnArrival
1078   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDAudioOnArrival" "VLCPlayDVDAudioOnArrival"
1079   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDAudioOnArrival
1080   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayVideoFilesOnArrival" "VLCPlayVideoFilesOnArrival"
1081   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayVideoFilesOnArrival
1082   DeleteRegValue HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayMusicFilesOnArrival" "VLCPlayMusicFilesOnArrival"
1083   DeleteRegKey HKLM SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayMusicFilesOnArrival
1084
1085   DeleteRegKey HKLM Software\Clients\Media\VLC
1086   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
1087   DeleteRegKey HKCR "VLC.MediaFile"
1088   DeleteRegKey HKCR "VLC.DVDMovie"
1089   DeleteRegKey HKCR "VLC.CDAudio"
1090   DeleteRegKey HKCR "VLC.VCDMovie"
1091   DeleteRegKey HKCR "VLC.SVCDMovie"
1092   DeleteRegKey HKCR "VLC.OPENFolder"
1093
1094
1095   DeleteRegKey HKLM \
1096     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
1097
1098   DeleteRegKey HKLM \
1099     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
1100
1101   Delete "$DESKTOP\VLC media player.lnk"
1102
1103   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
1104   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
1105   SetAutoClose true
1106 SectionEnd
1107
1108 Section /o "un.$Name_Section92" SEC92
1109   !insertmacro delprefs
1110 SectionEnd
1111
1112 ; Uninstaller section descriptions
1113 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
1114   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
1115   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
1116 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
1117
1118 Function un.OnUnInstFailed
1119     UAC::Unload
1120 FunctionEnd
1121
1122 Function un.OnUnInstSuccess
1123     UAC::Unload
1124     Delete "$INSTDIR\UAC.dll"
1125 FunctionEnd
1126
1127 Function un.onInit
1128
1129 UAC_Elevate:
1130     UAC::RunElevated
1131     StrCmp 1223 $0 UAC_ElevationAborted
1132     StrCmp 0 $0 0 UAC_Err
1133     StrCmp 1 $1 0 UAC_Success
1134     Quit
1135
1136 UAC_Err:
1137     MessageBox mb_iconstop "Unable to elevate, error $0"
1138     Abort
1139
1140 UAC_ElevationAborted:
1141     MessageBox mb_iconstop "This installer requires admin access, aborting!"
1142     Abort
1143
1144 UAC_Success:
1145     StrCmp 1 $3 +4
1146     StrCmp 3 $1 0 UAC_ElevationAborted
1147     MessageBox mb_iconstop "This installer requires admin access, try again"
1148     goto UAC_Elevate
1149
1150   !insertmacro MUI_UNGETLANGUAGE
1151
1152   !include "languages\english.nsh"
1153   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
1154   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
1155   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
1156   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
1157   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
1158   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
1159   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
1160   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
1161   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
1162   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
1163   StrCmp $LANGUAGE ${LANG_DANISH} Danish 0
1164   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
1165   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
1166   StrCmp $LANGUAGE ${LANG_JAPANESE} Japanese 0
1167 ;  StrCmp $LANGUAGE ${LANG_BENGALI} Bengali 0
1168 ;  StrCmp $LANGUAGE ${LANG_PUNJABI} Punjabi 0
1169 ;  StrCmp $LANGUAGE ${LANG_SLOVENIAN} Slovenian 0
1170   StrCmp $LANGUAGE ${LANG_SPANISH} Spanish 0
1171   StrCmp $LANGUAGE ${LANG_ESTONIAN} Estonian 0
1172   StrCmp $LANGUAGE ${LANG_LITHUANIAN} Lithuanian 0
1173   StrCmp $LANGUAGE ${LANG_BASQUE} Basque 0
1174   StrCmp $LANGUAGE ${LANG_SERBIAN} Serbian 0
1175   StrCmp $LANGUAGE ${LANG_RUSSIAN} Russian 0
1176   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
1177   French:
1178   !include "languages\french.nsh"
1179   Goto EndLanguageCmp
1180   German:
1181   !include "languages\german.nsh"
1182   Goto EndLanguageCmp
1183   Italian:
1184   !include "languages\italian.nsh"
1185   Goto EndLanguageCmp
1186   Hungarian:
1187   !include "languages\hungarian.nsh"
1188   Goto EndLanguageCmp
1189   Romanian:
1190   !include "languages\romanian.nsh"
1191   Goto EndLanguageCmp
1192   Catalan:
1193   !include "languages\catalan.nsh"
1194   Goto EndLanguageCmp
1195   Bulgarian:
1196   !include "languages\bulgarian.nsh"
1197   Goto EndLanguageCmp
1198   Slovak:
1199   !include "languages\slovak.nsh"
1200   Goto EndLanguageCmp
1201   Polish:
1202   !include "languages\polish.nsh"
1203   Goto EndLanguageCmp
1204   Dutch:
1205   !include "languages\dutch.nsh"
1206   Goto EndLanguageCmp
1207   Danish:
1208   !include "languages\danish.nsh"
1209   Goto EndLanguageCmp
1210   Schinese:
1211   !include "languages\schinese.nsh"
1212   Goto EndLanguageCmp
1213   Finnish:
1214   !include "languages\finnish.nsh"
1215   Goto EndLanguageCmp
1216   Japanese:
1217   !include "languages\japanese.nsh"
1218   Goto EndLanguageCmp
1219   Bengali:
1220   !include "languages\bengali.nsh"
1221   Goto EndLanguageCmp
1222   Punjabi:
1223   !include "languages\punjabi.nsh"
1224   Goto EndLanguageCmp
1225   Slovenian:
1226   !include "languages\slovenian.nsh"
1227   Goto EndLanguageCmp
1228   Spanish:
1229   !include "languages\spanish.nsh"
1230   Goto EndLanguageCmp
1231   Estonian:
1232   !include "languages\estonian.nsh"
1233   Goto EndLanguageCmp
1234   Lithuanian:
1235   !include "languages\lithuanian.nsh"
1236   Goto EndLanguageCmp
1237   Basque:
1238   !include "languages\basque.nsh"
1239   Goto EndLanguageCmp
1240   Serbian:
1241   !include "languages\serbian.nsh"
1242   Goto EndLanguageCmp
1243   Russian:
1244   !include "languages\russian.nsh"
1245   Goto EndLanguageCmp
1246   Brazilian:
1247   !include "languages\brazilian_portuguese.nsh"
1248   EndLanguageCmp:
1249
1250 FunctionEnd