forked from SiloDS/RToolDS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Installer.nsi
340 lines (282 loc) · 8.92 KB
/
Installer.nsi
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
; Script generated by the HM NIS Edit Script Wizard.
; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "RToolDS"
!define PRODUCT_VERSION "v0.3.1973"
!define PRODUCT_PUBLISHER "Silo"
!define PRODUCT_WEB_SITE "http://www.advanscene.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\RToolDS.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
SetCompressor lzma
; GetWindowsVersion
;
; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
; Updated by Joost Verburg
;
; Returns on top of stack
;
; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003, Vista)
; or
; '' (Unknown Windows Version)
;
; Usage:
; Call GetWindowsVersion
; Pop $R0
; ; at this point $R0 is "NT 4.0" or whatnot
Function GetWindowsVersion
Push $R0
Push $R1
ClearErrors
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
IfErrors 0 lbl_winnt
; we are not NT
ReadRegStr $R0 HKLM \
"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
StrCpy $R1 $R0 1
StrCmp $R1 '4' 0 lbl_error
StrCpy $R1 $R0 3
StrCmp $R1 '4.0' lbl_win32_95
StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
lbl_win32_95:
StrCpy $R0 '95'
Goto lbl_done
lbl_win32_98:
StrCpy $R0 '98'
Goto lbl_done
lbl_win32_ME:
StrCpy $R0 'ME'
Goto lbl_done
lbl_winnt:
StrCpy $R1 $R0 1
StrCmp $R1 '3' lbl_winnt_x
StrCmp $R1 '4' lbl_winnt_x
StrCpy $R1 $R0 3
StrCmp $R1 '5.0' lbl_winnt_2000
StrCmp $R1 '5.1' lbl_winnt_XP
StrCmp $R1 '5.2' lbl_winnt_2003
StrCmp $R1 '6.0' lbl_winnt_vista lbl_error
lbl_winnt_x:
StrCpy $R0 "NT $R0" 6
Goto lbl_done
lbl_winnt_2000:
Strcpy $R0 '2000'
Goto lbl_done
lbl_winnt_XP:
Strcpy $R0 'XP'
Goto lbl_done
lbl_winnt_2003:
Strcpy $R0 '2003'
Goto lbl_done
lbl_winnt_vista:
Strcpy $R0 'Vista'
Goto lbl_done
lbl_error:
Strcpy $R0 ''
lbl_done:
Pop $R1
Exch $R0
FunctionEnd
; MUI 1.67 compatible ------
!include "MUI.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "License.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\RToolDS.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\ReadMe.txt"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${PRODUCT_NAME}_${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\RToolDS"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite on
File "RToolDS.exe"
CreateDirectory "$SMPROGRAMS\RToolDS"
CreateShortCut "$SMPROGRAMS\RToolDS\RToolDS.lnk" "$INSTDIR\RToolDS.exe"
File "ReadMe.txt"
; File "library.zip"
; File "msvcp90.dll"
; File "MSVCR71.dll"
; File "w9xpopen.exe"
; File "gdiplus.dll"
; File "unrar.dll"
File "Help.htb"
File "API-MS-Win-Core-LocalRegistry-L1-1-0.dll"
File "API-MS-Win-Core-ProcessThreads-L1-1-0.dll"
File "API-MS-Win-Security-Base-L1-1-0.dll"
File "bz2.pyd"
File "gdiplus.dll"
File "KERNELBASE.dll"
File "library.zip"
File "License.txt"
File "Microsoft.VC90.CRT.manifest"
File "msvcp90.dll"
File "msvcr90.dll"
File "PIL._imaging.pyd"
; File "POWRPROF.dll"
File "pyexpat.pyd"
File "pylzma.pyd"
File "python26.dll"
File "pywintypes26.dll"
File "select.pyd"
File "unicodedata.pyd"
File "unrar.dll"
File "w9xpopen.exe"
File "win32api.pyd"
File "wx._controls_.pyd"
File "wx._core_.pyd"
File "wx._gdi_.pyd"
File "wx._gizmos.pyd"
File "wx._html.pyd"
File "wx._misc_.pyd"
File "wx._windows_.pyd"
File "wx._wizard.pyd"
File "wxbase28uh_net_vc.dll"
File "wxbase28uh_vc.dll"
File "wxmsw28uh_adv_vc.dll"
File "wxmsw28uh_core_vc.dll"
File "wxmsw28uh_gizmos_vc.dll"
File "wxmsw28uh_html_vc.dll"
File "_bsddb.pyd"
File "_ctypes.pyd"
File "_hashlib.pyd"
File "_socket.pyd"
File "_ssl.pyd"
Call GetWindowsVersion
Pop $R0
${If} $R0 == "Vista"
Goto vista
${Else}
Goto not_vista
${EndIf}
vista:
CreateDirectory "$APPDATA\RToolDS"
SetOutPath "$APPDATA\RToolDS"
File "RToolDS_Trimmed.dat.new"
File "ADVANsCEne_RToolDS.xml"
Goto go_end
not_vista:
CreateDirectory "$APPDATA\RToolDS"
SetOutPath "$APPDATA\RToolDS"
File "RToolDS_Trimmed.dat.new"
File "ADVANsCEne_RToolDS.xml"
go_end:
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\RToolDS\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\RToolDS\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\RToolDS.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\RToolDS.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "RToolDS was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove RToolDS and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Remove Downloaded Screenshots and Case Graphics?" IDYES next1 IDNO next2
next1:
RMdir /r "$APPDATA\RToolDS\cache\img"
RMdir /r "$APPDATA\RToolDS\cache\nfo"
next2:
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Remove Backed Up Save Games?" IDYES next3 IDNO next4
next3:
RMdir /r "$APPDATA\RToolDS\cache\saves"
next4:
RMdir "$APPDATA\RToolDS\cache"
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\ReadMe.txt"
Delete "$INSTDIR\RToolDS.exe"
Delete "$APPDATA\RToolDS\RToolDS.cfg"
Delete "$APPDATA\RToolDS\ADVANsCEne_RToolDS.xml"
Delete "$APPDATA\RToolDS\RToolDS_Master_List.dat"
Delete "$APPDATA\RToolDS\RToolDS_Tags.dat"
Delete "$APPDATA\RToolDS\RToolDS_Trimmed.dat"
Delete "$APPDATA\RToolDS\RToolDS_Unknown.dat"
Delete "$APPDATA\RToolDS\RToolDS_Trimmed.dat.new"
Delete "$INSTDIR\Help.htb"
Delete "$INSTDIR\API-MS-Win-Core-LocalRegistry-L1-1-0.dll"
Delete "$INSTDIR\API-MS-Win-Core-ProcessThreads-L1-1-0.dll"
Delete "$INSTDIR\API-MS-Win-Security-Base-L1-1-0.dll"
Delete "$INSTDIR\bz2.pyd"
Delete "$INSTDIR\gdiplus.dll"
Delete "$INSTDIR\KERNELBASE.dll"
Delete "$INSTDIR\library.zip"
Delete "$INSTDIR\License.txt"
Delete "$INSTDIR\Microsoft.VC90.CRT.manifest"
Delete "$INSTDIR\msvcp90.dll"
Delete "$INSTDIR\msvcr90.dll"
Delete "$INSTDIR\PIL._imaging.pyd"
; Delete "$INSTDIR\POWRPROF.dll"
Delete "$INSTDIR\pyexpat.pyd"
Delete "$INSTDIR\pylzma.pyd"
Delete "$INSTDIR\python26.dll"
Delete "$INSTDIR\pywintypes26.dll"
Delete "$INSTDIR\select.pyd"
Delete "$INSTDIR\unicodedata.pyd"
Delete "$INSTDIR\unrar.dll"
Delete "$INSTDIR\w9xpopen.exe"
Delete "$INSTDIR\win32api.pyd"
Delete "$INSTDIR\wx._controls_.pyd"
Delete "$INSTDIR\wx._core_.pyd"
Delete "$INSTDIR\wx._gdi_.pyd"
Delete "$INSTDIR\wx._gizmos.pyd"
Delete "$INSTDIR\wx._html.pyd"
Delete "$INSTDIR\wx._misc_.pyd"
Delete "$INSTDIR\wx._windows_.pyd"
Delete "$INSTDIR\wx._wizard.pyd"
Delete "$INSTDIR\wxbase28uh_net_vc.dll"
Delete "$INSTDIR\wxbase28uh_vc.dll"
Delete "$INSTDIR\wxmsw28uh_adv_vc.dll"
Delete "$INSTDIR\wxmsw28uh_core_vc.dll"
Delete "$INSTDIR\wxmsw28uh_gizmos_vc.dll"
Delete "$INSTDIR\wxmsw28uh_html_vc.dll"
Delete "$INSTDIR\_bsddb.pyd"
Delete "$INSTDIR\_ctypes.pyd"
Delete "$INSTDIR\_hashlib.pyd"
Delete "$INSTDIR\_socket.pyd"
Delete "$INSTDIR\_ssl.pyd"
RMDir "$APPDATA\RToolDS"
Delete "$SMPROGRAMS\RToolDS\Uninstall.lnk"
Delete "$SMPROGRAMS\RToolDS\Website.lnk"
Delete "$SMPROGRAMS\RToolDS\RToolDS.lnk"
RMDir "$SMPROGRAMS\RToolDS"
RMDir "$INSTDIR"
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd