Statistiques
| Révision :

root / tmp / org.txm.setups / nsis / Include / FileFunc.nsh @ 3136

Historique | Voir | Annoter | Télécharger (39,55 ko)

1
/*
2
_____________________________________________________________________________
3

    
4
                       File Functions Header v3.4
5
_____________________________________________________________________________
6

    
7
 2006 Shengalts Aleksander aka Instructor (Shengalts@mail.ru)
8

    
9
 See documentation for more information about the following functions.
10

    
11
 Usage in script:
12
 1. !include "FileFunc.nsh"
13
 2. [Section|Function]
14
      ${FileFunction} "Param1" "Param2" "..." $var
15
    [SectionEnd|FunctionEnd]
16

    
17

    
18
 FileFunction=[Locate|GetSize|DriveSpace|GetDrives|GetTime|GetFileAttributes|
19
               GetFileVersion|GetExeName|GetExePath|GetParameters|GetOptions|
20
               GetOptionsS|GetRoot|GetParent|GetFileName|GetBaseName|GetFileExt|
21
               BannerTrimPath|DirState|RefreshShellIcons]
22

    
23
_____________________________________________________________________________
24

    
25
                       Thanks to:
26
_____________________________________________________________________________
27

    
28
GetSize
29
	KiCHiK (Function "FindFiles")
30
DriveSpace
31
	sunjammer (Function "CheckSpaceFree")
32
GetDrives
33
	deguix (Based on his idea of Function "DetectDrives")
34
GetTime
35
	Takhir (Script "StatTest") and deguix (Function "FileModifiedDate")
36
GetFileVersion
37
	KiCHiK (Based on his example for command "GetDLLVersion")
38
GetParameters
39
	sunjammer (Based on his Function "GetParameters")
40
GetRoot
41
	KiCHiK (Based on his Function "GetRoot")
42
GetParent
43
	sunjammer (Based on his Function "GetParent")
44
GetFileName
45
	KiCHiK (Based on his Function "GetFileName")
46
GetBaseName
47
	comperio (Based on his idea of Function "GetBaseName")
48
GetFileExt
49
	opher (author)
50
RefreshShellIcons
51
	jerome tremblay (author)
52
*/
53

    
54

    
55
;_____________________________________________________________________________
56
;
57
;                         Macros
58
;_____________________________________________________________________________
59
;
60
; Change log window verbosity (default: 3=no script)
61
;
62
; Example:
63
; !include "FileFunc.nsh"
64
; !insertmacro Locate
65
; ${FILEFUNC_VERBOSE} 4   # all verbosity
66
; !insertmacro VersionCompare
67
; ${FILEFUNC_VERBOSE} 3   # no script
68

    
69
!ifndef FILEFUNC_INCLUDED
70

    
71
!verbose push 3
72
!define /IfNDef _FILEFUNC_VERBOSE 3
73
!verbose ${_FILEFUNC_VERBOSE}
74
!define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
75

    
76
!define FILEFUNC_INCLUDED
77

    
78
!include Util.nsh
79

    
80

    
81
!macro FILEFUNC_VERBOSE _VERBOSE
82
	!verbose push 3
83
	!define /ReDef _FILEFUNC_VERBOSE ${_VERBOSE}
84
	!verbose pop
85
!macroend
86

    
87
!macro LocateCall _PATH _OPTIONS _FUNC
88
	!verbose push
89
	!verbose ${_FILEFUNC_VERBOSE}
90
	Push $0
91
	Push `${_PATH}`
92
	Push `${_OPTIONS}`
93
	GetFunctionAddress $0 `${_FUNC}`
94
	Push `$0`
95
	${CallArtificialFunction} Locate_
96
	Pop $0
97
	!verbose pop
98
!macroend
99

    
100
!macro GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
101
	!verbose push
102
	!verbose ${_FILEFUNC_VERBOSE}
103
	Push `${_PATH}`
104
	Push `${_OPTIONS}`
105
	${CallArtificialFunction} GetSize_
106
	Pop ${_RESULT1}
107
	Pop ${_RESULT2}
108
	Pop ${_RESULT3}
109
	!verbose pop
110
!macroend
111

    
112
!macro DriveSpaceCall _DRIVE _OPTIONS _RESULT
113
	!verbose push
114
	!verbose ${_FILEFUNC_VERBOSE}
115
	Push `${_DRIVE}`
116
	Push `${_OPTIONS}`
117
	${CallArtificialFunction} DriveSpace_
118
	Pop ${_RESULT}
119
	!verbose pop
120
!macroend
121

    
122
!macro GetDrivesCall _DRV _FUNC
123
	!verbose push
124
	!verbose ${_FILEFUNC_VERBOSE}
125
	Push $0
126
	Push `${_DRV}`
127
	GetFunctionAddress $0 `${_FUNC}`
128
	Push `$0`
129
	${CallArtificialFunction} GetDrives_
130
	Pop $0
131
	!verbose pop
132
!macroend
133

    
134
!macro GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
135
	!verbose push
136
	!verbose ${_FILEFUNC_VERBOSE}
137
	Push `${_FILE}`
138
	Push `${_OPTION}`
139
	${CallArtificialFunction} GetTime_
140
	Pop ${_RESULT1}
141
	Pop ${_RESULT2}
142
	Pop ${_RESULT3}
143
	Pop ${_RESULT4}
144
	Pop ${_RESULT5}
145
	Pop ${_RESULT6}
146
	Pop ${_RESULT7}
147
	!verbose pop
148
!macroend
149

    
150
!macro GetFileAttributesCall _PATH _ATTR _RESULT
151
	!verbose push
152
	!verbose ${_FILEFUNC_VERBOSE}
153
	Push `${_PATH}`
154
	Push `${_ATTR}`
155
	${CallArtificialFunction} GetFileAttributes_
156
	Pop ${_RESULT}
157
	!verbose pop
158
!macroend
159

    
160
!macro GetFileVersionCall _FILE _RESULT
161
	!verbose push
162
	!verbose ${_FILEFUNC_VERBOSE}
163
	Push `${_FILE}`
164
	${CallArtificialFunction} GetFileVersion_
165
	Pop ${_RESULT}
166
	!verbose pop
167
!macroend
168

    
169
!macro GetExeNameCall _RESULT
170
	!verbose push
171
	!verbose ${_FILEFUNC_VERBOSE}
172
	${CallArtificialFunction} GetExeName_
173
	Pop ${_RESULT}
174
	!verbose pop
175
!macroend
176

    
177
!macro GetExePathCall _RESULT
178
	!verbose push
179
	!verbose ${_FILEFUNC_VERBOSE}
180
	${CallArtificialFunction} GetExePath_
181
	Pop ${_RESULT}
182
	!verbose pop
183
!macroend
184

    
185
!macro GetParametersCall _RESULT
186
	!verbose push
187
	!verbose ${_FILEFUNC_VERBOSE}
188
	${CallArtificialFunction} GetParameters_
189
	Pop ${_RESULT}
190
	!verbose pop
191
!macroend
192

    
193
!macro GetOptionsCall _PARAMETERS _OPTION _RESULT
194
	!verbose push
195
	!verbose ${_FILEFUNC_VERBOSE}
196
	Push `${_PARAMETERS}`
197
	Push `${_OPTION}`
198
	${CallArtificialFunction} GetOptions_
199
	Pop ${_RESULT}
200
	!verbose pop
201
!macroend
202

    
203
!macro GetOptionsSCall _PARAMETERS _OPTION _RESULT
204
	!verbose push
205
	!verbose ${_FILEFUNC_VERBOSE}
206
	Push `${_PARAMETERS}`
207
	Push `${_OPTION}`
208
	${CallArtificialFunction} GetOptionsS_
209
	Pop ${_RESULT}
210
	!verbose pop
211
!macroend
212

    
213
!macro GetRootCall _FULLPATH _RESULT
214
	!verbose push
215
	!verbose ${_FILEFUNC_VERBOSE}
216
	Push `${_FULLPATH}`
217
	${CallArtificialFunction} GetRoot_
218
	Pop ${_RESULT}
219
	!verbose pop
220
!macroend
221

    
222
!macro GetParentCall _PATHSTRING _RESULT
223
	!verbose push
224
	!verbose ${_FILEFUNC_VERBOSE}
225
	Push `${_PATHSTRING}`
226
	${CallArtificialFunction} GetParent_
227
	Pop ${_RESULT}
228
	!verbose pop
229
!macroend
230

    
231
!macro GetFileNameCall _PATHSTRING _RESULT
232
	!verbose push
233
	!verbose ${_FILEFUNC_VERBOSE}
234
	Push `${_PATHSTRING}`
235
	${CallArtificialFunction} GetFileName_
236
	Pop ${_RESULT}
237
	!verbose pop
238
!macroend
239

    
240
!macro GetBaseNameCall _FILESTRING _RESULT
241
	!verbose push
242
	!verbose ${_FILEFUNC_VERBOSE}
243
	Push `${_FILESTRING}`
244
	${CallArtificialFunction} GetBaseName_
245
	Pop ${_RESULT}
246
	!verbose pop
247
!macroend
248

    
249
!macro GetFileExtCall _FILESTRING _RESULT
250
	!verbose push
251
	!verbose ${_FILEFUNC_VERBOSE}
252
	Push `${_FILESTRING}`
253
	${CallArtificialFunction} GetFileExt_
254
	Pop ${_RESULT}
255
	!verbose pop
256
!macroend
257

    
258
!macro BannerTrimPathCall _PATH _LENGHT _RESULT
259
	!verbose push
