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