Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Examples / makensis.nsi @ 3136

Historique | Voir | Annoter | Télécharger (34,64 ko)

1
;NSIS Setup Script
2
;--------------------------------
3

    
4
!pragma warning error all
5
!pragma warning warning 7010 ; File /NonFatal
6

    
7
!ifdef VER_MAJOR & VER_MINOR
8
  !define /ifndef VER_REVISION 0
9
  !define /ifndef VER_BUILD 0
10
!endif
11

    
12
!define /ifndef VERSION 'anonymous-build'
13

    
14
;--------------------------------
15
;Configuration
16

    
17
!if ${NSIS_PTR_SIZE} > 4
18
  !define BITS 64
19
  !define NAMESUFFIX " (64 bit)"
20
!else
21
  !define BITS 32
22
  !define NAMESUFFIX ""
23
!endif
24

    
25
!ifndef OUTFILE
26
  !define OUTFILE "..\nsis${BITS}-${VERSION}-setup.exe"
27
  !searchreplace OUTFILE "${OUTFILE}" nsis32 nsis
28
!endif
29

    
30
OutFile "${OUTFILE}"
31
Unicode true
32
SetCompressor /SOLID lzma
33

    
34
InstType "Full"
35
InstType "Lite"
36
InstType "Minimal"
37

    
38
InstallDir $PROGRAMFILES${BITS}\NSIS
39
InstallDirRegKey HKLM Software\NSIS ""
40

    
41
RequestExecutionLevel admin
42

    
43
;--------------------------------
44
;Header Files
45

    
46
!include "MUI2.nsh"
47
!include "Sections.nsh"
48
!include "LogicLib.nsh"
49
!include "Memento.nsh"
50
!include "WordFunc.nsh"
51
!include "Util.nsh"
52
!include "Integration.nsh"
53

    
54
;--------------------------------
55
;Configuration
56

    
57
;Names
58
Name "NSIS"
59
Caption "NSIS ${VERSION}${NAMESUFFIX} Setup"
60

    
61
!define REG_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS"
62

    
63
;Memento Settings
64
!define MEMENTO_REGISTRY_ROOT HKLM
65
!define MEMENTO_REGISTRY_KEY "${REG_UNINST_KEY}"
66

    
67
;Interface Settings
68
!define MUI_ABORTWARNING
69

    
70
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\nsis3-install.ico"
71
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\nsis3-uninstall.ico"
72

    
73
!define MUI_HEADERIMAGE
74
!define MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis3-branding.bmp"
75
!define MUI_WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\nsis3-branding.bmp"
76

    
77
!define MUI_COMPONENTSPAGE_SMALLDESC
78

    
79
;Pages
80
!define MUI_WELCOMEPAGE_TITLE "Welcome to the NSIS ${VERSION} Setup Wizard"
81
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of NSIS (Nullsoft Scriptable Install System) ${VERSION}, the next generation of the Windows installer and uninstaller system that doesn't suck and isn't huge.$\r$\n$\r$\nNSIS includes a Modern User Interface, LZMA compression, support for multiple languages and an easy plug-in system.$\r$\n$\r$\n$_CLICK"
82

    
83
!insertmacro MUI_PAGE_WELCOME
84
!insertmacro MUI_PAGE_LICENSE "..\COPYING"
85
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
86
Page custom PageReinstall PageLeaveReinstall
87
!endif
88
!insertmacro MUI_PAGE_COMPONENTS
89
!insertmacro MUI_PAGE_DIRECTORY
90
!insertmacro MUI_PAGE_INSTFILES
91

    
92
!define MUI_FINISHPAGE_LINK "Visit the NSIS site for the latest news, FAQs and support"
93
!define MUI_FINISHPAGE_LINK_LOCATION "http://nsis.sf.net/"
94

    
95
!define MUI_FINISHPAGE_RUN "$INSTDIR\NSIS.exe"
96
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
97

    
98
!define MUI_FINISHPAGE_SHOWREADME
99
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show release notes"
100
!define MUI_FINISHPAGE_SHOWREADME_FUNCTION ShowReleaseNotes
101

    
102
!insertmacro MUI_PAGE_FINISH
103

    
104
!insertmacro MUI_UNPAGE_CONFIRM
105
!insertmacro MUI_UNPAGE_INSTFILES
106

    
107
;--------------------------------
108
;Languages
109

    
110
!insertmacro MUI_LANGUAGE "English"
111

    
112
;--------------------------------
113
;Version information
114

    
115
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
116
VIProductVersion ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD}
117
VIAddVersionKey "FileVersion" "${VERSION}"
118
VIAddVersionKey "FileDescription" "NSIS Setup"
119
VIAddVersionKey "LegalCopyright" "http://nsis.sf.net/License"
120
!endif
121

    
122
;--------------------------------
123
;Installer Sections
124

    
125
!macro InstallPlugin pi
126
  !if ${BITS} >= 64
127
    File "/oname=$InstDir\Plugins\amd64-unicode\${pi}.dll" ..\Plugins\amd64-unicode\${pi}.dll
128
  !else
129
    File "/oname=$InstDir\Plugins\x86-ansi\${pi}.dll" ..\Plugins\x86-ansi\${pi}.dll
130
    File "/oname=$InstDir\Plugins\x86-unicode\${pi}.dll" ..\Plugins\x86-unicode\${pi}.dll
131
  !endif
132
!macroend
133

    
134
!macro InstallStub stub
135
  !if ${BITS} >= 64
136
    File ..\Stubs\${stub}-amd64-unicode
137
  !else
138
    File ..\Stubs\${stub}-x86-ansi
139
    File ..\Stubs\${stub}-x86-unicode
140
  !endif
141
!macroend
142

    
143
${MementoSection} "NSIS Core Files (required)" SecCore
144

    
145
  SetDetailsPrint textonly
146
  DetailPrint "Installing NSIS Core Files..."
147
  SetDetailsPrint listonly
148

    
149
  SectionIn 1 2 3 RO
150
  SetOutPath $INSTDIR
151
  RMDir /r $SMPROGRAMS\NSIS
152

    
153
  IfFileExists $INSTDIR\nsisconf.nsi "" +2
154
  Rename $INSTDIR\nsisconf.nsi $INSTDIR\nsisconf.nsh
155
  SetOverwrite off
156
  File ..\nsisconf.nsh
157

    
158
  SetOverwrite on
159
  File ..\makensis.exe