260
	!verbose ${_FILEFUNC_VERBOSE}
261
	Push `${_PATH}`
262
	Push `${_LENGHT}`
263
	${CallArtificialFunction} BannerTrimPath_
264
	Pop ${_RESULT}
265
	!verbose pop
266
!macroend
267

    
268
!macro DirStateCall _PATH _RESULT
269
	!verbose push
270
	!verbose ${_FILEFUNC_VERBOSE}
271
	Push `${_PATH}`
272
	${CallArtificialFunction} DirState_
273
	Pop ${_RESULT}
274
	!verbose pop
275
!macroend
276

    
277
!macro RefreshShellIconsCall
278
	!verbose push
279
	!verbose ${_FILEFUNC_VERBOSE}
280
	${CallArtificialFunction} RefreshShellIcons_
281
	!verbose pop
282
!macroend
283

    
284
!define Locate `!insertmacro LocateCall`
285
!define un.Locate `!insertmacro LocateCall`
286

    
287
!macro Locate
288
!macroend
289

    
290
!macro un.Locate
291
!macroend
292

    
293
!macro Locate_
294
	!verbose push
295
	!verbose ${_FILEFUNC_VERBOSE}
296
		
297
	Exch $2
298
	Exch
299
	Exch $1
300
	Exch
301
	Exch 2
302
	Exch $0
303
	Exch 2
304
	Push $3
305
	Push $4
306
	Push $5
307
	Push $6
308
	Push $7
309
	Push $8
310
	Push $9
311
	Push $R6
312
	Push $R7
313
	Push $R8
314
	Push $R9
315
	ClearErrors
316

    
317
	StrCpy $3 ''
318
	StrCpy $4 ''
319
	StrCpy $5 ''
320
	StrCpy $6 ''
321
	StrCpy $7 ''
322
	StrCpy $8 0
323
	StrCpy $R7 ''
324

    
325
	StrCpy $R9 $0 1 -1
326
	StrCmp $R9 '\' 0 +3
327
	StrCpy $0 $0 -1
328
	goto -3
329
	IfFileExists '$0\*.*' 0 FileFunc_Locate_error
330

    
331
	FileFunc_Locate_option:
332
	StrCpy $R9 $1 1
333
	StrCpy $1 $1 '' 1
334
	StrCmp $R9 ' ' -2
335
	StrCmp $R9 '' FileFunc_Locate_sizeset
336
	StrCmp $R9 '/' 0 -4
337
	StrCpy $9 -1
338
	IntOp $9 $9 + 1
339
	StrCpy $R9 $1 1 $9
340
	StrCmp $R9 '' +2
341
	StrCmp $R9 '/' 0 -3
342
	StrCpy $R8 $1 $9
343
	StrCpy $R8 $R8 '' 2
344
	StrCpy $R9 $R8 '' -1
345
	StrCmp $R9 ' ' 0 +3
346
	StrCpy $R8 $R8 -1
347
	goto -3
348
	StrCpy $R9 $1 2
349
	StrCpy $1 $1 '' $9
350

    
351
	StrCmp $R9 'L=' 0 FileFunc_Locate_mask
352
	StrCpy $3 $R8
353
	StrCmp $3 '' +6
354
	StrCmp $3 'FD' +5
355
	StrCmp $3 'F' +4
356
	StrCmp $3 'D' +3
357
	StrCmp $3 'DE' +2
358
	StrCmp $3 'FDE' 0 FileFunc_Locate_error
359
	goto FileFunc_Locate_option
360

    
361
	FileFunc_Locate_mask:
362
	StrCmp $R9 'M=' 0 FileFunc_Locate_size
363
	StrCpy $4 $R8
364
	goto FileFunc_Locate_option
365

    
366
	FileFunc_Locate_size:
367
	StrCmp $R9 'S=' 0 FileFunc_Locate_gotosubdir
368
	StrCpy $6 $R8
369
	goto FileFunc_Locate_option
370

    
371
	FileFunc_Locate_gotosubdir:
372
	StrCmp $R9 'G=' 0 FileFunc_Locate_banner
373
	StrCpy $7 $R8
374
	StrCmp $7 '' +3
375
	StrCmp $7 '1' +2
376
	StrCmp $7 '0' 0 FileFunc_Locate_error
377
	goto FileFunc_Locate_option
378

    
379
	FileFunc_Locate_banner:
380
	StrCmp $R9 'B=' 0 FileFunc_Locate_error
381
	StrCpy $R7 $R8
382
	StrCmp $R7 '' +3
383
	StrCmp $R7 '1' +2
384
	StrCmp $R7 '0' 0 FileFunc_Locate_error
385
	goto FileFunc_Locate_option
386

    
387
	FileFunc_Locate_sizeset:
388
	StrCmp $6 '' FileFunc_Locate_default
389
	StrCpy $9 0
390
	StrCpy $R9 $6 1 $9
391
	StrCmp $R9 '' +4
392
	StrCmp $R9 ':' +3
393
	IntOp $9 $9 + 1
394
	goto -4
395
	StrCpy $5 $6 $9
396
	IntOp $9 $9 + 1
397
	StrCpy $1 $6 1 -1
398
	StrCpy $6 $6 -1 $9
399
	StrCmp $5 '' +2
400
	IntOp $5 $5 + 0
401
	StrCmp $6 '' +2
402
	IntOp $6 $6 + 0
403

    
404
	StrCmp $1 'B' 0 +3
405
	StrCpy $1 1
406
	goto FileFunc_Locate_default
407
	StrCmp $1 'K' 0 +3
408
	StrCpy $1 1024
409
	goto FileFunc_Locate_default
410
	StrCmp $1 'M' 0 +3
411
	StrCpy $1 1048576
412
	goto FileFunc_Locate_default
413
	StrCmp $1 'G' 0 FileFunc_Locate_error
414
	StrCpy $1 1073741824
415

    
416
	FileFunc_Locate_default:
417
	StrCmp $3 '' 0 +2
418
	StrCpy $3 'FD'
419
	StrCmp $4 '' 0 +2
420
	StrCpy $4 '*.*'
421
	StrCmp $7 '' 0 +2
422
	StrCpy $7 '1'
423
	StrCmp $R7 '' 0 +2
424
	StrCpy $R7 '0'
425
	StrCpy $7 'G$7B$R7'
426

    
427
	StrCpy $8 1
428
	Push $0
429
	SetDetailsPrint textonly
430

    
431
	FileFunc_Locate_nextdir:
432
	IntOp $8 $8 - 1
433
	Pop $R8
434

    
435
	StrCpy $9 $7 2 2
436
	StrCmp $9 'B0' +3
437
	GetLabelAddress $9 FileFunc_Locate_findfirst
438
	goto call
439
	DetailPrint 'Search in: $R8'
440

    
441
	FileFunc_Locate_findfirst:
442
	FindFirst $0 $R7 '$R8\$4'
443
	IfErrors FileFunc_Locate_subdir
444
	StrCmp $R7 '.' 0 FileFunc_Locate_dir
445
	FindNext $0 $R7
446
	StrCmp $R7 '..' 0 FileFunc_Locate_dir
447
	FindNext $0 $R7
448
	IfErrors 0 FileFunc_Locate_dir
449
	FindClose $0
450
	goto FileFunc_Locate_subdir
451

    
452
	FileFunc_Locate_dir:
453
	IfFileExists '$R8\$R7\*.*' 0 FileFunc_Locate_file
454
	StrCpy $R6 ''
455
	StrCmp $3 'DE' +4
456
	StrCmp $3 'FDE' +3
457
	StrCmp $3 'FD' FileFunc_Locate_precall
458
	StrCmp $3 'F' FileFunc_Locate_findnext FileFunc_Locate_precall
459
	FindFirst $9 $R9 '$R8\$R7\*.*'
460
	StrCmp $R9 '.' 0 +4
461
	FindNext $9 $R9
462
	StrCmp $R9 '..' 0 +2
463
	FindNext $9 $R9
464
	FindClose $9
465
	IfErrors FileFunc_Locate_precall FileFunc_Locate_findnext
466

    
467
	FileFunc_Locate_file:
468
	StrCmp $3 'FDE' +3
469
	StrCmp $3 'FD' +2
470
	StrCmp $3 'F' 0 FileFunc_Locate_findnext
471
	StrCpy $R6 0
472
	StrCmp $5$6 '' FileFunc_Locate_precall
473
	FileOpen $9 '$R8\$R7' r
474
	IfErrors +3
475
	FileSeek $9 0 END $R6
476
	FileClose $9
477
	System::Int64Op $R6 / $1
478
	Pop $R6
479
	StrCmp $5 '' +2
480
	IntCmp $R6 $5 0 FileFunc_Locate_findnext
481
	StrCmp $6 '' +2
482
	IntCmp $R6 $6 0 0 FileFunc_Locate_findnext
483

    
484
	FileFunc_Locate_precall:
485
	StrCpy $9 0
486
	StrCpy $R9 '$R8\$R7'
487

    
488
	call:
489
	Push $0
490
	Push $1
491
	Push $2
492
	Push $3
493
	Push $4
494
	Push $5
495
	Push $6
496
	Push $7
497
	Push $8
498
	Push $9
499
	Push $R7
500
	Push $R8
501
	StrCmp $9 0 +4
502
	StrCpy $R6 ''
503
	StrCpy $R7 ''
504
	StrCpy $R9 ''
505
	Call $2
506
	Pop $R9
507
	Pop $R8
508
	Pop $R7
509
	Pop $9
510
	Pop $8
511
	Pop $7
512
	Pop $6
513
	Pop $5
514
	Pop $4
515
	Pop $3
516
	Pop $2
517
	Pop $1
518
	Pop $0
519

    
520
	IfErrors 0 +3
521
	FindClose $0
522
	goto FileFunc_Locate_error
523
	StrCmp $R9 'StopLocate' 0 +3
524
	FindClose $0
525
	goto FileFunc_Locate_clearstack
526
	goto $9
527

    
528
	FileFunc_Locate_findnext:
529
	FindNext $0 $R7
530
	IfErrors 0 FileFunc_Locate_dir
531
	FindClose $0
532

    
533
	FileFunc_Locate_subdir:
534
	StrCpy $9 $7 2
535
	StrCmp $9 'G0' FileFunc_Locate_end
536
	FindFirst $0 $R7 '$R8\*.*'
537
	StrCmp $R7 '.' 0 FileFunc_Locate_pushdir
538
	FindNext $0 $R7
539
	StrCmp $R7 '..' 0 FileFunc_Locate_pushdir
540
	FindNext $0 $R7
541
	IfErrors 0 FileFunc_Locate_pushdir
542
	FindClose $0
543
	StrCmp $8 0 FileFunc_Locate_end FileFunc_Locate_nextdir
544

    
545
	FileFunc_Locate_pushdir:
546
	IfFileExists '$R8\$R7\*.*' 0 +3
547
	Push '$R8\$R7'
548
	IntOp $8 $8 + 1
549
	FindNext $0 $R7
550
	IfErrors 0 FileFunc_Locate_pushdir
551
	FindClose $0
552
	StrCmp $8 0 FileFunc_Locate_end FileFunc_Locate_nextdir
553

    
554
	FileFunc_Locate_error:
555
	SetErrors
556

    
557
	FileFunc_Locate_clearstack:
558
	StrCmp $8 0 FileFunc_Locate_end
559
	IntOp $8 $8 - 1
560
	Pop $R8
561
	goto FileFunc_Locate_clearstack
562

    
563
	FileFunc_Locate_end:
564
	SetDetailsPrint both
565
	Pop $R9
566
	Pop $R8
567
	Pop $R7
568
	Pop $R6
569
	Pop $9
570
	Pop $8
571
	Pop $7
572
	Pop $6
573
	Pop $5
574
	Pop $4
575
	Pop $3
576
	Pop $2
577
	Pop $1
578
	Pop $0
579

    
580
	!verbose pop
581
!macroend
582

    
583
!define GetSize `!insertmacro GetSizeCall`
584
!define un.GetSize `!insertmacro GetSizeCall`
585

    
586
!macro GetSize
587
!macroend
588

    
589
!macro un.GetSize
590
!macroend
591

    
592
!macro GetSize_
593
	!verbose push
594
	!verbose ${_FILEFUNC_VERBOSE}
595
	
596
	Exch $1
597
	Exch
598
	Exch $0
599
	Exch
600
	Push $2
601
	Push $3
602
	Push $4
603
	Push $5
604
	Push $6
605
	Push $7
606
	Push $8
607
	Push $9
608
	Push $R3
609
	Push $R4
610
	Push $R5
611
	Push $R6
612
	Push $R7
613
	Push $R8
614
	Push $R9
615
	ClearErrors
616

    
617
	StrCpy $R9 $0 1 -1
618
	StrCmp $R9 '\' 0 +3
619
	StrCpy $0 $0 -1
620
	goto -3
621
	IfFileExists '$0\*.*' 0 FileFunc_GetSize_error
622

    
623
	StrCpy $3 ''
624
	StrCpy $4 ''
625
	StrCpy $5 ''
626
	StrCpy $6 ''
627
	StrCpy $8 0
628
	StrCpy $R3 ''
629
	StrCpy $R4 ''
630
	StrCpy $R5 ''
631

    
632
	FileFunc_GetSize_option:
633
	StrCpy $R9 $1 1
634
	StrCpy $1 $1 '' 1
635
	StrCmp $R9 ' ' -2
636
	StrCmp $R9 '' FileFunc_GetSize_sizeset
637
	StrCmp $R9 '/' 0 -4
638

    
639
	StrCpy $9 -1
640
	IntOp $9 $9 + 1
641
	StrCpy $R9 $1 1 $9
642
	StrCmp $R9 '' +2
643
	StrCmp $R9 '/' 0 -3
644
	StrCpy $8 $1 $9
645
	StrCpy $8 $8 '' 2
646
	StrCpy $R9 $8 '' -1
647
	StrCmp $R9 ' ' 0 +3
648
	StrCpy $8 $8 -1
649
	goto -3
650
	StrCpy $R9 $1 2
651
	StrCpy $1 $1 '' $9
652

    
653
	StrCmp $R9 'M=' 0 FileFunc_GetSize_size
654
	StrCpy $4 $8
655
	goto FileFunc_GetSize_option
656

    
657
	FileFunc_GetSize_size:
658
	StrCmp $R9 'S=' 0 FileFunc_GetSize_gotosubdir
659
	StrCpy $6 $8
660
	goto FileFunc_GetSize_option
661

    
662
	FileFunc_GetSize_gotosubdir:
663
	StrCmp $R9 'G=' 0 FileFunc_GetSize_error
664
	StrCpy $7 $8
665
	StrCmp $7 '' +3
666
	StrCmp $7 '1' +2
667
	StrCmp $7 '0' 0 FileFunc_GetSize_error
668
	goto FileFunc_GetSize_option
669

    
670
	FileFunc_GetSize_sizeset:
671
	StrCmp $6 '' FileFunc_GetSize_default
672
	StrCpy $9 0
673
	StrCpy $R9 $6 1 $9
674
	StrCmp $R9 '' +4
675
	StrCmp $R9 ':' +3
676
	IntOp $9 $9 + 1
677
	goto -4
678
	StrCpy $5 $6 $9
679
	IntOp $9 $9 + 1
680
	StrCpy $1 $6 1 -1
681
	StrCpy $6 $6 -1 $9
682
	StrCmp $5 '' +2
683
	IntOp $5 $5 + 0
684
	StrCmp $6 '' +2
685
	IntOp $6 $6 + 0
686

    
687
	StrCmp $1 'B' 0 +4
688
	StrCpy $1 1
689
	StrCpy $2 bytes
690
	goto FileFunc_GetSize_default
691
	StrCmp $1 'K' 0 +4
692
	StrCpy $1 1024
693
	StrCpy $2 Kb
694
	goto FileFunc_GetSize_default
695
	StrCmp $1 'M' 0 +4
696
	StrCpy $1 1048576
697
	StrCpy $2 Mb
698
	goto FileFunc_GetSize_default
699
	StrCmp $1 'G' 0 FileFunc_GetSize_error
700
	StrCpy $1 1073741824
701
	StrCpy $2 Gb
702

    
703
	FileFunc_GetSize_default:
704
	StrCmp $4 '' 0 +2
705
	StrCpy $4 '*.*'
706
	StrCmp $7 '' 0 +2
707
	StrCpy $7 '1'
708

    
709
	StrCpy $8 1
710
	Push $0
711
	SetDetailsPrint textonly
712

    
713
	FileFunc_GetSize_nextdir:
714
	IntOp $8 $8 - 1
715
	Pop $R8
716
	FindFirst $0 $R7 '$R8\$4'
717
	IfErrors FileFunc_GetSize_show
718
	StrCmp $R7 '.' 0 FileFunc_GetSize_dir
719
	FindNext $0 $R7
720
	StrCmp $R7 '..' 0 FileFunc_GetSize_dir
721
	FindNext $0 $R7
722
	IfErrors 0 FileFunc_GetSize_dir
723
	FindClose $0
724
	goto FileFunc_GetSize_show
725

    
726
	FileFunc_GetSize_dir:
727
	IfFileExists '$R8\$R7\*.*' 0 FileFunc_GetSize_file
728
	IntOp $R5 $R5 + 1
729
	goto FileFunc_GetSize_findnext
730

    
731
	FileFunc_GetSize_file:
732
	StrCpy $R6 0
733
	StrCmp $5$6 '' 0 +3
734
	IntOp $R4 $R4 + 1
735
	goto FileFunc_GetSize_findnext
736
	FileOpen $9 '$R8\$R7' r
737
	IfErrors +3
738
	FileSeek $9 0 END $R6
739
	FileClose $9
740
	StrCmp $5 '' +2
741
	IntCmp $R6 $5 0 FileFunc_GetSize_findnext
742
	StrCmp $6 '' +2
743
	IntCmp $R6 $6 0 0 FileFunc_GetSize_findnext
744
	IntOp $R4 $R4 + 1
745
	System::Int64Op $R3 + $R6
746
	Pop $R3
747

    
748
	FileFunc_GetSize_findnext:
749
	FindNext $0 $R7
750
	IfErrors 0 FileFunc_GetSize_dir
751
	FindClose $0
752

    
753
	FileFunc_GetSize_show:
754
	StrCmp $5$6 '' FileFunc_GetSize_nosize
755
	System::Int64Op $R3 / $1
756
	Pop $9
757
	DetailPrint 'Size:$9 $2  Files:$R4  Folders:$R5'
758
	goto FileFunc_GetSize_subdir
759
	FileFunc_GetSize_nosize:
760
	DetailPrint 'Files:$R4  Folders:$R5'
761

    
762
	FileFunc_GetSize_subdir:
763
	StrCmp $7 0 FileFunc_GetSize_preend
764
	FindFirst $0 $R7 '$R8\*.*'
765
	StrCmp $R7 '.' 0 FileFunc_GetSize_pushdir
