summaryrefslogtreecommitdiffstats
path: root/util/scripts/win-binary/nsis/installer.nsi
blob: e61f00e49c8a0c57a1674726d8c0080d2ebf1e87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
; Script generated by the HM NIS Edit Script Wizard.

SetCompressor /FINAL /SOLID lzma
!include "config.nsh"
!include "includes\global.nsh"

!define PRODUCT_PUBLISHER "Nokia Corporation and/or its subsidiary(-ies)"
!define PRODUCT_WEB_SITE "http://qtsoftware.com"

!define INSTALL_ICON "images\install.ico"

!ifndef WELCOME_ICON
  !define WELCOME_ICON "images\qt-wizard.bmp"
!endif
!define PAGE_HEADER_ICON "images\qt-header.bmp"

!include "MUI.nsh"
!include "FileFunc.nsh"
!insertmacro GetParameters
!insertmacro GetOptions

; modules
!include "modules\mingw.nsh"
!include "modules\msvc.nsh"
!include "modules\addin7x.nsh"
!include "modules\qsa.nsh"
!include "modules\addin60.nsh"
!include "modules\qtjambi.nsh"
!include "modules\debugext.nsh"
!include "modules\license.nsh"
!include "modules\vsip.nsh"
!include "modules\help.nsh"
!include "modules\registeruiext.nsh"
!include "modules\environment.nsh"
!include "modules\evaluation.nsh"
!include "modules\opensource.nsh"
!include "modules\eclipse.nsh"
!include "modules\qtjambieclipse.nsh"
!include "modules\qtdemo.nsh"
!include "includes\instdir.nsh"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${INSTALL_ICON}"
!define MUI_UNICON "${INSTALL_ICON}"

!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${PAGE_HEADER_ICON}"
!define MUI_HEADERIMAGE_UNBITMAP "${PAGE_HEADER_ICON}"

!define MUI_WELCOMEFINISHPAGE_BITMAP "${WELCOME_ICON}"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${WELCOME_ICON}"

!ifdef WELCOME_NOTE
  !define MUI_WELCOMEPAGE_TEXT "${WELCOME_NOTE}"
!endif
!ifdef WELCOME_TITLE
  !define MUI_WELCOMEPAGE_TITLE "${WELCOME_TITLE}"
!endif
!insertmacro MUI_PAGE_WELCOME
!insertmacro OPENSOURCE_INITIALIZE
!insertmacro EVALUATION_INITIALIZE
!insertmacro LICENSECHECK_INITIALIZE
!insertmacro MSVC_INITIALIZE
!insertmacro ADDIN7X_INITIALIZE
!insertmacro ADDIN60_INITIALIZE
!insertmacro QTJAMBI_INITIALIZE
!insertmacro DEBUGEXT_INITIALIZE
!insertmacro HELP_INITIALIZE
!insertmacro VSIP_INITIALIZE

!ifdef USE_COMPONENT_PAGE
  !insertmacro MUI_PAGE_COMPONENTS
!endif

!ifdef USE_DIRECTORY_PAGE
  !insertmacro INSTDIR_INITIALIZE
!endif

!ifdef USE_STARTMENU_PAGE
  !define MUI_STARTMENUPAGE_NODISABLE
  !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${DEFAULT_STARTMENU_STRING}"
  !insertmacro MUI_PAGE_STARTMENU 1 $STARTMENU_STRING
!endif

!insertmacro MINGW_INITIALIZE
!insertmacro QSA_INITIALIZE
!insertmacro ENVIRONMENT_INITIALIZE
!insertmacro REGISTERUIEXT_INITIALIZE
!insertmacro ECLIPSE_INITIALIZE
!insertmacro QTJAMBIECLIPSE_INITIALIZE

!define MUI_FINISHPAGE_NOAUTOCLOSE

!insertmacro MUI_PAGE_INSTFILES
!ifdef README_FILE
  !define MUI_FINISHPAGE_SHOWREADME ${README_FILE}
!else
  !ifdef README_FUNCTION
    !define MUI_FINISHPAGE_SHOWREADME
    !define MUI_FINISHPAGE_SHOWREADME_TEXT "${README_FUNCTION}"
    !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CommonReadmeFunction"
  !endif
!endif
!ifdef RUN_FUNCTION
  !define MUI_FINISHPAGE_RUN
  !define MUI_FINISHPAGE_RUN_TEXT "${RUN_FUNCTION}"
  !define MUI_FINISHPAGE_RUN_FUNCTION "CommonRunFunction"
