forked from clayreimann/CodeHelp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakeInstaller.nsi
More file actions
159 lines (125 loc) · 5.34 KB
/
MakeInstaller.nsi
File metadata and controls
159 lines (125 loc) · 5.34 KB
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
; installer written for NSIS version 2.46
!include MUI2.nsh
!include Library.nsh
Name "Code Help - VB6 IDE Extensions"
Outfile "CodeHelpInstaller.exe"
InstallDir "$ProgramFiles\CodeHelp"
RequestExecutionLevel admin
Function RegisterDotNet
Exch $R0
Push $R1
ReadRegStr $R1 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework" "InstallRoot"
IfFileExists "$R1\v4.0.30319\regasm.exe" FileExists
MessageBox MB_ICONSTOP|MB_OK "Microsoft .NET Framework 4.x was not detected!"
Abort
FileExists:
ExecWait '"$R1\v4.0.30319\regasm.exe" "$R0" /tlb /codebase /silent'
Pop $R1
Pop $R0
FunctionEnd
Function UnregisterDotNet
Exch $R0
Push $R1
ReadRegStr $R1 HKEY_LOCAL_MACHINE "Software\Microsoft\.NETFramework" "InstallRoot"
IfFileExists "$R1\v4.0.30319\regasm.exe" FileExists
MessageBox MB_ICONSTOP|MB_OK "Microsoft .NET Framework 4.x was not detected!"
Abort
FileExists:
ExecWait '"$R1\v4.0.30319\regasm.exe" "$R0" /unregister /silent'
Pop $R1
Pop $R0
FunctionEnd
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
; Install the non-optional components
Section
; create the necessary subdirectories
SetOutPath $InstDir\Interfaces
SetOutPath $InstDir\Plugins
SetOutPath $InstDir
; setup the stuff the CHCore depends on
!insertmacro InstallLib RegDllTlb NotShared NoReboot_Protected \
Interfaces\chlib.tlb $InstDir\Interfaces\CHLib.tlb $SYSDIR
!insertmacro InstallLib RegDllTlb NotShared NoReboot_Protected \
Interfaces\WinApiForVb.tlb $InstDir\Interfaces\WinApiForVb.tlb $SYSDIR
; install CHCore
!insertmacro InstallLib RegDll NotShared NoReboot_Protected \
CHCore\bin\CHGlobalLib.dll $InstDir\CHGlobalLib.dll $SYSDIR
!insertmacro InstallLib RegDll NotShared NoReboot_Protected \
CHCore\bin\CHCore.dll $InstDir\CHCore.dll $SYSDIR
; install the tabs plugin
!insertmacro InstallLib RegDll NotShared NoReboot_Protected \
CHCore\bin\Plugins\CHTabMDI2.dll $InstDir\Plugins\CHTabMDI2.dll $SYSDIR
; tell windows about the uninstaller
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CodeHelp" \
"DisplayName" "Code Help - VB6 IDE Extensions"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\CodeHelp" \
"UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteUninstaller uninstall.exe
SectionEnd
; install the fullscreen plugin
Section "Fullscreen"
SetOutPath $InstDir
!insertmacro InstallLib RegDll NotShared NoReboot_Protected \
CHCore\bin\Plugins\CHFullScreen.dll $InstDir\Plugins\CHFullScreen.dll $SYSDIR
SectionEnd
; install the complexity plugin
Section "Code Complexity"
SetOutPath "$InstDir\3rd Party"
SetOutPath $InstDir
; register antlr and the CodeAnalysis library
File "/oname=3rd Party\Antlr4.Runtime.dll" Plugins\CHCodeComplexity\Antlr4.Runtime.dll
File "/oname=3rd Party\CodeAnalysis.dll" Plugins\CHCodeComplexity\CodeAnalysis.dll
Push "$InstDir\3rd Party\CodeAnalysis.dll"
Call RegisterDotNet
!insertmacro InstallLib RegDll NotShared NoReboot_Protected \
CHCore\bin\Plugins\CHCodeComplexity.dll $InstDir\Plugins\CHCodeComplexity.dll $SYSDIR
SectionEnd
; install the comment plugin
Section "Comment/Uncomment"
SetOutPath $InstDir
; !insertmacro InstallLib RegDll NotShared NoReboot_Protected \
; CHCore\bin\Plugins\CHFullScreen.dll Plugins\CHFullScreen.dll $SYSDIR
SectionEnd
; install the snippets plugin
Section "Snippets"
SetOutPath $InstDir
!insertmacro InstallLib RegDll NotShared NoReboot_Protected \
CHCore\bin\Plugins\CHCoder.dll Plugins\CHCoder.dll $SYSDIR
File "/oname=Plugins\code_templates.mdb" CHCore\bin\Plugins\code_templates.mdb
SectionEnd
; uninstall everything
Section "Uninstall"
Delete $InstDir\uninstall.exe
; remove interfaces
!insertmacro UninstallLib RegDllTlb NotShared NoReboot_Protected $InstDir\Interfaces\CHLib.tlb
!insertmacro UninstallLib RegDllTlb NotShared NoReboot_Protected $InstDir\Interfaces\WinApiForVb.tlb
Delete "$InstDir\Interfaces\CHLib.tlb"
Delete "$InstDir\Interfaces\WinApiForVb.tlb"
RmDir "$InstDir\Interfaces"
; remove CHCore
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\CHCore.dll
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\CHGlobalLib.dll
Delete "$InstDir\CHCore.dll"
Delete "$InstDir\CHGlobalLib.dll"
; remove plugins
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\Plugins\CHTabMDI2.dll
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\Plugins\CHFullScreen.dll
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\Plugins\CHCodeComplexity.dll
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\Plugins\CHCoder.dll
!insertmacro UninstallLib RegDll NotShared NoReboot_Protected $InstDir\Plugins\CHComment.dll
Delete "$InstDir\Plugins\CHTabMDI2.dll"
Delete "$InstDir\Plugins\CHFullScreen.dll"
Delete "$InstDir\Plugins\CHCoder.dll"
Delete "$InstDir\Plugins\CHComment.dll"
Delete "$InstDir\Plugins\CHCodeComplexity.dll"
Delete "$InstDir\Plugins\code_templates.mdb"
RmDir "$InstDir\Plugins"
Delete "$InstDir\3rd Party\Antlr4.Runtime.dll"
Delete "$InstDir\3rd Party\CodeAnalysis.dll"
Delete "$InstDir\3rd Party\CodeAnalysis.tlb"
RmDir "$InstDir\3rd Party"
SectionEnd