160
  File ..\makensisw.exe
161
  File ..\COPYING
162
  File ..\NSIS.chm
163
  !pragma verifychm "..\NSIS.chm"
164
  !if /FileExists "..\NSIS.exe"
165
    !if /FileExists "..\NSIS.exe.manifest"
166
      File "..\NSIS.exe.manifest"
167
    !endif
168
  !else
169
    !define NO_NSISMENU_HTML 1
170
    !makensis '-v2 "NSISMenu.nsi" "-XOutFile ..\NSIS.exe"' = 0
171
  !endif
172
  File ..\NSIS.exe
173

    
174
  SetOutPath $INSTDIR\Bin
175
  File ..\Bin\makensis.exe
176
!ifdef USE_NEW_ZLIB
177
  File ..\Bin\zlib.dll
178
!else
179
  File ..\Bin\zlib1.dll
180
!endif
181

    
182
  SetOutPath $INSTDIR\Stubs
183
  File ..\Stubs\uninst
184
  !insertmacro InstallStub bzip2
185
  !insertmacro InstallStub bzip2_solid
186
  !insertmacro InstallStub lzma
187
  !insertmacro InstallStub lzma_solid
188
  !insertmacro InstallStub zlib
189
  !insertmacro InstallStub zlib_solid
190
  
191

    
192
  SetOutPath $INSTDIR\Include
193
  File ..\Include\WinMessages.nsh
194
  File ..\Include\Sections.nsh
195
  File ..\Include\Library.nsh
196
  File ..\Include\UpgradeDLL.nsh
197
  File ..\Include\LogicLib.nsh
198
  File ..\Include\StrFunc.nsh
199
  File ..\Include\Colors.nsh
200
  File ..\Include\FileFunc.nsh
201
  File ..\Include\TextFunc.nsh
202
  File ..\Include\WordFunc.nsh
203
  File ..\Include\WinVer.nsh
204
  File ..\Include\x64.nsh
205
  File ..\Include\Memento.nsh
206
  File ..\Include\LangFile.nsh
207
  File ..\Include\InstallOptions.nsh
208
  File ..\Include\MultiUser.nsh
209
  File ..\Include\VB6RunTime.nsh
210
  File ..\Include\Util.nsh
211
  File ..\Include\Integration.nsh
212
  File ..\Include\WinCore.nsh
213

    
214
  SetOutPath $INSTDIR\Include\Win
215
  File ..\Include\Win\WinDef.nsh
216
  File ..\Include\Win\WinError.nsh
217
  File ..\Include\Win\WinNT.nsh
218
  File ..\Include\Win\WinUser.nsh
219
  File ..\Include\Win\COM.nsh
220
  File ..\Include\Win\Propkey.nsh
221

    
222
  SetOutPath $INSTDIR\Docs\StrFunc
223
  File ..\Docs\StrFunc\StrFunc.txt
224

    
225
  SetOutPath $INSTDIR\Docs\MultiUser
226
  File ..\Docs\MultiUser\Readme.html
227

    
228
  SetOutPath $INSTDIR\Docs\makensisw
229
  File ..\Docs\makensisw\*.txt
230

    
231
  !ifndef NO_NSISMENU_HTML
232
    SetOutPath $INSTDIR\Menu
233
    File ..\Menu\*.html
234
    SetOutPath $INSTDIR\Menu\images
235
    File ..\Menu\images\header.gif
236
    File ..\Menu\images\line.gif
237
    File ..\Menu\images\site.gif
238
  !endif
239

    
240
  Delete $INSTDIR\makensis.htm
241
  Delete $INSTDIR\Docs\*.html
242
  Delete $INSTDIR\Docs\style.css
243
  RMDir $INSTDIR\Docs
244

    
245
  SetOutPath $INSTDIR\Bin
246
  !if ${BITS} >= 64
247
    File /NonFatal  ..\Bin\RegTool-x86.bin
248
    File            ..\Bin\RegTool-amd64.bin
249
  !else
250
    File            ..\Bin\RegTool-x86.bin
251
    !if /FileExists ..\Bin\RegTool-amd64.bin ; It is unlikely that this exists, avoid the /NonFatal warning.
252
      File          ..\Bin\RegTool-amd64.bin
253
    !endif
254
  !endif
255

    
256
  CreateDirectory $INSTDIR\Plugins\x86-ansi
257
  CreateDirectory $INSTDIR\Plugins\x86-unicode
258
  !if ${BITS} >= 64
259
    CreateDirectory $INSTDIR\Plugins\amd64-unicode
260
  !endif
261
  !insertmacro InstallPlugin TypeLib
262

    
263
  ReadRegStr $R0 HKCR ".nsi" ""
264
  StrCmp $R0 "NSISFile" 0 +2
265
    DeleteRegKey HKCR "NSISFile"
266

    
267
  WriteRegStr HKCR ".nsi" "" "NSIS.Script"
268
  WriteRegStr HKCR ".nsi" "PerceivedType" "text"
269
  WriteRegStr HKCR "NSIS.Script" "" "NSIS Script File"
270
  WriteRegStr HKCR "NSIS.Script\DefaultIcon" "" "$INSTDIR\makensisw.exe,1"
271
  ReadRegStr $R0 HKCR "NSIS.Script\shell\open\command" ""
272
  ${If} $R0 == ""
273
    WriteRegStr HKCR "NSIS.Script\shell" "" "open"
274
    WriteRegStr HKCR "NSIS.Script\shell\open\command" "" 'notepad.exe "%1"'
275
  ${EndIf}
276
  WriteRegStr HKCR "NSIS.Script\shell\compile" "" "Compile NSIS Script"
277
  WriteRegStr HKCR "NSIS.Script\shell\compile\command" "" '"$INSTDIR\makensisw.exe" "%1"'
278
  WriteRegStr HKCR "NSIS.Script\shell\compile-compressor" "" "Compile NSIS Script (Choose Compressor)"
279
  WriteRegStr HKCR "NSIS.Script\shell\compile-compressor\command" "" '"$INSTDIR\makensisw.exe" /ChooseCompressor "%1"'
280

    
281
  ReadRegStr $R0 HKCR ".nsh" ""
282
  StrCmp $R0 "NSHFile" 0 +2
283
    DeleteRegKey HKCR "NSHFile"
284

    
285
  WriteRegStr HKCR ".nsh" "" "NSIS.Header"
