tools/installer/nsis/installer.nsi
changeset 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
-1:000000000000 0:1918ee327afb
       
     1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
     2 ;;
       
     3 ;; Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 ;; All rights reserved.
       
     5 ;; Contact: Nokia Corporation (qt-info@nokia.com)
       
     6 ;;
       
     7 ;; This file is part of the tools applications of the Qt Toolkit.
       
     8 ;;
       
     9 ;; $QT_BEGIN_LICENSE:LGPL$
       
    10 ;; No Commercial Usage
       
    11 ;; This file contains pre-release code and may not be distributed.
       
    12 ;; You may use this file in accordance with the terms and conditions
       
    13 ;; contained in the Technology Preview License Agreement accompanying
       
    14 ;; this package.
       
    15 ;;
       
    16 ;; GNU Lesser General Public License Usage
       
    17 ;; Alternatively, this file may be used under the terms of the GNU Lesser
       
    18 ;; General Public License version 2.1 as published by the Free Software
       
    19 ;; Foundation and appearing in the file LICENSE.LGPL included in the
       
    20 ;; packaging of this file.  Please review the following information to
       
    21 ;; ensure the GNU Lesser General Public License version 2.1 requirements
       
    22 ;; will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
       
    23 ;;
       
    24 ;; In addition, as a special exception, Nokia gives you certain additional
       
    25 ;; rights.  These rights are described in the Nokia Qt LGPL Exception
       
    26 ;; version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
       
    27 ;;
       
    28 ;; If you have questions regarding the use of this file, please contact
       
    29 ;; Nokia at qt-info@nokia.com.
       
    30 ;;
       
    31 ;;
       
    32 ;;
       
    33 ;;
       
    34 ;;
       
    35 ;;
       
    36 ;;
       
    37 ;;
       
    38 ;; $QT_END_LICENSE$
       
    39 ;;
       
    40 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
       
    41 ; Script generated by the HM NIS Edit Script Wizard.
       
    42 
       
    43 !include "config.nsh"
       
    44 !include "includes\global.nsh"
       
    45 
       
    46 !define PRODUCT_PUBLISHER "Nokia Corporation and/or its subsidiary(-ies)"
       
    47 !define PRODUCT_WEB_SITE "http://qt.nokia.com"
       
    48 
       
    49 !define INSTALL_ICON "images\install.ico"
       
    50 !define WELCOME_PAGE_ICON "images\qt-wizard.bmp"
       
    51 !define PAGE_HEADER_ICON "images\qt-header.bmp"
       
    52 
       
    53 !include "MUI.nsh"
       
    54 
       
    55 ; modules
       
    56 !include "modules\mingw.nsh"
       
    57 !include "modules\opensource.nsh"
       
    58 !include "includes\instdir.nsh"
       
    59 !include "modules\environment.nsh"
       
    60 !include "modules\registeruiext.nsh"
       
    61 !ifndef OPENSOURCE_BUILD
       
    62 !include "modules\msvc.nsh"
       
    63 !include "modules\addin7x.nsh"
       
    64 !include "modules\qsa.nsh"
       
    65 !include "modules\addin60.nsh"
       
    66 !include "modules\debugext.nsh"
       
    67 !include "modules\license.nsh"
       
    68 !include "modules\vsip.nsh"
       
    69 !include "modules\help.nsh"
       
    70 !include "modules\evaluation.nsh"
       
    71 !include "modules\eclipse.nsh"
       
    72 !include "modules\qtjambieclipse.nsh"
       
    73 !endif
       
    74 
       
    75 ; MUI Settings
       
    76 !define MUI_ABORTWARNING
       
    77 !define MUI_ICON "${INSTALL_ICON}"
       
    78 !define MUI_UNICON "${INSTALL_ICON}"
       
    79 
       
    80 !define MUI_HEADERIMAGE
       
    81 !define MUI_HEADERIMAGE_BITMAP "${PAGE_HEADER_ICON}"
       
    82 !define MUI_HEADERIMAGE_UNBITMAP "${PAGE_HEADER_ICON}"
       
    83 
       
    84 !define MUI_WELCOMEFINISHPAGE_BITMAP "${WELCOME_PAGE_ICON}"
       
    85 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${WELCOME_PAGE_ICON}"
       
    86 
       
    87 !ifdef WELCOME_NOTE
       
    88   !define MUI_WELCOMEPAGE_TEXT "${WELCOME_NOTE}"
       
    89 !endif
       
    90 !insertmacro MUI_PAGE_WELCOME
       
    91 !insertmacro OPENSOURCE_INITIALIZE
       
    92 !ifndef OPENSOURCE_BUILD
       
    93 !insertmacro EVALUATION_INITIALIZE
       
    94 !insertmacro LICENSECHECK_INITIALIZE
       
    95 !insertmacro MSVC_INITIALIZE
       
    96 !insertmacro ADDIN7X_INITIALIZE
       
    97 !insertmacro ADDIN60_INITIALIZE
       
    98 !insertmacro DEBUGEXT_INITIALIZE
       
    99 !insertmacro HELP_INITIALIZE
       
   100 !insertmacro VSIP_INITIALIZE
       
   101 !endif
       
   102  
       
   103 !ifdef USE_COMPONENT_PAGE
       
   104   !insertmacro MUI_PAGE_COMPONENTS
       
   105 !endif
       
   106 
       
   107 !ifdef USE_DIRECTORY_PAGE
       
   108   !insertmacro INSTDIR_INITIALIZE
       
   109 !endif
       
   110 
       
   111 !ifdef USE_STARTMENU_PAGE
       
   112   !define MUI_STARTMENUPAGE_NODISABLE
       
   113   !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${DEFAULT_STARTMENU_STRING}"
       
   114   !insertmacro MUI_PAGE_STARTMENU 1 $STARTMENU_STRING
       
   115 !endif
       
   116 
       
   117 !insertmacro MINGW_INITIALIZE
       
   118 !insertmacro ENVIRONMENT_INITIALIZE
       
   119 !insertmacro REGISTERUIEXT_INITIALIZE
       
   120 !ifndef OPENSOURCE_BUILD
       
   121 !insertmacro QSA_INITIALIZE
       
   122 !insertmacro ECLIPSE_INITIALIZE
       
   123 !insertmacro QTJAMBIECLIPSE_INITIALIZE
       
   124 !endif
       
   125  
       
   126 !define MUI_FINISHPAGE_NOAUTOCLOSE
       
   127 
       
   128 !insertmacro MUI_PAGE_INSTFILES
       
   129 !ifdef README_FILE
       
   130   !define MUI_FINISHPAGE_SHOWREADME ${README_FILE}
       
   131 !else
       
   132   !ifdef README_FUNCTION
       
   133     !define MUI_FINISHPAGE_SHOWREADME
       
   134     !define MUI_FINISHPAGE_SHOWREADME_TEXT "${README_FUNCTION}"
       
   135     !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CommonReadmeFunction"
       
   136   !endif
       
   137 !endif
       
   138 !ifdef RUN_FUNCTION
       
   139   !define MUI_FINISHPAGE_RUN
       
   140   !define MUI_FINISHPAGE_RUN_TEXT "${RUN_FUNCTION}"
       
   141   !define MUI_FINISHPAGE_RUN_FUNCTION "CommonRunFunction"
       
   142 !endif
       
   143 !insertmacro MUI_PAGE_FINISH
       
   144 
       
   145 !insertmacro MUI_UNPAGE_WELCOME
       
   146 !define UNINSTALLER_CONFIRM_PAGE "confirmpage.ini"
       
   147 UninstPage custom un.UninstallerConfirmPage
       
   148 !insertmacro MUI_UNPAGE_INSTFILES
       
   149 
       
   150 !insertmacro MUI_UNPAGE_FINISH
       
   151 
       
   152 !insertmacro MUI_LANGUAGE "English"
       
   153 
       
   154 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
       
   155 OutFile ${OUTPUT_FILE}
       
   156 
       
   157 Section -PreCommonSection
       
   158 !ifdef INSTDIR_0 ;the default one, must exist
       
   159   strcpy $INSTDIR $${INSTDIR_0}_INSTDIR
       
   160   ${StrRep} $PRODUCT_UNIQUE_KEY "${PRODUCT_NAME} ${PRODUCT_VERSION} - $INSTDIR" "\" "_"
       
   161   strcpy $PRODUCT_UNIQUE_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_UNIQUE_KEY"
       
   162   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_0}_INSTDIR" "$${INSTDIR_0}_INSTDIR"
       
   163 !endif
       
   164 !ifdef INSTDIR_1
       
   165   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_1}_INSTDIR" "$${INSTDIR_1}_INSTDIR"
       
   166 !endif
       
   167 !ifdef INSTDIR_2
       
   168   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_2}_INSTDIR" "$${INSTDIR_2}_INSTDIR"
       
   169 !endif
       
   170 !ifdef INSTDIR_3
       
   171   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_3}_INSTDIR" "$${INSTDIR_3}_INSTDIR"
       
   172 !endif
       
   173 !ifdef INSTDIR_4
       
   174   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_4}_INSTDIR" "$${INSTDIR_4}_INSTDIR"
       
   175 !endif
       
   176 !ifdef INSTDIR_5
       
   177   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_5}_INSTDIR" "$${INSTDIR_5}_INSTDIR"
       
   178 !endif
       
   179 
       
   180   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "StartMenu" "$STARTMENU_STRING"
       
   181   CreateDirectory "$SMPROGRAMS\$STARTMENU_STRING"
       
   182 SectionEnd
       
   183 
       
   184 !insertmacro OPENSOURCE_SECTIONS
       
   185 !insertmacro MINGW_SECTIONS
       
   186 !insertmacro ENVIRONMENT_SECTIONS
       
   187 !insertmacro REGISTERUIEXT_SECTIONS
       
   188 !ifndef OPENSOURCE_BUILD
       
   189 !insertmacro MSVC_SECTIONS
       
   190 !insertmacro ADDIN7X_SECTIONS
       
   191 !insertmacro ADDIN60_SECTIONS
       
   192 !insertmacro VSIP_SECTIONS
       
   193 !insertmacro HELP_SECTIONS
       
   194 !insertmacro DEBUGEXT_SECTIONS
       
   195 !insertmacro LICENSECHECK_SECTIONS
       
   196 !insertmacro QSA_SECTIONS
       
   197 !insertmacro EVALUATION_SECTIONS
       
   198 !insertmacro ECLIPSE_SECTIONS
       
   199 !insertmacro QTJAMBIECLIPSE_SECTIONS
       
   200 !endif
       
   201 
       
   202 !insertmacro INSTDIR_FUNCTIONS
       
   203 
       
   204 Section -CommonSection
       
   205   WriteUninstaller "$INSTDIR\uninst.exe"
       
   206 
       
   207   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayName" "$(^Name)"
       
   208   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "UninstallString" "$INSTDIR\uninst.exe"
       
   209   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayVersion" "${PRODUCT_VERSION}"
       
   210   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
       
   211   WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "Publisher" "${PRODUCT_PUBLISHER}"
       
   212 
       
   213   WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
       
   214   CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\qt.nokia.com.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
       
   215   CreateShortCut "$SMPROGRAMS\$STARTMENU_STRING\Uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\uninst.exe"
       
   216   SetOutPath "$INSTDIR"
       
   217 SectionEnd
       
   218 
       
   219 Function CheckLocalLicenseProduct
       
   220 !ifdef MODULE_LICENSECHECK
       
   221   !insertmacro QSA_CHECKLICENSEPRODUCT
       
   222 !endif
       
   223 FunctionEnd
       
   224 
       
   225 Function .onInit
       
   226   StrCpy $STARTMENU_STRING "${DEFAULT_STARTMENU_STRING}"
       
   227 
       
   228 !ifdef USE_UNINSTALL_PREVIOUS
       
   229   push "${PRODUCT_NAME}"
       
   230   call GetExistsPreviousInstallationOfProduct
       
   231   exch $0
       
   232   StrCmp $0 true 0 +3
       
   233     MessageBox MB_OK|MB_ICONSTOP "A previous installation of ${PRODUCT_NAME} was detected.$\nPlease uninstall it before running this installer."
       
   234     Abort
       
   235   pop $0
       
   236 !endif
       
   237 
       
   238   call SetAdminVar
       
   239   StrCmp "$RUNNING_AS_ADMIN" "false" 0 common_running_as_admin
       
   240 !ifdef USE_ADMIN_CHECK
       
   241     MessageBox MB_OK|MB_ICONSTOP "You need to have administrator rights to install this software!"
       
   242     Abort
       
   243 !endif
       
   244     SetShellVarContext current
       
   245     goto common_admin_check_done
       
   246   common_running_as_admin:
       
   247     SetShellVarContext all
       
   248   common_admin_check_done:
       
   249 
       
   250   !insertmacro INSTDIR_STARTUP
       
   251 
       
   252   !insertmacro OPENSOURCE_STARTUP
       
   253   !insertmacro ENVIRONMENT_STARTUP
       
   254   !insertmacro REGISTERUIEXT_STARTUP
       
   255   !insertmacro MINGW_STARTUP
       
   256 !ifndef OPENSOURCE_BUILD
       
   257   !insertmacro LICENSECHECK_STARTUP
       
   258   !insertmacro MSVC_STARTUP
       
   259   !insertmacro EVALUATION_STARTUP
       
   260   !insertmacro ADDIN7X_STARTUP
       
   261   !insertmacro ADDIN60_STARTUP
       
   262   !insertmacro DEBUGEXT_STARTUP
       
   263   !insertmacro VSIP_STARTUP
       
   264   !insertmacro HELP_STARTUP
       
   265   !insertmacro QSA_STARTUP
       
   266   !insertmacro ECLIPSE_STARTUP
       
   267   !insertmacro QTJAMBIECLIPSE_STARTUP
       
   268 !endif
       
   269 FunctionEnd
       
   270 
       
   271 Function .onInstSuccess
       
   272   !insertmacro ENVIRONMENT_FINISH
       
   273   !insertmacro REGISTERUIEXT_FINISH
       
   274   !insertmacro OPENSOURCE_FINISH
       
   275   !insertmacro MINGW_FINISH
       
   276 !ifndef OPENSOURCE_BUILD
       
   277   !insertmacro LICENSECHECK_FINISH
       
   278   !insertmacro MSVC_FINISH
       
   279   !insertmacro EVALUATION_FINISH
       
   280   !insertmacro ADDIN7X_FINISH
       
   281   !insertmacro ADDIN60_FINISH
       
   282   !insertmacro DEBUGEXT_FINISH
       
   283   !insertmacro VSIP_FINISH
       
   284   !insertmacro HELP_FINISH
       
   285   !insertmacro QSA_FINISH
       
   286   !insertmacro ECLIPSE_FINISH
       
   287   !insertmacro QTJAMBIECLIPSE_FINISH
       
   288 !endif
       
   289 FunctionEnd
       
   290 
       
   291 Function un.onUninstSuccess
       
   292   !insertmacro ENVIRONMENT_UNFINISH
       
   293   !insertmacro REGISTERUIEXT_UNFINISH
       
   294   !insertmacro OPENSOURCE_UNFINISH
       
   295   !insertmacro MINGW_UNFINISH
       
   296 !ifndef OPENSOURCE_BUILD
       
   297   !insertmacro LICENSECHECK_UNFINISH
       
   298   !insertmacro MSVC_UNFINISH
       
   299   !insertmacro EVALUATION_UNFINISH
       
   300   !insertmacro ADDIN7X_UNFINISH
       
   301   !insertmacro ADDIN60_UNFINISH
       
   302   !insertmacro DEBUGEXT_UNFINISH
       
   303   !insertmacro VSIP_UNFINISH
       
   304   !insertmacro HELP_UNFINISH
       
   305   !insertmacro QSA_UNFINISH
       
   306   !insertmacro ECLIPSE_UNFINISH
       
   307   !insertmacro QTJAMBIECLIPSE_UNFINISH
       
   308 !endif
       
   309 FunctionEnd
       
   310 
       
   311 Function un.onInit
       
   312   call un.SetAdminVar
       
   313   StrCmp "$RUNNING_AS_ADMIN" "false" 0 common_running_as_admin
       
   314 !ifdef USE_ADMIN_CHECK
       
   315     MessageBox MB_OK|MB_ICONSTOP "You do not have the required access rights to uninstall this package."
       
   316     Abort
       
   317 !endif
       
   318     SetShellVarContext current
       
   319     goto common_admin_check_done
       
   320   common_running_as_admin:
       
   321     SetShellVarContext all
       
   322   common_admin_check_done:
       
   323 
       
   324   ${UnStrRep} $PRODUCT_UNIQUE_KEY "${PRODUCT_NAME} ${PRODUCT_VERSION} - $INSTDIR" "\" "_"
       
   325   strcpy $PRODUCT_UNIQUE_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_UNIQUE_KEY"
       
   326 
       
   327   push $0
       
   328   ClearErrors
       
   329   ReadRegStr $0 SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayName"
       
   330   IfErrors 0 +3
       
   331     MessageBox MB_OK|MB_ICONSTOP "The uninstaller was unable to find the product to uninstall."
       
   332     Abort
       
   333   pop $0
       
   334 
       
   335   ReadRegStr $STARTMENU_STRING SHCTX "$PRODUCT_UNIQUE_KEY" "StartMenu"
       
   336   StrCmp "$STARTMENU_STRING" "" 0 +2
       
   337     StrCpy $STARTMENU_STRING "${DEFAULT_STARTMENU_STRING}"
       
   338 
       
   339 !ifdef INSTDIR_0 ;the default one, must exist
       
   340   ReadRegStr $${INSTDIR_0}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_0}_INSTDIR"
       
   341 !endif
       
   342 !ifdef INSTDIR_1
       
   343   ReadRegStr $${INSTDIR_1}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_1}_INSTDIR"
       
   344 !endif
       
   345 !ifdef INSTDIR_2
       
   346   ReadRegStr $${INSTDIR_2}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_2}_INSTDIR"
       
   347 !endif
       
   348 !ifdef INSTDIR_3
       
   349   ReadRegStr $${INSTDIR_3}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_3}_INSTDIR"
       
   350 !endif
       
   351 !ifdef INSTDIR_4
       
   352   ReadRegStr $${INSTDIR_4}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_4}_INSTDIR"
       
   353 !endif
       
   354 !ifdef INSTDIR_5
       
   355   ReadRegStr $${INSTDIR_5}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_5}_INSTDIR"
       
   356 !endif
       
   357 
       
   358   !insertmacro ENVIRONMENT_UNSTARTUP
       
   359   !insertmacro REGISTERUIEXT_UNSTARTUP
       
   360   !insertmacro OPENSOURCE_UNSTARTUP
       
   361   !insertmacro MINGW_UNSTARTUP
       
   362 !ifndef OPENSOURCE_BUILD
       
   363   !insertmacro LICENSECHECK_UNSTARTUP
       
   364   !insertmacro MSVC_UNSTARTUP
       
   365   !insertmacro EVALUATION_UNSTARTUP
       
   366   !insertmacro ADDIN7X_UNSTARTUP
       
   367   !insertmacro ADDIN60_UNSTARTUP
       
   368   !insertmacro DEBUGEXT_UNSTARTUP
       
   369   !insertmacro VSIP_UNSTARTUP
       
   370   !insertmacro HELP_UNSTARTUP
       
   371   !insertmacro QSA_UNSTARTUP
       
   372   !insertmacro ECLIPSE_UNSTARTUP
       
   373   !insertmacro QTJAMBIECLIPSE_UNSTARTUP
       
   374 !endif
       
   375   
       
   376   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${UNINSTALLER_CONFIRM_PAGE}"
       
   377 FunctionEnd
       
   378 
       
   379 !insertmacro OPENSOURCE_UNINSTALL
       
   380 !insertmacro ENVIRONMENT_UNINSTALL
       
   381 !insertmacro REGISTERUIEXT_UNINSTALL
       
   382 !insertmacro MINGW_UNINSTALL
       
   383 !ifndef OPENSOURCE_BUILD
       
   384 !insertmacro HELP_UNINSTALL
       
   385 !insertmacro DEBUGEXT_UNINSTALL
       
   386 !insertmacro MSVC_UNINSTALL
       
   387 !insertmacro EVALUATION_UNINSTALL
       
   388 !insertmacro QSA_UNINSTALL
       
   389 !insertmacro ECLIPSE_UNINSTALL
       
   390 !insertmacro QTJAMBIECLIPSE_UNINSTALL
       
   391 !endif
       
   392 
       
   393 Section Uninstall
       
   394   !ifndef OPENSOURCE_BUILD
       
   395   !insertmacro LICENSECHECK_UNINSTALL
       
   396   !insertmacro ADDIN7X_UNINSTALL
       
   397   !insertmacro ADDIN60_UNINSTALL
       
   398   !insertmacro VSIP_UNINSTALL
       
   399   !endif
       
   400 
       
   401   ; COMMON
       
   402   Delete "$INSTDIR\${PRODUCT_NAME}.url"
       
   403   Delete "$INSTDIR\uninst.exe"
       
   404   Delete "$SMPROGRAMS\$STARTMENU_STRING\Uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"
       
   405   Delete "$SMPROGRAMS\$STARTMENU_STRING\qt.nokia.com.lnk"
       
   406 
       
   407   RMDir "$SMPROGRAMS\$STARTMENU_STRING"
       
   408   RMDir "$INSTDIR"
       
   409   
       
   410   DeleteRegKey SHCTX "$PRODUCT_UNIQUE_KEY"
       
   411 SectionEnd
       
   412 
       
   413 Function CommonRunFunction
       
   414   !ifndef OPENSOURCE_BUILD
       
   415   !insertmacro MSVC_RUN_FUNCTION
       
   416   !insertmacro QSA_RUN_FUNCTION
       
   417   !endif
       
   418   !insertmacro MINGW_RUN_FUNCTION
       
   419   DoneRunFunction:
       
   420 FunctionEnd
       
   421 
       
   422 Function CommonReadmeFunction
       
   423   !ifndef OPENSOURCE_BUILD
       
   424   !insertmacro MSVC_README_FUNCTION
       
   425   !endif
       
   426   !insertmacro MINGW_README_FUNCTION
       
   427   DoneReadmeFunction:
       
   428 FunctionEnd
       
   429 
       
   430 Function un.UninstallerConfirmPage
       
   431   !insertmacro MUI_HEADER_TEXT "Confirm" "Confirm Uninstallation Directories"
       
   432   !insertmacro MUI_INSTALLOPTIONS_WRITE "${UNINSTALLER_CONFIRM_PAGE}" "Field 2" "Text" "$UninstallerConfirmProduct"
       
   433   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${UNINSTALLER_CONFIRM_PAGE}"
       
   434 FunctionEnd
       
   435 
       
   436 ;pops product name from stack and as result pushes TRUE or FALSE on stack
       
   437 Function GetExistsPreviousInstallationOfProduct
       
   438   exch $0
       
   439   push $1
       
   440   push $2
       
   441   push $3
       
   442 
       
   443   StrCpy $1 0
       
   444   loop:
       
   445     EnumRegKey $2 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall $1
       
   446     StrCmp $2 "" no_reg_key_found
       
   447     ${StrStr} $3 $2 $0
       
   448     StrCmp $3 $2 reg_key_found
       
   449     IntOp $1 $1 + 1
       
   450     goto loop
       
   451   
       
   452   reg_key_found:
       
   453   push true
       
   454   goto done
       
   455   
       
   456   no_reg_key_found:
       
   457   push false
       
   458   
       
   459   done:
       
   460   exch
       
   461   pop $3
       
   462   exch
       
   463   pop $2
       
   464   exch
       
   465   pop $1
       
   466   exch
       
   467   pop $0
       
   468 FunctionEnd
       
   469 
       
   470 ;pops product name from stack
       
   471 Function WarnIfInstalledProductDetected
       
   472   exch $0
       
   473   push $0
       
   474   call GetExistsPreviousInstallationOfProduct
       
   475   exch $1
       
   476   StrCmp $1 true +1 +3
       
   477     MessageBox MB_YESNO|MB_ICONQUESTION "An existing installation of $0 was detected.$\nIt is recommended to deinstall $0 before continuing.$\nDo you want to continue this installation nevertheless?" IDYES +2 IDNO +1
       
   478       Abort
       
   479   pop $1
       
   480   pop $0
       
   481 FunctionEnd
       
   482 
       
   483 ;sets $RUNNING_AS_ADMIN to "true" if Admin or Power user
       
   484 !macro SetAdminVar UN
       
   485 Function ${UN}SetAdminVar
       
   486   push $0
       
   487   ClearErrors
       
   488   UserInfo::GetAccountType
       
   489   IfErrors Admin ;It's probably Win95
       
   490   pop $0
       
   491   StrCmp $0 "Admin" Admin
       
   492   StrCmp $0 "Power" Admin
       
   493 
       
   494   StrCpy $RUNNING_AS_ADMIN "false"
       
   495   goto Done
       
   496 
       
   497   Admin:
       
   498   StrCpy $RUNNING_AS_ADMIN "true"
       
   499 
       
   500   Done:
       
   501   pop $0
       
   502 FunctionEnd
       
   503 !macroend
       
   504 !insertmacro SetAdminVar ""
       
   505 !insertmacro SetAdminVar "un."
       
   506 
       
   507 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
       
   508   !insertmacro OPENSOURCE_DESCRIPTION
       
   509   !insertmacro ENVIRONMENT_DESCRIPTION
       
   510   !insertmacro REGISTERUIEXT_DESCRIPTION
       
   511   !insertmacro MINGW_DESCRIPTION
       
   512   !ifndef OPENSOURCE_BUILD
       
   513   !insertmacro MSVC_DESCRIPTION
       
   514   !insertmacro EVALUATION_DESCRIPTION
       
   515   !insertmacro ADDIN7X_DESCRIPTION
       
   516   !insertmacro ADDIN60_DESCRIPTION
       
   517   !insertmacro DEBUGEXT_DESCRIPTION
       
   518   !insertmacro HELP_DESCRIPTION
       
   519   !insertmacro VSIP_DESCRIPTION
       
   520   !insertmacro QSA_DESCRIPTION
       
   521   !insertmacro ECLIPSE_DESCRIPTION
       
   522   !insertmacro QTJAMBIECLIPSE_DESCRIPTION
       
   523   !endif
       
   524 !insertmacro MUI_FUNCTION_DESCRIPTION_END