]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
8c462a008e8e96f22ee2bb814a62e739982d57b7
[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 Team"
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 .
53 !addplugindir .
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_SHOWREADME "$INSTDIR\README.txt"
95     !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
96     !define MUI_FINISHPAGE_LINK $Link_VisitWebsite
97     !define MUI_FINISHPAGE_LINK_LOCATION "http://www.videolan.org/vlc/"
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
135 ; Reserve files for solid compression
136   !insertmacro MUI_RESERVEFILE_LANGDLL
137   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
138
139 ; MUI end ------
140
141 ;;;;;;;;;;;;;;;;;;;;;;;
142 ; Macro and Functions ;
143 ;;;;;;;;;;;;;;;;;;;;;;;
144
145 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
146 ; 1. File type associations ;
147 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
148
149 ;; Function that register one extension for VLC
150 Function RegisterExtension
151   ; back up old value for extension $R0 (eg. ".opt")
152   ReadRegStr $1 HKCR "$R0" ""
153   StrCmp $1 "" NoBackup
154     StrCmp $1 "VLC$R0" "NoBackup"
155     WriteRegStr HKCR "$R0" "VLC.backup" $1
156 NoBackup:
157   WriteRegStr HKCR "$R0" "" "VLC$R0"
158   ReadRegStr $0 HKCR "VLC$R0" ""
159   WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
160   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
161   WriteRegStr HKCR "VLC$R0\shell\Open" "" $ShellAssociation_Play
162   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
163   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
164
165 ;;; Vista Only part
166   ; Vista and above detection
167   ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
168   StrCpy $R2 $R1 1
169   StrCmp $R2 '6' ForVista ToEnd
170 ForVista:
171   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
172
173 ToEnd:
174 FunctionEnd
175
176 ;; Function that removes one extension that VLC owns.
177 Function un.RegisterExtension
178   ;start of restore script
179   ReadRegStr $1 HKCR "$R0" ""
180   StrCmp $1 "VLC$R0" 0 NoOwn ; only do this if we own it
181     ; Read the old value from Backup
182     ReadRegStr $1 HKCR "$R0" "VLC.backup"
183     StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
184       DeleteRegKey HKCR "$R0"
185     Goto NoOwn
186 Restore:
187       WriteRegStr HKCR "$R0" "" $1
188       DeleteRegValue HKCR "$R0" "VLC.backup"
189 NoOwn:
190     DeleteRegKey HKCR "VLC$R0" ;Delete key with association settings
191     DeleteRegKey HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations\VLC$R0" ; for vista
192 FunctionEnd
193
194 !macro RegisterExtensionSection EXT
195   Section ${EXT}
196     SectionIn 1 3
197     Push $R0
198     StrCpy $R0 ${EXT}
199     Call RegisterExtension
200     Pop $R0
201   SectionEnd
202 !macroend
203
204 !macro UnRegisterExtensionSection EXT
205   Push $R0
206   StrCpy $R0 ${EXT}
207   Call un.RegisterExtension
208   Pop $R0
209 !macroend
210
211 !macro WriteRegStrSupportedTypes EXT
212   WriteRegStr HKCR Applications\vlc.exe\SupportedTypes ${EXT} ""
213 !macroend
214
215 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
216 ; Extension lists  Macros                    ;
217 ; Those macros calls the previous functions  ;
218 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
219
220 !macro MacroAudioExtensions _action
221   !insertmacro ${_action} ".a52"
222   !insertmacro ${_action} ".aac"
223   !insertmacro ${_action} ".ac3"
224   !insertmacro ${_action} ".aob"
225   !insertmacro ${_action} ".dts"
226   !insertmacro ${_action} ".flac"
227   !insertmacro ${_action} ".m4a"
228   !insertmacro ${_action} ".m4p"
229   !insertmacro ${_action} ".mka"
230   !insertmacro ${_action} ".mod"
231   !insertmacro ${_action} ".mp1"
232   !insertmacro ${_action} ".mp2"
233   !insertmacro ${_action} ".mp3"
234   !insertmacro ${_action} ".oma"
235   !insertmacro ${_action} ".oga"
236   !insertmacro ${_action} ".spx"
237   !insertmacro ${_action} ".tta"
238   !insertmacro ${_action} ".wav"
239   !insertmacro ${_action} ".wma"
240   !insertmacro ${_action} ".wv"
241   !insertmacro ${_action} ".xm"
242 !macroend
243
244 !macro MacroVideoExtensions _action
245   !insertmacro ${_action} ".asf"
246   !insertmacro ${_action} ".avi"
247   !insertmacro ${_action} ".divx"
248   !insertmacro ${_action} ".dv"
249   !insertmacro ${_action} ".flv"
250   !insertmacro ${_action} ".gxf"
251   !insertmacro ${_action} ".m1v"
252   !insertmacro ${_action} ".m2v"
253   !insertmacro ${_action} ".m2ts"
254   !insertmacro ${_action} ".m4v"
255   !insertmacro ${_action} ".mkv"
256   !insertmacro ${_action} ".mov"
257   !insertmacro ${_action} ".mp4"
258   !insertmacro ${_action} ".mpeg"
259   !insertmacro ${_action} ".mpeg1"
260   !insertmacro ${_action} ".mpeg2"
261   !insertmacro ${_action} ".mpeg4"
262   !insertmacro ${_action} ".mpg"
263   !insertmacro ${_action} ".mts"
264   !insertmacro ${_action} ".mxf"
265   !insertmacro ${_action} ".nuv"
266   !insertmacro ${_action} ".ogg"
267   !insertmacro ${_action} ".ogm"
268   !insertmacro ${_action} ".ogx"
269   !insertmacro ${_action} ".ogv"
270   !insertmacro ${_action} ".rmvb"
271   !insertmacro ${_action} ".ts"
272   !insertmacro ${_action} ".vob"
273   !insertmacro ${_action} ".vro"
274   !insertmacro ${_action} ".wmv"
275 !macroend
276
277 !macro MacroOtherExtensions _action
278   !insertmacro ${_action} ".asx"
279   !insertmacro ${_action} ".bin"
280   !insertmacro ${_action} ".cue"
281   !insertmacro ${_action} ".ifo"
282   !insertmacro ${_action} ".m3u"
283   !insertmacro ${_action} ".pls"
284   !insertmacro ${_action} ".sdp"
285   !insertmacro ${_action} ".vlc"
286   !insertmacro ${_action} ".xspf"
287 !macroend
288
289 ; One macro to rule them all
290 !macro MacroAllExtensions _action
291   !insertmacro MacroAudioExtensions ${_action}
292   !insertmacro MacroVideoExtensions ${_action}
293   !insertmacro MacroOtherExtensions ${_action}
294 !macroend
295
296 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
297 ; 2. Context menu entries ;
298 ;;;;;;;;;;;;;;;;;;;;;;;;;;;
299
300 ; Generic function for adding the context menu for one ext.
301 !macro AddContextMenuExt EXT
302   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" $ContextMenuEntry_PlayWith
303   WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --no-playlist-enqueue "%1"'
304
305   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" $ContextMenuEntry_AddToPlaylist
306   WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '"$INSTDIR\vlc.exe" --started-from-file --playlist-enqueue "%1"'
307 !macroend
308
309 !macro AddContextMenu EXT
310   Push $R0
311   ReadRegStr $R0 HKCR ${EXT} ""
312   !insertmacro AddContextMenuExt $R0
313   Pop $R0
314 !macroend
315
316 !macro DeleteContextMenuExt EXT
317   DeleteRegKey HKCR ${EXT}\shell\PlayWithVLC
318   DeleteRegKey HKCR ${EXT}\shell\AddToPlaylistVLC
319 !macroend
320
321 !macro DeleteContextMenu EXT
322   Push $R0
323   ReadRegStr $R0 HKCR ${EXT} ""
324   !insertmacro DeleteContextMenuExt $R0
325   Pop $R0
326 !macroend
327
328 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
329 ; 3. Delete prefs and cache ;
330 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
331
332 Function ExecCacheGen
333   ExecWait "$INSTDIR\vlc-cache-gen.exe $APPDATA\\VideoLAN\\VLC"
334 FunctionEnd
335
336 !macro gencache
337   SetShellVarContext all
338   CreateDirectory "$APPDATA\\VideoLAN"
339   CreateDirectory "$APPDATA\\VideoLAN\\VLC"
340   !insertmacro UAC.CallFunctionAsUser ExecCacheGen
341   SetShellVarContext current
342 !macroend
343
344 !macro delprefs
345   StrCpy $0 0
346   !define Index 'Line${__LINE__}'
347   "${Index}-Loop:"
348   ; FIXME
349   ; this will loop through all the logged users and "virtual" windows users
350   ; (it looks like users are only present in HKEY_USERS when they are logged in)
351     ClearErrors
352     EnumRegKey $1 HKU "" $0
353     StrCmp $1 "" "${Index}-End"
354     IntOp $0 $0 + 1
355     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
356     StrCmp $2 "" "${Index}-Loop"
357     RMDir /r "$2\vlc"
358     Goto "${Index}-Loop"
359   "${Index}-End:"
360   !undef Index
361   SetShellVarContext all
362   RMDir /r "$APPDATA\\VideoLAN"
363   SetShellVarContext current
364 !macroend
365
366 ;;;;;;;;;;;;;;;
367 ; 4. Logging  ;
368 ;;;;;;;;;;;;;;;
369 Var UninstallLog
370 !macro OpenUninstallLog
371   FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
372   FileSeek $UninstallLog 0 END
373 !macroend
374
375 !macro CloseUninstallLog
376   FileClose $UninstallLog
377   SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
378 !macroend
379
380 ;;;;;;;;;;;;;;;;;;;;
381 ; 5. Installations ;
382 ;;;;;;;;;;;;;;;;;;;;
383 !macro InstallFile FILEREGEX
384   File "${FILEREGEX}"
385   !define Index 'Line${__LINE__}'
386   FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
387   StrCmp $0 "" "${Index}-End"
388   "${Index}-Loop:"
389     StrCmp $1 "" "${Index}-End"
390     FileWrite $UninstallLog "$1$\r$\n"
391     FindNext $0 $1
392     Goto "${Index}-Loop"
393   "${Index}-End:"
394   !undef Index
395 !macroend
396
397 !macro InstallFolder FOLDER
398   File /r "${FOLDER}"
399   Push "${FOLDER}"
400   Call InstallFolderInternal
401 !macroend
402
403 Function InstallFolderInternal
404   Pop $9
405   !define Index 'Line${__LINE__}'
406   FindFirst $0 $1 "$INSTDIR\$9\*"
407   StrCmp $0 "" "${Index}-End"
408   "${Index}-Loop:"
409     StrCmp $1 "" "${Index}-End"
410     StrCmp $1 "." "${Index}-Next"
411     StrCmp $1 ".." "${Index}-Next"
412     IfFileExists "$9\$1\*" 0 "${Index}-Write"
413       Push $0
414       Push $9
415       Push "$9\$1"
416       Call InstallFolderInternal
417       Pop $9
418       Pop $0
419       Goto "${Index}-Next"
420     "${Index}-Write:"
421     FileWrite $UninstallLog "$9\$1$\r$\n"
422     "${Index}-Next:"
423     FindNext $0 $1
424     Goto "${Index}-Loop"
425   "${Index}-End:"
426   !undef Index
427 FunctionEnd
428 ;;; End of Macros
429
430
431 ;;;;;;;;;;;;;;;;;;;;;;
432 ; Installer sections ;
433 ; The CORE of the    ;
434 ; installer          ;
435 ;;;;;;;;;;;;;;;;;;;;;;
436
437 Section $Name_Section01 SEC01
438   SectionIn 1 2 3 RO
439   SetShellVarContext all
440   SetOutPath "$INSTDIR"
441
442   !insertmacro OpenUninstallLog
443
444   ; VLC.exe, libvlc.dll
445   !insertmacro InstallFile vlc.exe
446   !insertmacro InstallFile vlc.exe.manifest
447   !insertmacro InstallFile vlc-cache-gen.exe
448
449   ; All dlls
450   !insertmacro InstallFile *.dll
451
452   ; Text files
453   !insertmacro InstallFile *.txt
454
455   ; Subfolders
456   !insertmacro InstallFolder plugins
457   !insertmacro InstallFolder locale
458 @BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
459 @BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
460 @BUILD_HTTPD_TRUE@   !insertmacro InstallFolder http
461 @BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
462   !insertmacro gencache
463
464
465   ; URLs
466   WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
467     "${PRODUCT_WEB_SITE}"
468   FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
469   WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
470     "${PRODUCT_WEB_SITE}/doc/"
471   FileWrite $UninstallLog "Documentation.url$\r$\n"
472   WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" \
473     "${PRODUCT_WEB_SITE}/vlc/skins.php"
474   FileWrite $UninstallLog "New_Skins.url$\r$\n"
475
476   !insertmacro CloseUninstallLog
477
478   ; Add VLC to "recommended programs" for the following extensions
479   WriteRegStr HKCR Applications\vlc.exe "" ""
480   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
481   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
482   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" \
483     '"$INSTDIR\vlc.exe" --started-from-file "%1"'
484   !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
485
486 ; Windows default programs Registration
487   ; Vista and above detection
488   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
489   StrCpy $R1 $R0 1
490   StrCmp $R1 '6' lbl_vista lbl_done
491
492   lbl_vista:
493   WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
494   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
495   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
496   WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
497   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
498   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
499   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
500   WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
501
502   lbl_done:
503 SectionEnd
504
505 Section $Name_Section02a SEC02a
506   SectionIn 1 2 3
507   CreateDirectory "$SMPROGRAMS\VideoLAN"
508   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
509   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
510   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
511     "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc://quit"
512   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
513     "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc://quit"
514   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
515 @BUILD_SKINS_TRUE@  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
516 @BUILD_SKINS_TRUE@    "$INSTDIR\vlc.exe" "-I skins --save-config vlc://quit"
517   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Qt (default).lnk" \
518     "$INSTDIR\vlc.exe" "-I qt --save-config vlc://quit"
519   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
520   ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
521   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
522     "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc://quit"
523   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
524     "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc://quit"
525   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
526     "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc://quit"
527   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
528     "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc://quit"
529   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
530     "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc://quit"
531   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
532     "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc://quit"
533   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
534     "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
535   CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
536     "$INSTDIR\Documentation.url"
537   CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
538     "$INSTDIR\NEWS.txt" ""
539   CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
540     "$INSTDIR\${PRODUCT_GROUP} Website.url"
541   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
542     "$INSTDIR\vlc.exe" ""
543 SectionEnd
544
545 Section $Name_Section02b SEC02b
546   SectionIn 1 2 3
547   CreateShortCut "$DESKTOP\VLC media player.lnk" \
548     "$INSTDIR\vlc.exe" ""
549 SectionEnd
550
551 !ifdef INSTALL_MOZILLA
552 Section /o $Name_Section03 SEC03
553   SectionIn 3
554
555   SetOutPath "$INSTDIR"
556   !insertmacro OpenUninstallLog
557   !insertmacro InstallFile mozilla\npvlc.dll
558   !insertmacro InstallFile mozilla\npvlc.dll.manifest
559   !insertmacro CloseUninstallLog
560
561   !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
562   WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
563   WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
564   WriteRegStr HKLM ${Moz} "Product" "VLC media player"
565   WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
566   WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
567
568  ; for very old version of mozilla, these lines may be needed
569  ;Push $R0
570  ;Push $R1
571  ;Push $R2
572
573  ;!define Index 'Line${__LINE__}'
574  ;StrCpy $R1 "0"
575
576  ;"${Index}-Loop:"
577
578  ;  ; Check for Key
579  ;  EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
580  ;  StrCmp $R0 "" "${Index}-End"
581  ;  IntOp $R1 $R1 + 1
582  ;  ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
583  ;  StrCmp $R2 "" "${Index}-Loop" ""
584
585  ;  CopyFiles "$INSTDIR\npvlc.dll" "$R2"
586  ;  !ifdef LIBVLC_DLL
587  ;  CopyFiles ${LIBVLC_DLL} "$R2"
588  ;  !endif
589  ;  !ifdef LIBVLC_CONTROL_DLL
590  ;  CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
591  ;  !endif
592  ;  Goto "${Index}-Loop"
593
594  ;"${Index}-End:"
595  ;!undef Index
596
597 SectionEnd
598 !endif
599
600 !ifdef INSTALL_ACTIVEX
601 Section $Name_Section04 SEC04
602   SectionIn 3
603   SetOutPath "$INSTDIR"
604   !insertmacro OpenUninstallLog
605   !insertmacro InstallFile activex\axvlc.dll
606   !insertmacro InstallFile activex\axvlc.dll.manifest
607   !insertmacro CloseUninstallLog
608   RegDLL "$INSTDIR\axvlc.dll"
609 SectionEnd
610 !endif
611
612
613 Section $Name_Section05 SEC05
614   SectionIn 1 2 3
615   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
616   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
617     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
618   WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
619   WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
620     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
621
622   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
623   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
624   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
625   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
626   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "play"
627   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
628
629   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
630   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
631   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
632   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
633   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play"
634   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
635   WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
636   WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
637   WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
638     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
639   WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
640   WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
641   WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
642   WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
643     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
644   WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
645
646 SectionEnd
647
648
649 SectionGroup /e !$Name_Section06 SEC06
650   SectionGroup $Name_SectionGroupAudio
651     !insertmacro MacroAudioExtensions RegisterExtensionSection
652   SectionGroupEnd
653   SectionGroup $Name_SectionGroupVideo
654     !insertmacro MacroVideoExtensions RegisterExtensionSection
655   SectionGroupEnd
656   SectionGroup $Name_SectionGroupOther
657     !insertmacro MacroOtherExtensions RegisterExtensionSection
658   SectionGroupEnd
659 SectionGroupEnd
660
661 Section $Name_Section07 SEC07
662   SectionIn 1 3
663   !insertmacro MacroAllExtensions AddContextMenu
664   !insertmacro AddContextMenuExt "Directory"
665 SectionEnd
666
667 Section $Name_Section08 SEC08
668   !insertmacro delprefs
669 SectionEnd
670
671 ; Installer section descriptions
672 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
673   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01
674   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a
675   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b
676 @BUILD_MOZILLA_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
677 @BUILD_ACTIVEX_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
678   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
679   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
680   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
681   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08
682 !insertmacro MUI_FUNCTION_DESCRIPTION_END
683
684 ;;; Start function
685 Function .onInit
686
687 UAC_Elevate:
688     UAC::RunElevated
689     StrCmp 1223 $0 UAC_ElevationAborted
690     StrCmp 0 $0 0 UAC_Err
691     StrCmp 1 $1 0 UAC_Success
692     Quit
693
694 UAC_Err:
695     MessageBox mb_iconstop "Unable to elevate, error $0"
696     Abort
697
698 UAC_ElevationAborted:
699     MessageBox mb_iconstop "This installer requires admin access, aborting!"
700     Abort
701
702 UAC_Success:
703     StrCmp 1 $3 +4
704     StrCmp 3 $1 0 UAC_ElevationAborted
705     MessageBox mb_iconstop "This installer requires admin access, try again"
706     goto UAC_Elevate
707   !insertmacro MUI_LANGDLL_DISPLAY
708
709   !include "languages\english.nsh"
710   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
711   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
712   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
713   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
714   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
715   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
716   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
717   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
718   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
719   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
720   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
721   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
722   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
723   French:
724   !include "languages\french.nsh"
725   Goto EndLanguageCmp
726   German:
727   !include "languages\german.nsh"
728   Goto EndLanguageCmp
729   Italian:
730   !include "languages\italian.nsh"
731   Goto EndLanguageCmp
732   Hungarian:
733   !include "languages\hungarian.nsh"
734   Goto EndLanguageCmp
735   Romanian:
736   !include "languages\romanian.nsh"
737   Goto EndLanguageCmp
738   Catalan:
739   !include "languages\catalan.nsh"
740   Goto EndLanguageCmp
741   Bulgarian:
742   !include "languages\bulgarian.nsh"
743   Goto EndLanguageCmp
744   Slovak:
745   !include "languages\slovak.nsh"
746   Goto EndLanguageCmp
747   Polish:
748   !include "languages\polish.nsh"
749   Goto EndLanguageCmp
750   Dutch:
751   !include "languages\dutch.nsh"
752   Goto EndLanguageCmp
753   Schinese:
754   !include "languages\schinese.nsh"
755   Goto EndLanguageCmp
756   Finnish:
757   !include "languages\finnish.nsh"
758   Goto EndLanguageCmp
759   Brazilian:
760   !include "languages\brazilian_portuguese.nsh"
761   EndLanguageCmp:
762
763   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
764   "UninstallString"
765   StrCmp $R0 "" done
766
767   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done
768
769   ;Run the uninstaller
770   ;uninst:
771     ClearErrors
772     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
773   done:
774
775 FunctionEnd
776
777 Function .OnInstFailed
778     UAC::Unload
779 FunctionEnd
780
781 Function .OnInstSuccess
782     UAC::Unload
783 FunctionEnd
784 ;; End function
785 Section -Post
786   WriteUninstaller "$INSTDIR\uninstall.exe"
787   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
788   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
789   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
790
791   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
792     "DisplayName" "$(^Name)"
793   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
794     "UninstallString" "$INSTDIR\uninstall.exe"
795   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
796     "InstallLocation" "$INSTDIR"
797   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
798     "DisplayIcon" "$INSTDIR\vlc.exe"
799   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
800     "DisplayVersion" "${PRODUCT_VERSION}"
801   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
802     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
803   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
804     "Publisher" "${PRODUCT_PUBLISHER}"
805   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
806     "VersionMajor"  "@VERSION_MAJOR@"
807   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
808     "VersionMinor" "@VERSION_MINOR@"
809 SectionEnd
810
811 ;;;;;;;;;;;;;;;;;;;;;;;;
812 ; Uninstaller sections ;
813 ;;;;;;;;;;;;;;;;;;;;;;;;
814
815 ; TrimNewlines (copied from NSIS documentation)
816 ; input, top of stack  (e.g. whatever$\r$\n)
817 ; output, top of stack (replaces, with e.g. whatever)
818 ; modifies no other variables.
819
820 Function un.TrimNewlines
821  Exch $R0
822  Push $R1
823  Push $R2
824  StrCpy $R1 0
825
826  loop:
827    IntOp $R1 $R1 - 1
828    StrCpy $R2 $R0 1 $R1
829    StrCmp $R2 "$\r" loop
830    StrCmp $R2 "$\n" loop
831    IntOp $R1 $R1 + 1
832    IntCmp $R1 0 no_trim_needed
833    StrCpy $R0 $R0 $R1
834
835  no_trim_needed:
836    Pop $R2
837    Pop $R1
838    Exch $R0
839 FunctionEnd
840
841 Function un.RemoveEmptyDirs
842   Pop $9
843   !define Index 'Line${__LINE__}'
844   FindFirst $0 $1 "$INSTDIR$9*"
845   StrCmp $0 "" "${Index}-End"
846   "${Index}-Loop:"
847     StrCmp $1 "" "${Index}-End"
848     StrCmp $1 "." "${Index}-Next"
849     StrCmp $1 ".." "${Index}-Next"
850       Push $0
851       Push $1
852       Push $9
853       Push "$9$1\"
854       Call un.RemoveEmptyDirs
855       Pop $9
856       Pop $1
857       Pop $0
858     "${Index}-Remove:"
859     RMDir "$INSTDIR$9$1"
860     "${Index}-Next:"
861     FindNext $0 $1
862     Goto "${Index}-Loop"
863   "${Index}-End:"
864   FindClose $0
865   !undef Index
866 FunctionEnd
867
868 Section "un.$Name_Section91" SEC91
869   SectionIn 1 2 3 RO
870   SetShellVarContext all
871
872   !insertmacro MacroAllExtensions DeleteContextMenu
873   !insertmacro MacroAllExtensions UnRegisterExtensionSection
874   !insertmacro DeleteContextMenuExt "Directory"
875
876   ;remove activex plugin
877   UnRegDLL "$INSTDIR\axvlc.dll"
878   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
879   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
880
881   ;remove mozilla plugin
882   Push $R0
883   Push $R1
884   Push $R2
885
886   !define Index 'Line${__LINE__}'
887   StrCpy $R1 "0"
888
889   "${Index}-Loop:"
890
891     ; Check for Key
892     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
893     StrCmp $R0 "" "${Index}-End"
894     IntOp $R1 $R1 + 1
895     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
896     StrCmp $R2 "" "${Index}-Loop" ""
897
898     ; old files (0.8.5 and before) that may be lying around
899     Delete /REBOOTOK "$R2\npvlc.dll"
900     Delete /REBOOTOK "$R2\libvlc.dll"
901     Delete /REBOOTOK "$R2\vlcintf.xpt"
902     Goto "${Index}-Loop"
903
904   "${Index}-End:"
905   !undef Index
906   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
907   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
908
909   RMDir "$SMPROGRAMS\VideoLAN"
910   RMDir /r $SMPROGRAMS\VideoLAN
911
912   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
913   UninstallLoop:
914     ClearErrors
915     FileRead $UninstallLog $R0
916     IfErrors UninstallEnd
917     Push $R0
918     Call un.TrimNewLines
919     Pop $R0
920     Delete "$INSTDIR\$R0"
921     Goto UninstallLoop
922   UninstallEnd:
923   FileClose $UninstallLog
924   Delete "$INSTDIR\uninstall.log"
925   Delete "$INSTDIR\uninstall.exe"
926   Push "\"
927   Call un.RemoveEmptyDirs
928   RMDir "$INSTDIR"
929
930   DeleteRegKey HKLM Software\VideoLAN
931
932   DeleteRegKey HKCR Applications\vlc.exe
933   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
934   DeleteRegKey HKCR DVD\shell\PlayWithVLC
935   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
936   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
937   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
938   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
939   DeleteRegKey HKLM Software\Clients\Media\VLC
940   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
941   DeleteRegKey HKCR "VLC.MediaFile"
942
943   DeleteRegKey HKLM \
944     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
945
946   DeleteRegKey HKLM \
947     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
948
949   Delete "$DESKTOP\VLC media player.lnk"
950
951   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
952   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
953   SetAutoClose true
954 SectionEnd
955
956 Section /o "un.$Name_Section92" SEC92
957   !insertmacro delprefs
958 SectionEnd
959
960 ; Uninstaller section descriptions
961 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
962   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
963   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
964 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
965
966 Function un.OnUnInstFailed
967     UAC::Unload
968 FunctionEnd
969
970 Function un.OnUnInstSuccess
971     UAC::Unload
972     Delete "$INSTDIR\UAC.dll"
973 FunctionEnd
974
975 Function un.onInit
976
977 UAC_Elevate:
978     UAC::RunElevated
979     StrCmp 1223 $0 UAC_ElevationAborted
980     StrCmp 0 $0 0 UAC_Err
981     StrCmp 1 $1 0 UAC_Success
982     Quit
983
984 UAC_Err:
985     MessageBox mb_iconstop "Unable to elevate, error $0"
986     Abort
987
988 UAC_ElevationAborted:
989     MessageBox mb_iconstop "This installer requires admin access, aborting!"
990     Abort
991
992 UAC_Success:
993     StrCmp 1 $3 +4
994     StrCmp 3 $1 0 UAC_ElevationAborted
995     MessageBox mb_iconstop "This installer requires admin access, try again"
996     goto UAC_Elevate
997
998   !insertmacro MUI_UNGETLANGUAGE
999
1000   !include "languages\english.nsh"
1001   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
1002   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
1003   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
1004   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
1005   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
1006   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
1007   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
1008   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
1009   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
1010   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
1011   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
1012   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
1013   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
1014   French:
1015   !include "languages\french.nsh"
1016   Goto EndLanguageCmp
1017   German:
1018   !include "languages\german.nsh"
1019   Goto EndLanguageCmp
1020   Italian:
1021   !include "languages\italian.nsh"
1022   Goto EndLanguageCmp
1023   Hungarian:
1024   !include "languages\hungarian.nsh"
1025   Goto EndLanguageCmp
1026   Romanian:
1027   !include "languages\romanian.nsh"
1028   Goto EndLanguageCmp
1029   Catalan:
1030   !include "languages\catalan.nsh"
1031   Goto EndLanguageCmp
1032   Bulgarian:
1033   !include "languages\bulgarian.nsh"
1034   Goto EndLanguageCmp
1035   Slovak:
1036   !include "languages\slovak.nsh"
1037   Goto EndLanguageCmp
1038   Polish:
1039   !include "languages\polish.nsh"
1040   Goto EndLanguageCmp
1041   Dutch:
1042   !include "languages\dutch.nsh"
1043   Goto EndLanguageCmp
1044   Schinese:
1045   !include "languages\schinese.nsh"
1046   Goto EndLanguageCmp
1047   Finnish:
1048   !include "languages\finnish.nsh"
1049   Goto EndLanguageCmp
1050   Brazilian:
1051   !include "languages\brazilian_portuguese.nsh"
1052   EndLanguageCmp:
1053
1054 FunctionEnd