This file is indexed.

/usr/share/doc/nsis/Examples/FileFuncTest.nsi is in nsis-doc 2.50-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
;_____________________________________________________________________________
;
;                          File Functions Test
;_____________________________________________________________________________
;
; 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)

Name "File Functions Test"
OutFile "FileFuncTest.exe"
Caption "$(^Name)"
ShowInstDetails show
XPStyle on
RequestExecutionLevel user

Var FUNCTION
Var OUT1
Var OUT2
Var OUT3
Var OUT4
Var OUT5
Var OUT6
Var OUT7

!include "FileFunc.nsh"
!include "LogicLib.nsh"

;############### INSTALL ###############

!define StackVerificationStart `!insertmacro StackVerificationStart`
!macro StackVerificationStart _FUNCTION
	StrCpy $FUNCTION ${_FUNCTION}
	Call StackVerificationStart
!macroend

!define StackVerificationEnd `!insertmacro StackVerificationEnd`
!macro StackVerificationEnd
	Call StackVerificationEnd
!macroend

Function StackVerificationStart
	StrCpy $0 !0
	StrCpy $1 !1
	StrCpy $2 !2
	StrCpy $3 !3
	StrCpy $4 !4
	StrCpy $5 !5
	StrCpy $6 !6
	StrCpy $7 !7
	StrCpy $8 !8
	StrCpy $9 !9
	StrCpy $R0 !R0
	StrCpy $R1 !R1
	StrCpy $R2 !R2
	StrCpy $R3 !R3
	StrCpy $R4 !R4
	StrCpy $R5 !R5
	StrCpy $R6 !R6
	StrCpy $R7 !R7
	StrCpy $R8 !R8
	StrCpy $R9 !R9
FunctionEnd

Function StackVerificationEnd
	IfErrors +3
	DetailPrint 'PASSED $FUNCTION no errors'
	goto +2
	DetailPrint 'FAILED   $FUNCTION error'

	StrCmp $0 '!0' 0 error
	StrCmp $1 '!1' 0 error
	StrCmp $2 '!2' 0 error
	StrCmp $3 '!3' 0 error
	StrCmp $4 '!4' 0 error
	StrCmp $5 '!5' 0 error
	StrCmp $6 '!6' 0 error
	StrCmp $7 '!7' 0 error
	StrCmp $8 '!8' 0 error
	StrCmp $9 '!9' 0 error
	StrCmp $R0 '!R0' 0 error
	StrCmp $R1 '!R1' 0 error
	StrCmp $R2 '!R2' 0 error
	StrCmp $R3 '!R3' 0 error
	StrCmp $R4 '!R4' 0 error
	StrCmp $R5 '!R5' 0 error
	StrCmp $R6 '!R6' 0 error
	StrCmp $R7 '!R7' 0 error
	StrCmp $R8 '!R8' 0 error
	StrCmp $R9 '!R9' 0 error
	DetailPrint 'PASSED $FUNCTION stack'
	goto end

	error:
	DetailPrint 'FAILED   $FUNCTION stack'
;	MessageBox MB_OKCANCEL '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}' IDOK +2
;	quit

	end:
FunctionEnd