!endif
!ifdef FINISH_TITLE
  !define MUI_FINISHPAGE_TITLE "${FINISH_TITLE}"
!endif
!insertmacro MUI_PAGE_FINISH

!ifdef WELCOME_TITLE
  !define MUI_WELCOMEPAGE_TITLE "${WELCOME_TITLE}"
!endif
!insertmacro MUI_UNPAGE_WELCOME
!define UNINSTALLER_CONFIRM_PAGE "confirmpage.ini"
UninstPage custom un.UninstallerConfirmPage
!insertmacro MUI_UNPAGE_INSTFILES

!ifdef FINISH_TITLE
  !define MUI_FINISHPAGE_TITLE "${FINISH_TITLE}"
!endif
!insertmacro MUI_UNPAGE_FINISH

!insertmacro MUI_LANGUAGE "English"

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile ${OUTPUT_FILE}

Section -PreCommonSection
!ifdef INSTDIR_0 ;the default one, must exist
  strcpy $INSTDIR $${INSTDIR_0}_INSTDIR
  ${StrRep} $PRODUCT_UNIQUE_KEY "${PRODUCT_NAME} ${PRODUCT_VERSION} - $INSTDIR" "\" "_"
  strcpy $PRODUCT_UNIQUE_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_UNIQUE_KEY"
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_0}_INSTDIR" "$${INSTDIR_0}_INSTDIR"
!endif
!ifdef INSTDIR_1
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_1}_INSTDIR" "$${INSTDIR_1}_INSTDIR"
!endif
!ifdef INSTDIR_2
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_2}_INSTDIR" "$${INSTDIR_2}_INSTDIR"
!endif
!ifdef INSTDIR_3
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_3}_INSTDIR" "$${INSTDIR_3}_INSTDIR"
!endif
!ifdef INSTDIR_4
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_4}_INSTDIR" "$${INSTDIR_4}_INSTDIR"
!endif
!ifdef INSTDIR_5
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_5}_INSTDIR" "$${INSTDIR_5}_INSTDIR"
!endif

  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "StartMenu" "$STARTMENU_STRING"
  !insertmacro CreateConditionalShortCutDirectory "$SMPROGRAMS\$STARTMENU_STRING"
SectionEnd

!insertmacro MSVC_SECTIONS
!insertmacro OPENSOURCE_SECTIONS
!insertmacro ADDIN7X_SECTIONS
!insertmacro ADDIN60_SECTIONS
!insertmacro QTJAMBI_SECTIONS
!insertmacro VSIP_SECTIONS
!insertmacro HELP_SECTIONS
!insertmacro DEBUGEXT_SECTIONS
!insertmacro LICENSECHECK_SECTIONS
!insertmacro QSA_SECTIONS
!insertmacro MINGW_SECTIONS
!insertmacro EVALUATION_SECTIONS
!insertmacro ENVIRONMENT_SECTIONS
!insertmacro REGISTERUIEXT_SECTIONS
!insertmacro ECLIPSE_SECTIONS
!insertmacro QTJAMBIECLIPSE_SECTIONS
!insertmacro QTDEMO_SECTIONS

!ifdef USE_OPTIONAL_SHORTCUTCREATION
Section "Create shortcuts" SEC_SHORTCUTCREATION
SectionEnd
!endif ;USE_OPTIONAL_SHORTCUTCREATION

!insertmacro INSTDIR_FUNCTIONS

Section -CommonSection
  WriteUninstaller "$INSTDIR\uninst.exe"

  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayName" "$(^Name)"
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr SHCTX "$PRODUCT_UNIQUE_KEY" "Publisher" "${PRODUCT_PUBLISHER}"

  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\QtSoftware.com.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
  !insertmacro CreateConditionalShortCut "$SMPROGRAMS\$STARTMENU_STRING\Uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk" "$INSTDIR\uninst.exe"
  SetOutPath "$INSTDIR"
SectionEnd

Function CheckLocalLicenseProduct
!ifdef MODULE_LICENSECHECK
  !insertmacro QSA_CHECKLICENSEPRODUCT
!endif
FunctionEnd

Function .onInit
  StrCpy $STARTMENU_STRING "${DEFAULT_STARTMENU_STRING}"
!ifdef USE_OPTIONAL_SHORTCUTCREATION
  SectionSetText ${SEC_SHORTCUTCREATION} "${GLOBAL_SEC_SHORTCUTCREATION_TEXT}"
!endif ;USE_OPTIONAL_SHORTCUTCREATION

!ifdef USE_UNINSTALL_PREVIOUS
  push "${PRODUCT_NAME}"
  call GetExistsPreviousInstallationOfProduct
  exch $0
  StrCmp $0 true 0 +3
    MessageBox MB_OK|MB_ICONSTOP "A previous installation of ${PRODUCT_NAME} was detected.$\nPlease uninstall it before running this installer."
    Abort
  pop $0
!endif

!ifdef USE_WARN_NO_QT_FOUND
  Push $0
  EnumRegKey $0 HKLM "${QT_VERSION_KEY_NAME}" 0
  StrCmp $0 "" 0 qt_found
  EnumRegKey $0 HKCU "${QT_VERSION_KEY_NAME}" 0
  StrCmp $0 "" 0 qt_found
  MessageBox MB_OK|MB_ICONEXCLAMATION "No installed Qt package has been detected.$\nPlease make sure that Qt is installed before using the ${PRODUCT_NAME}"
  qt_found:
  Pop $0
!endif

  call SetAdminVar
  StrCmp "$RUNNING_AS_ADMIN" false 0 common_running_as_admin
!ifdef USE_ADMIN_CHECK
    MessageBox MB_OK|MB_ICONSTOP "You need to have administrator rights to install this software!"
    Abort
!endif
    SetShellVarContext current
    goto common_admin_check_done
  common_running_as_admin:
    SetShellVarContext all
  common_admin_check_done:

  Push $0
  Push $1
  ${GetParameters} $0
  ${GetOptions} $0 /LICENSEKEY= $1
  ClearErrors
  StrCmp $1 "" +2
  strcpy $LICENSE_KEY "$1"
    
  ${GetOptions} $0 /LICENSEE= $1
  ClearErrors
  StrCmp $1 "" +2
    strcpy $LICENSEE "$1"
    
  Pop $1
  Pop $0

  !insertmacro INSTDIR_STARTUP

  !insertmacro LICENSECHECK_STARTUP
  !insertmacro ENVIRONMENT_STARTUP
  !insertmacro REGISTERUIEXT_STARTUP
  !insertmacro MSVC_STARTUP
  !insertmacro OPENSOURCE_STARTUP
  !insertmacro EVALUATION_STARTUP
  !insertmacro ADDIN7X_STARTUP
  !insertmacro ADDIN60_STARTUP
  !insertmacro QTJAMBI_STARTUP
  !insertmacro DEBUGEXT_STARTUP
  !insertmacro VSIP_STARTUP
  !insertmacro HELP_STARTUP
  !insertmacro QSA_STARTUP
  !insertmacro MINGW_STARTUP
  !insertmacro ECLIPSE_STARTUP
  !insertmacro QTJAMBIECLIPSE_STARTUP
  !insertmacro QTDEMO_STARTUP
FunctionEnd

Function .onInstSuccess
  !insertmacro LICENSECHECK_FINISH
  !insertmacro ENVIRONMENT_FINISH
  !insertmacro REGISTERUIEXT_FINISH
  !insertmacro MSVC_FINISH
  !insertmacro OPENSOURCE_FINISH
  !insertmacro EVALUATION_FINISH
  !insertmacro ADDIN7X_FINISH
  !insertmacro ADDIN60_FINISH
  !insertmacro QTJAMBI_FINISH
  !insertmacro DEBUGEXT_FINISH
  !insertmacro VSIP_FINISH
  !insertmacro HELP_FINISH
  !insertmacro QSA_FINISH
  !insertmacro MINGW_FINISH
  !insertmacro ECLIPSE_FINISH
  !insertmacro QTJAMBIECLIPSE_FINISH
FunctionEnd

Function un.onUninstSuccess
  !insertmacro LICENSECHECK_UNFINISH
  !insertmacro ENVIRONMENT_UNFINISH
  !insertmacro REGISTERUIEXT_UNFINISH
  !insertmacro MSVC_UNFINISH
  !insertmacro OPENSOURCE_UNFINISH
  !insertmacro EVALUATION_UNFINISH
  !insertmacro ADDIN7X_UNFINISH
  !insertmacro ADDIN60_UNFINISH
  !insertmacro QTJAMBI_UNFINISH
  !insertmacro DEBUGEXT_UNFINISH
  !insertmacro VSIP_UNFINISH
  !insertmacro HELP_UNFINISH
  !insertmacro QSA_UNFINISH
  !insertmacro MINGW_UNFINISH
  !insertmacro ECLIPSE_UNFINISH
  !insertmacro QTJAMBIECLIPSE_UNFINISH
