Subversion Repositories DevTools

Rev

Rev 2561 | Blame | Compare with Previous | Last modification | View Log | RSS feed

;*****************************************************************
; Author : Hugues DOILLON
; Date : 03/2007
; Modifié : 
;*****************************************************************
; MUI GUI Version 2
; If problem during compilation -> You need to install the latest version of NSIS
!include MUI2.nsh

!include Library.nsh

; Utiliser les instructions conditionnel
!include LogicLib.nsh

!include Sections.nsh

!include WordFunc.nsh

!include TextReplace.nsh

;!include WinMessages.nsh

!include VixMacros.nsh

;-------------------------------------------------------------------------------------------------------------------------------

; Set the compression method
SetCompressor bzip2 ; zlib|bzip2|lzma

; Execution Setup section that generates the files and libraries to install
; Inclusion of sections containing the libraries to install (generated by the previous setup)
;
; Note: Paths within the installer are relative
;       Becareful of the CWD when running to program
;
!system  "${GBE_BINDIR}\SetupInstallationLibrairie.exe"
!include "${GBE_BINDIR}\InstallationLibrairie.nsh"

; Inclusion of information from the application (files change depending on application)
!include InformationApplication.nsh

!include IsUserAdmin.nsh

!include GestionRaccourci.nsh

; Adding macro to detect. NET framework
!ifdef FRAMEWORK_DOT_NET
        !include GetDotNETVersion.nsh
!endif

; Added macro for a custom section
!ifdef  SECTION_INSTALLATION_PERSONNALISE_INITIAL | SECTION_INSTALLATION_PERSONNALISE_PREMIER | SECTION_INSTALLATION_PERSONNALISE_DERNIER | SECTION_DESINSTALLATION_PERSONNALISE_PREMIER | SECTION_DESINSTALLATION_PERSONNALISE_DERNIER | UI_PAGE_PARAMETRAGE
    !include "${A_INSTALLER}\SectionPersonnalise.nsh"
!endif

;-------------------------------------------------------------------------------------------------------------------------------

; Registry Key

!define REGISTRE_APPLICATION "Software\Microsoft\Windows\CurrentVersion\App Paths\${NOM_APPLICATION}.exe"

!define REGISTRE_DESINSTALLATION "Software\Microsoft\Windows\CurrentVersion\Uninstall\${NOM_APPLICATION}"

;-------------------------------------------------------------------------------------------------------------------------------

; Display Settings MUI

; Warning message in case of cancellation
!define MUI_ABORTWARNING

; Added macro for a custom section
; Icon Installation
!define MUI_ICON                        "${GBE_NSISDATA}\inVix.ico"
; Icon Uninstall
!define MUI_UNICON                      "${GBE_NSISDATA}\unVix.ico"
        
; Image
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
; Image Host and closing
!define MUI_HEADERIMAGE_BITMAP          "${GBE_NSISDATA}\VixHeader.bmp"
!define MUI_HEADERIMAGE_UNBITMAP        "${GBE_NSISDATA}\VixHeader.bmp"
        
; Image top left
!define MUI_WELCOMEFINISHPAGE_BITMAP    "${GBE_NSISDATA}\VixPanel.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP  "${GBE_NSISDATA}\VixPanel.bmp"

; Description of the page component selection
!define MUI_COMPONENTSPAGE_NODESC ; MUI_COMPONENTSPAGE_SMALLDESC

; Can choose to run the application
!ifndef SANS_LANCEMENT
        !define MUI_FINISHPAGE_RUN "$INSTDIR\${EXE_APPLICATION}"
!endif

; Defined functions launched initialization installation and uninstallation
!define MUI_CUSTOMFUNCTION_GUIINIT initialisationGUI
!define MUI_CUSTOMFUNCTION_UNGUIINIT un.initialisationGUI
;!define MUI_CUSTOMFUNCTION_ABORT function
;!define MUI_CUSTOMFUNCTION_UNABORT function