Section Locate
	${StackVerificationStart} Locate

	${Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'LocateCallback'

	${StackVerificationEnd}
SectionEnd

Function LocateCallback
;	MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
;	StrCpy $0 StopLocate

	Push $0
FunctionEnd


Section GetSize
	${StackVerificationStart} GetSize

	${GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3

	${StackVerificationEnd}
SectionEnd


Section DriveSpace
	${StackVerificationStart} DriveSpace

	${DriveSpace} 'C:\' '/D=F /S=M' $OUT1

	${StackVerificationEnd}
SectionEnd


Section GetDrives
	${StackVerificationStart} GetDrives

	${GetDrives} 'FDD+CDROM' 'GetDrivesCallback'

	${StackVerificationEnd}
SectionEnd

Function GetDrivesCallback
;	MessageBox MB_YESNO '$$0={$0}$\n$$1={$1}$\n$$2={$2}$\n$$3={$3}$\n$$4={$4}$\n$$5={$5}$\n$$6={$6}$\n$$7={$7}$\n$$8={$8}$\n$$9={$9}$\n$$R0={$R0}$\n$$R1={$R1}$\n$$R2={$R2}$\n$$R3={$R3}$\n$$R4={$R4}$\n$$R5={$R5}$\n$$R6={$R6}$\n$$R7={$R7}$\n$$R8={$R8}$\n$$R9={$R9}$\n$\nContinue?' IDYES +2
;	StrCpy $0 StopGetDrives

	Push $0
FunctionEnd


Section GetTime
	${StackVerificationStart} GetTime

	${GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7

	${StackVerificationEnd}
SectionEnd


Section GetFileAttributes
	${StackVerificationStart} GetFileAttributes

	${GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1

	${StackVerificationEnd}
SectionEnd


Section GetFileVersion
	${StackVerificationStart} GetFileVersion

	${GetFileVersion} '$WINDIR\explorer.exe' $OUT1

	${StackVerificationEnd}
SectionEnd


Section GetExeName
	${StackVerificationStart} GetExeName

	${GetExeName} $OUT1

	${StackVerificationEnd}
SectionEnd


Section GetExePath
	${StackVerificationStart} GetExePath

	${GetExePath} $OUT1

	${StackVerificationEnd}
SectionEnd


Section GetParameters
	${StackVerificationStart} GetParameters

	# basic stuff

	StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe"'
	${GetParameters} $OUT1
	StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" test'
	${GetParameters} $OUT2
	StrCpy $CMDLINE '"$PROGRAMFILES\Something\Hello.exe" "test"'
	${GetParameters} $OUT3
	StrCpy $CMDLINE 'C:\Hello.exe'
	${GetParameters} $OUT4
	StrCpy $CMDLINE 'C:\Hello.exe test'
	${GetParameters} $OUT5
	StrCpy $CMDLINE 'C:\Hello.exe "test"'
	${GetParameters} $OUT6
	StrCpy $CMDLINE 'C:\Hello.exe       test test  '
	${GetParameters} $OUT7

	${If} $OUT1 != ""
	${OrIf} $OUT2 != "test"
	${OrIf} $OUT3 != '"test"'
	${OrIf} $OUT4 != ""
	${OrIf} $OUT5 != "test"
	${OrIf} $OUT6 != '"test"'
	${OrIf} $OUT7 != 'test test'
		SetErrors
	${EndIf}

	# some corner cases

	StrCpy $CMDLINE ''
	${GetParameters} $OUT1
	StrCpy $CMDLINE '"'
	${GetParameters} $OUT2
	StrCpy $CMDLINE '""'
	${GetParameters} $OUT3
	StrCpy $CMDLINE '"" test'
	${GetParameters} $OUT4
	StrCpy $CMDLINE ' test'
	${GetParameters} $OUT5
	StrCpy $CMDLINE '  test' # left over bug(?) from old GetParameters
	                         # it starts looking for ' ' from the third char
	${GetParameters} $OUT6
	StrCpy $CMDLINE ' '
	${GetParameters} $OUT7

	${If} $OUT1 != ""
	${OrIf} $OUT2 != ""
	${OrIf} $OUT3 != ""
	${OrIf} $OUT4 != ""
	${OrIf} $OUT5 != ""
	${OrIf} $OUT6 != ""
	${OrIf} $OUT7 != ""
		SetErrors
	${EndIf}

	${StackVerificationEnd}
SectionEnd


Section GetOptions
	${StackVerificationStart} GetOptions

	${GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
	StrCmp $OUT1 'C:\Program Files\Common Files' 0 error

	${GetOptions} '-TMP=temp.tmp -INSTDIR="C:/Program Files/Common Files" -SILENT=yes' '-INSTDIR=' $OUT1
	StrCmp $OUT1 'C:/Program Files/Common Files' 0 error

	${GetOptions} "/INSTDIR='C:/Program Files/Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
	StrCmp $OUT1 'C:/Program Files/Common Files' 0 error

	StrCpy $OUT1 '/INSTDIR=`C:/Program Files/Common Files` /SILENT=yes'
	${GetOptions} '$OUT1' '/INSTDIR=' $OUT1
	StrCmp $OUT1 'C:/Program Files/Common Files' 0 error

	${GetOptions} '/SILENT=yes /INSTDIR=C:\Program Files\Common Files' '/INSTDIR=' $OUT1
	StrCmp $OUT1 'C:\Program Files\Common Files' 0 error

	${GetOptions} "/INSTDIR=common directory: 'C:\Program Files\Common Files' /SILENT=yes" '/INSTDIR=' $OUT1
	StrCmp $OUT1 "common directory: 'C:\Program Files\Common Files'" 0 error

	${GetOptions} '/INSTDIR=WxxxW /SILENT=yes' '/INSTDIR=' $OUT1
	StrCmp $OUT1 'WxxxW' 0 error

	${GetOptions} "/Prm='/D=True' /D=1" '/D=' $OUT1
	StrCmp $OUT1 "1" 0 error

	${GetOptions} "/D=1 /Prm='/D=True'" '/Prm=' $OUT1
	StrCmp $OUT1 "/D=True" 0 error

	${GetOptions} `/D=1 /Prm='/D="True" /S="/Temp"'` '/Prm=' $OUT1
	StrCmp $OUT1 '/D="True" /S="/Temp"' 0 error

	${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR=' $OUT1
	StrCmp $OUT1 '"C:/Program Files/Common Files"' 0 error

	${GetOptions} `/INSTDIR='"C:/Program Files/Common Files"' /SILENT=yes` '/INSTDIR*=' $OUT1
	IfErrors 0 error
	StrCmp $OUT1 '' 0 error

	${GetOptions} `/INSTDIR="C:/Program Files/Common Files" /SILENT=yes` '' $OUT1
	IfErrors 0 error
	StrCmp $OUT1 '' 0 error

	${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT' '/SILENT' $OUT1
	IfErrors error
	StrCmp $OUT1 '' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section GetOptionsS
	${StackVerificationStart} GetOptionsS

	${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
	IfErrors error
	StrCmp $OUT1 'C:\Program Files\Common Files' 0 error

	${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/Instdir=' $OUT1
	IfErrors 0 error
	StrCmp $OUT1 '' 0 error

	${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT' '/SILENT' $OUT1
	IfErrors error
	StrCmp $OUT1 '' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section GetRoot
	${StackVerificationStart} GetRoot

	${GetRoot} 'C:\Program Files\NSIS' $OUT1
	StrCmp $OUT1 'C:' 0 error

	${GetRoot} '\\SuperPimp\NSIS\Source\exehead\Ui.c' $OUT1
	StrCmp $OUT1 '\\SuperPimp\NSIS' 0 error

	${GetRoot} '\\Program Files\NSIS' $OUT1
	StrCmp $OUT1 '\\Program Files\NSIS' 0 error

	${GetRoot} '\\Program Files\NSIS\' $OUT1
	StrCmp $OUT1 '\\Program Files\NSIS' 0 error

	${GetRoot} '\\Program Files\NSIS\Source\exehead\Ui.c' $OUT1
	StrCmp $OUT1 '\\Program Files\NSIS' 0 error

	${GetRoot} '\Program Files\NSIS' $OUT1
	StrCmp $OUT1 '' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section GetParent
	${StackVerificationStart} GetParent

	${GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	StrCmp $OUT1 'C:\Program Files\Winamp' 0 error

	${GetParent} 'C:\Program Files\Winamp\plugins' $OUT1
	StrCmp $OUT1 'C:\Program Files\Winamp' 0 error

	${GetParent} 'C:\Program Files\Winamp\plugins\' $OUT1
	StrCmp $OUT1 'C:\Program Files\Winamp' 0 error

	${GetParent} 'C:\' $OUT1
	StrCmp $OUT1 '' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section GetFileName
	${StackVerificationStart} GetFileName

	${GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	StrCmp $OUT1 'uninstwa.exe' 0 error

	${GetFileName} 'uninstwa.exe' $OUT1
	StrCmp $OUT1 'uninstwa.exe' 0 error

	${GetFileName} 'C:\Program Files\Winamp\plugins' $OUT1
	StrCmp $OUT1 'plugins' 0 error

	${GetFileName} 'C:\Program Files\Winamp\plugins\' $OUT1
	StrCmp $OUT1 'plugins' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section GetBaseName
	${StackVerificationStart} GetBaseName

	${GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	StrCmp $OUT1 'uninstwa' 0 error

	${GetBaseName} 'uninstwa.exe' $OUT1
	StrCmp $OUT1 'uninstwa' 0 error

	${GetBaseName} 'C:\Program Files\Winamp\plugins' $OUT1
	StrCmp $OUT1 'plugins' 0 error

	${GetBaseName} 'C:\Program Files\Winamp\plugins\' $OUT1
	StrCmp $OUT1 '' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section GetFileExt
	${StackVerificationStart} GetFileExt

	${GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	StrCmp $OUT1 'exe' 0 error

	${GetFileExt} 'uninstwa.exe' $OUT1
	StrCmp $OUT1 'exe' 0 error

	${GetFileExt} 'C:\Program Files\Winamp\plugins' $OUT1
	StrCmp $OUT1 '' 0 error

	${GetFileExt} 'C:\Program Files\Winamp\plugins\' $OUT1
	StrCmp $OUT1 '' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section BannerTrimPath
	${StackVerificationStart} BannerTrimPath

	${BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
	StrCmp $OUT1 'C:\Server\...\Terminal\license.htm' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '3A' $OUT1
	StrCmp $OUT1 '' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '4A' $OUT1
	StrCmp $OUT1 'C...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '11A' $OUT1
	StrCmp $OUT1 'C:\12\...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '13A' $OUT1
	StrCmp $OUT1 'C:\12\...\789' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
	StrCmp $OUT1 'C:\12\3456\789' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '14A' $OUT1
	StrCmp $OUT1 'C:\12\3456\789' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '11B' $OUT1
	StrCmp $OUT1 'C:\12\...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
	StrCmp $OUT1 'C:...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '5B' $OUT1
	StrCmp $OUT1 'C:...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '11C' $OUT1
	StrCmp $OUT1 'C:\12\34...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '9D' $OUT1
	StrCmp $OUT1 'C:\12\...' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '10D' $OUT1
	StrCmp $OUT1 'C:\...\789' 0 error

	${BannerTrimPath} 'C:\12\3456\789' '11D' $OUT1
	StrCmp $OUT1 'C:\1...\789' 0 error

	${BannerTrimPath} '123456789' '5D' $OUT1
	StrCmp $OUT1 '12...' 0 error

	goto +2
	error:
	SetErrors

	${StackVerificationEnd}
SectionEnd


Section DirState
	${StackVerificationStart} DirState

	${DirState} '$TEMP' $OUT1

	${StackVerificationEnd}
SectionEnd


Section RefreshShellIcons
	${StackVerificationStart} RefreshShellIcons

	${RefreshShellIcons}

	${StackVerificationEnd}
SectionEnd


Section WriteUninstaller
	goto +2
	WriteUninstaller '$EXEDIR\un.FileFuncTest.exe'
SectionEnd



;############### UNINSTALL ###############

Section un.Uninstall
	${Locate} '$DOCUMENTS' '/L=FD /M=*.* /S=0B /G=0' 'un.LocateCallback'
	${GetSize} '$WINDIR' '/M=Explorer.exe /S=0K /G=0' $OUT1 $OUT2 $OUT3
	${DriveSpace} 'C:\' '/D=F /S=M' $OUT1
	${GetDrives} 'FDD+CDROM' 'un.GetDrivesCallback'
	${GetTime} '' 'L' $OUT1 $OUT2 $OUT3 $OUT4 $OUT5 $OUT6 $OUT7
	${GetFileAttributes} '$WINDIR\explorer.exe' 'ALL' $OUT1
	${GetFileVersion} '$WINDIR\explorer.exe' $OUT1
	${GetExeName} $OUT1
	${GetExePath} $OUT1
	${GetParameters} $OUT1
	${GetOptions} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
	${GetOptionsS} '/INSTDIR=C:\Program Files\Common Files /SILENT=yes' '/INSTDIR=' $OUT1
	${GetRoot} 'C:\Program Files\NSIS' $OUT1
	${GetParent} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	${GetFileName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	${GetBaseName} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	${GetFileExt} 'C:\Program Files\Winamp\uninstwa.exe' $OUT1
	${BannerTrimPath} 'C:\Server\Documents\Terminal\license.htm' '35A' $OUT1
	${DirState} '$TEMP' $OUT1
	${RefreshShellIcons}
SectionEnd

Function un.LocateCallback
	Push $0
FunctionEnd

Function un.GetDrivesCallback
	Push $0
FunctionEnd