Debian Codegraph @

Include/FileFunc.nsh

raw
1 /*
2 _____________________________________________________________________________
3
4 File Functions Header v3.4
5 _____________________________________________________________________________
6
7 2006 Shengalts Aleksander aka Instructor ([email protected])
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.r5,&i2.r6,&i2.r4,&i2.r0,&i2.r3,&i2.r2,&i2.r1,&i2)'
1150 System::Free $7
1151
1152 IntFmt $6 "%.2u" $6 ; Month
1153 IntFmt $0 "%.2u" $0 ; Day
1154 IntFmt $3 "%.2u" $3 ; Hour
1155 IntFmt $2 "%.2u" $2 ; Minute
1156 IntFmt $1 "%.2u" $1 ; Second
1157
1158 StrCmp $4 0 0 +3
1159 StrCpy $4 Sunday
1160 goto FileFunc_GetTime_end
1161 StrCmp $4 1 0 +3
1162 StrCpy $4 Monday
1163 goto FileFunc_GetTime_end
1164 StrCmp $4 2 0 +3
1165 StrCpy $4 Tuesday
1166 goto FileFunc_GetTime_end
1167 StrCmp $4 3 0 +3
1168 StrCpy $4 Wednesday
1169 goto FileFunc_GetTime_end
1170 StrCmp $4 4 0 +3
1171 StrCpy $4 Thursday
1172 goto FileFunc_GetTime_end
1173 StrCmp $4 5 0 +3
1174 StrCpy $4 Friday
1175 goto FileFunc_GetTime_end
1176 StrCmp $4 6 0 FileFunc_GetTime_error
1177 StrCpy $4 Saturday
1178 goto FileFunc_GetTime_end
1179
1180 FileFunc_GetTime_error:
1181 SetErrors
1182 StrCpy $0 ''
1183 StrCpy $1 ''
1184 StrCpy $2 ''
1185 StrCpy $3 ''
1186 StrCpy $4 ''
1187 StrCpy $5 ''
1188 StrCpy $6 ''
1189
1190 FileFunc_GetTime_end:
1191 Pop $7
1192 Exch $6
1193 Exch
1194 Exch $5
1195 Exch 2
1196 Exch $4
1197 Exch 3
1198 Exch $3
1199 Exch 4
1200 Exch $2
1201 Exch 5
1202 Exch $1
1203 Exch 6
1204 Exch $0
1205
1206 !verbose pop
1207 !macroend
1208
1209 !define GetFileAttributes `!insertmacro GetFileAttributesCall`
1210 !define un.GetFileAttributes `!insertmacro GetFileAttributesCall`
1211
1212 !macro GetFileAttributes
1213 !macroend
1214
1215 !macro un.GetFileAttributes
1216 !macroend
1217
1218 !macro GetFileAttributes_
1219 !verbose push
1220 !verbose ${_FILEFUNC_VERBOSE}
1221
1222 Exch $1
1223 Exch
1224 Exch $0
1225 Exch
1226 Push $2
1227 Push $3
1228 Push $4
1229 Push $5
1230
1231 System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
1232 StrCmp $2 -1 FileFunc_GetFileAttributes_error
1233 StrCpy $3 ''
1234
1235 IntOp $0 $2 & 0x4000
1236 IntCmp $0 0 +2
1237 StrCpy $3 'ENCRYPTED|'
1238
1239 IntOp $0 $2 & 0x2000
1240 IntCmp $0 0 +2
1241 StrCpy $3 'NOT_CONTENT_INDEXED|$3'
1242
1243 IntOp $0 $2 & 0x1000
1244 IntCmp $0 0 +2
1245 StrCpy $3 'OFFLINE|$3'
1246
1247 IntOp $0 $2 & 0x0800
1248 IntCmp $0 0 +2
1249 StrCpy $3 'COMPRESSED|$3'
1250
1251 IntOp $0 $2 & 0x0400
1252 IntCmp $0 0 +2
1253 StrCpy $3 'REPARSE_POINT|$3'
1254
1255 IntOp $0 $2 & 0x0200
1256 IntCmp $0 0 +2
1257 StrCpy $3 'SPARSE_FILE|$3'
1258
1259 IntOp $0 $2 & 0x0100
1260 IntCmp $0 0 +2
1261 StrCpy $3 'TEMPORARY|$3'
1262
1263 IntOp $0 $2 & 0x0080
1264 IntCmp $0 0 +2
1265 StrCpy $3 'NORMAL|$3'
1266
1267 IntOp $0 $2 & 0x0040
1268 IntCmp $0 0 +2
1269 StrCpy $3 'DEVICE|$3'
1270
1271 IntOp $0 $2 & 0x0020
1272 IntCmp $0 0 +2
1273 StrCpy $3 'ARCHIVE|$3'
1274
1275 IntOp $0 $2 & 0x0010
1276 IntCmp $0 0 +2
1277 StrCpy $3 'DIRECTORY|$3'
1278
1279 IntOp $0 $2 & 0x0004
1280 IntCmp $0 0 +2
1281 StrCpy $3 'SYSTEM|$3'
1282
1283 IntOp $0 $2 & 0x0002
1284 IntCmp $0 0 +2
1285 StrCpy $3 'HIDDEN|$3'
1286
1287 IntOp $0 $2 & 0x0001
1288 IntCmp $0 0 +2
1289 StrCpy $3 'READONLY|$3'
1290
1291 StrCpy $0 $3 -1
1292 StrCmp $1 '' FileFunc_GetFileAttributes_end
1293 StrCmp $1 'ALL' FileFunc_GetFileAttributes_end
1294
1295 FileFunc_GetFileAttributes_attrcmp:
1296 StrCpy $5 0
1297 IntOp $5 $5 + 1
1298 StrCpy $4 $1 1 $5
1299 StrCmp $4 '' +2
1300 StrCmp $4 '|' 0 -3
1301 StrCpy $2 $1 $5
1302 IntOp $5 $5 + 1
1303 StrCpy $1 $1 '' $5
1304 StrLen $3 $2
1305 StrCpy $5 -1
1306 IntOp $5 $5 + 1
1307 StrCpy $4 $0 $3 $5
1308 StrCmp $4 '' FileFunc_GetFileAttributes_notfound
1309 StrCmp $4 $2 0 -3
1310 StrCmp $1 '' 0 FileFunc_GetFileAttributes_attrcmp
1311 StrCpy $0 1
1312 goto FileFunc_GetFileAttributes_end
1313
1314 FileFunc_GetFileAttributes_notfound:
1315 StrCpy $0 0
1316 goto FileFunc_GetFileAttributes_end
1317
1318 FileFunc_GetFileAttributes_error:
1319 SetErrors
1320 StrCpy $0 ''
1321
1322 FileFunc_GetFileAttributes_end:
1323 Pop $5
1324 Pop $4
1325 Pop $3
1326 Pop $2
1327 Pop $1
1328 Exch $0
1329
1330 !verbose pop
1331 !macroend
1332
1333 !define GetFileVersion `!insertmacro GetFileVersionCall`
1334 !define un.GetFileVersion `!insertmacro GetFileVersionCall`
1335
1336 !macro GetFileVersion
1337 !macroend
1338
1339 !macro un.GetFileVersion
1340 !macroend
1341
1342 !macro GetFileVersion_
1343 !verbose push
1344 !verbose ${_FILEFUNC_VERBOSE}
1345
1346 Exch $0
1347 Push $1
1348 Push $2
1349 Push $3
1350 Push $4
1351 Push $5
1352 Push $6
1353 ClearErrors
1354
1355 GetDllVersion '$0' $1 $2
1356 IfErrors FileFunc_GetFileVersion_error
1357 IntOp $3 $1 >> 16
1358 IntOp $3 $3 & 0x0000FFFF
1359 IntOp $4 $1 & 0x0000FFFF
1360 IntOp $5 $2 >> 16
1361 IntOp $5 $5 & 0x0000FFFF
1362 IntOp $6 $2 & 0x0000FFFF
1363 StrCpy $0 '$3.$4.$5.$6'
1364 goto FileFunc_GetFileVersion_end
1365
1366 FileFunc_GetFileVersion_error:
1367 SetErrors
1368 StrCpy $0 ''
1369
1370 FileFunc_GetFileVersion_end:
1371 Pop $6
1372 Pop $5
1373 Pop $4
1374 Pop $3
1375 Pop $2
1376 Pop $1
1377 Exch $0
1378
1379 !verbose pop
1380 !macroend
1381
1382 !define GetExeName `!insertmacro GetExeNameCall`
1383 !define un.GetExeName `!insertmacro GetExeNameCall`
1384
1385 !macro GetExeName
1386 !macroend
1387
1388 !macro un.GetExeName
1389 !macroend
1390
1391 !macro GetExeName_
1392 !verbose push
1393 !verbose ${_FILEFUNC_VERBOSE}
1394
1395 Push $0
1396 Push $1
1397 Push $2
1398 System::Call 'kernel32::GetModuleFileName(p 0, t.r0, i ${NSIS_MAX_STRLEN})'
1399 System::Call 'kernel32::GetLongPathName(t r0, t.r1, i ${NSIS_MAX_STRLEN})i.r2'
1400 StrCmp $2 error +2
1401 StrCpy $0 $1
1402 Pop $2
1403 Pop $1
1404 Exch $0
1405
1406 !verbose pop
1407 !macroend
1408
1409 !define GetExePath `!insertmacro GetExePathCall`
1410 !define un.GetExePath `!insertmacro GetExePathCall`
1411
1412 !macro GetExePath
1413 !macroend
1414
1415 !macro un.GetExePath
1416 !macroend
1417
1418 !macro GetExePath_
1419 !verbose push
1420 !verbose ${_FILEFUNC_VERBOSE}
1421
1422 Push $0
1423 Push $1
1424 Push $2
1425 StrCpy $0 $EXEDIR
1426 System::Call 'kernel32::GetLongPathName(t r0, t.r1, i ${NSIS_MAX_STRLEN})i.r2'
1427 StrCmp $2 error +2
1428 StrCpy $0 $1
1429 Pop $2
1430 Pop $1
1431 Exch $0
1432
1433 !verbose pop
1434 !macroend
1435
1436 !define GetParameters `!insertmacro GetParametersCall`
1437 !define un.GetParameters `!insertmacro GetParametersCall`
1438
1439 !macro GetParameters
1440 !macroend
1441
1442 !macro un.GetParameters
1443 !macroend
1444
1445 !macro GetParameters_
1446 !verbose push
1447 !verbose ${_FILEFUNC_VERBOSE}
1448
1449 ;cmdline-check
1450 StrCmp $CMDLINE "" 0 +3
1451 Push ""
1452 Return
1453
1454 ;vars
1455 Push $0 ;tmp
1456 Push $1 ;length
1457 Push $2 ;parameter offset
1458 Push $3 ;separator
1459
1460 ;length/offset
1461 StrLen $1 $CMDLINE
1462 StrCpy $2 2 ;start with third character
1463
1464 ;separator
1465 StrCpy $3 $CMDLINE 1 ;first character
1466 StrCmp $3 '"' +2
1467 StrCpy $3 ' '
1468
1469 FileFunc_GetParameters_token: ;finding second separator
1470 IntCmp $2 $1 FileFunc_GetParameters_strip 0 FileFunc_GetParameters_strip
1471 StrCpy $0 $CMDLINE 1 $2
1472 IntOp $2 $2 + 1
1473 StrCmp $3 $0 0 FileFunc_GetParameters_token
1474
1475 FileFunc_GetParameters_strip: ;strip white space
1476 IntCmp $2 $1 FileFunc_GetParameters_copy 0 FileFunc_GetParameters_copy
1477 StrCpy $0 $CMDLINE 1 $2
1478 StrCmp $0 ' ' 0 FileFunc_GetParameters_copy
1479 IntOp $2 $2 + 1
1480 Goto FileFunc_GetParameters_strip
1481
1482 FileFunc_GetParameters_copy:
1483 StrCpy $0 $CMDLINE "" $2
1484
1485 ;strip white spaces from end
1486 FileFunc_GetParameters_rstrip:
1487 StrCpy $1 $0 1 -1
1488 StrCmp $1 ' ' 0 FileFunc_GetParameters_done
1489 StrCpy $0 $0 -1
1490 Goto FileFunc_GetParameters_rstrip
1491
1492 FileFunc_GetParameters_done:
1493 Pop $3
1494 Pop $2
1495 Pop $1
1496 Exch $0
1497
1498 !verbose pop
1499 !macroend
1500
1501 !macro GetOptionsBody _FILEFUNC_S
1502
1503 Exch $1
1504 Exch
1505 Exch $0
1506 Exch
1507 Push $2
1508 Push $3
1509 Push $4
1510 Push $5
1511 Push $6
1512 Push $7
1513 ClearErrors
1514
1515 StrCpy $2 $1 '' 1
1516 StrCpy $1 $1 1
1517 StrLen $3 $2
1518 StrCpy $7 0
1519
1520 FileFunc_GetOptions${_FILEFUNC_S}_begin:
1521 StrCpy $4 -1
1522 StrCpy $6 ''
1523
1524 FileFunc_GetOptions${_FILEFUNC_S}_quote:
1525 IntOp $4 $4 + 1
1526 StrCpy $5 $0 1 $4
1527 StrCmp${_FILEFUNC_S} $5$7 '0' FileFunc_GetOptions${_FILEFUNC_S}_notfound
1528 StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_trimright
1529 StrCmp${_FILEFUNC_S} $5 '"' 0 +7
1530 StrCmp${_FILEFUNC_S} $6 '' 0 +3
1531 StrCpy $6 '"'
1532 goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1533 StrCmp${_FILEFUNC_S} $6 '"' 0 +3
1534 StrCpy $6 ''
1535 goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1536 StrCmp${_FILEFUNC_S} $5 `'` 0 +7
1537 StrCmp${_FILEFUNC_S} $6 `` 0 +3
1538 StrCpy $6 `'`
1539 goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1540 StrCmp${_FILEFUNC_S} $6 `'` 0 +3
1541 StrCpy $6 ``
1542 goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1543 StrCmp${_FILEFUNC_S} $5 '`' 0 +7
1544 StrCmp${_FILEFUNC_S} $6 '' 0 +3
1545 StrCpy $6 '`'
1546 goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1547 StrCmp${_FILEFUNC_S} $6 '`' 0 +3
1548 StrCpy $6 ''
1549 goto FileFunc_GetOptions${_FILEFUNC_S}_quote
1550 StrCmp${_FILEFUNC_S} $6 '"' FileFunc_GetOptions${_FILEFUNC_S}_quote
1551 StrCmp${_FILEFUNC_S} $6 `'` FileFunc_GetOptions${_FILEFUNC_S}_quote
1552 StrCmp${_FILEFUNC_S} $6 '`' FileFunc_GetOptions${_FILEFUNC_S}_quote
1553 StrCmp${_FILEFUNC_S} $5 $1 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
1554 StrCmp${_FILEFUNC_S} $7 0 FileFunc_GetOptions${_FILEFUNC_S}_trimleft FileFunc_GetOptions${_FILEFUNC_S}_trimright
1555
1556 FileFunc_GetOptions${_FILEFUNC_S}_trimleft:
1557 IntOp $4 $4 + 1
1558 StrCpy $5 $0 $3 $4
1559 StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_notfound
1560 StrCmp${_FILEFUNC_S} $5 $2 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
1561 IntOp $4 $4 + $3
1562 StrCpy $0 $0 '' $4
1563 StrCpy $4 $0 1
1564 StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
1565 StrCpy $0 $0 '' 1
1566 goto -3
1567 StrCpy $7 1
1568 goto FileFunc_GetOptions${_FILEFUNC_S}_begin
1569
1570 FileFunc_GetOptions${_FILEFUNC_S}_trimright:
1571 StrCpy $0 $0 $4
1572 StrCpy $4 $0 1 -1
1573 StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
1574 StrCpy $0 $0 -1
1575 goto -3
1576 StrCpy $3 $0 1
1577 StrCpy $4 $0 1 -1
1578 StrCmp${_FILEFUNC_S} $3 $4 0 FileFunc_GetOptions${_FILEFUNC_S}_end
1579 StrCmp${_FILEFUNC_S} $3 '"' +3
1580 StrCmp${_FILEFUNC_S} $3 `'` +2
1581 StrCmp${_FILEFUNC_S} $3 '`' 0 FileFunc_GetOptions${_FILEFUNC_S}_end
1582 StrCpy $0 $0 -1 1
1583 goto FileFunc_GetOptions${_FILEFUNC_S}_end
1584
1585 FileFunc_GetOptions${_FILEFUNC_S}_notfound:
1586 SetErrors
1587 StrCpy $0 ''
1588
1589 FileFunc_GetOptions${_FILEFUNC_S}_end:
1590 Pop $7
1591 Pop $6
1592 Pop $5
1593 Pop $4
1594 Pop $3
1595 Pop $2
1596 Pop $1
1597 Exch $0
1598
1599 !macroend
1600
1601 !define GetOptions `!insertmacro GetOptionsCall`
1602 !define un.GetOptions `!insertmacro GetOptionsCall`
1603
1604 !macro GetOptions
1605 !macroend
1606
1607 !macro un.GetOptions
1608 !macroend
1609
1610 !macro GetOptions_
1611 !verbose push
1612 !verbose ${_FILEFUNC_VERBOSE}
1613
1614 !insertmacro GetOptionsBody ''
1615
1616 !verbose pop
1617 !macroend
1618
1619 !define GetOptionsS `!insertmacro GetOptionsSCall`
1620 !define un.GetOptionsS `!insertmacro GetOptionsSCall`
1621
1622 !macro GetOptionsS
1623 !macroend
1624
1625 !macro un.GetOptionsS
1626 !macroend
1627
1628 !macro GetOptionsS_
1629 !verbose push
1630 !verbose ${_FILEFUNC_VERBOSE}
1631
1632 !insertmacro GetOptionsBody 'S'
1633
1634 !verbose pop
1635 !macroend
1636
1637 !define GetRoot `!insertmacro GetRootCall`
1638 !define un.GetRoot `!insertmacro GetRootCall`
1639
1640 !macro GetRoot
1641 !macroend
1642
1643 !macro un.GetRoot
1644 !macroend
1645
1646 !macro GetRoot_
1647 !verbose push
1648 !verbose ${_FILEFUNC_VERBOSE}
1649
1650 Exch $0
1651 Push $1
1652 Push $2
1653 Push $3
1654
1655 StrCpy $1 $0 2
1656 StrCmp $1 '\\' FileFunc_GetRoot_UNC
1657 StrCpy $2 $1 1 1
1658 StrCmp $2 ':' 0 FileFunc_GetRoot_empty
1659 StrCpy $0 $1
1660 goto FileFunc_GetRoot_end
1661
1662 FileFunc_GetRoot_UNC:
1663 StrCpy $2 1
1664 StrCpy $3 ''
1665
1666 FileFunc_GetRoot_loop:
1667 IntOp $2 $2 + 1
1668 StrCpy $1 $0 1 $2
1669 StrCmp $1$3 '' FileFunc_GetRoot_empty
1670 StrCmp $1 '' +5
1671 StrCmp $1 '\' 0 FileFunc_GetRoot_loop
1672 StrCmp $3 '1' +3
1673 StrCpy $3 '1'
1674 goto FileFunc_GetRoot_loop
1675 StrCpy $0 $0 $2
1676 StrCpy $2 $0 1 -1
1677 StrCmp $2 '\' 0 FileFunc_GetRoot_end
1678
1679 FileFunc_GetRoot_empty:
1680 StrCpy $0 ''
1681
1682 FileFunc_GetRoot_end:
1683 Pop $3
1684 Pop $2
1685 Pop $1
1686 Exch $0
1687
1688 !verbose pop
1689 !macroend
1690
1691 !define GetParent `!insertmacro GetParentCall`
1692 !define un.GetParent `!insertmacro GetParentCall`
1693
1694 !macro GetParent
1695 !macroend
1696
1697 !macro un.GetParent
1698 !macroend
1699
1700 !macro GetParent_
1701 !verbose push
1702 !verbose ${_FILEFUNC_VERBOSE}
1703
1704 Exch $0
1705 Push $1
1706 Push $2
1707
1708 StrCpy $2 $0 1 -1
1709 StrCmp $2 '\' 0 +3
1710 StrCpy $0 $0 -1
1711 goto -3
1712
1713 StrCpy $1 0
1714 IntOp $1 $1 - 1
1715 StrCpy $2 $0 1 $1
1716 StrCmp $2 '\' +2
1717 StrCmp $2 '' 0 -3
1718 StrCpy $0 $0 $1
1719
1720 Pop $2
1721 Pop $1
1722 Exch $0
1723
1724 !verbose pop
1725 !macroend
1726
1727 !define GetFileName `!insertmacro GetFileNameCall`
1728 !define un.GetFileName `!insertmacro GetFileNameCall`
1729
1730 !macro GetFileName
1731 !macroend
1732
1733 !macro un.GetFileName
1734 !macroend
1735
1736 !macro GetFileName_
1737 !verbose push
1738 !verbose ${_FILEFUNC_VERBOSE}
1739
1740 Exch $0
1741 Push $1
1742 Push $2
1743
1744 StrCpy $2 $0 1 -1
1745 StrCmp $2 '\' 0 +3
1746 StrCpy $0 $0 -1
1747 goto -3
1748
1749 StrCpy $1 0
1750 IntOp $1 $1 - 1
1751 StrCpy $2 $0 1 $1
1752 StrCmp $2 '' FileFunc_GetFileName_end
1753 StrCmp $2 '\' 0 -3
1754 IntOp $1 $1 + 1
1755 StrCpy $0 $0 '' $1
1756
1757 FileFunc_GetFileName_end:
1758 Pop $2
1759 Pop $1
1760 Exch $0
1761
1762 !verbose pop
1763 !macroend
1764
1765 !define GetBaseName `!insertmacro GetBaseNameCall`
1766 !define un.GetBaseName `!insertmacro GetBaseNameCall`
1767
1768 !macro GetBaseName
1769 !macroend
1770
1771 !macro un.GetBaseName
1772 !macroend
1773
1774 !macro GetBaseName_
1775 !verbose push
1776 !verbose ${_FILEFUNC_VERBOSE}
1777
1778 Exch $0
1779 Push $1
1780 Push $2
1781 Push $3
1782
1783 StrCpy $1 0
1784 StrCpy $3 ''
1785
1786 FileFunc_GetBaseName_loop:
1787 IntOp $1 $1 - 1
1788 StrCpy $2 $0 1 $1
1789 StrCmp $2 '' FileFunc_GetBaseName_trimpath
1790 StrCmp $2 '\' FileFunc_GetBaseName_trimpath
1791 StrCmp $3 'noext' FileFunc_GetBaseName_loop
1792 StrCmp $2 '.' 0 FileFunc_GetBaseName_loop
1793 StrCpy $0 $0 $1
1794 StrCpy $3 'noext'
1795 StrCpy $1 0
1796 goto FileFunc_GetBaseName_loop
1797
1798 FileFunc_GetBaseName_trimpath:
1799 StrCmp $1 -1 FileFunc_GetBaseName_empty
1800 IntOp $1 $1 + 1
1801 StrCpy $0 $0 '' $1
1802 goto FileFunc_GetBaseName_end
1803
1804 FileFunc_GetBaseName_empty:
1805 StrCpy $0 ''
1806
1807 FileFunc_GetBaseName_end:
1808 Pop $3
1809 Pop $2
1810 Pop $1
1811 Exch $0
1812
1813 !verbose pop
1814 !macroend
1815
1816 !define GetFileExt `!insertmacro GetFileExtCall`
1817 !define un.GetFileExt `!insertmacro GetFileExtCall`
1818
1819 !macro GetFileExt
1820 !macroend
1821
1822 !macro un.GetFileExt
1823 !macroend
1824
1825 !macro GetFileExt_
1826 !verbose push
1827 !verbose ${_FILEFUNC_VERBOSE}
1828
1829 Exch $0
1830 Push $1
1831 Push $2
1832
1833 StrCpy $1 0
1834
1835 FileFunc_GetFileExt_loop:
1836 IntOp $1 $1 - 1
1837 StrCpy $2 $0 1 $1
1838 StrCmp $2 '' FileFunc_GetFileExt_empty
1839 StrCmp $2 '\' FileFunc_GetFileExt_empty
1840 StrCmp $2 '.' 0 FileFunc_GetFileExt_loop
1841
1842 StrCmp $1 -1 FileFunc_GetFileExt_empty
1843 IntOp $1 $1 + 1
1844 StrCpy $0 $0 '' $1
1845 goto FileFunc_GetFileExt_end
1846
1847 FileFunc_GetFileExt_empty:
1848 StrCpy $0 ''
1849
1850 FileFunc_GetFileExt_end:
1851 Pop $2
1852 Pop $1
1853 Exch $0
1854
1855 !verbose pop
1856 !macroend
1857
1858 !define BannerTrimPath `!insertmacro BannerTrimPathCall`
1859 !define un.BannerTrimPath `!insertmacro BannerTrimPathCall`
1860
1861 !macro BannerTrimPath
1862 !macroend
1863
1864 !macro un.BannerTrimPath
1865 !macroend
1866
1867 !macro BannerTrimPath_
1868 !verbose push
1869 !verbose ${_FILEFUNC_VERBOSE}
1870
1871 Exch $1
1872 Exch
1873 Exch $0
1874 Exch
1875 Push $2
1876 Push $3
1877 Push $4
1878
1879 StrCpy $3 $1 1 -1
1880 IntOp $1 $1 + 0
1881 StrLen $2 $0
1882 IntCmp $2 $1 FileFunc_BannerTrimPath_end FileFunc_BannerTrimPath_end
1883 IntOp $1 $1 - 3
1884 IntCmp $1 0 FileFunc_BannerTrimPath_empty FileFunc_BannerTrimPath_empty
1885 StrCmp $3 'A' FileFunc_BannerTrimPath_A-trim
1886 StrCmp $3 'B' FileFunc_BannerTrimPath_B-trim
1887 StrCmp $3 'C' FileFunc_BannerTrimPath_C-trim
1888 StrCmp $3 'D' FileFunc_BannerTrimPath_D-trim
1889
1890 FileFunc_BannerTrimPath_A-trim:
1891 StrCpy $3 $0 1 1
1892 StrCpy $2 0
1893 StrCmp $3 ':' 0 +2
1894 IntOp $2 $2 + 2
1895
1896 FileFunc_BannerTrimPath_loopleft:
1897 IntOp $2 $2 + 1
1898 StrCpy $3 $0 1 $2
1899 StrCmp $2 $1 FileFunc_BannerTrimPath_C-trim
1900 StrCmp $3 '\' 0 FileFunc_BannerTrimPath_loopleft
1901 StrCpy $3 $0 $2
1902 IntOp $2 $2 - $1
1903 IntCmp $2 0 FileFunc_BannerTrimPath_B-trim 0 FileFunc_BannerTrimPath_B-trim
1904
1905 FileFunc_BannerTrimPath_loopright:
1906 IntOp $2 $2 + 1
1907 StrCpy $4 $0 1 $2
1908 StrCmp $2 0 FileFunc_BannerTrimPath_B-trim
1909 StrCmp $4 '\' 0 FileFunc_BannerTrimPath_loopright
1910 StrCpy $4 $0 '' $2
1911 StrCpy $0 '$3\...$4'
1912 goto FileFunc_BannerTrimPath_end
1913
1914 FileFunc_BannerTrimPath_B-trim:
1915 StrCpy $2 $1
1916 IntOp $2 $2 - 1
1917 StrCmp $2 -1 FileFunc_BannerTrimPath_C-trim
1918 StrCpy $3 $0 1 $2
1919 StrCmp $3 '\' 0 -3
1920 StrCpy $0 $0 $2
1921 StrCpy $0 '$0\...'
1922 goto FileFunc_BannerTrimPath_end
1923
1924 FileFunc_BannerTrimPath_C-trim:
1925 StrCpy $0 $0 $1
1926 StrCpy $0 '$0...'
1927 goto FileFunc_BannerTrimPath_end
1928
1929 FileFunc_BannerTrimPath_D-trim:
1930 StrCpy $3 -1
1931 IntOp $3 $3 - 1
1932 StrCmp $3 -$2 FileFunc_BannerTrimPath_C-trim
1933 StrCpy $4 $0 1 $3
1934 StrCmp $4 '\' 0 -3
1935 StrCpy $4 $0 '' $3
1936 IntOp $3 $1 + $3
1937 IntCmp $3 2 FileFunc_BannerTrimPath_C-trim FileFunc_BannerTrimPath_C-trim
1938 StrCpy $0 $0 $3
1939 StrCpy $0 '$0...$4'
1940 goto FileFunc_BannerTrimPath_end
1941
1942 FileFunc_BannerTrimPath_empty:
1943 StrCpy $0 ''
1944
1945 FileFunc_BannerTrimPath_end:
1946 Pop $4
1947 Pop $3
1948 Pop $2
1949 Pop $1
1950 Exch $0
1951
1952 !verbose pop
1953 !macroend
1954
1955 !define DirState `!insertmacro DirStateCall`
1956 !define un.DirState `!insertmacro DirStateCall`
1957
1958 !macro DirState
1959 !macroend
1960
1961 !macro un.DirState
1962 !macroend
1963
1964 !macro DirState_
1965 !verbose push
1966 !verbose ${_FILEFUNC_VERBOSE}
1967
1968 Exch $0
1969 Push $1
1970 ClearErrors
1971
1972 FindFirst $1 $0 '$0\*.*'
1973 IfErrors 0 +3
1974 StrCpy $0 -1
1975 goto FileFunc_DirState_end
1976 StrCmp $0 '.' 0 +4
1977 FindNext $1 $0
1978 StrCmp $0 '..' 0 +2
1979 FindNext $1 $0
1980 FindClose $1
1981 IfErrors 0 +3
1982 StrCpy $0 0
1983 goto FileFunc_DirState_end
1984 StrCpy $0 1
1985
1986 FileFunc_DirState_end:
1987 Pop $1
1988 Exch $0
1989
1990 !verbose pop
1991 !macroend
1992
1993 !define RefreshShellIcons `!insertmacro RefreshShellIconsCall`
1994 !define un.RefreshShellIcons `!insertmacro RefreshShellIconsCall`
1995
1996 !macro RefreshShellIcons
1997 !macroend
1998
1999 !macro un.RefreshShellIcons
2000 !macroend
2001
2002 !macro RefreshShellIcons_
2003 !verbose push
2004 !verbose ${_FILEFUNC_VERBOSE}
2005
2006 System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
2007
2008 !verbose pop
2009 !macroend
2010
2011 !verbose pop
2012 !endif