;!define MUI_FINISHPAGE_LINK_LOCATION ${WEB_SITE_APPLICATION}

;-------------------------------------------------------------------------------------------------------------------------------

; Definition of pages visible MUI Installation

;!define MULTIUSER_EXECUTIONLEVEL Admin
;!define MULTIUSER_MUI
;!include MultiUser.nsh

;!insertmacro MULTIUSER_PAGE_INSTALLMODE


; Home Installation
; Uses 3 lines instead of 2 for the title display
!define MUI_WELCOMEPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_WELCOME

; Page License
;!insertmacro MUI_PAGE_LICENSE "..\..\dossier\vers\license\VotreLicenseLogicielle.txt"

; Page de choix des composants à installer
!insertmacro MUI_PAGE_COMPONENTS


; Page selection in the installation directory
!insertmacro MUI_PAGE_DIRECTORY

; Page progress of the installation
!insertmacro MUI_PAGE_INSTFILES

!ifdef UI_PAGE_PARAMETRAGE
        !insertmacro UI_Page_Parametrage
!endif

; Page Setup Complete
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_PAGE_FINISH

;-------------------------------------------------------------------------------------------------------------------------------

; Definition of Uninstall pages visible MUI

; Home Installation
; Uses 3 lines instead of 2 for the title display
;!define MUI_WELCOMEPAGE_TITLE_3LINES
;!insertmacro MUI_UNPAGE_WELCOME

; Page uninstall confirmation
!insertmacro MUI_UNPAGE_CONFIRM

; Page unwinding uninstalling
!insertmacro MUI_UNPAGE_INSTFILES

; End Page Uninstall
!define MUI_FINISHPAGE_TITLE_3LINES
!insertmacro MUI_UNPAGE_FINISH

; End Pages MUI

;-------------------------------------------------------------------------------------------------------------------------------

; MUI language available
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Spanish"
;-------------------------------------------------------------------------------------------------------------------------------

; Set the name of the installation.
;; Name "${NOM_APPLICATION} ${VERSION_APPLICATION}"

; Specifies the file to be used by makensis order to create the installation.
;ddp; OutFile "Setup\${NOM_SETUP}"

; Set the installation directory by default.
InstallDir "${CHEMIN_INSTALLATION}"

; Seeking the installation folder in the registry
;InstallDirRegKey HKLM "${REGISTRE_APPLICATION}" ""

; Defined if installation details are shown or not.
ShowInstDetails show

; Defined if the uninstallation details are shown or not.
ShowUnInstDetails show

;-------------------------------------------------------------------------------------------------------------------------------

; Variable

; Management of unique choice (All Users or Current user)

var menuTousUtilisateurs
var menuUtilisateurCourant
var raccourciTousUtilisateurs
var raccourciUtilisateurCourant

; Other Variables

var cheminAncienneDesinstallation
var cheminAncienneInstallation

;-------------------------------------------------------------------------------------------------------------------------------

; Definition of language strings used

LangString stringAncienneVersion ${LANG_FRENCH} "Une ancienne version de cette application est installée sur votre système. Avant de poursuivre le processus d'installation, la version existante de cette application sera supprimée. Souhaitez-vous supprimer cette application ainsi que tous les fichiers du dossier d'installation ?"
LangString stringAncienneVersion ${LANG_ENGLISH} "Another version of this software is already installed. Delete existing version ?"
LangString stringAncienneVersion ${LANG_SPANISH} "Otra versión del software ya está instalada .¿ Borrar la versión acual ?"

LangString stringFrameworkNET ${LANG_FRENCH} "Cette application requiert le Framework .NET ${FRAMEWORK_DOT_NET}. Pour installer cette application, installez d'abord le Framework .NET ${FRAMEWORK_DOT_NET}, ou contactez votre service de support pour obtenir de l'assistance."
LangString stringFrameworkNET ${LANG_ENGLISH} "Software needs Framework .NET ${FRAMEWORK_DOT_NET}."
LangString stringFrameworkNET ${LANG_SPANISH} "Este programa necesita el Framework .NET ${FRAMEWORK_DOT_NET}."