286
  WriteRegStr HKCR ".nsh" "PerceivedType" "text"
287
  WriteRegStr HKCR "NSIS.Header" "" "NSIS Header File"
288
  WriteRegStr HKCR "NSIS.Header\DefaultIcon" "" "$INSTDIR\makensisw.exe,2"
289
  ReadRegStr $R0 HKCR "NSIS.Header\shell\open\command" ""
290
  ${If} $R0 == ""
291
    WriteRegStr HKCR "NSIS.Header\shell" "" "open"
292
    WriteRegStr HKCR "NSIS.Header\shell\open\command" "" 'notepad.exe "%1"'
293
  ${EndIf}
294

    
295
  ${NotifyShell_AssocChanged}
296

    
297
${MementoSectionEnd}
298

    
299
${MementoSection} "Script Examples" SecExample
300

    
301
  SetDetailsPrint textonly
302
  DetailPrint "Installing Script Examples..."
303
  SetDetailsPrint listonly
304

    
305
  SectionIn 1 2
306
  SetOutPath $INSTDIR\Examples
307
  File ..\Examples\makensis.nsi
308
  File ..\Examples\example1.nsi
309
  File ..\Examples\example2.nsi
310
  File ..\Examples\install-per-user.nsi
311
  File ..\Examples\install-shared.nsi
312
  File ..\Examples\waplugin.nsi
313
  File ..\Examples\bigtest.nsi
314
  File ..\Examples\primes.nsi
315
  File ..\Examples\rtest.nsi
316
  File ..\Examples\gfx.nsi
317
  File ..\Examples\one-section.nsi
318
  File ..\Examples\languages.nsi
319
  File ..\Examples\Library.nsi
320
  File ..\Examples\VersionInfo.nsi
321
  File ..\Examples\LogicLib.nsi
322
  File ..\Examples\silent.nsi
323
  File ..\Examples\StrFunc.nsi
324
  File ..\Examples\FileFunc.nsi
325
  File ..\Examples\FileFunc.ini
326
  File ..\Examples\FileFuncTest.nsi
327
  File ..\Examples\TextFunc.nsi
328
  File ..\Examples\TextFunc.ini
329
  File ..\Examples\TextFuncTest.nsi
330
  File ..\Examples\WordFunc.nsi
331
  File ..\Examples\WordFunc.ini
332
  File ..\Examples\WordFuncTest.nsi
333
  File ..\Examples\Memento.nsi
334
  File ..\Examples\unicode.nsi
335
  File ..\Examples\NSISMenu.nsi
336

    
337
  SetOutPath $INSTDIR\Examples\Plugin
338
  File ..\Examples\Plugin\exdll.c
339
  File ..\Examples\Plugin\exdll.dpr
340
  File ..\Examples\Plugin\exdll.dsp
341
  File ..\Examples\Plugin\exdll.dsw
342
  File ..\Examples\Plugin\exdll_with_unit.dpr
343
  File ..\Examples\Plugin\exdll-vs2008.sln
344
  File ..\Examples\Plugin\exdll-vs2008.vcproj
345
  File ..\Examples\Plugin\extdll.inc
346
  File ..\Examples\Plugin\nsis.pas
347

    
348
  SetOutPath $INSTDIR\Examples\Plugin\nsis
349
  File ..\Examples\Plugin\nsis\pluginapi.h
350
  File /nonfatal ..\Examples\Plugin\nsis\pluginapi*.lib
351
  File ..\Examples\Plugin\nsis\api.h
352
  File ..\Examples\Plugin\nsis\nsis_tchar.h
353

    
354
${MementoSectionEnd}
355

    
356
!ifndef NO_STARTMENUSHORTCUTS
357
${MementoSection} "Start Menu and Desktop Shortcuts" SecShortcuts
358

    
359
  SetDetailsPrint textonly
360
  DetailPrint "Installing Start Menu and Desktop Shortcuts..."
361
  SetDetailsPrint listonly
362

    
363
!else
364
${MementoSection} "Desktop Shortcut" SecShortcuts
365

    
366
  SetDetailsPrint textonly
367
  DetailPrint "Installing Desktop Shortcut..."
368
  SetDetailsPrint listonly
369

    
370
!endif
371
  SectionIn 1 2
372
  SetOutPath $INSTDIR
373
!ifndef NO_STARTMENUSHORTCUTS
374
  CreateShortcut "$SMPROGRAMS\NSIS${NAMESUFFIX}.lnk" "$INSTDIR\NSIS.exe"
375
!endif
376

    
377
  CreateShortcut "$DESKTOP\NSIS${NAMESUFFIX}.lnk" "$INSTDIR\NSIS.exe"
378

    
379
${MementoSectionEnd}
380

    
381
SectionGroup "User Interfaces" SecInterfaces
382

    
383
${MementoSection} "Modern User Interface" SecInterfacesModernUI
384

    
385
  SetDetailsPrint textonly
386
  DetailPrint "Installing User Interfaces | Modern User Interface..."
387
  SetDetailsPrint listonly
388

    
389
  SectionIn 1 2
390

    
391
  SetOutPath "$INSTDIR\Examples\Modern UI"
392
  File "..\Examples\Modern UI\Basic.nsi"
393
  File "..\Examples\Modern UI\HeaderBitmap.nsi"
394
  File "..\Examples\Modern UI\MultiLanguage.nsi"
395
  File "..\Examples\Modern UI\StartMenu.nsi"
396
  File "..\Examples\Modern UI\WelcomeFinish.nsi"
397

    
398
  SetOutPath "$INSTDIR\Contrib\Modern UI"
399
  File "..\Contrib\Modern UI\System.nsh"
400
  File "..\Contrib\Modern UI\ioSpecial.ini"
401

    
402
  SetOutPath "$INSTDIR\Docs\Modern UI"
403
  File "..\Docs\Modern UI\Readme.html"
404
  File "..\Docs\Modern UI\Changelog.txt"
405
  File "..\Docs\Modern UI\License.txt"
406

    
407
  SetOutPath "$INSTDIR\Docs\Modern UI\images"
408
  File "..\Docs\Modern UI\images\header.gif"
409
  File "..\Docs\Modern UI\images\screen1.png"
410
  File "..\Docs\Modern UI\images\screen2.png"
411
  File "..\Docs\Modern UI\images\open.gif"
412
  File "..\Docs\Modern UI\images\closed.gif"
