]> git.sesse.net Git - vlc/blob - extras/package/win32/vlc.win32.nsi.in
Win32: don't remove inexistant directory while uninstalling
[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           ;
330 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
331
332 !macro delprefs
333   StrCpy $0 0
334   !define Index 'Line${__LINE__}'
335   "${Index}-Loop:"
336   ; FIXME
337   ; this will loop through all the logged users and "virtual" windows users
338   ; (it looks like users are only present in HKEY_USERS when they are logged in)
339     ClearErrors
340     EnumRegKey $1 HKU "" $0
341     StrCmp $1 "" "${Index}-End"
342     IntOp $0 $0 + 1
343     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
344     StrCmp $2 "" "${Index}-Loop"
345     RMDir /r "$2\vlc"
346     Goto "${Index}-Loop"
347   "${Index}-End:"
348   !undef Index
349 !macroend
350
351 ;;;;;;;;;;;;;;;
352 ; 4. Logging  ;
353 ;;;;;;;;;;;;;;;
354 Var UninstallLog
355 !macro OpenUninstallLog
356   FileOpen $UninstallLog "$INSTDIR\uninstall.log" a
357   FileSeek $UninstallLog 0 END
358 !macroend
359
360 !macro CloseUninstallLog
361   FileClose $UninstallLog
362   SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
363 !macroend
364
365 ;;;;;;;;;;;;;;;;;;;;
366 ; 5. Installations ;
367 ;;;;;;;;;;;;;;;;;;;;
368 !macro InstallFile FILEREGEX
369   File "${FILEREGEX}"
370   !define Index 'Line${__LINE__}'
371   FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
372   StrCmp $0 "" "${Index}-End"
373   "${Index}-Loop:"
374     StrCmp $1 "" "${Index}-End"
375     FileWrite $UninstallLog "$1$\r$\n"
376     FindNext $0 $1
377     Goto "${Index}-Loop"
378   "${Index}-End:"
379   !undef Index
380 !macroend
381
382 !macro InstallFolder FOLDER
383   File /r "${FOLDER}"
384   Push "${FOLDER}"
385   Call InstallFolderInternal
386 !macroend
387
388 Function InstallFolderInternal
389   Pop $9
390   !define Index 'Line${__LINE__}'
391   FindFirst $0 $1 "$INSTDIR\$9\*"
392   StrCmp $0 "" "${Index}-End"
393   "${Index}-Loop:"
394     StrCmp $1 "" "${Index}-End"
395     StrCmp $1 "." "${Index}-Next"
396     StrCmp $1 ".." "${Index}-Next"
397     IfFileExists "$9\$1\*" 0 "${Index}-Write"
398       Push $0
399       Push $9
400       Push "$9\$1"
401       Call InstallFolderInternal
402       Pop $9
403       Pop $0
404       Goto "${Index}-Next"
405     "${Index}-Write:"
406     FileWrite $UninstallLog "$9\$1$\r$\n"
407     "${Index}-Next:"
408     FindNext $0 $1
409     Goto "${Index}-Loop"
410   "${Index}-End:"
411   !undef Index
412 FunctionEnd
413 ;;; End of Macros
414
415
416 ;;;;;;;;;;;;;;;;;;;;;;
417 ; Installer sections ;
418 ; The CORE of the    ;
419 ; installer          ;
420 ;;;;;;;;;;;;;;;;;;;;;;
421
422 Section $Name_Section01 SEC01
423   SectionIn 1 2 3 RO
424   SetShellVarContext all
425   SetOutPath "$INSTDIR"
426
427   !insertmacro OpenUninstallLog
428
429   ; VLC.exe, libvlc.dll
430   !insertmacro InstallFile vlc.exe
431   !insertmacro InstallFile vlc.exe.manifest
432   !insertmacro InstallFile vlc-cache-gen.exe
433
434   ; All dlls
435   !insertmacro InstallFile *.dll
436
437   ; Text files
438   !insertmacro InstallFile *.txt
439
440   ; Subfolders
441   !insertmacro InstallFolder plugins
442   !insertmacro InstallFolder locale
443 @BUILD_OSDMENU_TRUE@ !insertmacro InstallFolder osdmenu
444 @BUILD_SKINS_TRUE@   !insertmacro InstallFolder skins
445 @BUILD_HTTPD_TRUE@   !insertmacro InstallFolder http
446 @BUILD_LUA_TRUE@     !insertmacro InstallFolder lua
447   ExecWait "$INSTDIR\vlc-cache-gen.exe $INSTDIR\plugins"
448
449
450   ; URLs
451   WriteIniStr "$INSTDIR\${PRODUCT_GROUP} Website.url" "InternetShortcut" "URL" \
452     "${PRODUCT_WEB_SITE}"
453   FileWrite $UninstallLog "${PRODUCT_GROUP} Website.url$\r$\n"
454   WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
455     "${PRODUCT_WEB_SITE}/doc/"
456   FileWrite $UninstallLog "Documentation.url$\r$\n"
457   WriteIniStr "$INSTDIR\New_Skins.url" "InternetShortcut" "URL" \
458     "${PRODUCT_WEB_SITE}/vlc/skins.php"
459   FileWrite $UninstallLog "New_Skins.url$\r$\n"
460
461   !insertmacro CloseUninstallLog
462
463   ; Add VLC to "recommended programs" for the following extensions
464   WriteRegStr HKCR Applications\vlc.exe "" ""
465   WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player"
466   WriteRegStr HKCR Applications\vlc.exe\shell\Open "" $ContextMenuEntry_PlayWith
467   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" \
468     '"$INSTDIR\vlc.exe" --started-from-file "%1"'
469   !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
470
471 ; Windows default programs Registration
472   ; Vista and above detection
473   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
474   StrCpy $R1 $R0 1
475   StrCmp $R1 '6' lbl_vista lbl_done
476
477   lbl_vista:
478   WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
479   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
480   WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
481   WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
482   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
483   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
484   WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
485   WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
486
487   lbl_done:
488 SectionEnd
489
490 Section $Name_Section02a SEC02a
491   SectionIn 1 2 3
492   CreateDirectory "$SMPROGRAMS\VideoLAN"
493   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings"
494   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Audio"
495   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to DirectX (default).lnk" \
496     "$INSTDIR\vlc.exe" "--aout aout_directx --save-config vlc://quit"
497   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Audio\Set Audio mode to Waveout.lnk" \
498     "$INSTDIR\vlc.exe" "--aout waveout --save-config vlc://quit"
499   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Interface"
500 @BUILD_SKINS_TRUE@  CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Skinnable.lnk" \
501 @BUILD_SKINS_TRUE@    "$INSTDIR\vlc.exe" "-I skins --save-config vlc://quit"
502   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Interface\Set Main Interface to Qt (default).lnk" \
503     "$INSTDIR\vlc.exe" "-I qt --save-config vlc://quit"
504   CreateDirectory "$SMPROGRAMS\VideoLAN\Quick Settings\Video"
505   ; FIXME add detection for Vista. Direct3D will be default there, for all others it's DirectX
506   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D.lnk" \
507     "$INSTDIR\vlc.exe" "--vout direct3d --overlay --directx-hw-yuv --save-config vlc://quit"
508   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to Direct3D (no hardware acceleration).lnk" \
509     "$INSTDIR\vlc.exe" "--vout direct3d --overlay --no-directx-hw-yuv --save-config vlc://quit"
510   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX.lnk" \
511     "$INSTDIR\vlc.exe" "--vout directx --overlay --directx-hw-yuv --save-config vlc://quit"
512   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no hardware acceleration).lnk" \
513     "$INSTDIR\vlc.exe" "--vout directx --no-overlay --no-directx-hw-yuv --save-config vlc://quit"
514   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to DirectX (no video overlay).lnk" \
515     "$INSTDIR\vlc.exe" "--vout directx --no-overlay --directx-hw-yuv --save-config vlc://quit"
516   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Video\Set Video mode to OpenGL.lnk" \
517     "$INSTDIR\vlc.exe" "--vout opengl --overlay --save-config vlc://quit"
518   CreateShortCut "$SMPROGRAMS\VideoLAN\Quick Settings\Reset VLC media player preferences and cache files.lnk" \
519     "$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache vlc://quit"
520   CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
521     "$INSTDIR\Documentation.url"
522   CreateShortCut "$SMPROGRAMS\VideoLAN\Release Notes.lnk" \
523     "$INSTDIR\NEWS.txt" ""
524   CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_GROUP} Website.lnk" \
525     "$INSTDIR\${PRODUCT_GROUP} Website.url"
526   CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \
527     "$INSTDIR\vlc.exe" ""
528 SectionEnd
529
530 Section $Name_Section02b SEC02b
531   SectionIn 1 2 3
532   CreateShortCut "$DESKTOP\VLC media player.lnk" \
533     "$INSTDIR\vlc.exe" ""
534 SectionEnd
535
536 !ifdef INSTALL_MOZILLA
537 Section /o $Name_Section03 SEC03
538   SectionIn 3
539
540   SetOutPath "$INSTDIR"
541   !insertmacro OpenUninstallLog
542   !insertmacro InstallFile mozilla\npvlc.dll
543   !insertmacro InstallFile mozilla\npvlc.dll.manifest
544   !insertmacro CloseUninstallLog
545
546   !define Moz "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
547   WriteRegStr HKLM ${Moz} "Description" "VLC Multimedia Plugin"
548   WriteRegStr HKLM ${Moz} "Path" "$INSTDIR\npvlc.dll"
549   WriteRegStr HKLM ${Moz} "Product" "VLC media player"
550   WriteRegStr HKLM ${Moz} "Vendor" "VideoLAN"
551   WriteRegStr HKLM ${Moz} "Version" "${VERSION}"
552
553  ; for very old version of mozilla, these lines may be needed
554  ;Push $R0
555  ;Push $R1
556  ;Push $R2
557
558  ;!define Index 'Line${__LINE__}'
559  ;StrCpy $R1 "0"
560
561  ;"${Index}-Loop:"
562
563  ;  ; Check for Key
564  ;  EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
565  ;  StrCmp $R0 "" "${Index}-End"
566  ;  IntOp $R1 $R1 + 1
567  ;  ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
568  ;  StrCmp $R2 "" "${Index}-Loop" ""
569
570  ;  CopyFiles "$INSTDIR\npvlc.dll" "$R2"
571  ;  !ifdef LIBVLC_DLL
572  ;  CopyFiles ${LIBVLC_DLL} "$R2"
573  ;  !endif
574  ;  !ifdef LIBVLC_CONTROL_DLL
575  ;  CopyFiles ${LIBVLC_CONTROL_DLL} "$R2"
576  ;  !endif
577  ;  Goto "${Index}-Loop"
578
579  ;"${Index}-End:"
580  ;!undef Index
581
582 SectionEnd
583 !endif
584
585 !ifdef INSTALL_ACTIVEX
586 Section $Name_Section04 SEC04
587   SectionIn 3
588   SetOutPath "$INSTDIR"
589   !insertmacro OpenUninstallLog
590   !insertmacro InstallFile activex\axvlc.dll
591   !insertmacro InstallFile activex\axvlc.dll.manifest
592   !insertmacro CloseUninstallLog
593   RegDLL "$INSTDIR\axvlc.dll"
594 SectionEnd
595 !endif
596
597
598 Section $Name_Section05 SEC05
599   SectionIn 1 2 3
600   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
601   WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \
602     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
603   WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" $ContextMenuEntry_PlayWith
604   WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \
605     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
606
607   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" ""
608   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" $Action_OnArrivalDVD
609   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
610   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeProgID" "VLC.DVDMovie"
611   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "InvokeVerb" "Open"
612   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Provider" "VideoLAN VLC media player"
613
614   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" ""
615   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" $Action_OnArrivalAudioCD
616   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe",0'
617   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio"
618   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "Open"
619   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player"
620   WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie"
621   WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Open"
622   WriteRegStr HKCR "VLC.DVDMovie\shell\Open\command" "" \
623     '"$INSTDIR\vlc.exe" --started-from-file dvd://%1'
624   WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
625   WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio"
626   WriteRegStr HKCR "VLC.CDAudio\shell" "" "Open"
627   WriteRegStr HKCR "VLC.CDAudio\shell\Open\command" "" \
628     '"$INSTDIR\vlc.exe" --started-from-file cdda://%1'
629   WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
630
631 SectionEnd
632
633
634 SectionGroup /e !$Name_Section06 SEC06
635   SectionGroup $Name_SectionGroupAudio
636     !insertmacro MacroAudioExtensions RegisterExtensionSection
637   SectionGroupEnd
638   SectionGroup $Name_SectionGroupVideo
639     !insertmacro MacroVideoExtensions RegisterExtensionSection
640   SectionGroupEnd
641   SectionGroup $Name_SectionGroupOther
642     !insertmacro MacroOtherExtensions RegisterExtensionSection
643   SectionGroupEnd
644 SectionGroupEnd
645
646 Section $Name_Section07 SEC07
647   SectionIn 1 3
648   !insertmacro MacroAllExtensions AddContextMenu
649   !insertmacro AddContextMenuExt "Directory"
650 SectionEnd
651
652 Section $Name_Section08 SEC08
653   !insertmacro delprefs
654 SectionEnd
655
656 ; Installer section descriptions
657 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
658   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $Desc_Section01
659   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02a} $Desc_Section02a
660   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02b} $Desc_Section02b
661 @BUILD_MOZILLA_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $Desc_Section03
662 @BUILD_ACTIVEX_TRUE@ !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $Desc_Section04
663   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $Desc_Section05
664   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $Desc_Section06
665   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $Desc_Section07
666   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $Desc_Section08
667 !insertmacro MUI_FUNCTION_DESCRIPTION_END
668
669 ;;; Start function
670 Function .onInit
671
672 UAC_Elevate:
673     UAC::RunElevated
674     StrCmp 1223 $0 UAC_ElevationAborted
675     StrCmp 0 $0 0 UAC_Err
676     StrCmp 1 $1 0 UAC_Success
677     Quit
678
679 UAC_Err:
680     MessageBox mb_iconstop "Unable to elevate, error $0"
681     Abort
682
683 UAC_ElevationAborted:
684     MessageBox mb_iconstop "This installer requires admin access, aborting!"
685     Abort
686
687 UAC_Success:
688     StrCmp 1 $3 +4
689     StrCmp 3 $1 0 UAC_ElevationAborted
690     MessageBox mb_iconstop "This installer requires admin access, try again"
691     goto UAC_Elevate
692   !insertmacro MUI_LANGDLL_DISPLAY
693
694   !include "languages\english.nsh"
695   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
696   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
697   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
698   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
699   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
700   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
701   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
702   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
703   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
704   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
705   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
706   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
707   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
708   French:
709   !include "languages\french.nsh"
710   Goto EndLanguageCmp
711   German:
712   !include "languages\german.nsh"
713   Goto EndLanguageCmp
714   Italian:
715   !include "languages\italian.nsh"
716   Goto EndLanguageCmp
717   Hungarian:
718   !include "languages\hungarian.nsh"
719   Goto EndLanguageCmp
720   Romanian:
721   !include "languages\romanian.nsh"
722   Goto EndLanguageCmp
723   Catalan:
724   !include "languages\catalan.nsh"
725   Goto EndLanguageCmp
726   Bulgarian:
727   !include "languages\bulgarian.nsh"
728   Goto EndLanguageCmp
729   Slovak:
730   !include "languages\slovak.nsh"
731   Goto EndLanguageCmp
732   Polish:
733   !include "languages\polish.nsh"
734   Goto EndLanguageCmp
735   Dutch:
736   !include "languages\dutch.nsh"
737   Goto EndLanguageCmp
738   Schinese:
739   !include "languages\schinese.nsh"
740   Goto EndLanguageCmp
741   Finnish:
742   !include "languages\finnish.nsh"
743   Goto EndLanguageCmp
744   Brazilian:
745   !include "languages\brazilian_portuguese.nsh"
746   EndLanguageCmp:
747
748   ReadRegStr $R0  ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
749   "UninstallString"
750   StrCmp $R0 "" done
751
752   MessageBox MB_YESNO|MB_ICONEXCLAMATION $Message_AlreadyInstalled IDNO done
753
754   ;Run the uninstaller
755   ;uninst:
756     ClearErrors
757     ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
758   done:
759
760 FunctionEnd
761
762 Function .OnInstFailed
763     UAC::Unload
764 FunctionEnd
765
766 Function .OnInstSuccess
767     UAC::Unload
768 FunctionEnd
769 ;; End function
770 Section -Post
771   WriteUninstaller "$INSTDIR\uninstall.exe"
772   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" $INSTDIR
773   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${VERSION}"
774   WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\vlc.exe"
775
776   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
777     "DisplayName" "$(^Name)"
778   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
779     "UninstallString" "$INSTDIR\uninstall.exe"
780   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
781     "InstallLocation" "$INSTDIR"
782   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
783     "DisplayIcon" "$INSTDIR\vlc.exe"
784   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
785     "DisplayVersion" "${PRODUCT_VERSION}"
786   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
787     "URLInfoAbout" "${PRODUCT_WEB_SITE}"
788   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
789     "Publisher" "${PRODUCT_PUBLISHER}"
790   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
791     "VersionMajor"  "@VERSION_MAJOR@"
792   WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" \
793     "VersionMinor" "@VERSION_MINOR@"
794 SectionEnd
795
796 ;;;;;;;;;;;;;;;;;;;;;;;;
797 ; Uninstaller sections ;
798 ;;;;;;;;;;;;;;;;;;;;;;;;
799
800 ; TrimNewlines (copied from NSIS documentation)
801 ; input, top of stack  (e.g. whatever$\r$\n)
802 ; output, top of stack (replaces, with e.g. whatever)
803 ; modifies no other variables.
804
805 Function un.TrimNewlines
806  Exch $R0
807  Push $R1
808  Push $R2
809  StrCpy $R1 0
810
811  loop:
812    IntOp $R1 $R1 - 1
813    StrCpy $R2 $R0 1 $R1
814    StrCmp $R2 "$\r" loop
815    StrCmp $R2 "$\n" loop
816    IntOp $R1 $R1 + 1
817    IntCmp $R1 0 no_trim_needed
818    StrCpy $R0 $R0 $R1
819
820  no_trim_needed:
821    Pop $R2
822    Pop $R1
823    Exch $R0
824 FunctionEnd
825
826 Function un.RemoveEmptyDirs
827   Pop $9
828   !define Index 'Line${__LINE__}'
829   FindFirst $0 $1 "$INSTDIR$9*"
830   StrCmp $0 "" "${Index}-End"
831   "${Index}-Loop:"
832     StrCmp $1 "" "${Index}-End"
833     StrCmp $1 "." "${Index}-Next"
834     StrCmp $1 ".." "${Index}-Next"
835       Push $0
836       Push $1
837       Push $9
838       Push "$9$1\"
839       Call un.RemoveEmptyDirs
840       Pop $9
841       Pop $1
842       Pop $0
843     "${Index}-Remove:"
844     RMDir "$INSTDIR$9$1"
845     "${Index}-Next:"
846     FindNext $0 $1
847     Goto "${Index}-Loop"
848   "${Index}-End:"
849   FindClose $0
850   !undef Index
851 FunctionEnd
852
853 Section "un.$Name_Section91" SEC91
854   SectionIn 1 2 3 RO
855   SetShellVarContext all
856
857   !insertmacro MacroAllExtensions DeleteContextMenu
858   !insertmacro MacroAllExtensions UnRegisterExtensionSection
859   !insertmacro DeleteContextMenuExt "Directory"
860
861   ;remove activex plugin
862   UnRegDLL "$INSTDIR\axvlc.dll"
863   Delete /REBOOTOK "$INSTDIR\axvlc.dll"
864   Delete /REBOOTOK "$INSTDIR\axvlc.dll.manifest"
865
866   ;remove mozilla plugin
867   Push $R0
868   Push $R1
869   Push $R2
870
871   !define Index 'Line${__LINE__}'
872   StrCpy $R1 "0"
873
874   "${Index}-Loop:"
875
876     ; Check for Key
877     EnumRegKey $R0 HKLM "SOFTWARE\Mozilla" "$R1"
878     StrCmp $R0 "" "${Index}-End"
879     IntOp $R1 $R1 + 1
880     ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins"
881     StrCmp $R2 "" "${Index}-Loop" ""
882
883     ; old files (0.8.5 and before) that may be lying around
884     Delete /REBOOTOK "$R2\npvlc.dll"
885     Delete /REBOOTOK "$R2\libvlc.dll"
886     Delete /REBOOTOK "$R2\vlcintf.xpt"
887     Goto "${Index}-Loop"
888
889   "${Index}-End:"
890   !undef Index
891   Delete /REBOOTOK "$INSTDIR\npvlc.dll"
892   Delete /REBOOTOK "$INSTDIR\npvlc.dll.manifest"
893
894   RMDir "$SMPROGRAMS\VideoLAN"
895   RMDir /r $SMPROGRAMS\VideoLAN
896
897   FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
898   UninstallLoop:
899     ClearErrors
900     FileRead $UninstallLog $R0
901     IfErrors UninstallEnd
902     Push $R0
903     Call un.TrimNewLines
904     Pop $R0
905     Delete "$INSTDIR\$R0"
906     Goto UninstallLoop
907   UninstallEnd:
908   FileClose $UninstallLog
909   Delete "$INSTDIR\uninstall.log"
910   Delete "$INSTDIR\uninstall.exe"
911   Push "\"
912   Call un.RemoveEmptyDirs
913   RMDir "$INSTDIR"
914
915   DeleteRegKey HKLM Software\VideoLAN
916
917   DeleteRegKey HKCR Applications\vlc.exe
918   DeleteRegKey HKCR AudioCD\shell\PlayWithVLC
919   DeleteRegKey HKCR DVD\shell\PlayWithVLC
920   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival"
921   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival
922   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival"
923   DeleteRegKey HKLM Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival
924   DeleteRegKey HKLM Software\Clients\Media\VLC
925   DeleteRegValue HKLM "Software\RegisteredApplications" "VLC"
926   DeleteRegKey HKCR "VLC.MediaFile"
927
928   DeleteRegKey HKLM \
929     "SOFTWARE\MozillaPlugins\@videolan.org/vlc,version=${VERSION}"
930
931   DeleteRegKey HKLM \
932     "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
933
934   Delete "$DESKTOP\VLC media player.lnk"
935
936   DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
937   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
938   SetAutoClose true
939 SectionEnd
940
941 Section /o "un.$Name_Section92" SEC92
942   !insertmacro delprefs
943 SectionEnd
944
945 ; Uninstaller section descriptions
946 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
947   !insertmacro MUI_DESCRIPTION_TEXT ${SEC91} $Desc_Section91
948   !insertmacro MUI_DESCRIPTION_TEXT ${SEC92} $Desc_Section92
949 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
950
951 Function un.OnUnInstFailed
952     UAC::Unload
953 FunctionEnd
954
955 Function un.OnUnInstSuccess
956     UAC::Unload
957     Delete "$INSTDIR\UAC.dll"
958 FunctionEnd
959
960 Function un.onInit
961
962 UAC_Elevate:
963     UAC::RunElevated
964     StrCmp 1223 $0 UAC_ElevationAborted
965     StrCmp 0 $0 0 UAC_Err
966     StrCmp 1 $1 0 UAC_Success
967     Quit
968
969 UAC_Err:
970     MessageBox mb_iconstop "Unable to elevate, error $0"
971     Abort
972
973 UAC_ElevationAborted:
974     MessageBox mb_iconstop "This installer requires admin access, aborting!"
975     Abort
976
977 UAC_Success:
978     StrCmp 1 $3 +4
979     StrCmp 3 $1 0 UAC_ElevationAborted
980     MessageBox mb_iconstop "This installer requires admin access, try again"
981     goto UAC_Elevate
982
983   !insertmacro MUI_UNGETLANGUAGE
984
985   !include "languages\english.nsh"
986   StrCmp $LANGUAGE ${LANG_FRENCH} French 0
987   StrCmp $LANGUAGE ${LANG_GERMAN} German 0
988   StrCmp $LANGUAGE ${LANG_ITALIAN} Italian 0
989   StrCmp $LANGUAGE ${LANG_HUNGARIAN} Hungarian 0
990   StrCmp $LANGUAGE ${LANG_ROMANIAN} Romanian 0
991   StrCmp $LANGUAGE ${LANG_CATALAN} Catalan 0
992   StrCmp $LANGUAGE ${LANG_BULGARIAN} Bulgarian 0
993   StrCmp $LANGUAGE ${LANG_SLOVAK} Slovak 0
994   StrCmp $LANGUAGE ${LANG_POLISH} Polish 0
995   StrCmp $LANGUAGE ${LANG_DUTCH} Dutch 0
996   StrCmp $LANGUAGE ${LANG_SIMPCHINESE} SChinese 0
997   StrCmp $LANGUAGE ${LANG_FINNISH} Finnish 0
998   StrCmp $LANGUAGE ${LANG_PORTUGUESEBR} Brazilian EndLanguageCmp
999   French:
1000   !include "languages\french.nsh"
1001   Goto EndLanguageCmp
1002   German:
1003   !include "languages\german.nsh"
1004   Goto EndLanguageCmp
1005   Italian:
1006   !include "languages\italian.nsh"
1007   Goto EndLanguageCmp
1008   Hungarian:
1009   !include "languages\hungarian.nsh"
1010   Goto EndLanguageCmp
1011   Romanian:
1012   !include "languages\romanian.nsh"
1013   Goto EndLanguageCmp
1014   Catalan:
1015   !include "languages\catalan.nsh"
1016   Goto EndLanguageCmp
1017   Bulgarian:
1018   !include "languages\bulgarian.nsh"
1019   Goto EndLanguageCmp
1020   Slovak:
1021   !include "languages\slovak.nsh"
1022   Goto EndLanguageCmp
1023   Polish:
1024   !include "languages\polish.nsh"
1025   Goto EndLanguageCmp
1026   Dutch:
1027   !include "languages\dutch.nsh"
1028   Goto EndLanguageCmp
1029   Schinese:
1030   !include "languages\schinese.nsh"
1031   Goto EndLanguageCmp
1032   Finnish:
1033   !include "languages\finnish.nsh"
1034   Goto EndLanguageCmp
1035   Brazilian:
1036   !include "languages\brazilian_portuguese.nsh"
1037   EndLanguageCmp:
1038
1039 FunctionEnd