LangString stringInstallationApplication ${LANG_FRENCH} "L'installation de cette application requiert les droits d'administration. Pour installer cette application, ouvrez une session en tant qu'administrateur, ou contactez votre service de support pour obtenir de l'assistance."
LangString stringInstallationApplication ${LANG_ENGLISH} "Software Installer needs Administrator Rights."
LangString stringInstallationApplication ${LANG_SPANISH} "El programa de instalación necesita derechos de administrador."

LangString stringDesinstallationApplication ${LANG_FRENCH} "La désinstallation de cette application requiert les droits d'administration. Pour supprimer cette application, ouvrez une session en tant qu'administrateur, ou contactez votre service de support pour obtenir de l'assistance."
LangString stringDesinstallationApplication ${LANG_ENGLISH} "Software Uninstaller needs Administrator Rights."
LangString stringDesinstallationApplication ${LANG_SPANISH} "El programa de desinstalación necesita derechos de administrador."

LangString stringApplication ${LANG_FRENCH} "Application"
LangString stringApplication ${LANG_ENGLISH} "Application"
LangString stringApplication ${LANG_SPANISH} "Aplicación"

LangString stringSecAncienneVersion ${LANG_FRENCH} "Désinstaller ancienne version"
LangString stringSecAncienneVersion ${LANG_ENGLISH} "Uninstall old version"
LangString stringSecAncienneVersion ${LANG_SPANISH} "???"

LangString stringLibrairies ${LANG_FRENCH} "Librairies"
LangString stringLibrairies ${LANG_ENGLISH} "Library"
LangString stringLibrairies ${LANG_SPANISH} "Librería"

!ifdef SECTION_INSTALLATION_PERSONNALISE_EBRIO
        !insertmacro LangStringInstalleSectionPersonnalisePremier
!endif

!ifdef SECTION_INSTALLATION_PERSONNALISE_INITIAL
        !insertmacro LangStringInstalleSectionPersonnaliseInitial
!endif

!ifdef SECTION_INSTALLATION_PERSONNALISE_PREMIER
        !insertmacro LangStringInstalleSectionPersonnalisePremier
!endif

!ifdef SECTION_INSTALLATION_PERSONNALISE_DERNIER
        !insertmacro LangStringInstalleSectionPersonnaliseDernier
!endif

LangString stringRaccourciMenuDemarrer ${LANG_FRENCH} "Raccourci menu Démarrer"
LangString stringRaccourciMenuDemarrer ${LANG_ENGLISH} "Create Shortcut in Windows Start Menu"
LangString stringRaccourciMenuDemarrer ${LANG_SPANISH} "Creación acceso directo en el menú Windows Inicio"

LangString stringRaccourciBureau ${LANG_FRENCH} "Raccourci sur le bureau"
LangString stringRaccourciBureau ${LANG_ENGLISH} "Create Shortcut on Desktop"
LangString stringRaccourciBureau ${LANG_SPANISH} "Creación acceso directo en el escritorio"

LangString stringTousUtilisateurs ${LANG_FRENCH} "Tous les utilisateurs"
LangString stringTousUtilisateurs ${LANG_ENGLISH} "All user"
LangString stringTousUtilisateurs ${LANG_SPANISH} "Todos los utilizadores"

LangString stringUtilisateurCourant ${LANG_FRENCH} "Utilisateur courant"
LangString stringUtilisateurCourant ${LANG_ENGLISH} "Current user"
LangString stringUtilisateurCourant ${LANG_SPANISH} "Utilizador actual"

LangString stringRaccourciDesinstalle ${LANG_FRENCH} "Désinstallation"
LangString stringRaccourciDesinstalle ${LANG_ENGLISH} "Uninstall"
LangString stringRaccourciDesinstalle ${LANG_SPANISH} "Desinstalación"

LangString stringMessageAvertissement ${LANG_FRENCH} "${MESSAGE_AVERTISSEMENT_FRANCAIS}"
LangString stringMessageAvertissement ${LANG_ENGLISH} "${MESSAGE_AVERTISSEMENT_ANGLAIS}"
LangString stringMessageAvertissement ${LANG_SPANISH} "${MESSAGE_AVERTISSEMENT_SPANISH}"


;-------------------------------------------------------------------------------------------------------------------------------

; Macro

!ifdef FRAMEWORK_DOT_NET
        !insertmacro VersionCompare
         
        ;!insertmacro IsDotNETInstalled
        !insertmacro GetDotNETVersion
!endif

!insertmacro IsUserAdmin ""

!insertmacro IsUserAdmin "un."


/*============================================================================================================================*/
/*============================================================================================================================*/

; Section obligatory custom installation
!ifdef SECTION_INSTALLATION_PERSONNALISE_INITIAL

        Section "$(stringInstalleSectionPersonnaliseInitial)" ID_SEC_PERSONNALISE_INITIAL
        
                !if ${SECTION_INSTALLATION_PERSONNALISE_INITIAL} == "Obligatoire"
                        SectionIn RO ; indicates that the section is mandatory
                !endif
                
                !insertmacro InstalleSectionPersonnaliseInitial
        
        SectionEnd

!endif

;-------------------------------------------------------------------------------------------------------------------------------

; Section invisible Uninstall
Section "-$(stringSecAncienneVersion)" ID_SEC_OLDVERSION
        SectionIn RO
        StrCmp $cheminAncienneDesinstallation "" pas_installe deja_installe
        deja_installe:
                ClearErrors
; Launch of Silent uninstallation process
                ExecWait '"$cheminAncienneDesinstallation" /S  _?=$cheminAncienneInstallation'
        pas_installe:
SectionEnd

;-------------------------------------------------------------------------------------------------------------------------------

; Section obligatory custom installation
!ifdef SECTION_INSTALLATION_PERSONNALISE_PREMIER

        Section "$(stringInstalleSectionPersonnalisePremier)" ID_SEC_PERSONNALISE_PREMIER
        
                !if ${SECTION_INSTALLATION_PERSONNALISE_PREMIER} == "Obligatoire"
                        SectionIn RO ; indicates that the section is mandatory
                !endif
                
                !insertmacro InstalleSectionPersonnalisePremier
        
        SectionEnd

!endif

;-------------------------------------------------------------------------------------------------------------------------------

; Section mandatory application installation
Section "$(stringApplication)" ID_SEC_APPLICATION
    SectionIn RO ; indicates that the section is mandatory
    SetOutPath "$INSTDIR"
    SetOverwrite on
    
    File /nonfatal /r /x .svn "${APPLICATION_PROGRAMFILES}\*"

SectionEnd

;-------------------------------------------------------------------------------------------------------------------------------

; Section mandatory installation libraries
Section "$(stringLibrairies)" ID_SEC_LIBRAIRIES
    SectionIn RO ; indicates that the section is mandatory

    !insertmacro SectionLibrairies

SectionEnd

;-------------------------------------------------------------------------------------------------------------------------------

; Section obligatory custom installation
!ifdef SECTION_INSTALLATION_PERSONNALISE_DERNIER

        Section "$(stringInstalleSectionPersonnaliseDernier)" ID_SEC_PERSONNALISE_DERNIER
        
                        !if ${SECTION_INSTALLATION_PERSONNALISE_DERNIER} == "Obligatoire"
                                SectionIn RO ; indicates that the section is mandatory
                        !endif
                        
                        !insertmacro InstalleSectionPersonnaliseDernier
        
        SectionEnd

!endif

;-------------------------------------------------------------------------------------------------------------------------------

; Section facultative d'installation du menu
!ifndef SANS_RACCOURCI

; Group section unfolded / e
        SectionGroup /e "$(stringRaccourciMenuDemarrer)" ID_SEC_RACCOURCI_MENU
        
                Section "$(stringTousUtilisateurs)" ID_SEC_RACCOURCI_MENU_TS_UTILISATEURS
                