413

    
414
  SetOutPath $INSTDIR\Contrib\UIs
415
  File "..\Contrib\UIs\modern.exe"
416
  File "..\Contrib\UIs\modern_headerbmp.exe"
417
  File "..\Contrib\UIs\modern_headerbmpr.exe"
418
  File "..\Contrib\UIs\modern_nodesc.exe"
419
  File "..\Contrib\UIs\modern_smalldesc.exe"
420

    
421
  SetOutPath $INSTDIR\Include
422
  File "..\Include\MUI.nsh"
423

    
424
  SetOutPath "$INSTDIR\Contrib\Modern UI 2"
425
  File "..\Contrib\Modern UI 2\Deprecated.nsh"
426
  File "..\Contrib\Modern UI 2\Interface.nsh"
427
  File "..\Contrib\Modern UI 2\Localization.nsh"
428
  File "..\Contrib\Modern UI 2\MUI2.nsh"
429
  File "..\Contrib\Modern UI 2\Pages.nsh"
430

    
431
  SetOutPath "$INSTDIR\Contrib\Modern UI 2\Pages"
432
  File "..\Contrib\Modern UI 2\Pages\Components.nsh"
433
  File "..\Contrib\Modern UI 2\Pages\Directory.nsh"
434
  File "..\Contrib\Modern UI 2\Pages\Finish.nsh"
435
  File "..\Contrib\Modern UI 2\Pages\InstallFiles.nsh"
436
  File "..\Contrib\Modern UI 2\Pages\License.nsh"
437
  File "..\Contrib\Modern UI 2\Pages\StartMenu.nsh"
438
  File "..\Contrib\Modern UI 2\Pages\UninstallConfirm.nsh"
439
  File "..\Contrib\Modern UI 2\Pages\Welcome.nsh"
440

    
441
  SetOutPath "$INSTDIR\Docs\Modern UI 2"
442
  File "..\Docs\Modern UI 2\Readme.html"
443
  File "..\Docs\Modern UI 2\License.txt"
444

    
445
  SetOutPath "$INSTDIR\Docs\Modern UI 2\images"
446
  File "..\Docs\Modern UI 2\images\header.gif"
447
  File "..\Docs\Modern UI 2\images\screen1.png"
448
  File "..\Docs\Modern UI 2\images\screen2.png"
449
  File "..\Docs\Modern UI 2\images\open.gif"
450
  File "..\Docs\Modern UI 2\images\closed.gif"
451

    
452
  SetOutPath $INSTDIR\Include
453
  File "..\Include\MUI2.nsh"
454

    
455
${MementoSectionEnd}
456

    
457
${MementoSection} "Default User Interface" SecInterfacesDefaultUI
458

    
459
  SetDetailsPrint textonly
460
  DetailPrint "Installing User Interfaces | Default User Interface..."
461
  SetDetailsPrint listonly
462

    
463
  SectionIn 1
464

    
465
  SetOutPath "$INSTDIR\Contrib\UIs"
466
  File "..\Contrib\UIs\default.exe"
467

    
468
${MementoSectionEnd}
469

    
470
${MementoSection} "Tiny User Interface" SecInterfacesTinyUI
471

    
472
  SetDetailsPrint textonly
473
  DetailPrint "Installing User Interfaces | Tiny User Interface..."
474
  SetDetailsPrint listonly
475

    
476
  SectionIn 1
477

    
478
  SetOutPath "$INSTDIR\Contrib\UIs"
479
  File "..\Contrib\UIs\sdbarker_tiny.exe"
480

    
481
${MementoSectionEnd}
482

    
483
SectionGroupEnd
484

    
485
${MementoSection} "Graphics" SecGraphics
486

    
487
  SetDetailsPrint textonly
488
  DetailPrint "Installing Graphics..."
489
  SetDetailsPrint listonly
490

    
491
  SectionIn 1
492

    
493
  Delete $INSTDIR\Contrib\Icons\*.ico
494
  Delete $INSTDIR\Contrib\Icons\*.bmp
495
  RMDir $INSTDIR\Contrib\Icons
496
  SetOutPath $INSTDIR\Contrib\Graphics
497
  File /r "..\Contrib\Graphics\*.ico"
498
  File /r "..\Contrib\Graphics\*.bmp"
499
${MementoSectionEnd}
500

    
501
${MementoSection} "Language Files" SecLangFiles
502

    
503
  SetDetailsPrint textonly
504
  DetailPrint "Installing Language Files..."
505
  SetDetailsPrint listonly
506

    
507
  SectionIn 1
508

    
509
  SetOutPath "$INSTDIR\Contrib\Language files"
510
  File "..\Contrib\Language files\*.nlf"
511

    
512
  SetOutPath $INSTDIR\Bin
513
  File ..\Bin\MakeLangID.exe
514

    
515
  ${If} ${SectionIsSelected} ${SecInterfacesModernUI}
516
    SetOutPath "$INSTDIR\Contrib\Language files"
517
    File "..\Contrib\Language files\*.nsh"
518
  ${EndIf}
519

    
520
${MementoSectionEnd}
521

    
522
SectionGroup "Tools" SecTools
523

    
524
${MementoSection} "Zip2Exe" SecToolsZ2E
525

    
526
  SetDetailsPrint textonly
527
  DetailPrint "Installing Tools | Zip2Exe..."
528
  SetDetailsPrint listonly
529

    
530
  SectionIn 1
531

    
532
  SetOutPath $INSTDIR\Bin
533
  File ..\Bin\zip2exe.exe
534
  SetOutPath $INSTDIR\Contrib\zip2exe
535
  File ..\Contrib\zip2exe\Base.nsh
536
  File ..\Contrib\zip2exe\Modern.nsh
537
  File ..\Contrib\zip2exe\Classic.nsh
538

    
539
${MementoSectionEnd}
540

    
541
SectionGroupEnd
542

    
543
SectionGroup "Plug-ins" SecPluginsPlugins
544

    
545
${MementoSection} "Banner" SecPluginsBanner
546

    
547
  SetDetailsPrint textonly
548
  DetailPrint "Installing Plug-ins | Banner..."
549
  SetDetailsPrint listonly
550

    
551
  SectionIn 1
552

    
553
  !insertmacro InstallPlugin Banner
554
  SetOutPath $INSTDIR\Docs\Banner
555
  File ..\Docs\Banner\Readme.txt
556
  SetOutPath $INSTDIR\Examples\Banner