FunctionEnd

Function un.onInit
  call un.SetAdminVar
  StrCmp "$RUNNING_AS_ADMIN" false 0 common_running_as_admin
!ifdef USE_ADMIN_CHECK
    MessageBox MB_OK|MB_ICONSTOP "You do not have the required access rights to uninstall this package."
    Abort
!endif
    SetShellVarContext current
    goto common_admin_check_done
  common_running_as_admin:
    SetShellVarContext all
  common_admin_check_done:

  ${UnStrRep} $PRODUCT_UNIQUE_KEY "${PRODUCT_NAME} ${PRODUCT_VERSION} - $INSTDIR" "\" "_"
  strcpy $PRODUCT_UNIQUE_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\$PRODUCT_UNIQUE_KEY"

  push $0
  ClearErrors
  ReadRegStr $0 SHCTX "$PRODUCT_UNIQUE_KEY" "DisplayName"
  IfErrors 0 +3
    MessageBox MB_OK|MB_ICONSTOP "The uninstaller was unable to find the product to uninstall."
    Abort
  pop $0

  ReadRegStr $STARTMENU_STRING SHCTX "$PRODUCT_UNIQUE_KEY" "StartMenu"
  StrCmp "$STARTMENU_STRING" "" 0 +2
    StrCpy $STARTMENU_STRING "${DEFAULT_STARTMENU_STRING}"

!ifdef INSTDIR_0 ;the default one, must exist
  ReadRegStr $${INSTDIR_0}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_0}_INSTDIR"
!endif
!ifdef INSTDIR_1
  ReadRegStr $${INSTDIR_1}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_1}_INSTDIR"
!endif
!ifdef INSTDIR_2
  ReadRegStr $${INSTDIR_2}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_2}_INSTDIR"
!endif
!ifdef INSTDIR_3
  ReadRegStr $${INSTDIR_3}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_3}_INSTDIR"
!endif
!ifdef INSTDIR_4
  ReadRegStr $${INSTDIR_4}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_4}_INSTDIR"
!endif
!ifdef INSTDIR_5
  ReadRegStr $${INSTDIR_5}_INSTDIR SHCTX "$PRODUCT_UNIQUE_KEY" "${INSTDIR_5}_INSTDIR"
!endif

  !insertmacro LICENSECHECK_UNSTARTUP
  !insertmacro ENVIRONMENT_UNSTARTUP
  !insertmacro REGISTERUIEXT_UNSTARTUP
  !insertmacro MSVC_UNSTARTUP
  !insertmacro OPENSOURCE_UNSTARTUP
  !insertmacro EVALUATION_UNSTARTUP
  !insertmacro ADDIN7X_UNSTARTUP
  !insertmacro ADDIN60_UNSTARTUP
  !insertmacro QTJAMBI_UNSTARTUP
  !insertmacro DEBUGEXT_UNSTARTUP
  !insertmacro VSIP_UNSTARTUP
  !insertmacro HELP_UNSTARTUP
  !insertmacro QSA_UNSTARTUP
  !insertmacro MINGW_UNSTARTUP
  !insertmacro ECLIPSE_UNSTARTUP
  !insertmacro QTJAMBIECLIPSE_UNSTARTUP
  
  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "${UNINSTALLER_CONFIRM_PAGE}"
FunctionEnd

!insertmacro HELP_UNINSTALL
!insertmacro DEBUGEXT_UNINSTALL
!insertmacro MSVC_UNINSTALL
!insertmacro OPENSOURCE_UNINSTALL
!insertmacro EVALUATION_UNINSTALL
!insertmacro ENVIRONMENT_UNINSTALL
!insertmacro REGISTERUIEXT_UNINSTALL
!insertmacro QSA_UNINSTALL
!insertmacro MINGW_UNINSTALL
!insertmacro ECLIPSE_UNINSTALL
!insertmacro QTJAMBIECLIPSE_UNINSTALL