; Systems files common to all users ('all users') are used.
                        SetShellVarContext all
                
; Creating the Start menu shortcut
                        !insertmacro InstalleMenuDemarrer
                SectionEnd
                
                Section /o "$(stringUtilisateurCourant)" ID_SEC_RACCOURCI_MENU_UTILISATEUR_COURANT
; Systems files common to all users ('all users') are used.
                        SetShellVarContext current
        
; Creating the Start menu shortcut
                        !insertmacro InstalleMenuDemarrer
                SectionEnd
                
        SectionGroupEnd

!endif

;-------------------------------------------------------------------------------------------------------------------------------

; Section optional installation of shortcuts on the desktop
!ifndef SANS_RACCOURCI

        SectionGroup /e "$(stringRaccourciBureau)" ID_SEC_RACCOURCI_BUREAU
        
                Section "$(stringTousUtilisateurs)" ID_SEC_RACCOURCI_BUREAU_TS_UTILISATEURS
; Systems files common to all users will be used.
                        SetShellVarContext all
        
; Creating shortcut on the desktop
                                !insertmacro InstalleRaccourciBureau
                SectionEnd
        
                Section /o "$(stringUtilisateurCourant)" ID_SEC_RACCOURCI_BUREAU_UTILISATEUR_COURANT
; The system folders of the current user will be used.
                        SetShellVarContext current
        
; Creating shortcut on the desktop
                                !insertmacro InstalleRaccourciBureau
                SectionEnd
        
        SectionGroupEnd

!endif

;-------------------------------------------------------------------------------------------------------------------------------

Function .onInit

    ; Displays the choice of language
        ${if} ${CHOIX_LANGUE} == "Fenetre_choix"
                !insertmacro MUI_LANGDLL_DISPLAY
        ${EndIf}
        
        ;!insertmacro MULTIUSER_INIT
    
    ; Use the previously installed directory if possible
    ReadRegStr $0 HKLM "${REGISTRE_APPLICATION}" "Path"
    IfErrors +2 0
       ; set default installdir to what was previously used
        StrCpy $INSTDIR $0

    ; Variable mode to manage radio buttons
        StrCpy $menuTousUtilisateurs 1
        StrCpy $menuUtilisateurCourant 0
        StrCpy $raccourciTousUtilisateurs 1
        StrCpy $raccourciUtilisateurCourant 0

FunctionEnd

;-------------------------------------------------------------------------------------------------------------------------------

Function initialisationGUI

    ; Management of user rights
        Call IsUserAdmin
        Pop $R0

        ${if} $R0 == "false"
                MessageBox MB_OK|MB_ICONEXCLAMATION "$(stringInstallationApplication)"
                Abort
        ${EndIf}

    ; Management of pre-requisites. NET Framework
        !ifdef FRAMEWORK_DOT_NET

    ; Old method
                /*
                Call IsDotNETInstalled
                Pop $R1
                StrCmp $R1 1 DotNET_installe DotNET_pas_installe
                DotNET_pas_installe:
                        MessageBox MB_OK|MB_ICONEXCLAMATION "$(stringFrameworkNET)"
                        Abort
                DotNET_installe:
                */
        
                Call GetDotNETVersion
                Pop $R1
        
                ${If} $R1 == "not found"
                        MessageBox MB_OK|MB_ICONEXCLAMATION "$(stringFrameworkNET)"
                        Abort
                ${EndIf}
        
                StrCpy $R1 $R1 "" 1 ; supprime "v"
        
                ${VersionCompare} $R1 ${FRAMEWORK_DOT_NET} $1
                ; FRAMEWORK_DOT_NET requis est plus récent
                ${If} $1 == 2
                        MessageBox MB_OK|MB_ICONEXCLAMATION "$(stringFrameworkNET)"
                        Abort
                ${EndIf}

        !endif

    ; Management of versions already installed
        !ifndef SANS_DESINSTALLATION
        ; Retrieves the values ??of the old installation in the registry
                ReadRegStr $cheminAncienneDesinstallation HKLM "${REGISTRE_DESINSTALLATION}" "UninstallString"
                ReadRegStr $cheminAncienneInstallation HKLM "${REGISTRE_APPLICATION}" "Path"
                
                StrCmp $cheminAncienneDesinstallation "" pas_installe deja_installe
                deja_installe:
                        MessageBox MB_YESNO|MB_ICONQUESTION "$(stringAncienneVersion)" IDYES oui IDNO non
                        oui:
                                goto pas_installe
                        non:
                                Abort
                pas_installe:
        !endif
  
        ; Management Post parameterizable application
        !ifdef MESSAGE_AVERTISSEMENT_FRANCAIS
                MessageBox MB_YESNO|MB_ICONQUESTION "$(stringMessageAvertissement)" IDYES oui2 IDNO non2
                non2:
                        Abort
                oui2:
        !endif

FunctionEnd

;-------------------------------------------------------------------------------------------------------------------------------

Function .onSelChange

    !ifndef SANS_RACCOURCI

        ; Management Mode radio buttons
            
            SectionGetFlags ${ID_SEC_RACCOURCI_MENU_TS_UTILISATEURS} $1
            ${if} $1 == 1
            ${AndIf} $menuTousUtilisateurs != 1
                !insertmacro UnselectSection ${ID_SEC_RACCOURCI_MENU_UTILISATEUR_COURANT}
                StrCpy $menuTousUtilisateurs 1
                StrCpy $menuUtilisateurCourant 0
        ${endif}
    
        SectionGetFlags ${ID_SEC_RACCOURCI_MENU_UTILISATEUR_COURANT} $2
        ${if} $2 == 1
        ${AndIf} $menuUtilisateurCourant != 1
                        !insertmacro UnselectSection ${ID_SEC_RACCOURCI_MENU_TS_UTILISATEURS}
                        StrCpy $menuTousUtilisateurs 0
                        StrCpy $menuUtilisateurCourant 1
        ${endif}
    
    
            SectionGetFlags ${ID_SEC_RACCOURCI_BUREAU_TS_UTILISATEURS} $3
            ${if} $3 == 1
            ${AndIf} $raccourciTousUtilisateurs != 1
                    !insertmacro UnselectSection ${ID_SEC_RACCOURCI_BUREAU_UTILISATEUR_COURANT}
                StrCpy $raccourciTousUtilisateurs 1
                StrCpy $raccourciUtilisateurCourant 0
        ${endif}

        SectionGetFlags ${ID_SEC_RACCOURCI_BUREAU_UTILISATEUR_COURANT} $4
        ${if} $4 == 1
        ${AndIf} $raccourciUtilisateurCourant != 1
                        !insertmacro UnselectSection ${ID_SEC_RACCOURCI_BUREAU_TS_UTILISATEURS}
                        StrCpy $raccourciTousUtilisateurs 0
                        StrCpy $raccourciUtilisateurCourant 1
        ${endif}

    !endif

FunctionEnd

;-------------------------------------------------------------------------------------------------------------------------------