557
  File ..\Examples\Banner\Example.nsi
558
${MementoSectionEnd}
559

    
560
${MementoSection} "Language DLL" SecPluginsLangDLL
561

    
562
  SetDetailsPrint textonly
563
  DetailPrint "Installing Plug-ins | Language DLL..."
564
  SetDetailsPrint listonly
565

    
566
  SectionIn 1
567
  !insertmacro InstallPlugin LangDLL
568
${MementoSectionEnd}
569

    
570
${MementoSection} "nsExec" SecPluginsnsExec
571

    
572
  SetDetailsPrint textonly
573
  DetailPrint "Installing Plug-ins | nsExec..."
574
  SetDetailsPrint listonly
575

    
576
  SectionIn 1
577

    
578
  !insertmacro InstallPlugin nsExec
579
  SetOutPath $INSTDIR\Docs\nsExec
580
  File ..\Docs\nsExec\nsExec.txt
581
  SetOutPath $INSTDIR\Examples\nsExec
582
  File ..\Examples\nsExec\test.nsi
583
${MementoSectionEnd}
584

    
585
${MementoSection} "Splash" SecPluginsSplash
586

    
587
  SetDetailsPrint textonly
588
  DetailPrint "Installing Plug-ins | Splash..."
589
  SetDetailsPrint listonly
590

    
591
  SectionIn 1
592

    
593
  !insertmacro InstallPlugin splash
594
  SetOutPath $INSTDIR\Docs\Splash
595
  File ..\Docs\Splash\splash.txt
596
  SetOutPath $INSTDIR\Examples\Splash
597
  File ..\Examples\Splash\Example.nsi
598
${MementoSectionEnd}
599

    
600
${MementoSection} "AdvSplash" SecPluginsSplashT
601

    
602
  SetDetailsPrint textonly
603
  DetailPrint "Installing Plug-ins | AdvSplash..."
604
  SetDetailsPrint listonly
605

    
606
  SectionIn 1
607

    
608
  !insertmacro InstallPlugin advsplash
609
  SetOutPath $INSTDIR\Docs\AdvSplash
610
  File ..\Docs\AdvSplash\advsplash.txt
611
  SetOutPath $INSTDIR\Examples\AdvSplash
612
  File ..\Examples\AdvSplash\Example.nsi
613
${MementoSectionEnd}
614

    
615
${MementoSection} "BgImage" SecPluginsBgImage
616

    
617
  SetDetailsPrint textonly
618
  DetailPrint "Installing Plug-ins | BgImage..."
619
  SetDetailsPrint listonly
620

    
621
  SectionIn 1
622

    
623
  !insertmacro InstallPlugin BgImage
624
  SetOutPath $INSTDIR\Docs\BgImage
625
  File ..\Docs\BgImage\BgImage.txt
626
  SetOutPath $INSTDIR\Examples\BgImage
627
  File ..\Examples\BgImage\Example.nsi
628
${MementoSectionEnd}
629

    
630
${MementoSection} "InstallOptions" SecPluginsIO
631

    
632
  SetDetailsPrint textonly
633
  DetailPrint "Installing Plug-ins | InstallOptions..."
634
  SetDetailsPrint listonly
635

    
636
  SectionIn 1
637

    
638
  !insertmacro InstallPlugin InstallOptions
639
  SetOutPath $INSTDIR\Docs\InstallOptions
640
  File ..\Docs\InstallOptions\Readme.html
641
  File ..\Docs\InstallOptions\Changelog.txt
642
  SetOutPath $INSTDIR\Examples\InstallOptions
643
  File ..\Examples\InstallOptions\test.ini
644
  File ..\Examples\InstallOptions\test.nsi
645
  File ..\Examples\InstallOptions\testimgs.ini
646
  File ..\Examples\InstallOptions\testimgs.nsi
647
  File ..\Examples\InstallOptions\testlink.ini
648
  File ..\Examples\InstallOptions\testlink.nsi
649
  File ..\Examples\InstallOptions\testnotify.ini
650
  File ..\Examples\InstallOptions\testnotify.nsi
651
${MementoSectionEnd}
652

    
653
${MementoSection} "nsDialogs" SecPluginsDialogs
654

    
655
  SetDetailsPrint textonly
656
  DetailPrint "Installing Plug-ins | nsDialogs..."
657
  SetDetailsPrint listonly
658

    
659
  SectionIn 1
660

    
661
  !insertmacro InstallPlugin nsDialogs
662
  SetOutPath $INSTDIR\Examples\nsDialogs
663
  File ..\Examples\nsDialogs\example.nsi
664
  File ..\Examples\nsDialogs\InstallOptions.nsi
665
  File ..\Examples\nsDialogs\timer.nsi
666
  File ..\Examples\nsDialogs\welcome.nsi
667
  SetOutPath $INSTDIR\Include
668
  File ..\Include\nsDialogs.nsh
669
  SetOutPath $INSTDIR\Docs\nsDialogs
670
  File ..\Docs\nsDialogs\Readme.html
671
${MementoSectionEnd}
672

    
673
${MementoSection} "Math" SecPluginsMath
674

    
675
  SetDetailsPrint textonly
676
  DetailPrint "Installing Plug-ins | Math..."
677
  SetDetailsPrint listonly
678

    
679
  SectionIn 1
680

    
681
  !insertmacro InstallPlugin Math
682
  SetOutPath $INSTDIR\Docs\Math
683
  File ..\Docs\Math\Math.txt
684
  SetOutPath $INSTDIR\Examples\Math
685
  File ..\Examples\Math\math.nsi
686
  File ..\Examples\Math\mathtest.txt
687
  File ..\Examples\Math\mathtest.nsi
688
  File ..\Examples\Math\mathtest.ini
689

    
690
${MementoSectionEnd}
691

    
692
${MementoSection} "NSISdl" SecPluginsNSISDL
693

    
694
  SetDetailsPrint textonly
695
  DetailPrint "Installing Plug-ins | NSISdl..."
696
  SetDetailsPrint listonly
697

    
698
  SectionIn 1
699

    
700
  !insertmacro InstallPlugin nsisdl
701
  SetOutPath $INSTDIR\Docs\NSISdl
702
  File ..\Docs\NSISdl\ReadMe.txt
703
  File ..\Docs\NSISdl\License.txt
704
${MementoSectionEnd}
705

    
706
${MementoSection} "System" SecPluginsSystem
707

    
708
  SetDetailsPrint textonly
709
  DetailPrint "Installing Plug-ins | System..."
710
  SetDetailsPrint listonly
711

    
712
  SectionIn 1
713

    
714
  !insertmacro InstallPlugin System
715
  SetOutPath $INSTDIR\Docs\System
716
  File ..\Docs\System\System.html
717
  File ..\Docs\System\WhatsNew.txt
718
  SetOutPath $INSTDIR\Examples\System
719
  File ..\Examples\System\Resource.dll
720
  File ..\Examples\System\SysFunc.nsh
721
  File ..\Examples\System\System.nsh
722
  File ..\Examples\System\System.nsi
723
${MementoSectionEnd}
724

    
725
${MementoSection} "StartMenu" SecPluginsStartMenu
726

    
727
  SetDetailsPrint textonly
728
  DetailPrint "Installing Plug-ins | StartMenu..."
729
  SetDetailsPrint listonly
730

    
731
  SectionIn 1
732

    
733
  !insertmacro InstallPlugin StartMenu
734
  SetOutPath $INSTDIR\Docs\StartMenu
735
  File ..\Docs\StartMenu\Readme.txt
736
  SetOutPath $INSTDIR\Examples\StartMenu
737
  File ..\Examples\StartMenu\Example.nsi
738
${MementoSectionEnd}
739

    
740
${MementoSection} "UserInfo" SecPluginsUserInfo
741

    
742
  SetDetailsPrint textonly
743
  DetailPrint "Installing Plug-ins | UserInfo..."
744
  SetDetailsPrint listonly
745

    
746
  SectionIn 1
747

    
748
  !insertmacro InstallPlugin UserInfo
749
  SetOutPath $INSTDIR\Examples\UserInfo
750
  File ..\Examples\UserInfo\UserInfo.nsi
751
${MementoSectionEnd}
752

    
753
${MementoSection} "Dialer" SecPluginsDialer
754

    
755
  SetDetailsPrint textonly
756
  DetailPrint "Installing Plug-ins | Dialer..."
757
  SetDetailsPrint listonly
758

    
759
  SectionIn 1
760

    
761
  !insertmacro InstallPlugin Dialer
762
  SetOutPath $INSTDIR\Docs\Dialer
763
  File ..\Docs\Dialer\Dialer.txt
764
${MementoSectionEnd}
765

    
766
${MementoSection} "VPatch" SecPluginsVPatch
767

    
768
  SetDetailsPrint textonly
769
  DetailPrint "Installing Plug-ins | VPatch..."
770
  SetDetailsPrint listonly
771

    
772
  SectionIn 1
773

    
774
  !insertmacro InstallPlugin VPatch
775
  SetOutPath $INSTDIR\Examples\VPatch
776
  File ..\Examples\VPatch\example.nsi
777
  File ..\Examples\VPatch\oldfile.txt
778
  File ..\Examples\VPatch\newfile.txt
779
  File ..\Examples\VPatch\patch.pat
780
  SetOutPath $INSTDIR\Docs\VPatch
781
  File ..\Docs\VPatch\Readme.html
782
  SetOutPath $INSTDIR\Bin
783
  File ..\Bin\GenPat.exe
784
  SetOutPath $INSTDIR\Include
785
  File ..\Include\VPatchLib.nsh
786
${MementoSectionEnd}
787

    
788
${MementoSectionDone}
789

    
790
SectionGroupEnd
791

    
792
Section -post
793

    
794
  ; When Modern UI is installed:
795
  ; * Always install the English language file
796
  ; * Always install default icons / bitmaps
797

    
798
  ${If} ${SectionIsSelected} ${SecInterfacesModernUI}
799

    
800
    SetDetailsPrint textonly
801
    DetailPrint "Configuring Modern UI..."
802
    SetDetailsPrint listonly
803

    
804
    ${IfNot} ${SectionIsSelected} ${SecLangFiles}
805
      SetOutPath "$INSTDIR\Contrib\Language files"
806
      File "..\Contrib\Language files\English.nlf"
807
      File "..\Contrib\Language files\English.nsh"
808
    ${EndIf}
809

    
810
    ${IfNot} ${SectionIsSelected} ${SecGraphics}
811
      SetOutPath $INSTDIR\Contrib\Graphics\Checks
812
      File "..\Contrib\Graphics\Checks\modern.bmp"
813
      SetOutPath $INSTDIR\Contrib\Graphics\Icons
814
      File "..\Contrib\Graphics\Icons\modern-install.ico"
815
      File "..\Contrib\Graphics\Icons\modern-uninstall.ico"
816
      SetOutPath $INSTDIR\Contrib\Graphics\Header
817
      File "..\Contrib\Graphics\Header\nsis.bmp"
818
      SetOutPath $INSTDIR\Contrib\Graphics\Wizard
819
      File "..\Contrib\Graphics\Wizard\win.bmp"
820
    ${EndIf}
821

    
822
  ${EndIf}
823

    
824
  SetDetailsPrint textonly
825
  DetailPrint "Creating Registry Keys..."
826
  SetDetailsPrint listonly
827

    
828
  SetOutPath $INSTDIR
829

    
830
  WriteRegStr HKLM "Software\NSIS" "" $INSTDIR
831
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
832
  WriteRegDword HKLM "Software\NSIS" "VersionMajor" "${VER_MAJOR}"
833
  WriteRegDword HKLM "Software\NSIS" "VersionMinor" "${VER_MINOR}"
834
  WriteRegDword HKLM "Software\NSIS" "VersionRevision" "${VER_REVISION}"
835
  WriteRegDword HKLM "Software\NSIS" "VersionBuild" "${VER_BUILD}"
836
!endif
837

    
838
  WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst-nsis.exe"'
839
  ;WriteRegStr HKLM "${REG_UNINST_KEY}" "QuietUninstallString" '"$INSTDIR\uninst-nsis.exe" /S' ; Ideally WACK would use this
840
  WriteRegExpandStr HKLM "${REG_UNINST_KEY}" "InstallLocation" "$INSTDIR"
841
  WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayName" "Nullsoft Install System${NAMESUFFIX}"
842
  WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayIcon" "$INSTDIR\uninst-nsis.exe,0"
843
  WriteRegStr HKLM "${REG_UNINST_KEY}" "DisplayVersion" "${VERSION}"
