-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.nsi
More file actions
291 lines (250 loc) · 10.2 KB
/
Setup.nsi
File metadata and controls
291 lines (250 loc) · 10.2 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
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
/*
HM NIS Edit (c) 2003 Héctor Mauricio Rodríguez Segura <ranametal@users.sourceforge.net>
For conditions of distribution and use, see license.txt
Installation script
*/
; Helper defines
!define APP_NAME "HM NIS Edit"
!define APP_VERSION "2.0b5"
!define APP_HOME_PAGE "http://hmne.sourceforge.net/"
!include "MUI.nsh"
SetCompressor lzma
########## MUI Settings ##########
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\classic-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\classic-uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
########## Pages ##########
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$INSTDIR\nisedit.exe"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
########## Languages ##########
!insertmacro MUI_LANGUAGE "Spanish"
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "Polish"
!insertmacro MUI_LANGUAGE "French"
!insertmacro MUI_LANGUAGE "Czech"
!insertmacro MUI_LANGUAGE "Italian"
!insertmacro MUI_LANGUAGE "Russian"
!insertmacro MUI_LANGUAGE "German"
!insertmacro MUI_LANGUAGE "Greek"
!insertmacro MUI_LANGUAGE "TradChinese"
!insertmacro MUI_LANGUAGE "SimpChinese"
!insertmacro MUI_LANGUAGE "Ukrainian"
!insertmacro MUI_LANGUAGE "PortugueseBR"
!insertmacro MUI_LANGUAGE "Korean"
!insertmacro MUI_LANGUAGE "Hungarian"
;-------------------------------------------------------------------------
; Undef this if you dont have UPX upx.sourceforge.net
!define HAVE_UPX
!ifdef HAVE_UPX
!packhdr tmpexe.tmp "UPX -9 -q --compress-icons=0 tmpexe.tmp"
!endif
Name "${APP_NAME} ${APP_VERSION}"
OutFile "..\nisedit${APP_VERSION}.exe"
InstallDir "$PROGRAMFILES\HMSoft\NIS Edit"
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\NISEdit.exe" ""
ShowInstDetails show
ShowUnInstDetails show
; Languaje files
LangString LANGFILE ${LANG_SPANISH} "Español"
LangString LANGFILE ${LANG_ENGLISH} "English"
LangString LANGFILE ${LANG_POLISH} "Polski"
LangString LANGFILE ${LANG_FRENCH} "French"
LangString LANGFILE ${LANG_CZECH} "Czech"
LangString LANGFILE ${LANG_ITALIAN} "Italiano"
LangString LANGFILE ${LANG_RUSSIAN} "Russian"
LangString LANGFILE ${LANG_GERMAN} "German"
LangString LANGFILE ${LANG_GREEK} "Greek"
LangString LANGFILE ${LANG_TRADCHINESE} "Chinese_Traditional"
LangString LANGFILE ${LANG_SIMPCHINESE} "Chinese_Simplified"
LangString LANGFILE ${LANG_UKRAINIAN} "Ukrainian"
LangString LANGFILE ${LANG_PORTUGUESEBR} "Portuguese_Brazil"
LangString LANGFILE ${LANG_KOREAN} "Korean"
LangString LANGFILE ${LANG_HUNGARIAN} "Hungarian"
;--------------------------------------------------------------
Function .onInit
!insertmacro MUI_LANGDLL_DISPLAY
FunctionEnd
!define MAX_MRU_ITEMS 9
var C
Function _AddToMRU
Pop $R1 ; File to add to the MRU
StrCpy $C 0 ; Clear variable
loopbegin:
IntOp $C $C + 1
ifFileExists "$INSTDIR\nisedit.ini" 0 +3
ReadIniStr $R0 "$INSTDIR\nisedit.ini" "Recent" "MRU$C"
Goto +2
ReadRegStr $R0 HKCU "Software\HM Software\Nis Edit\Recent" "MRU$C"
StrCmp $R0 "" loopend
StrCmp $R0 $R1 end ; File aready in the MRU
Goto loopbegin
loopend:
IntCmp $C ${MAX_MRU_ITEMS} 0 0 end ; MRU full
ifFileExists "$INSTDIR\nisedit.ini" 0 +3
WriteIniStr "$INSTDIR\nisedit.ini" "Recent" "MRU$C" "$R1"
Goto end
WriteRegStr HKCU "Software\HM Software\Nis Edit\Recent" "MRU$C" "$R1"
end:
FunctionEnd
!macro AddToMRU FILE_NAME
Push "${FILE_NAME}"
Call _AddToMRU
!macroend
Section "-" SEC01
; Si se instala sobre la versión anterior se hacen las modificaciones respectivas
Delete $INSTDIR\Default.lng
Delete $INSTDIR\English.lng
Delete $INSTDIR\Ejemplo\Lic.txt
Delete $INSTDIR\Ejemplo\App.hlp
Delete $INSTDIR\Ejemplo\App.exe
RmDir $INSTDIR\Ejemplo
Delete "$INSTDIR\CmpParsing.ini"
Delete "$INSTDIR\CmpParsing-French.ini"
Delete "$INSTDIR\HelpIndex.ini"
Delete "$INSTDIR\NSIS.syn"
SetOverwrite try
SetOutPath "$INSTDIR"
File "NISEdit.exe"
CreateShortCut "$DESKTOP\HM NIS Edit.lnk" "$INSTDIR\NISEdit.exe"
File "Setup.nsi"
File "License.txt"
File "Header.bmp"
File "TIPS.txt"
SetOverWrite off
File "Templates.dat"
; Language files
SetOverwrite on
SetOutPath "$INSTDIR\Lang"
File "Lang\Español.lng"
File "Lang\English.lng"
File "Lang\Polski.lng"
File "Lang\French.lng"
File "Lang\Czech.lng"
File "Lang\Italiano.lng"
File "Lang\Russian.lng"
File "Lang\German.lng"
File "Lang\Greek.lng"
File "Lang\Chinese_Traditional.lng"
File "Lang\Chinese_Simplified.lng"
File "Lang\Ukrainian.lng"
File "Lang\Portuguese_Brazil.lng"
File "Lang\Korean.lng"
File "Lang\Hungarian.lng"
; Configuration files
SetOutPath "$INSTDIR\Config"
File "Config\Syntax.ini"
File "Config\IOCtrlFlags.ini"
File "Config\HelpIndex.ini"
File "Config\CmpParsing.ini"
File "Config\CmpParsing-French.ini" ; <-- Para que amigos de Francia estén contentos :)
; Plugins
SetOutPath "$INSTDIR\Plugins"
; << Install some plugins >>
SetOutPath "$INSTDIR\Plugins\ExDll\Delphi"
File "Plugins\ExDll\Delphi\hmne_sample.dpr"
File "Plugins\ExDll\Delphi\hmne_sample.dof"
File "Source\PluginsInt.pas"
SetOutPath "$INSTDIR\Plugins\ExDll\C"
File "Plugins\ExDll\C\hmne_sample.dev"
File "Plugins\ExDll\C\hmne_sample.c"
File "Plugins\ExDll\C\PluginsInt.h"
ifFileExists "$INSTDIR\nisedit.ini" 0 +4
WriteIniStr "$INSTDIR\nisedit.ini" "Options" "Language" "$(LANGFILE)"
WriteIniStr "$INSTDIR\nisedit.ini" "Options" "IntallLanguage" "$LANGUAGE"
Goto +3
WriteRegStr HKCU "Software\HM Software\Nis Edit\Options" "Language" "$(LANGFILE)"
WriteRegStr HKCU "Software\HM Software\Nis Edit\Options" "IntallLanguage" "$LANGUAGE"
!insertmacro AddToMRU "$INSTDIR\Setup.nsi"
!insertmacro AddToMRU "$INSTDIR\TIPS.txt"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\NISEdit.exe" "" "$INSTDIR\NISEdit.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "DisplayName" "$(^Name)"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "DisplayIcon" "$INSTDIR\NISEdit.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "DisplayVersion" "${APP_VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "URLUpdateInfo" "${APP_HOME_PAGE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "URLInfoAbout" "${APP_HOME_PAGE}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "InstallSource" "$EXEDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "Publisher" "Hector Maurcio Rodriguez Segura"
WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "NoModifiy" 1
WriteRegDWord HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit" "NoRepair" 1
WriteRegStr HKCR "NSISFile\shell\HMNISEdit" "" "Edit with HM NIS Edit"
WriteRegStr HKCR "NSISFile\shell\HMNISEdit\command" "" '$INSTDIR\NISEdit.exe "%1"'
WriteRegStr HKCR "NSHFile\shell\HMNISEdit" "" "Edit with HM NIS Edit"
WriteRegStr HKCR "NSHFile\shell\HMNISEdit\command" "" '$INSTDIR\NISEdit.exe "%1"'
SectionEnd
############################################################################################
; Desinstalador ;
############################################################################################
Function un.onInit
FindWindow $R0 "THMNISEdit2_MainWindowClass"
IsWindow $R0 0 +3
MessageBox MB_ICONEXCLAMATION|MB_OK "Before uninstall HM NIS Edit you must close it."
Abort
ifFileExists "$INSTDIR\nisedit.ini" 0 +3
ReadIniStr $LANGUAGE "$INSTDIR\nisedit.ini" "Options" "IntallLanguage"
Goto +2
ReadRegStr $LANGUAGE HKCU "Software\HM Software\Nis Edit\Options" "IntallLanguage"
FunctionEnd
Section Uninstall
Delete "$INSTDIR\NISEdit.exe"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\Setup.nsi"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\Header.bmp"
Delete "$INSTDIR\Templates.dat"
Delete "$INSTDIR\TIPS.txt"
Delete "$INSTDIR\nisedit.ini"
Delete "$INSTDIR\Config\HelpIndex.ini"
Delete "$INSTDIR\Config\Syntax.ini"
Delete "$INSTDIR\Config\CmpParsing.ini"
Delete "$INSTDIR\Config\CmpParsing-French.ini"
Delete "$INSTDIR\Config\IOCtrlFlags.ini"
Delete "$INSTDIR\Lang\Español.lng"
Delete "$INSTDIR\Lang\English.lng"
Delete "$INSTDIR\Lang\Polski.lng"
Delete "$INSTDIR\Lang\French.lng"
Delete "$INSTDIR\Lang\Czech.lng"
Delete "$INSTDIR\Lang\Italiano.lng"
Delete "$INSTDIR\Lang\Russian.lng"
Delete "$INSTDIR\Lang\German.lng"
Delete "$INSTDIR\Lang\Greek.lng"
Delete "$INSTDIR\Lang\Chinese_Traditional.lng"
Delete "$INSTDIR\Lang\Chinese_Simplified.lng"
Delete "$INSTDIR\Lang\Ukrainian.lng"
Delete "$INSTDIR\Lang\Portuguese_Brazil.lng"
Delete "$INSTDIR\Lang\Korean.lng"
Delete "$INSTDIR\Lang\Hungarian.lng"
Delete "$INSTDIR\Plugins\ExDll\Delphi\hmne_sample.dpr"
Delete "$INSTDIR\Plugins\ExDll\Delphi\hmne_sample.dof"
Delete "$INSTDIR\Plugins\ExDll\Delphi\PluginsInt.pas"
Delete "$INSTDIR\Plugins\ExDll\C\hmne_sample.dev"
Delete "$INSTDIR\Plugins\ExDll\C\hmne_sample.c"
Delete "$INSTDIR\Plugins\ExDll\C\PluginsInt.h"
Delete "$DESKTOP\HM NIS Edit.lnk"
RMDir "$INSTDIR\Plugins\ExDll\Delphi"
RMDir "$INSTDIR\Plugins\ExDll\C"
RMDir "$INSTDIR\Plugins\ExDll"
RMDir "$INSTDIR\Plugins"
RMDir "$INSTDIR\Config"
RMDir "$INSTDIR\Lang"
RMDir "$INSTDIR"
DeleteRegKey HKCU "Software\HM Software\Nis Edit"
DeleteRegKey /ifempty HKCU "Software\HM Software"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\HM NIS Edit"
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\NISEdit.exe"
DeleteRegKey HKCR "NSISFile\shell\HMNISEdit"
DeleteRegKey HKCR "NSHFile\shell\HMNISEdit"
SetAutoClose false
SectionEnd