766
	FindNext $0 $R7
767
	StrCmp $R7 '..' 0 FileFunc_GetSize_pushdir
768
	FindNext $0 $R7
769
	IfErrors 0 FileFunc_GetSize_pushdir
770
	FindClose $0
771
	StrCmp $8 0 FileFunc_GetSize_preend FileFunc_GetSize_nextdir
772

    
773
	FileFunc_GetSize_pushdir:
774
	IfFileExists '$R8\$R7\*.*' 0 +3
775
	Push '$R8\$R7'
776
	IntOp $8 $8 + 1
777
	FindNext $0 $R7
778
	IfErrors 0 FileFunc_GetSize_pushdir
779
	FindClose $0
780
	StrCmp $8 0 FileFunc_GetSize_preend FileFunc_GetSize_nextdir
781

    
782
	FileFunc_GetSize_preend:
783
	StrCmp $R3 '' FileFunc_GetSize_nosizeend
784
	System::Int64Op $R3 / $1
785
	Pop $R3
786
	FileFunc_GetSize_nosizeend:
787
	StrCpy $2 $R4
788
	StrCpy $1 $R5
789
	StrCpy $0 $R3
790
	goto FileFunc_GetSize_end
791

    
792
	FileFunc_GetSize_error:
793
	SetErrors
794
	StrCpy $0 ''
795
	StrCpy $1 ''
796
	StrCpy $2 ''
797

    
798
	FileFunc_GetSize_end:
799
	SetDetailsPrint both
800
	Pop $R9
801
	Pop $R8
802
	Pop $R7
803
	Pop $R6
804
	Pop $R5
805
	Pop $R4
806
	Pop $R3
807
	Pop $9
808
	Pop $8
809
	Pop $7
810
	Pop $6
811
	Pop $5
812
	Pop $4
813
	Pop $3
814
	Exch $2
815
	Exch
816
	Exch $1
817
	Exch 2
818
	Exch $0
819

    
820
	!verbose pop
821
!macroend
822

    
823
!define DriveSpace `!insertmacro DriveSpaceCall`
824
!define un.DriveSpace `!insertmacro DriveSpaceCall`
825

    
826
!macro DriveSpace
827
!macroend
828

    
829
!macro un.DriveSpace
830
!macroend
831

    
832
!macro DriveSpace_
833
	!verbose push
834
	!verbose ${_FILEFUNC_VERBOSE}
835
	
836
	Exch $1
837
	Exch
838
	Exch $0
839
	Exch
840
	Push $2
841
	Push $3
842
	Push $4
843
	Push $5
844
	Push $6
845
	ClearErrors
846

    
847
	StrCpy $2 $0 1 -1
848
	StrCmp $2 '\' 0 +3
849
	StrCpy $0 $0 -1
850
	goto -3
851
	IfFileExists '$0\NUL' 0 FileFunc_DriveSpace_error
852

    
853
	StrCpy $5 ''
854
	StrCpy $6 ''
855

    
856
	FileFunc_DriveSpace_option:
857
	StrCpy $2 $1 1
858
	StrCpy $1 $1 '' 1
859
	StrCmp $2 ' ' -2
860
	StrCmp $2 '' FileFunc_DriveSpace_default
861
	StrCmp $2 '/' 0 -4
862
	StrCpy $3 -1
863
	IntOp $3 $3 + 1
864
	StrCpy $2 $1 1 $3
865
	StrCmp $2 '' +2
866
	StrCmp $2 '/' 0 -3
867
	StrCpy $4 $1 $3
868
	StrCpy $4 $4 '' 2
869
	StrCpy $2 $4 1 -1
870
	StrCmp $2 ' ' 0 +3
871
	StrCpy $4 $4 -1
872
	goto -3
873
	StrCpy $2 $1 2
874
	StrCpy $1 $1 '' $3
875

    
876
	StrCmp $2 'D=' 0 FileFunc_DriveSpace_unit
877
	StrCpy $5 $4
878
	StrCmp $5 '' +4
879
	StrCmp $5 'T' +3
880
	StrCmp $5 'O' +2
881
	StrCmp $5 'F' 0 FileFunc_DriveSpace_error
882
	goto FileFunc_DriveSpace_option
883

    
884
	FileFunc_DriveSpace_unit:
885
	StrCmp $2 'S=' 0 FileFunc_DriveSpace_error
886
	StrCpy $6 $4
887
	goto FileFunc_DriveSpace_option
888

    
889
	FileFunc_DriveSpace_default:
890
	StrCmp $5 '' 0 +2
891
	StrCpy $5 'T'
892
	StrCmp $6 '' 0 +3
893
	StrCpy $6 '1'
894
	goto FileFunc_DriveSpace_getspace
895

    
896
	StrCmp $6 'B' 0 +3
897
	StrCpy $6 1
898
	goto FileFunc_DriveSpace_getspace
899
	StrCmp $6 'K' 0 +3
900
	StrCpy $6 1024
901
	goto FileFunc_DriveSpace_getspace
902
	StrCmp $6 'M' 0 +3
903
	StrCpy $6 1048576
904
	goto FileFunc_DriveSpace_getspace
905
	StrCmp $6 'G' 0 FileFunc_DriveSpace_error
906
	StrCpy $6 1073741824
907

    
908
	FileFunc_DriveSpace_getspace:
909
	System::Call 'kernel32::GetDiskFreeSpaceEx(t, *l, *l, *l)i(r0,.r2,.r3,.)'
910

    
911
	StrCmp $5 T 0 +3
912
	StrCpy $0 $3
913
	goto FileFunc_DriveSpace_getsize
914
	StrCmp $5 O 0 +4
915
	System::Int64Op $3 - $2
916
	Pop $0
917
	goto FileFunc_DriveSpace_getsize
918
	StrCmp $5 F 0 +2
919
	StrCpy $0 $2
920

    
921
	FileFunc_DriveSpace_getsize:
922
	System::Int64Op $0 / $6
923
	Pop $0
924
	goto FileFunc_DriveSpace_end
925

    
926
	FileFunc_DriveSpace_error:
927
	SetErrors
928
	StrCpy $0 ''
929

    
930
	FileFunc_DriveSpace_end:
931
	Pop $6
932
	Pop $5
933
	Pop $4
934
	Pop $3
935
	Pop $2
936
	Pop $1
937
	Exch $0
938

    
939
	!verbose pop
940
!macroend
941

    
942
!define GetDrives `!insertmacro GetDrivesCall`
943
!define un.GetDrives `!insertmacro GetDrivesCall`
944

    
945
!macro GetDrives
946
!macroend
947

    
948
!macro un.GetDrives
949
!macroend
950

    
951
!macro GetDrives_
952
	!verbose push
953
	!verbose ${_FILEFUNC_VERBOSE}
954
	
955
	Exch $1
956
	Exch
957
	Exch $0
958
	Exch
959
	Push $2
960
	Push $3
961
	Push $4
962
	Push $5
963
	Push $6
964
	Push $8
965
	Push $9
966

    
967
	System::StrAlloc 1024
968
	Pop $2
969
	System::Call 'kernel32::GetLogicalDriveStrings(i,i) i(1024, r2)'
970

    
971
	StrCmp $0 ALL FileFunc_GetDrives_drivestring
972
	StrCmp $0 '' 0 FileFunc_GetDrives_typeset
973
	StrCpy $0 ALL
974
	goto FileFunc_GetDrives_drivestring
975

    
976
	FileFunc_GetDrives_typeset:
977
	StrCpy $6 -1
978
	IntOp $6 $6 + 1
979
	StrCpy $8 $0 1 $6
980
	StrCmp $8$0 '' FileFunc_GetDrives_enumex
981
	StrCmp $8 '' +2
982
	StrCmp $8 '+' 0 -4
983
	StrCpy $8 $0 $6
984
	IntOp $6 $6 + 1
985
	StrCpy $0 $0 '' $6
986

    
987
	StrCmp $8 'FDD' 0 +3
988
	StrCpy $6 2
989
	goto FileFunc_GetDrives_drivestring
990
	StrCmp $8 'HDD' 0 +3
991
	StrCpy $6 3
992
	goto FileFunc_GetDrives_drivestring
993
	StrCmp $8 'NET' 0 +3
994
	StrCpy $6 4
995
	goto FileFunc_GetDrives_drivestring
996
	StrCmp $8 'CDROM' 0 +3
997
	StrCpy $6 5
998
	goto FileFunc_GetDrives_drivestring
999
	StrCmp $8 'RAM' 0 FileFunc_GetDrives_typeset
1000
	StrCpy $6 6
1001

    
1002
	FileFunc_GetDrives_drivestring:
1003
	StrCpy $3 $2
1004

    
1005
	FileFunc_GetDrives_enumok:
1006
	System::Call 'kernel32::lstrlen(t) i(i r3) .r4'
1007
	StrCmp $4$0 '0ALL' FileFunc_GetDrives_enumex
1008
	StrCmp $4 0 FileFunc_GetDrives_typeset
1009
	System::Call 'kernel32::GetDriveType(t) i(i r3) .r5'
1010

    
1011
	StrCmp $0 ALL +2
1012
	StrCmp $5 $6 FileFunc_GetDrives_letter FileFunc_GetDrives_enumnext
1013
	StrCmp $5 2 0 +3
1014
	StrCpy $8 FDD
1015
	goto FileFunc_GetDrives_letter
1016
	StrCmp $5 3 0 +3
1017
	StrCpy $8 HDD
1018
	goto FileFunc_GetDrives_letter
1019
	StrCmp $5 4 0 +3