844
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
845
  WriteRegDWORD HKLM "${REG_UNINST_KEY}" "VersionMajor" "${VER_MAJOR}" ; Required by WACK
846
  WriteRegDWORD HKLM "${REG_UNINST_KEY}" "VersionMinor" "${VER_MINOR}" ; Required by WACK
847
!endif
848
  WriteRegStr HKLM "${REG_UNINST_KEY}" "Publisher" "Nullsoft and Contributors" ; Required by WACK
849
  WriteRegStr HKLM "${REG_UNINST_KEY}" "URLInfoAbout" "https://nsis.sourceforge.io/"
850
  WriteRegStr HKLM "${REG_UNINST_KEY}" "HelpLink" "https://nsis.sourceforge.io/Support"
851
  WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoModify" "1"
852
  WriteRegDWORD HKLM "${REG_UNINST_KEY}" "NoRepair" "1"
853
  ${MakeARPInstallDate} $1
854
  WriteRegStr HKLM "${REG_UNINST_KEY}" "InstallDate" $1
855

    
856
  WriteUninstaller $INSTDIR\uninst-nsis.exe
857

    
858
  ${MementoSectionSave}
859

    
860
  SetDetailsPrint both
861

    
862
SectionEnd
863

    
864
;--------------------------------
865
;Descriptions
866

    
867
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
868
  !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "The core files required to use NSIS (compiler etc.)"
869
  !insertmacro MUI_DESCRIPTION_TEXT ${SecExample} "Example installation scripts that show you how to use NSIS"
870
  !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "Adds icons to your start menu and your desktop for easy access"
871
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInterfaces} "User interface designs that can be used to change the installer look and feel"
872
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInterfacesModernUI} "A modern user interface like the wizards of recent Windows versions"
873
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInterfacesDefaultUI} "The default NSIS user interface which you can customize to make your own UI"
874
  !insertmacro MUI_DESCRIPTION_TEXT ${SecInterfacesTinyUI} "A tiny version of the default user interface"
875
  !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} "Tools that help you with NSIS development"
876
  !insertmacro MUI_DESCRIPTION_TEXT ${SecToolsZ2E} "A utility that converts a ZIP file to a NSIS installer"
877
  !insertmacro MUI_DESCRIPTION_TEXT ${SecGraphics} "Icons, checkbox images and other graphics"
878
  !insertmacro MUI_DESCRIPTION_TEXT ${SecLangFiles} "Language files used to support multiple languages in an installer"
879
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsPlugins} "Useful plugins that extend NSIS's functionality"
880
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsBanner} "Plugin that lets you show a banner before installation starts"
881
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsLangDLL} "Plugin that lets you add a language select dialog to your installer"
882
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsnsExec} "Plugin that executes console programs and prints its output in the NSIS log window or hides it"
883
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsSplash} "Splash screen add-on that lets you add a splash screen to an installer"
884
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsSplashT} "Splash screen add-on with transparency support that lets you add a splash screen to an installer"
885
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsSystem} "Plugin that lets you call Win32 API or external DLLs"
886
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsMath} "Plugin that lets you evaluate complicated mathematical expressions"
887
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsDialer} "Plugin that provides internet connection functions"
888
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsIO} "Plugin that lets you add custom pages to an installer"
889
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsDialogs} "Plugin that lets you add custom pages to an installer"
890
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsStartMenu} "Plugin that lets the user select the start menu folder"
891
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsBgImage} "Plugin that lets you show a persistent background image plugin and play sounds"
892
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsUserInfo} "Plugin that that gives you the user name and the user account type"
893
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsNSISDL} "Plugin that lets you create a web based installer"
894
  !insertmacro MUI_DESCRIPTION_TEXT ${SecPluginsVPatch} "Plugin that lets you create patches to upgrade older files"
895
!insertmacro MUI_FUNCTION_DESCRIPTION_END
896

    
897
;--------------------------------
898
;Installer Functions
899

    
900
Function .onInit
901

    
902
  ${MementoSectionRestore}
903

    
904
FunctionEnd
905

    
906
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
907

    
908
Var ReinstallPageCheck
909

    
910
Function PageReinstall
911

    
912
  ReadRegStr $R0 HKLM "Software\NSIS" ""
913
  ReadRegStr $R1 HKLM "${REG_UNINST_KEY}" "UninstallString"
914
  ${IfThen} "$R0$R1" == "" ${|} Abort ${|}
915

    
916
  StrCpy $R4 "older"
917
  ReadRegDWORD $R0 HKLM "Software\NSIS" "VersionMajor"
918
  ReadRegDWORD $R1 HKLM "Software\NSIS" "VersionMinor"
919
  ReadRegDWORD $R2 HKLM "Software\NSIS" "VersionRevision"
920
  ReadRegDWORD $R3 HKLM "Software\NSIS" "VersionBuild"
921
  ${IfThen} $R0 = 0 ${|} StrCpy $R4 "unknown" ${|} ; Anonymous builds have no version number
922
  StrCpy $R0 $R0.$R1.$R2.$R3