Section -Post
    ; Generation of executable uninstall
        !ifndef SANS_DESINSTALLATION
                WriteUninstaller "$INSTDIR\${EXE_DESINSTALLATION}"
        !endif
        
        ; Ecriture des informations dans le registre
        
    ; Path to executable
        WriteRegStr HKLM "${REGISTRE_APPLICATION}" "" "$INSTDIR\${EXE_APPLICATION}"
        
    ; The installation path
        WriteRegStr HKLM "${REGISTRE_APPLICATION}" "Path" "$INSTDIR"
        
    ; Application version installed
        WriteRegStr HKLM "${REGISTRE_APPLICATION}" "Version" "${VERSION_APPLICATION}"
        
    ; Project installed application
        WriteRegStr HKLM "${REGISTRE_APPLICATION}" "Project" "${PROJET_APPLICATION}"
  
    ; Add uninstall information to Add / Remove Programs
        !ifndef SANS_DESINSTALLATION
    ; Application Name
                WriteRegStr HKLM "${REGISTRE_DESINSTALLATION}" "DisplayName" "${NOM_APPLICATION} ${VERSION_APPLICATION}"
                
    ; Path and filename of the uninstallation.
                WriteRegStr HKLM "${REGISTRE_DESINSTALLATION}" "UninstallString" "$INSTDIR\${EXE_DESINSTALLATION}"
                
    ; Path, file and index of the icon to display next to the name of your application
                WriteRegStr HKLM "${REGISTRE_DESINSTALLATION}" "DisplayIcon" "$INSTDIR\${EXE_APPLICATION}"
                
    ; The application displayed Version
                WriteRegStr HKLM "${REGISTRE_DESINSTALLATION}" "DisplayVersion" "${VERSION_APPLICATION}"
                
                ;WriteRegStr HKLM "${REGISTRE_DESINSTALLATION}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
                
    ; Name of distributor
                WriteRegStr HKLM "${REGISTRE_DESINSTALLATION}" "Publisher" "${EDITEUR_APPLICATION}"
        !endif

    ; Creates registry entries required by PkgMnt and procmgr
    ClearErrors
    ${VIX_CREATE_PACKAGING_REGISTRY}
    IfErrors 0 +2
        Abort "Error creating Package Management registry information"
  
SectionEnd

/*============================================================================================================================*/
/*============================================================================================================================*/

Function un.onInit

    ; Displays the choice of language
        ${if} ${CHOIX_LANGUE} == "Affiche_fenetre_choix"
                !insertmacro MUI_UNGETLANGUAGE
        ${EndIf}

        ;!insertmacro MULTIUSER_UNINIT

FunctionEnd

;-------------------------------------------------------------------------------------------------------------------------------

Function un.initialisationGUI

    ; Management of user rights
        Call un.IsUserAdmin
        Pop $R0
        
        ${if} $R0 == "false"
                MessageBox MB_OK|MB_ICONEXCLAMATION "$(stringDesinstallationApplication)"
                Abort
        ${EndIf}

FunctionEnd


;-------------------------------------------------------------------------------------------------------------------------------


; Section A 'Uninstall' is created to generate an uninstaller either.
; This section deletes all files, key registry, not shared libraries that were installed by the installation of the system.
Section Uninstall
        Delete "$INSTDIR\${EXE_DESINSTALLATION}"
  
    ; Section desinstalation personalized mandatory
        !ifdef SECTION_DESINSTALLATION_PERSONNALISE_PREMIER
                !insertmacro DesinstalleSectionPersonnalisePremier
        !endif

    ; It uninstalls the application of the Program Files folder (if the user does not specify otherwise)
        !insertmacro DesinstalleApplication
    
    ; Section desinstalation personalized mandatory
        !ifdef SECTION_DESINSTALLATION_PERSONNALISE_DERNIER
                !insertmacro DesinstalleSectionPersonnaliseDernier
        !endif
        
    ; It uninstalls the start menu shortcut and office
        !ifndef SANS_RACCOURCI
    ; Systems files common to all users will be used.
                SetShellVarContext all
    ; Deleting Shortcuts
                !insertmacro DesinstalleMenuDemarrerRaccourciBureau
                
    ; The system folders of the current user will be used.
                SetShellVarContext current
    ; Deleting Shortcuts
                !insertmacro DesinstalleMenuDemarrerRaccourciBureau
        !endif

    ; Deleting records
        DeleteRegKey HKLM "${REGISTRE_DESINSTALLATION}"
        DeleteRegKey HKLM "${REGISTRE_APPLICATION}"
        SetAutoClose true

    ; Delete the registry entries for pkgmnt and procmgr
    ${VIX_REMOVE_PACKAGING_REGISTRY}

SectionEnd


/*============================================================================================================================*/
/*============================================================================================================================*/