1020
	StrCpy $8 NET
1021
	goto FileFunc_GetDrives_letter
1022
	StrCmp $5 5 0 +3
1023
	StrCpy $8 CDROM
1024
	goto FileFunc_GetDrives_letter
1025
	StrCmp $5 6 0 FileFunc_GetDrives_enumex
1026
	StrCpy $8 RAM
1027

    
1028
	FileFunc_GetDrives_letter:
1029
	System::Call '*$3(&t1024 .r9)'
1030

    
1031
	Push $0
1032
	Push $1
1033
	Push $2
1034
	Push $3
1035
	Push $4
1036
	Push $5
1037
	Push $6
1038
	Push $8
1039
	Call $1
1040
	Pop $9
1041
	Pop $8
1042
	Pop $6
1043
	Pop $5
1044
	Pop $4
1045
	Pop $3
1046
	Pop $2
1047
	Pop $1
1048
	Pop $0
1049
	StrCmp $9 'StopGetDrives' FileFunc_GetDrives_enumex
1050

    
1051
	FileFunc_GetDrives_enumnext:
1052
	IntOp $4 $4 * ${NSIS_CHAR_SIZE}
1053
	IntOp $3 $3 + $4
1054
	IntOp $3 $3 + ${NSIS_CHAR_SIZE}
1055
	goto FileFunc_GetDrives_enumok
1056

    
1057
	FileFunc_GetDrives_enumex:
1058
	System::Free $2
1059

    
1060
	Pop $9
1061
	Pop $8
1062
	Pop $6
1063
	Pop $5
1064
	Pop $4
1065
	Pop $3
1066
	Pop $2
1067
	Pop $1
1068
	Pop $0
1069
	
1070
	!verbose pop
1071
!macroend
1072

    
1073
!define GetTime `!insertmacro GetTimeCall`
1074
!define un.GetTime `!insertmacro GetTimeCall`
1075

    
1076
!macro GetTime
1077
!macroend
1078

    
1079
!macro un.GetTime
1080
!macroend
1081

    
1082
!macro GetTime_
1083
	!verbose push
1084
	!verbose ${_FILEFUNC_VERBOSE}
1085
	
1086
	Exch $1
1087
	Exch
1088
	Exch $0
1089
	Exch
1090
	Push $2
1091
	Push $3
1092
	Push $4
1093
	Push $5
1094
	Push $6
1095
	Push $7
1096
	ClearErrors
1097

    
1098
	StrCmp $1 'L' FileFunc_GetTime_gettime
1099
	StrCmp $1 'A' FileFunc_GetTime_getfile
1100
	StrCmp $1 'C' FileFunc_GetTime_getfile
1101
	StrCmp $1 'M' FileFunc_GetTime_getfile
1102
	StrCmp $1 'LS' FileFunc_GetTime_gettime
1103
	StrCmp $1 'AS' FileFunc_GetTime_getfile
1104
	StrCmp $1 'CS' FileFunc_GetTime_getfile
1105
	StrCmp $1 'MS' FileFunc_GetTime_getfile
1106
	goto FileFunc_GetTime_error
1107

    
1108
	FileFunc_GetTime_getfile:
1109
	IfFileExists $0 0 FileFunc_GetTime_error
1110
	System::Call '*(i,l,l,l,i,i,i,i,&t260,&t14) p .r6'
1111
	System::Call 'kernel32::FindFirstFile(t,p)p(r0,r6) .r2'
1112
	System::Call 'kernel32::FindClose(i)i(r2)'
1113

    
1114
	FileFunc_GetTime_gettime:
1115
	System::Call '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) p .r7'
1116
	StrCmp $1 'L' 0 FileFunc_GetTime_systemtime
1117
	System::Call 'kernel32::GetLocalTime(p)i(r7)'
1118
	goto FileFunc_GetTime_convert
1119
	FileFunc_GetTime_systemtime:
1120
	StrCmp $1 'LS' 0 FileFunc_GetTime_filetime
1121
	System::Call 'kernel32::GetSystemTime(p)i(r7)'
1122
	goto FileFunc_GetTime_convert
1123

    
1124
	FileFunc_GetTime_filetime:
1125
	System::Call '*$6(i,l,l,l,i,i,i,i,&t260,&t14)p(,.r4,.r3,.r2)'
1126
	System::Free $6
1127
	StrCmp $1 'A' 0 +3
1128
	StrCpy $2 $3
1129
	goto FileFunc_GetTime_tolocal
1130
	StrCmp $1 'C' 0 +3
1131
	StrCpy $2 $4
1132
	goto FileFunc_GetTime_tolocal
1133
	StrCmp $1 'M' FileFunc_GetTime_tolocal
1134

    
1135
	StrCmp $1 'AS' FileFunc_GetTime_tosystem
1136
	StrCmp $1 'CS' 0 +3
1137
	StrCpy $3 $4
1138
	goto FileFunc_GetTime_tosystem
1139
	StrCmp $1 'MS' 0 +3
1140
	StrCpy $3 $2
1141
	goto FileFunc_GetTime_tosystem
1142

    
1143
	FileFunc_GetTime_tolocal:
1144
	System::Call 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
1145
	FileFunc_GetTime_tosystem:
1146
	System::Call 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'
1147

    
1148
	FileFunc_GetTime_convert:
1149
	System::Call '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)p(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
1150
	System::Free $7
1151

    
1152
	IntCmp $0 9 0 0 +2
1153
	StrCpy $0 '0$0'
1154
	IntCmp $1 9 0 0 +2
1155
	StrCpy $1 '0$1'
1156
	IntCmp $2 9 0 0 +2
1157
	StrCpy $2 '0$2'
1158
	IntCmp $6 9 0 0 +2
1159
	StrCpy $6 '0$6'
1160

    
1161
	StrCmp $4 0 0 +3
1162
	StrCpy $4 Sunday
1163
	goto FileFunc_GetTime_end
1164
	StrCmp $4 1 0 +3
1165
	StrCpy $4 Monday
1166
	goto FileFunc_GetTime_end
1167
	StrCmp $4 2 0 +3
1168
	StrCpy $4 Tuesday
1169
	goto FileFunc_GetTime_end
1170
	StrCmp $4 3 0 +3
1171
	StrCpy $4 Wednesday
1172
	goto FileFunc_GetTime_end
1173
	StrCmp $4 4 0 +3
1174
	StrCpy $4 Thursday
1175
	goto FileFunc_GetTime_end
1176
	StrCmp $4 5 0 +3
1177
	StrCpy $4 Friday
1178
	goto FileFunc_GetTime_end
1179
	StrCmp $4 6 0 FileFunc_GetTime_error
1180
	StrCpy $4 Saturday
1181
	goto FileFunc_GetTime_end
1182

    
1183
	FileFunc_GetTime_error:
1184
	SetErrors
1185
	StrCpy $0 ''
1186
	StrCpy $1 ''
1187
	StrCpy $2 ''
1188
	StrCpy $3 ''
1189
	StrCpy $4 ''
1190
	StrCpy $5 ''
1191
	StrCpy $6 ''
1192

    
1193
	FileFunc_GetTime_end:
1194
	Pop $7
1195
	Exch $6
1196
	Exch
1197
	Exch $5
1198
	Exch 2
1199
	Exch $4
1200
	Exch 3
1201
	Exch $3
1202
	Exch 4
1203
	Exch $2
1204
	Exch 5
1205
	Exch $1
1206
	Exch 6
1207
	Exch $0
1208

    
1209
	!verbose pop
1210
!macroend
1211

    
1212
!define GetFileAttributes `!insertmacro GetFileAttributesCall`
1213
!define un.GetFileAttributes `!insertmacro GetFileAttributesCall`
1214

    
1215
!macro GetFileAttributes
1216
!macroend
1217

    
1218
!macro un.GetFileAttributes
1219
!macroend
1220

    
1221
!macro GetFileAttributes_
1222
	!verbose push
1223
	!verbose ${_FILEFUNC_VERBOSE}
1224
	
1225
	Exch $1
1226
	Exch
1227
	Exch $0
1228
	Exch
1229
	Push $2
1230
	Push $3
1231
	Push $4
1232
	Push $5
1233

    
1234
	System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
1235
	StrCmp $2 -1 FileFunc_GetFileAttributes_error
1236
	StrCpy $3 ''
1237

    
1238
	IntOp $0 $2 & 0x4000
1239
	IntCmp $0 0 +2
1240
	StrCpy $3 'ENCRYPTED|'
1241

    
1242
	IntOp $0 $2 & 0x2000
1243
	IntCmp $0 0 +2
1244
	StrCpy $3 'NOT_CONTENT_INDEXED|$3'
1245

    
1246
	IntOp $0 $2 & 0x1000
1247
	IntCmp $0 0 +2
1248
	StrCpy $3 'OFFLINE|$3'
1249

    
1250
	IntOp $0 $2 & 0x0800
1251
	IntCmp $0 0 +2
1252
	StrCpy $3 'COMPRESSED|$3'
1253

    
1254
	IntOp $0 $2 & 0x0400
1255
	IntCmp $0 0 +2
1256
	StrCpy $3 'REPARSE_POINT|$3'
1257

    
1258
	IntOp $0 $2 & 0x0200
1259
	IntCmp $0 0 +2
1260
	StrCpy $3 'SPARSE_FILE|$3'
1261

    
1262
	IntOp $0 $2 & 0x0100
1263
	IntCmp $0 0 +2
1264
	StrCpy $3 'TEMPORARY|$3'
1265

    
1266
	IntOp $0 $2 & 0x0080