923

    
924
  ${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
925
  ${If} $R0 == 0
926
    StrCpy $R1 "NSIS ${VERSION} is already installed. Select the operation you want to perform and click Next to continue."
927
    StrCpy $R2 "Add/Reinstall components"
928
    StrCpy $R3 "Uninstall NSIS"
929
    !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
930
    StrCpy $R0 "2"
931
  ${ElseIf} $R0 == 1
932
    StrCpy $R1 "An $R4 version of NSIS is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
933
    StrCpy $R2 "Uninstall before installing"
934
    StrCpy $R3 "Do not uninstall"
935
    !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install NSIS."
936
    StrCpy $R0 "1"
937
  ${ElseIf} $R0 == 2
938
    StrCpy $R1 "A newer version of NSIS is already installed! It is not recommended that you install an older version. If you really want to install this older version, it's better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
939
    StrCpy $R2 "Uninstall before installing"
940
    StrCpy $R3 "Do not uninstall"
941
    !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install NSIS."
942
    StrCpy $R0 "1"
943
  ${Else}
944
    Abort
945
  ${EndIf}
946

    
947
  nsDialogs::Create 1018
948
  Pop $R4
949

    
950
  ${NSD_CreateLabel} 0 0 100% 24u $R1
951
  Pop $R1
952

    
953
  ${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
954
  Pop $R2
955
  ${NSD_OnClick} $R2 PageReinstallUpdateSelection
956

    
957
  ${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
958
  Pop $R3
959
  ${NSD_OnClick} $R3 PageReinstallUpdateSelection
960

    
961
  ${If} $ReinstallPageCheck != 2
962
    SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
963
  ${Else}
964
    SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
965
  ${EndIf}
966

    
967
  ${NSD_SetFocus} $R2
968

    
969
  nsDialogs::Show
970

    
971
FunctionEnd
972

    
973
Function PageReinstallUpdateSelection
974

    
975
  Pop $R1
976

    
977
  ${NSD_GetState} $R2 $R1
978

    
979
  ${If} $R1 == ${BST_CHECKED}
980
    StrCpy $ReinstallPageCheck 1
981
  ${Else}
982
    StrCpy $ReinstallPageCheck 2
983
  ${EndIf}
984

    
985
FunctionEnd
986

    
987
Function PageLeaveReinstall
988

    
989
  ${NSD_GetState} $R2 $R1
990

    
991
  StrCmp $R0 "1" 0 +2 ; Existing install is not the same version?
992
    StrCmp $R1 "1" reinst_uninstall reinst_done
993

    
994
  StrCmp $R1 "1" reinst_done ; Same version, skip to add/reinstall components?
995

    
996
  reinst_uninstall:
997
  ReadRegStr $R1 HKLM "${REG_UNINST_KEY}" "UninstallString"
998

    
999
  ;Run uninstaller
1000
    HideWindow
1001

    
1002
    ClearErrors
1003
    ExecWait '$R1 _?=$INSTDIR' $0
1004

    
1005
    BringToFront
1006

    
1007
    ${IfThen} ${Errors} ${|} StrCpy $0 2 ${|} ; ExecWait failed, set fake exit code
1008

    
1009
    ${If} $0 <> 0
1010
    ${OrIf} ${FileExists} "$INSTDIR\Bin\makensis.exe"
1011
      ${If} $0 = 1 ; User aborted uninstaller?
1012
        StrCmp $R0 "2" 0 +2 ; Is the existing install the same version?
1013
          Quit ; ...yes, already installed, we are done
1014
        Abort
1015
      ${EndIf}
1016
      MessageBox MB_ICONEXCLAMATION "Unable to uninstall!"
1017
      Abort
1018
    ${Else}
1019
      StrCpy $0 $R1 1
1020
      ${IfThen} $0 == '"' ${|} StrCpy $R1 $R1 -1 1 ${|} ; Strip quotes from UninstallString
1021
      Delete $R1
1022
      RMDir $INSTDIR
1023
    ${EndIf}
1024

    
1025
  reinst_done:
1026

    
1027
FunctionEnd
1028

    
1029
!endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
1030

    
1031
Function ShowReleaseNotes
1032
  StrCpy $0 $WINDIR\hh.exe
1033
  ${IfNotThen} ${FileExists} $0 ${|} SearchPath $0 hh.exe ${|}
1034
  ${If} ${FileExists} $0
1035
    Exec '"$0" mk:@MSITStore:$INSTDIR\NSIS.chm::/SectionF.1.html'
1036
  ${Else}
1037
    ExecShell "" "https://nsis.sourceforge.io/Docs/AppendixF.html#F.1"
1038
  ${EndIf}
1039
FunctionEnd
1040

    
1041
;--------------------------------
1042
;Uninstaller Section
1043

    
1044
Section Uninstall
1045

    
1046
  SetDetailsPrint textonly
1047
  DetailPrint "Uninstalling NSI Development Shell Extensions..."
1048
  SetDetailsPrint listonly
1049

    
1050
  IfFileExists $INSTDIR\Bin\makensis.exe nsis_installed
1051
    MessageBox MB_YESNO "It does not appear that NSIS is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES nsis_installed
1052
    Abort "Uninstall aborted by user"
1053
  nsis_installed:
1054

    
1055
  SetDetailsPrint textonly
1056
  DetailPrint "Deleting Registry Keys..."
1057
  SetDetailsPrint listonly
1058

    
1059
  !macro AssocDeleteFileExtAndProgId _hkey _dotext _pid
1060
  ReadRegStr $R0 ${_hkey} "Software\Classes\${_dotext}" ""
1061
  StrCmp $R0 "${_pid}" 0 +2
1062
    DeleteRegKey ${_hkey} "Software\Classes\${_dotext}"
1063

    
1064
  DeleteRegKey ${_hkey} "Software\Classes\${_pid}"
1065
  !macroend
1066

    
1067
  !insertmacro AssocDeleteFileExtAndProgId HKLM ".nsi" "NSIS.Script"
1068
  !insertmacro AssocDeleteFileExtAndProgId HKLM ".nsh" "NSIS.Header"
1069

    
1070
  ${NotifyShell_AssocChanged}
1071

    
1072
  DeleteRegKey HKLM "${REG_UNINST_KEY}"
1073
  DeleteRegKey HKLM "Software\NSIS"
1074

    
1075
  SetDetailsPrint textonly
1076
  DetailPrint "Deleting Files..."
1077
  SetDetailsPrint listonly
1078

    
1079
  Delete "$SMPROGRAMS\NSIS${NAMESUFFIX}.lnk"
1080
  Delete "$DESKTOP\NSIS${NAMESUFFIX}.lnk"
1081
  Delete $INSTDIR\makensis.exe
1082
  Delete $INSTDIR\makensisw.exe
1083
  Delete $INSTDIR\NSIS.exe
1084
  Delete $INSTDIR\NSIS.exe.manifest
1085
  Delete $INSTDIR\license.txt
1086
  Delete $INSTDIR\COPYING
1087
  Delete $INSTDIR\uninst-nsis.exe
1088
  Delete $INSTDIR\nsisconf.nsi
1089
  Delete $INSTDIR\nsisconf.nsh
1090
  Delete $INSTDIR\NSIS.chm
1091
  RMDir /r $INSTDIR\Bin
1092
  RMDir /r $INSTDIR\Contrib
1093
  RMDir /r $INSTDIR\Docs
1094
  RMDir /r $INSTDIR\Examples
1095
  RMDir /r $INSTDIR\Include
1096
  RMDir /r $INSTDIR\Menu
1097
  RMDir /r $INSTDIR\Plugins
1098
  RMDir /r $INSTDIR\Stubs
1099
  RMDir $INSTDIR
1100

    
1101
  SetDetailsPrint both
1102

    
1103
SectionEnd