Section Uninstall
  !insertmacro LICENSECHECK_UNINSTALL
  !insertmacro ADDIN7X_UNINSTALL
  !insertmacro ADDIN60_UNINSTALL
  !insertmacro QTJAMBI_UNINSTALL
  !insertmacro VSIP_UNINSTALL

  ; COMMON
  Delete "$INSTDIR\${PRODUCT_NAME}.url"
  Delete "$INSTDIR\uninst.exe"
  Delete "$SMPROGRAMS\$STARTMENU_STRING\Uninstall ${PRODUCT_NAME} ${PRODUCT_VERSION}.lnk"
  Delete "$SMPROGRAMS\$STARTMENU_STRING\QtSoftware.com.lnk"

  RMDir "$SMPROGRAMS\$STARTMENU_STRING"
  RMDir "$INSTDIR"
  
  DeleteRegKey SHCTX "$PRODUCT_UNIQUE_KEY"
SectionEnd

Function CommonRunFunction
  !insertmacro MSVC_RUN_FUNCTION
  !insertmacro QSA_RUN_FUNCTION
  !insertmacro MINGW_RUN_FUNCTION
  DoneRunFunction:
FunctionEnd

Function CommonReadmeFunction
  !insertmacro MSVC_README_FUNCTION
  !insertmacro MINGW_README_FUNCTION
  DoneReadmeFunction:
FunctionEnd

Function un.UninstallerConfirmPage
  !insertmacro MUI_HEADER_TEXT "Confirm" "Confirm Uninstallation Directories"
  !insertmacro MUI_INSTALLOPTIONS_WRITE "${UNINSTALLER_CONFIRM_PAGE}" "Field 2" "Text" "$UninstallerConfirmProduct"
  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "${UNINSTALLER_CONFIRM_PAGE}"
FunctionEnd

;pops product name from stack and as result pushes TRUE or FALSE on stack
Function GetExistsPreviousInstallationOfProduct
  exch $0
  push $1
  push $2
  push $3

  StrCpy $1 0
  loop:
    EnumRegKey $2 HKLM Software\Microsoft\Windows\CurrentVersion\Uninstall $1
    StrCmp $2 "" no_reg_key_found
    ${StrStr} $3 $2 $0
    StrCmp $3 $2 reg_key_found
    IntOp $1 $1 + 1
    goto loop
  
  reg_key_found:
  push true
  goto done
  
  no_reg_key_found:
  push false
  
  done:
  exch
  pop $3
  exch
  pop $2
  exch
  pop $1
  exch
  pop $0
FunctionEnd

;pops product name from stack
Function WarnIfInstalledProductDetected
  exch $0
  push $0
  call GetExistsPreviousInstallationOfProduct
  exch $1
  StrCmp $1 true +1 +3
    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
      Abort
  pop $1
  pop $0
FunctionEnd

;sets $RUNNING_AS_ADMIN to true if Admin or Power user
!macro SetAdminVar UN
Function ${UN}SetAdminVar
  push $0
  ClearErrors
  UserInfo::GetAccountType
  IfErrors Admin ;It's probably Win95
  pop $0
  StrCmp $0 "Admin" Admin
  StrCmp $0 "Power" Admin

  StrCpy $RUNNING_AS_ADMIN false
  goto Done

  Admin:
  StrCpy $RUNNING_AS_ADMIN true

  Done:
  pop $0
FunctionEnd
!macroend
!insertmacro SetAdminVar ""
!insertmacro SetAdminVar "un."

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MSVC_DESCRIPTION
  !insertmacro OPENSOURCE_DESCRIPTION
  !insertmacro ENVIRONMENT_DESCRIPTION
  !insertmacro REGISTERUIEXT_DESCRIPTION
  !insertmacro EVALUATION_DESCRIPTION
  !insertmacro ADDIN7X_DESCRIPTION
  !insertmacro ADDIN60_DESCRIPTION
  !insertmacro QTJAMBI_DESCRIPTION
  !insertmacro DEBUGEXT_DESCRIPTION
  !insertmacro HELP_DESCRIPTION
  !insertmacro VSIP_DESCRIPTION
  !insertmacro QSA_DESCRIPTION
  !insertmacro MINGW_DESCRIPTION
  !insertmacro ECLIPSE_DESCRIPTION
  !insertmacro QTJAMBIECLIPSE_DESCRIPTION
!insertmacro MUI_FUNCTION_DESCRIPTION_END