1267
	IntCmp $0 0 +2
1268
	StrCpy $3 'NORMAL|$3'
1269

    
1270
	IntOp $0 $2 & 0x0040
1271
	IntCmp $0 0 +2
1272
	StrCpy $3 'DEVICE|$3'
1273

    
1274
	IntOp $0 $2 & 0x0020
1275
	IntCmp $0 0 +2
1276
	StrCpy $3 'ARCHIVE|$3'
1277

    
1278
	IntOp $0 $2 & 0x0010
1279
	IntCmp $0 0 +2
1280
	StrCpy $3 'DIRECTORY|$3'
1281

    
1282
	IntOp $0 $2 & 0x0004
1283
	IntCmp $0 0 +2
1284
	StrCpy $3 'SYSTEM|$3'
1285

    
1286
	IntOp $0 $2 & 0x0002
1287
	IntCmp $0 0 +2
1288
	StrCpy $3 'HIDDEN|$3'
1289

    
1290
	IntOp $0 $2 & 0x0001
1291
	IntCmp $0 0 +2
1292
	StrCpy $3 'READONLY|$3'
1293

    
1294
	StrCpy $0 $3 -1
1295
	StrCmp $1 '' FileFunc_GetFileAttributes_end
1296
	StrCmp $1 'ALL' FileFunc_GetFileAttributes_end
1297

    
1298
	FileFunc_GetFileAttributes_attrcmp:
1299
	StrCpy $5 0
1300
	IntOp $5 $5 + 1
1301
	StrCpy $4 $1 1 $5
1302
	StrCmp $4 '' +2
1303
	StrCmp $4 '|'  0 -3
1304
	StrCpy $2 $1 $5
1305
	IntOp $5 $5 + 1
1306
	StrCpy $1 $1 '' $5
1307
	StrLen $3 $2
1308
	StrCpy $5 -1
1309
	IntOp $5 $5 + 1
1310
	StrCpy $4 $0 $3 $5
1311
	StrCmp $4 '' FileFunc_GetFileAttributes_notfound
1312
	StrCmp $4 $2 0 -3
1313
	StrCmp $1 '' 0 FileFunc_GetFileAttributes_attrcmp
1314
	StrCpy $0 1
1315
	goto FileFunc_GetFileAttributes_end
1316

    
1317
	FileFunc_GetFileAttributes_notfound:
1318
	StrCpy $0 0
1319
	goto FileFunc_GetFileAttributes_end
1320

    
1321
	FileFunc_GetFileAttributes_error:
1322
	SetErrors
1323
	StrCpy $0 ''
1324

    
1325
	FileFunc_GetFileAttributes_end:
1326
	Pop $5
1327
	Pop $4
1328
	Pop $3
1329
	Pop $2
1330
	Pop $1
1331
	Exch $0
1332
		
1333
	!verbose pop
1334
!macroend
1335

    
1336
!define GetFileVersion `!insertmacro GetFileVersionCall`
1337
!define un.GetFileVersion `!insertmacro GetFileVersionCall`
1338

    
1339
!macro GetFileVersion
1340
!macroend
1341

    
1342
!macro un.GetFileVersion
1343
!macroend
1344

    
1345
!macro GetFileVersion_
1346
	!verbose push
1347
	!verbose ${_FILEFUNC_VERBOSE}
1348
	
1349
	Exch $0
1350
	Push $1
1351
	Push $2
1352
	Push $3
1353
	Push $4
1354
	Push $5
1355
	Push $6
1356
	ClearErrors
1357

    
1358
	GetDllVersion '$0' $1 $2
1359
	IfErrors FileFunc_GetFileVersion_error
1360
	IntOp $3 $1 >> 16
1361
	IntOp $3 $3 & 0x0000FFFF
1362
	IntOp $4 $1 & 0x0000FFFF
1363
	IntOp $5 $2 >> 16
1364
	IntOp $5 $5 & 0x0000FFFF
1365
	IntOp $6 $2 & 0x0000FFFF
1366
	StrCpy $0 '$3.$4.$5.$6'
1367
	goto FileFunc_GetFileVersion_end
1368

    
1369
	FileFunc_GetFileVersion_error:
1370
	SetErrors
1371
	StrCpy $0 ''
1372

    
1373
	FileFunc_GetFileVersion_end:
1374
	Pop $6
1375
	Pop $5
1376
	Pop $4
1377
	Pop $3
1378
	Pop $2
1379
	Pop $1
1380
	Exch $0
1381

    
1382
	!verbose pop
1383
!macroend
1384

    
1385
!define GetExeName `!insertmacro GetExeNameCall`
1386
!define un.GetExeName `!insertmacro GetExeNameCall`
1387

    
1388
!macro GetExeName
1389
!macroend
1390

    
1391
!macro un.GetExeName
1392
!macroend
1393

    
1394
!macro GetExeName_
1395
	!verbose push
1396
	!verbose ${_FILEFUNC_VERBOSE}
1397
	
1398
	Push $0
1399
	Push $1
1400
	Push $2
1401
	System::Call 'kernel32::GetModuleFileName(p 0, t .r0, i 1024)'
1402
	System::Call 'kernel32::GetLongPathName(t r0, t .r1, i 1024)i .r2'
1403
	StrCmp $2 error +2
1404
	StrCpy $0 $1
1405
	Pop $2
1406
	Pop $1
1407
	Exch $0
1408

    
1409
	!verbose pop
1410
!macroend
1411

    
1412
!define GetExePath `!insertmacro GetExePathCall`
1413
!define un.GetExePath `!insertmacro GetExePathCall`
1414

    
1415
!macro GetExePath
1416
!macroend
1417

    
1418
!macro un.GetExePath
1419
!macroend
1420

    
1421
!macro GetExePath_
1422
	!verbose push
1423
	!verbose ${_FILEFUNC_VERBOSE}
1424
	
1425
	Push $0
1426
	Push $1
1427
	Push $2
1428
	StrCpy $0 $EXEDIR
1429
	System::Call 'kernel32::GetLongPathName(t r0, t .r1, i 1024)i .r2'
1430
	StrCmp $2 error +2
1431
	StrCpy $0 $1
1432
	Pop $2
1433
	Pop $1
1434
	Exch $0
1435
	
1436
	!verbose pop
1437
!macroend
1438

    
1439
!define GetParameters `!insertmacro GetParametersCall`
1440
!define un.GetParameters `!insertmacro GetParametersCall`
1441

    
1442
!macro GetParameters
1443
!macroend
1444

    
1445
!macro un.GetParameters
1446
!macroend
1447

    
1448
!macro GetParameters_
1449
	!verbose push
1450
	!verbose ${_FILEFUNC_VERBOSE}
1451
	
1452
	;cmdline-check
1453
	StrCmp $CMDLINE "" 0 +3
1454
	Push ""
1455
	Return
1456

    
1457
	;vars
1458
	Push $0  ;tmp
1459
	Push $1  ;length
1460
	Push $2  ;parameter offset
1461
	Push $3  ;separator
1462

    
1463
	;length/offset
1464
	StrLen $1 $CMDLINE
1465
	StrCpy $2 2  ;start with third character
1466

    
1467
	;separator
1468
	StrCpy $3 $CMDLINE 1 ;first character
1469
	StrCmp $3 '"' +2
1470
	StrCpy $3 ' '
1471

    
1472
	FileFunc_GetParameters_token:  ;finding second separator
1473
	IntCmp $2 $1 FileFunc_GetParameters_strip 0 FileFunc_GetParameters_strip
1474
	StrCpy $0 $CMDLINE 1 $2
1475
	IntOp $2 $2 + 1
1476
	StrCmp $3 $0 0 FileFunc_GetParameters_token
1477

    
1478
	FileFunc_GetParameters_strip:  ;strip white space
1479
	IntCmp $2 $1 FileFunc_GetParameters_copy 0 FileFunc_GetParameters_copy
1480
	StrCpy $0 $CMDLINE 1 $2
1481
	StrCmp $0 ' ' 0 FileFunc_GetParameters_copy
1482
	IntOp $2 $2 + 1
1483
	Goto FileFunc_GetParameters_strip
1484

    
1485
	FileFunc_GetParameters_copy:
1486
	StrCpy $0 $CMDLINE "" $2
1487

    
1488
	;strip white spaces from end
1489
	FileFunc_GetParameters_rstrip:
1490
	StrCpy $1 $0 1 -1
1491
	StrCmp $1 ' ' 0 FileFunc_GetParameters_done
1492
	StrCpy $0 $0 -1
1493
	Goto FileFunc_GetParameters_rstrip
1494

    
1495
	FileFunc_GetParameters_done:
1496
	Pop $3
1497
	Pop $2
1498
	Pop $1
1499
	Exch $0
1500

    
1501
	!verbose pop
1502
!macroend
1503

    
1504
!macro GetOptionsBody _FILEFUNC_S
1505

    
1506
	Exch $1
1507
	Exch
1508
	Exch $0
1509
	Exch
1510
	Push $2
1511
	Push $3
1512
	Push $4
1513
	Push $5
1514
	Push $6
1515
	Push $7
1516
	ClearErrors
1517

    
1518
	StrCpy $2 $1 '' 1
1519
	StrCpy $1 $1 1
1520
	StrLen $3 $2
1521
	StrCpy $7 0
1522

    
1523
	FileFunc_GetOptions${_FILEFUNC_S}_begin:
1524
	StrCpy $4 -1
1525
	StrCpy $6 ''
1526

    
1527
	FileFunc_GetOptions${_FILEFUNC_S}_quote:
1528
	IntOp $4 $4 + 1
1529
	StrCpy $5 $0 1 $4
1530
	StrCmp${_FILEFUNC_S} $5$7 '0' FileFunc_GetOptions${_FILEFUNC_S}_notfound
1531
	StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_trimright
1532
	StrCmp${_FILEFUNC_S} $5 '"' 0 +7
1533
	StrCmp${_FILEFUNC_S} $6 '' 0 +3
1534
	StrCpy $6 '"'
1535
	goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1536
	StrCmp${_FILEFUNC_S} $6 '"' 0 +3
1537
	StrCpy $6 ''
1538
	goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1539
	StrCmp${_FILEFUNC_S} $5 `'` 0 +7
1540
	StrCmp${_FILEFUNC_S} $6 `` 0 +3
1541
	StrCpy $6 `'`
1542
	goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1543
	StrCmp${_FILEFUNC_S} $6 `'` 0 +3
1544
	StrCpy $6 ``
1545
	goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1546
	StrCmp${_FILEFUNC_S} $5 '`' 0 +7
1547
	StrCmp${_FILEFUNC_S} $6 '' 0 +3
1548
	StrCpy $6 '`'
1549
	goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1550
	StrCmp${_FILEFUNC_S} $6 '`' 0 +3
1551
	StrCpy $6 ''
1552
	goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1553
	StrCmp${_FILEFUNC_S} $6 '"' FileFunc_GetOptions${_FILEFUNC_S}_quote
1554
	StrCmp${_FILEFUNC_S} $6 `'` FileFunc_GetOptions${_FILEFUNC_S}_quote
1555
	StrCmp${_FILEFUNC_S} $6 '`' FileFunc_GetOptions${_FILEFUNC_S}_quote
1556
	StrCmp${_FILEFUNC_S} $5 $1 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
1557
	StrCmp${_FILEFUNC_S} $7 0 FileFunc_GetOptions${_FILEFUNC_S}_trimleft FileFunc_GetOptions${_FILEFUNC_S}_trimright
1558

    
1559
	FileFunc_GetOptions${_FILEFUNC_S}_trimleft:
1560
	IntOp $4 $4 + 1
1561
	StrCpy $5 $0 $3 $4
1562
	StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_notfound
1563
	StrCmp${_FILEFUNC_S} $5 $2 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
1564
	IntOp $4 $4 + $3
1565
	StrCpy $0 $0 '' $4
1566
	StrCpy $4 $0 1
1567
	StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
1568
	StrCpy $0 $0 '' 1
1569
	goto -3
1570
	StrCpy $7 1
1571
	goto FileFunc_GetOptions${_FILEFUNC_S}_begin
1572

    
1573
	FileFunc_GetOptions${_FILEFUNC_S}_trimright:
1574
	StrCpy $0 $0 $4
1575
	StrCpy $4 $0 1 -1
1576
	StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
1577
	StrCpy $0 $0 -1
1578
	goto -3
1579
	StrCpy $3 $0 1
1580
	StrCpy $4 $0 1 -1
1581
	StrCmp${_FILEFUNC_S} $3 $4 0 FileFunc_GetOptions${_FILEFUNC_S}_end
1582
	StrCmp${_FILEFUNC_S} $3 '"' +3
1583
	StrCmp${_FILEFUNC_S} $3 `'` +2
1584
	StrCmp${_FILEFUNC_S} $3 '`' 0 FileFunc_GetOptions${_FILEFUNC_S}_end
1585
	StrCpy $0 $0 -1 1
1586
	goto FileFunc_GetOptions${_FILEFUNC_S}_end
1587

    
1588
	FileFunc_GetOptions${_FILEFUNC_S}_notfound:
1589
	SetErrors
1590
	StrCpy $0 ''
1591

    
1592
	FileFunc_GetOptions${_FILEFUNC_S}_end:
1593
	Pop $7
1594
	Pop $6
1595
	Pop $5
1596
	Pop $4
1597
	Pop $3
1598
	Pop $2
1599
	Pop $1
1600
	Exch $0
1601

    
1602
!macroend
1603

    
1604
!define GetOptions `!insertmacro GetOptionsCall`
1605
!define un.GetOptions `!insertmacro GetOptionsCall`
1606

    
1607
!macro GetOptions
1608
!macroend
1609

    
1610
!macro un.GetOptions
1611
!macroend
1612

    
1613
!macro GetOptions_
1614
	!verbose push
1615
	!verbose ${_FILEFUNC_VERBOSE}
1616

    
1617
	!insertmacro GetOptionsBody ''
1618

    
1619
	!verbose pop
1620
!macroend
1621

    
1622
!define GetOptionsS `!insertmacro GetOptionsSCall`
1623
!define un.GetOptionsS `!insertmacro GetOptionsSCall`
1624

    
1625
!macro GetOptionsS
1626
!macroend
1627

    
1628
!macro un.GetOptionsS
1629
!macroend
1630

    
1631
!macro GetOptionsS_
1632
	!verbose push
1633
	!verbose ${_FILEFUNC_VERBOSE}
1634

    
1635
	!insertmacro GetOptionsBody 'S'
1636

    
1637
	!verbose pop
1638
!macroend
1639

    
1640
!define GetRoot `!insertmacro GetRootCall`
1641
!define un.GetRoot `!insertmacro GetRootCall`
1642

    
1643
!macro GetRoot
1644
!macroend
1645

    
1646
!macro un.GetRoot
1647
!macroend
1648

    
1649
!macro GetRoot_
1650
	!verbose push
1651
	!verbose ${_FILEFUNC_VERBOSE}
1652
	
1653
	Exch $0
1654
	Push $1
1655
	Push $2
1656
	Push $3
1657

    
1658
	StrCpy $1 $0 2
1659
	StrCmp $1 '\\' FileFunc_GetRoot_UNC
1660
	StrCpy $2 $1 1 1
1661
	StrCmp $2 ':' 0 FileFunc_GetRoot_empty
1662
	StrCpy $0 $1
1663
	goto FileFunc_GetRoot_end
1664

    
1665
	FileFunc_GetRoot_UNC:
1666
	StrCpy $2 1
1667
	StrCpy $3 ''
1668

    
1669
	FileFunc_GetRoot_loop:
1670
	IntOp $2 $2 + 1
1671
	StrCpy $1 $0 1 $2
1672
	StrCmp $1$3 '' FileFunc_GetRoot_empty
1673
	StrCmp $1 '' +5
1674
	StrCmp $1 '\' 0 FileFunc_GetRoot_loop
1675
	StrCmp $3 '1' +3
1676
	StrCpy $3 '1'
1677
	goto FileFunc_GetRoot_loop
1678
	StrCpy $0 $0 $2
1679
	StrCpy $2 $0 1 -1
1680
	StrCmp $2 '\' 0 FileFunc_GetRoot_end
1681

    
1682
	FileFunc_GetRoot_empty:
1683
	StrCpy $0 ''
1684

    
1685
	FileFunc_GetRoot_end:
1686
	Pop $3
1687
	Pop $2
1688
	Pop $1
1689
	Exch $0
1690

    
1691
	!verbose pop
1692
!macroend
1693

    
1694
!define GetParent `!insertmacro GetParentCall`
1695
!define un.GetParent `!insertmacro GetParentCall`
1696

    
1697
!macro GetParent
1698
!macroend
1699

    
1700
!macro un.GetParent
1701
!macroend
1702

    
1703
!macro GetParent_
1704
	!verbose push
1705
	!verbose ${_FILEFUNC_VERBOSE}
1706
	
1707
	Exch $0
1708
	Push $1
1709
	Push $2
1710

    
1711
	StrCpy $2 $0 1 -1
1712
	StrCmp $2 '\' 0 +3
1713
	StrCpy $0 $0 -1
1714
	goto -3
1715

    
1716
	StrCpy $1 0
1717
	IntOp $1 $1 - 1
1718
	StrCpy $2 $0 1 $1
1719
	StrCmp $2 '\' +2
1720
	StrCmp $2 '' 0 -3
1721
	StrCpy $0 $0 $1
1722

    
1723
	Pop $2
1724
	Pop $1
1725
	Exch $0
1726

    
1727
	!verbose pop
1728
!macroend
1729

    
1730
!define GetFileName `!insertmacro GetFileNameCall`
1731
!define un.GetFileName `!insertmacro GetFileNameCall`
1732

    
1733
!macro GetFileName
1734
!macroend
1735

    
1736
!macro un.GetFileName
1737
!macroend
1738

    
1739
!macro GetFileName_
1740
	!verbose push
1741
	!verbose ${_FILEFUNC_VERBOSE}
1742
	
1743
	Exch $0
1744
	Push $1
1745
	Push $2
1746

    
1747
	StrCpy $2 $0 1 -1
1748
	StrCmp $2 '\' 0 +3
1749
	StrCpy $0 $0 -1
1750
	goto -3
1751

    
1752
	StrCpy $1 0
1753
	IntOp $1 $1 - 1
1754
	StrCpy $2 $0 1 $1
1755
	StrCmp $2 '' FileFunc_GetFileName_end
1756
	StrCmp $2 '\' 0 -3
1757
	IntOp $1 $1 + 1
1758
	StrCpy $0 $0 '' $1
1759

    
1760
	FileFunc_GetFileName_end:
1761
	Pop $2
1762
	Pop $1
1763
	Exch $0
1764

    
1765
	!verbose pop
1766
!macroend
1767

    
1768
!define GetBaseName `!insertmacro GetBaseNameCall`
1769
!define un.GetBaseName `!insertmacro GetBaseNameCall`
1770

    
1771
!macro GetBaseName
1772
!macroend
1773

    
1774
!macro un.GetBaseName
1775
!macroend
1776

    
1777
!macro GetBaseName_
1778
	!verbose push
1779
	!verbose ${_FILEFUNC_VERBOSE}
1780
	
1781
	Exch $0
1782
	Push $1
1783
	Push $2
1784
	Push $3
1785

    
1786
	StrCpy $1 0
1787
	StrCpy $3 ''
1788

    
1789
	FileFunc_GetBaseName_loop:
1790
	IntOp $1 $1 - 1
1791
	StrCpy $2 $0 1 $1
1792
	StrCmp $2 '' FileFunc_GetBaseName_trimpath
1793
	StrCmp $2 '\' FileFunc_GetBaseName_trimpath
1794
	StrCmp $3 'noext' FileFunc_GetBaseName_loop
1795
	StrCmp $2 '.' 0 FileFunc_GetBaseName_loop
1796
	StrCpy $0 $0 $1
1797
	StrCpy $3 'noext'
1798
	StrCpy $1 0
1799
	goto FileFunc_GetBaseName_loop
1800

    
1801
	FileFunc_GetBaseName_trimpath:
1802
	StrCmp $1 -1 FileFunc_GetBaseName_empty
1803
	IntOp $1 $1 + 1
1804
	StrCpy $0 $0 '' $1
1805
	goto FileFunc_GetBaseName_end
1806

    
1807
	FileFunc_GetBaseName_empty:
1808
	StrCpy $0 ''
1809

    
1810
	FileFunc_GetBaseName_end:
1811
	Pop $3
1812
	Pop $2
1813
	Pop $1
1814
	Exch $0
1815

    
1816
	!verbose pop
1817
!macroend
1818

    
1819
!define GetFileExt `!insertmacro GetFileExtCall`
1820
!define un.GetFileExt `!insertmacro GetFileExtCall`
1821

    
1822
!macro GetFileExt
1823
!macroend
1824

    
1825
!macro un.GetFileExt
1826
!macroend
1827

    
1828
!macro GetFileExt_
1829
	!verbose push
1830
	!verbose ${_FILEFUNC_VERBOSE}
1831
	
1832
	Exch $0
1833
	Push $1
1834
	Push $2
1835

    
1836
	StrCpy $1 0
1837

    
1838
	FileFunc_GetFileExt_loop:
1839
	IntOp $1 $1 - 1
1840
	StrCpy $2 $0 1 $1
1841
	StrCmp $2 '' FileFunc_GetFileExt_empty
1842
	StrCmp $2 '\' FileFunc_GetFileExt_empty
1843
	StrCmp $2 '.' 0 FileFunc_GetFileExt_loop
1844

    
1845
	StrCmp $1 -1 FileFunc_GetFileExt_empty
1846
	IntOp $1 $1 + 1
1847
	StrCpy $0 $0 '' $1
1848
	goto FileFunc_GetFileExt_end
1849

    
1850
	FileFunc_GetFileExt_empty:
1851
	StrCpy $0 ''
1852

    
1853
	FileFunc_GetFileExt_end:
1854
	Pop $2
1855
	Pop $1
1856
	Exch $0
1857

    
1858
	!verbose pop
1859
!macroend
1860

    
1861
!define BannerTrimPath `!insertmacro BannerTrimPathCall`
1862
!define un.BannerTrimPath `!insertmacro BannerTrimPathCall`
1863

    
1864
!macro BannerTrimPath
1865
!macroend
1866

    
1867
!macro un.BannerTrimPath
1868
!macroend
1869

    
1870
!macro BannerTrimPath_
1871
	!verbose push
1872
	!verbose ${_FILEFUNC_VERBOSE}
1873
	
1874
	Exch $1
1875
	Exch
1876
	Exch $0
1877
	Exch
1878
	Push $2
1879
	Push $3
1880
	Push $4
1881

    
1882
	StrCpy $3 $1 1 -1
1883
	IntOp $1 $1 + 0
1884
	StrLen $2 $0
1885
	IntCmp $2 $1 FileFunc_BannerTrimPath_end FileFunc_BannerTrimPath_end
1886
	IntOp $1 $1 - 3
1887
	IntCmp $1 0 FileFunc_BannerTrimPath_empty FileFunc_BannerTrimPath_empty
1888
	StrCmp $3 'A' FileFunc_BannerTrimPath_A-trim
1889
	StrCmp $3 'B' FileFunc_BannerTrimPath_B-trim
1890
	StrCmp $3 'C' FileFunc_BannerTrimPath_C-trim
1891
	StrCmp $3 'D' FileFunc_BannerTrimPath_D-trim
1892

    
1893
	FileFunc_BannerTrimPath_A-trim:
1894
	StrCpy $3 $0 1 1
1895
	StrCpy $2 0
1896
	StrCmp $3 ':' 0 +2
1897
	IntOp $2 $2 + 2
1898

    
1899
	FileFunc_BannerTrimPath_loopleft:
1900
	IntOp $2 $2 + 1
1901
	StrCpy $3 $0 1 $2
1902
	StrCmp $2 $1 FileFunc_BannerTrimPath_C-trim
1903
	StrCmp $3 '\' 0 FileFunc_BannerTrimPath_loopleft
1904
	StrCpy $3 $0 $2
1905
	IntOp $2 $2 - $1
1906
	IntCmp $2 0 FileFunc_BannerTrimPath_B-trim 0 FileFunc_BannerTrimPath_B-trim
1907

    
1908
	FileFunc_BannerTrimPath_loopright:
1909
	IntOp $2 $2 + 1
1910
	StrCpy $4 $0 1 $2
1911
	StrCmp $2 0 FileFunc_BannerTrimPath_B-trim
1912
	StrCmp $4 '\' 0 FileFunc_BannerTrimPath_loopright
1913
	StrCpy $4 $0 '' $2
1914
	StrCpy $0 '$3\...$4'
1915
	goto FileFunc_BannerTrimPath_end
1916

    
1917
	FileFunc_BannerTrimPath_B-trim:
1918
	StrCpy $2 $1
1919
	IntOp $2 $2 - 1
1920
	StrCmp $2 -1 FileFunc_BannerTrimPath_C-trim
1921
	StrCpy $3 $0 1 $2
1922
	StrCmp $3 '\' 0 -3
1923
	StrCpy $0 $0 $2
1924
	StrCpy $0 '$0\...'
1925
	goto FileFunc_BannerTrimPath_end
1926

    
1927
	FileFunc_BannerTrimPath_C-trim:
1928
	StrCpy $0 $0 $1
1929
	StrCpy $0 '$0...'
1930
	goto FileFunc_BannerTrimPath_end
1931

    
1932
	FileFunc_BannerTrimPath_D-trim:
1933
	StrCpy $3 -1
1934
	IntOp $3 $3 - 1
1935
	StrCmp $3 -$2 FileFunc_BannerTrimPath_C-trim
1936
	StrCpy $4 $0 1 $3
1937
	StrCmp $4 '\' 0 -3
1938
	StrCpy $4 $0 '' $3
1939
	IntOp $3 $1 + $3
1940
	IntCmp $3 2 FileFunc_BannerTrimPath_C-trim FileFunc_BannerTrimPath_C-trim
1941
	StrCpy $0 $0 $3
1942
	StrCpy $0 '$0...$4'
1943
	goto FileFunc_BannerTrimPath_end
1944

    
1945
	FileFunc_BannerTrimPath_empty:
1946
	StrCpy $0 ''
1947

    
1948
	FileFunc_BannerTrimPath_end:
1949
	Pop $4
1950
	Pop $3
1951
	Pop $2
1952
	Pop $1
1953
	Exch $0
1954

    
1955
	!verbose pop
1956
!macroend
1957

    
1958
!define DirState `!insertmacro DirStateCall`
1959
!define un.DirState `!insertmacro DirStateCall`
1960

    
1961
!macro DirState
1962
!macroend
1963

    
1964
!macro un.DirState
1965
!macroend
1966

    
1967
!macro DirState_
1968
	!verbose push
1969
	!verbose ${_FILEFUNC_VERBOSE}
1970
	
1971
	Exch $0
1972
	Push $1
1973
	ClearErrors
1974

    
1975
	FindFirst $1 $0 '$0\*.*'
1976
	IfErrors 0 +3
1977
	StrCpy $0 -1
1978
	goto FileFunc_DirState_end
1979
	StrCmp $0 '.' 0 +4
1980
	FindNext $1 $0
1981
	StrCmp $0 '..' 0 +2
1982
	FindNext $1 $0
1983
	FindClose $1
1984
	IfErrors 0 +3
1985
	StrCpy $0 0
1986
	goto FileFunc_DirState_end
1987
	StrCpy $0 1
1988

    
1989
	FileFunc_DirState_end:
1990
	Pop $1
1991
	Exch $0
1992

    
1993
	!verbose pop
1994
!macroend
1995

    
1996
!define RefreshShellIcons `!insertmacro RefreshShellIconsCall`
1997
!define un.RefreshShellIcons `!insertmacro RefreshShellIconsCall`
1998

    
1999
!macro RefreshShellIcons
2000
!macroend
2001

    
2002
!macro un.RefreshShellIcons
2003
!macroend
2004

    
2005
!macro RefreshShellIcons_
2006
	!verbose push
2007
	!verbose ${_FILEFUNC_VERBOSE}
2008
	
2009
	System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
2010

    
2011
	!verbose pop
2012
!macroend
2013

    
2014
!verbose pop
2015
!endif