home *** CD-ROM | disk | FTP | other *** search
/ Hackers Magazine 57 / CdHackersMagazineNr57.iso / Software / Programming / nsis-2.46-setup.exe / Include / FileFunc.nsh < prev    next >
Encoding:
Text File  |  2008-12-20  |  39.6 KB  |  2,018 lines

  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. !define FILEFUNC_INCLUDED
  71.  
  72. !include Util.nsh
  73.  
  74. !verbose push
  75. !verbose 3
  76. !ifndef _FILEFUNC_VERBOSE
  77.     !define _FILEFUNC_VERBOSE 3
  78. !endif
  79. !verbose ${_FILEFUNC_VERBOSE}
  80. !define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
  81. !verbose pop
  82.  
  83. !macro FILEFUNC_VERBOSE _VERBOSE
  84.     !verbose push
  85.     !verbose 3
  86.     !undef _FILEFUNC_VERBOSE
  87.     !define _FILEFUNC_VERBOSE ${_VERBOSE}
  88.     !verbose pop
  89. !macroend
  90.  
  91. !macro LocateCall _PATH _OPTIONS _FUNC
  92.     !verbose push
  93.     !verbose ${_FILEFUNC_VERBOSE}
  94.     Push $0
  95.     Push `${_PATH}`
  96.     Push `${_OPTIONS}`
  97.     GetFunctionAddress $0 `${_FUNC}`
  98.     Push `$0`
  99.     ${CallArtificialFunction} Locate_
  100.     Pop $0
  101.     !verbose pop
  102. !macroend
  103.  
  104. !macro GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
  105.     !verbose push
  106.     !verbose ${_FILEFUNC_VERBOSE}
  107.     Push `${_PATH}`
  108.     Push `${_OPTIONS}`
  109.     ${CallArtificialFunction} GetSize_
  110.     Pop ${_RESULT1}
  111.     Pop ${_RESULT2}
  112.     Pop ${_RESULT3}
  113.     !verbose pop
  114. !macroend
  115.  
  116. !macro DriveSpaceCall _DRIVE _OPTIONS _RESULT
  117.     !verbose push
  118.     !verbose ${_FILEFUNC_VERBOSE}
  119.     Push `${_DRIVE}`
  120.     Push `${_OPTIONS}`
  121.     ${CallArtificialFunction} DriveSpace_
  122.     Pop ${_RESULT}
  123.     !verbose pop
  124. !macroend
  125.  
  126. !macro GetDrivesCall _DRV _FUNC
  127.     !verbose push
  128.     !verbose ${_FILEFUNC_VERBOSE}
  129.     Push $0
  130.     Push `${_DRV}`
  131.     GetFunctionAddress $0 `${_FUNC}`
  132.     Push `$0`
  133.     ${CallArtificialFunction} GetDrives_
  134.     Pop $0
  135.     !verbose pop
  136. !macroend
  137.  
  138. !macro GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
  139.     !verbose push
  140.     !verbose ${_FILEFUNC_VERBOSE}
  141.     Push `${_FILE}`
  142.     Push `${_OPTION}`
  143.     ${CallArtificialFunction} GetTime_
  144.     Pop ${_RESULT1}
  145.     Pop ${_RESULT2}
  146.     Pop ${_RESULT3}
  147.     Pop ${_RESULT4}
  148.     Pop ${_RESULT5}
  149.     Pop ${_RESULT6}
  150.     Pop ${_RESULT7}
  151.     !verbose pop
  152. !macroend
  153.  
  154. !macro GetFileAttributesCall _PATH _ATTR _RESULT
  155.     !verbose push
  156.     !verbose ${_FILEFUNC_VERBOSE}
  157.     Push `${_PATH}`
  158.     Push `${_ATTR}`
  159.     ${CallArtificialFunction} GetFileAttributes_
  160.     Pop ${_RESULT}
  161.     !verbose pop
  162. !macroend
  163.  
  164. !macro GetFileVersionCall _FILE _RESULT
  165.     !verbose push
  166.     !verbose ${_FILEFUNC_VERBOSE}
  167.     Push `${_FILE}`
  168.     ${CallArtificialFunction} GetFileVersion_
  169.     Pop ${_RESULT}
  170.     !verbose pop
  171. !macroend
  172.  
  173. !macro GetExeNameCall _RESULT
  174.     !verbose push
  175.     !verbose ${_FILEFUNC_VERBOSE}
  176.     ${CallArtificialFunction} GetExeName_
  177.     Pop ${_RESULT}
  178.     !verbose pop
  179. !macroend
  180.  
  181. !macro GetExePathCall _RESULT
  182.     !verbose push
  183.     !verbose ${_FILEFUNC_VERBOSE}
  184.     ${CallArtificialFunction} GetExePath_
  185.     Pop ${_RESULT}
  186.     !verbose pop
  187. !macroend
  188.  
  189. !macro GetParametersCall _RESULT
  190.     !verbose push
  191.     !verbose ${_FILEFUNC_VERBOSE}
  192.     ${CallArtificialFunction} GetParameters_
  193.     Pop ${_RESULT}
  194.     !verbose pop
  195. !macroend
  196.  
  197. !macro GetOptionsCall _PARAMETERS _OPTION _RESULT
  198.     !verbose push
  199.     !verbose ${_FILEFUNC_VERBOSE}
  200.     Push `${_PARAMETERS}`
  201.     Push `${_OPTION}`
  202.     ${CallArtificialFunction} GetOptions_
  203.     Pop ${_RESULT}
  204.     !verbose pop
  205. !macroend
  206.  
  207. !macro GetOptionsSCall _PARAMETERS _OPTION _RESULT
  208.     !verbose push
  209.     !verbose ${_FILEFUNC_VERBOSE}
  210.     Push `${_PARAMETERS}`
  211.     Push `${_OPTION}`
  212.     ${CallArtificialFunction} GetOptionsS_
  213.     Pop ${_RESULT}
  214.     !verbose pop
  215. !macroend
  216.  
  217. !macro GetRootCall _FULLPATH _RESULT
  218.     !verbose push
  219.     !verbose ${_FILEFUNC_VERBOSE}
  220.     Push `${_FULLPATH}`
  221.     ${CallArtificialFunction} GetRoot_
  222.     Pop ${_RESULT}
  223.     !verbose pop
  224. !macroend
  225.  
  226. !macro GetParentCall _PATHSTRING _RESULT
  227.     !verbose push
  228.     !verbose ${_FILEFUNC_VERBOSE}
  229.     Push `${_PATHSTRING}`
  230.     ${CallArtificialFunction} GetParent_
  231.     Pop ${_RESULT}
  232.     !verbose pop
  233. !macroend
  234.  
  235. !macro GetFileNameCall _PATHSTRING _RESULT
  236.     !verbose push
  237.     !verbose ${_FILEFUNC_VERBOSE}
  238.     Push `${_PATHSTRING}`
  239.     ${CallArtificialFunction} GetFileName_
  240.     Pop ${_RESULT}
  241.     !verbose pop
  242. !macroend
  243.  
  244. !macro GetBaseNameCall _FILESTRING _RESULT
  245.     !verbose push
  246.     !verbose ${_FILEFUNC_VERBOSE}
  247.     Push `${_FILESTRING}`
  248.     ${CallArtificialFunction} GetBaseName_
  249.     Pop ${_RESULT}
  250.     !verbose pop
  251. !macroend
  252.  
  253. !macro GetFileExtCall _FILESTRING _RESULT
  254.     !verbose push
  255.     !verbose ${_FILEFUNC_VERBOSE}
  256.     Push `${_FILESTRING}`
  257.     ${CallArtificialFunction} GetFileExt_
  258.     Pop ${_RESULT}
  259.     !verbose pop
  260. !macroend
  261.  
  262. !macro BannerTrimPathCall _PATH _LENGHT _RESULT
  263.     !verbose push
  264.     !verbose ${_FILEFUNC_VERBOSE}
  265.     Push `${_PATH}`
  266.     Push `${_LENGHT}`
  267.     ${CallArtificialFunction} BannerTrimPath_
  268.     Pop ${_RESULT}
  269.     !verbose pop
  270. !macroend
  271.  
  272. !macro DirStateCall _PATH _RESULT
  273.     !verbose push
  274.     !verbose ${_FILEFUNC_VERBOSE}
  275.     Push `${_PATH}`
  276.     ${CallArtificialFunction} DirState_
  277.     Pop ${_RESULT}
  278.     !verbose pop
  279. !macroend
  280.  
  281. !macro RefreshShellIconsCall
  282.     !verbose push
  283.     !verbose ${_FILEFUNC_VERBOSE}
  284.     ${CallArtificialFunction} RefreshShellIcons_
  285.     !verbose pop
  286. !macroend
  287.  
  288. !define Locate `!insertmacro LocateCall`
  289. !define un.Locate `!insertmacro LocateCall`
  290.  
  291. !macro Locate
  292. !macroend
  293.  
  294. !macro un.Locate
  295. !macroend
  296.  
  297. !macro Locate_
  298.     !verbose push
  299.     !verbose ${_FILEFUNC_VERBOSE}
  300.         
  301.     Exch $2
  302.     Exch
  303.     Exch $1
  304.     Exch
  305.     Exch 2
  306.     Exch $0
  307.     Exch 2
  308.     Push $3
  309.     Push $4
  310.     Push $5
  311.     Push $6
  312.     Push $7
  313.     Push $8
  314.     Push $9
  315.     Push $R6
  316.     Push $R7
  317.     Push $R8
  318.     Push $R9
  319.     ClearErrors
  320.  
  321.     StrCpy $3 ''
  322.     StrCpy $4 ''
  323.     StrCpy $5 ''
  324.     StrCpy $6 ''
  325.     StrCpy $7 ''
  326.     StrCpy $8 0
  327.     StrCpy $R7 ''
  328.  
  329.     StrCpy $R9 $0 1 -1
  330.     StrCmp $R9 '\' 0 +3
  331.     StrCpy $0 $0 -1
  332.     goto -3
  333.     IfFileExists '$0\*.*' 0 FileFunc_Locate_error
  334.  
  335.     FileFunc_Locate_option:
  336.     StrCpy $R9 $1 1
  337.     StrCpy $1 $1 '' 1
  338.     StrCmp $R9 ' ' -2
  339.     StrCmp $R9 '' FileFunc_Locate_sizeset
  340.     StrCmp $R9 '/' 0 -4
  341.     StrCpy $9 -1
  342.     IntOp $9 $9 + 1
  343.     StrCpy $R9 $1 1 $9
  344.     StrCmp $R9 '' +2
  345.     StrCmp $R9 '/' 0 -3
  346.     StrCpy $R8 $1 $9
  347.     StrCpy $R8 $R8 '' 2
  348.     StrCpy $R9 $R8 '' -1
  349.     StrCmp $R9 ' ' 0 +3
  350.     StrCpy $R8 $R8 -1
  351.     goto -3
  352.     StrCpy $R9 $1 2
  353.     StrCpy $1 $1 '' $9
  354.  
  355.     StrCmp $R9 'L=' 0 FileFunc_Locate_mask
  356.     StrCpy $3 $R8
  357.     StrCmp $3 '' +6
  358.     StrCmp $3 'FD' +5
  359.     StrCmp $3 'F' +4
  360.     StrCmp $3 'D' +3
  361.     StrCmp $3 'DE' +2
  362.     StrCmp $3 'FDE' 0 FileFunc_Locate_error
  363.     goto FileFunc_Locate_option
  364.  
  365.     FileFunc_Locate_mask:
  366.     StrCmp $R9 'M=' 0 FileFunc_Locate_size
  367.     StrCpy $4 $R8
  368.     goto FileFunc_Locate_option
  369.  
  370.     FileFunc_Locate_size:
  371.     StrCmp $R9 'S=' 0 FileFunc_Locate_gotosubdir
  372.     StrCpy $6 $R8
  373.     goto FileFunc_Locate_option
  374.  
  375.     FileFunc_Locate_gotosubdir:
  376.     StrCmp $R9 'G=' 0 FileFunc_Locate_banner
  377.     StrCpy $7 $R8
  378.     StrCmp $7 '' +3
  379.     StrCmp $7 '1' +2
  380.     StrCmp $7 '0' 0 FileFunc_Locate_error
  381.     goto FileFunc_Locate_option
  382.  
  383.     FileFunc_Locate_banner:
  384.     StrCmp $R9 'B=' 0 FileFunc_Locate_error
  385.     StrCpy $R7 $R8
  386.     StrCmp $R7 '' +3
  387.     StrCmp $R7 '1' +2
  388.     StrCmp $R7 '0' 0 FileFunc_Locate_error
  389.     goto FileFunc_Locate_option
  390.  
  391.     FileFunc_Locate_sizeset:
  392.     StrCmp $6 '' FileFunc_Locate_default
  393.     StrCpy $9 0
  394.     StrCpy $R9 $6 1 $9
  395.     StrCmp $R9 '' +4
  396.     StrCmp $R9 ':' +3
  397.     IntOp $9 $9 + 1
  398.     goto -4
  399.     StrCpy $5 $6 $9
  400.     IntOp $9 $9 + 1
  401.     StrCpy $1 $6 1 -1
  402.     StrCpy $6 $6 -1 $9
  403.     StrCmp $5 '' +2
  404.     IntOp $5 $5 + 0
  405.     StrCmp $6 '' +2
  406.     IntOp $6 $6 + 0
  407.  
  408.     StrCmp $1 'B' 0 +3
  409.     StrCpy $1 1
  410.     goto FileFunc_Locate_default
  411.     StrCmp $1 'K' 0 +3
  412.     StrCpy $1 1024
  413.     goto FileFunc_Locate_default
  414.     StrCmp $1 'M' 0 +3
  415.     StrCpy $1 1048576
  416.     goto FileFunc_Locate_default
  417.     StrCmp $1 'G' 0 FileFunc_Locate_error
  418.     StrCpy $1 1073741824
  419.  
  420.     FileFunc_Locate_default:
  421.     StrCmp $3 '' 0 +2
  422.     StrCpy $3 'FD'
  423.     StrCmp $4 '' 0 +2
  424.     StrCpy $4 '*.*'
  425.     StrCmp $7 '' 0 +2
  426.     StrCpy $7 '1'
  427.     StrCmp $R7 '' 0 +2
  428.     StrCpy $R7 '0'
  429.     StrCpy $7 'G$7B$R7'
  430.  
  431.     StrCpy $8 1
  432.     Push $0
  433.     SetDetailsPrint textonly
  434.  
  435.     FileFunc_Locate_nextdir:
  436.     IntOp $8 $8 - 1
  437.     Pop $R8
  438.  
  439.     StrCpy $9 $7 2 2
  440.     StrCmp $9 'B0' +3
  441.     GetLabelAddress $9 FileFunc_Locate_findfirst
  442.     goto call
  443.     DetailPrint 'Search in: $R8'
  444.  
  445.     FileFunc_Locate_findfirst:
  446.     FindFirst $0 $R7 '$R8\$4'
  447.     IfErrors FileFunc_Locate_subdir
  448.     StrCmp $R7 '.' 0 FileFunc_Locate_dir
  449.     FindNext $0 $R7
  450.     StrCmp $R7 '..' 0 FileFunc_Locate_dir
  451.     FindNext $0 $R7
  452.     IfErrors 0 FileFunc_Locate_dir
  453.     FindClose $0
  454.     goto FileFunc_Locate_subdir
  455.  
  456.     FileFunc_Locate_dir:
  457.     IfFileExists '$R8\$R7\*.*' 0 FileFunc_Locate_file
  458.     StrCpy $R6 ''
  459.     StrCmp $3 'DE' +4
  460.     StrCmp $3 'FDE' +3
  461.     StrCmp $3 'FD' FileFunc_Locate_precall
  462.     StrCmp $3 'F' FileFunc_Locate_findnext FileFunc_Locate_precall
  463.     FindFirst $9 $R9 '$R8\$R7\*.*'
  464.     StrCmp $R9 '.' 0 +4
  465.     FindNext $9 $R9
  466.     StrCmp $R9 '..' 0 +2
  467.     FindNext $9 $R9
  468.     FindClose $9
  469.     IfErrors FileFunc_Locate_precall FileFunc_Locate_findnext
  470.  
  471.     FileFunc_Locate_file:
  472.     StrCmp $3 'FDE' +3
  473.     StrCmp $3 'FD' +2
  474.     StrCmp $3 'F' 0 FileFunc_Locate_findnext
  475.     StrCpy $R6 0
  476.     StrCmp $5$6 '' FileFunc_Locate_precall
  477.     FileOpen $9 '$R8\$R7' r
  478.     IfErrors +3
  479.     FileSeek $9 0 END $R6
  480.     FileClose $9
  481.     System::Int64Op $R6 / $1
  482.     Pop $R6
  483.     StrCmp $5 '' +2
  484.     IntCmp $R6 $5 0 FileFunc_Locate_findnext
  485.     StrCmp $6 '' +2
  486.     IntCmp $R6 $6 0 0 FileFunc_Locate_findnext
  487.  
  488.     FileFunc_Locate_precall:
  489.     StrCpy $9 0
  490.     StrCpy $R9 '$R8\$R7'
  491.  
  492.     call:
  493.     Push $0
  494.     Push $1
  495.     Push $2
  496.     Push $3
  497.     Push $4
  498.     Push $5
  499.     Push $6
  500.     Push $7
  501.     Push $8
  502.     Push $9
  503.     Push $R7
  504.     Push $R8
  505.     StrCmp $9 0 +4
  506.     StrCpy $R6 ''
  507.     StrCpy $R7 ''
  508.     StrCpy $R9 ''
  509.     Call $2
  510.     Pop $R9
  511.     Pop $R8
  512.     Pop $R7
  513.     Pop $9
  514.     Pop $8
  515.     Pop $7
  516.     Pop $6
  517.     Pop $5
  518.     Pop $4
  519.     Pop $3
  520.     Pop $2
  521.     Pop $1
  522.     Pop $0
  523.  
  524.     IfErrors 0 +3
  525.     FindClose $0
  526.     goto FileFunc_Locate_error
  527.     StrCmp $R9 'StopLocate' 0 +3
  528.     FindClose $0
  529.     goto FileFunc_Locate_clearstack
  530.     goto $9
  531.  
  532.     FileFunc_Locate_findnext:
  533.     FindNext $0 $R7
  534.     IfErrors 0 FileFunc_Locate_dir
  535.     FindClose $0
  536.  
  537.     FileFunc_Locate_subdir:
  538.     StrCpy $9 $7 2
  539.     StrCmp $9 'G0' FileFunc_Locate_end
  540.     FindFirst $0 $R7 '$R8\*.*'
  541.     StrCmp $R7 '.' 0 FileFunc_Locate_pushdir
  542.     FindNext $0 $R7
  543.     StrCmp $R7 '..' 0 FileFunc_Locate_pushdir
  544.     FindNext $0 $R7
  545.     IfErrors 0 FileFunc_Locate_pushdir
  546.     FindClose $0
  547.     StrCmp $8 0 FileFunc_Locate_end FileFunc_Locate_nextdir
  548.  
  549.     FileFunc_Locate_pushdir:
  550.     IfFileExists '$R8\$R7\*.*' 0 +3
  551.     Push '$R8\$R7'
  552.     IntOp $8 $8 + 1
  553.     FindNext $0 $R7
  554.     IfErrors 0 FileFunc_Locate_pushdir
  555.     FindClose $0
  556.     StrCmp $8 0 FileFunc_Locate_end FileFunc_Locate_nextdir
  557.  
  558.     FileFunc_Locate_error:
  559.     SetErrors
  560.  
  561.     FileFunc_Locate_clearstack:
  562.     StrCmp $8 0 FileFunc_Locate_end
  563.     IntOp $8 $8 - 1
  564.     Pop $R8
  565.     goto FileFunc_Locate_clearstack
  566.  
  567.     FileFunc_Locate_end:
  568.     SetDetailsPrint both
  569.     Pop $R9
  570.     Pop $R8
  571.     Pop $R7
  572.     Pop $R6
  573.     Pop $9
  574.     Pop $8
  575.     Pop $7
  576.     Pop $6
  577.     Pop $5
  578.     Pop $4
  579.     Pop $3
  580.     Pop $2
  581.     Pop $1
  582.     Pop $0
  583.  
  584.     !verbose pop
  585. !macroend
  586.  
  587. !define GetSize `!insertmacro GetSizeCall`
  588. !define un.GetSize `!insertmacro GetSizeCall`
  589.  
  590. !macro GetSize
  591. !macroend
  592.  
  593. !macro un.GetSize
  594. !macroend
  595.  
  596. !macro GetSize_
  597.     !verbose push
  598.     !verbose ${_FILEFUNC_VERBOSE}
  599.     
  600.     Exch $1
  601.     Exch
  602.     Exch $0
  603.     Exch
  604.     Push $2
  605.     Push $3
  606.     Push $4
  607.     Push $5
  608.     Push $6
  609.     Push $7
  610.     Push $8
  611.     Push $9
  612.     Push $R3
  613.     Push $R4
  614.     Push $R5
  615.     Push $R6
  616.     Push $R7
  617.     Push $R8
  618.     Push $R9
  619.     ClearErrors
  620.  
  621.     StrCpy $R9 $0 1 -1
  622.     StrCmp $R9 '\' 0 +3
  623.     StrCpy $0 $0 -1
  624.     goto -3
  625.     IfFileExists '$0\*.*' 0 FileFunc_GetSize_error
  626.  
  627.     StrCpy $3 ''
  628.     StrCpy $4 ''
  629.     StrCpy $5 ''
  630.     StrCpy $6 ''
  631.     StrCpy $8 0
  632.     StrCpy $R3 ''
  633.     StrCpy $R4 ''
  634.     StrCpy $R5 ''
  635.  
  636.     FileFunc_GetSize_option:
  637.     StrCpy $R9 $1 1
  638.     StrCpy $1 $1 '' 1
  639.     StrCmp $R9 ' ' -2
  640.     StrCmp $R9 '' FileFunc_GetSize_sizeset
  641.     StrCmp $R9 '/' 0 -4
  642.  
  643.     StrCpy $9 -1
  644.     IntOp $9 $9 + 1
  645.     StrCpy $R9 $1 1 $9
  646.     StrCmp $R9 '' +2
  647.     StrCmp $R9 '/' 0 -3
  648.     StrCpy $8 $1 $9
  649.     StrCpy $8 $8 '' 2
  650.     StrCpy $R9 $8 '' -1
  651.     StrCmp $R9 ' ' 0 +3
  652.     StrCpy $8 $8 -1
  653.     goto -3
  654.     StrCpy $R9 $1 2
  655.     StrCpy $1 $1 '' $9
  656.  
  657.     StrCmp $R9 'M=' 0 FileFunc_GetSize_size
  658.     StrCpy $4 $8
  659.     goto FileFunc_GetSize_option
  660.  
  661.     FileFunc_GetSize_size:
  662.     StrCmp $R9 'S=' 0 FileFunc_GetSize_gotosubdir
  663.     StrCpy $6 $8
  664.     goto FileFunc_GetSize_option
  665.  
  666.     FileFunc_GetSize_gotosubdir:
  667.     StrCmp $R9 'G=' 0 FileFunc_GetSize_error
  668.     StrCpy $7 $8
  669.     StrCmp $7 '' +3
  670.     StrCmp $7 '1' +2
  671.     StrCmp $7 '0' 0 FileFunc_GetSize_error
  672.     goto FileFunc_GetSize_option
  673.  
  674.     FileFunc_GetSize_sizeset:
  675.     StrCmp $6 '' FileFunc_GetSize_default
  676.     StrCpy $9 0
  677.     StrCpy $R9 $6 1 $9
  678.     StrCmp $R9 '' +4
  679.     StrCmp $R9 ':' +3
  680.     IntOp $9 $9 + 1
  681.     goto -4
  682.     StrCpy $5 $6 $9
  683.     IntOp $9 $9 + 1
  684.     StrCpy $1 $6 1 -1
  685.     StrCpy $6 $6 -1 $9
  686.     StrCmp $5 '' +2
  687.     IntOp $5 $5 + 0
  688.     StrCmp $6 '' +2
  689.     IntOp $6 $6 + 0
  690.  
  691.     StrCmp $1 'B' 0 +4
  692.     StrCpy $1 1
  693.     StrCpy $2 bytes
  694.     goto FileFunc_GetSize_default
  695.     StrCmp $1 'K' 0 +4
  696.     StrCpy $1 1024
  697.     StrCpy $2 Kb
  698.     goto FileFunc_GetSize_default
  699.     StrCmp $1 'M' 0 +4
  700.     StrCpy $1 1048576
  701.     StrCpy $2 Mb
  702.     goto FileFunc_GetSize_default
  703.     StrCmp $1 'G' 0 FileFunc_GetSize_error
  704.     StrCpy $1 1073741824
  705.     StrCpy $2 Gb
  706.  
  707.     FileFunc_GetSize_default:
  708.     StrCmp $4 '' 0 +2
  709.     StrCpy $4 '*.*'
  710.     StrCmp $7 '' 0 +2
  711.     StrCpy $7 '1'
  712.  
  713.     StrCpy $8 1
  714.     Push $0
  715.     SetDetailsPrint textonly
  716.  
  717.     FileFunc_GetSize_nextdir:
  718.     IntOp $8 $8 - 1
  719.     Pop $R8
  720.     FindFirst $0 $R7 '$R8\$4'
  721.     IfErrors FileFunc_GetSize_show
  722.     StrCmp $R7 '.' 0 FileFunc_GetSize_dir
  723.     FindNext $0 $R7
  724.     StrCmp $R7 '..' 0 FileFunc_GetSize_dir
  725.     FindNext $0 $R7
  726.     IfErrors 0 FileFunc_GetSize_dir
  727.     FindClose $0
  728.     goto FileFunc_GetSize_show
  729.  
  730.     FileFunc_GetSize_dir:
  731.     IfFileExists '$R8\$R7\*.*' 0 FileFunc_GetSize_file
  732.     IntOp $R5 $R5 + 1
  733.     goto FileFunc_GetSize_findnext
  734.  
  735.     FileFunc_GetSize_file:
  736.     StrCpy $R6 0
  737.     StrCmp $5$6 '' 0 +3
  738.     IntOp $R4 $R4 + 1
  739.     goto FileFunc_GetSize_findnext
  740.     FileOpen $9 '$R8\$R7' r
  741.     IfErrors +3
  742.     FileSeek $9 0 END $R6
  743.     FileClose $9
  744.     StrCmp $5 '' +2
  745.     IntCmp $R6 $5 0 FileFunc_GetSize_findnext
  746.     StrCmp $6 '' +2
  747.     IntCmp $R6 $6 0 0 FileFunc_GetSize_findnext
  748.     IntOp $R4 $R4 + 1
  749.     System::Int64Op $R3 + $R6
  750.     Pop $R3
  751.  
  752.     FileFunc_GetSize_findnext:
  753.     FindNext $0 $R7
  754.     IfErrors 0 FileFunc_GetSize_dir
  755.     FindClose $0
  756.  
  757.     FileFunc_GetSize_show:
  758.     StrCmp $5$6 '' FileFunc_GetSize_nosize
  759.     System::Int64Op $R3 / $1
  760.     Pop $9
  761.     DetailPrint 'Size:$9 $2  Files:$R4  Folders:$R5'
  762.     goto FileFunc_GetSize_subdir
  763.     FileFunc_GetSize_nosize:
  764.     DetailPrint 'Files:$R4  Folders:$R5'
  765.  
  766.     FileFunc_GetSize_subdir:
  767.     StrCmp $7 0 FileFunc_GetSize_preend
  768.     FindFirst $0 $R7 '$R8\*.*'
  769.     StrCmp $R7 '.' 0 FileFunc_GetSize_pushdir
  770.     FindNext $0 $R7
  771.     StrCmp $R7 '..' 0 FileFunc_GetSize_pushdir
  772.     FindNext $0 $R7
  773.     IfErrors 0 FileFunc_GetSize_pushdir
  774.     FindClose $0
  775.     StrCmp $8 0 FileFunc_GetSize_preend FileFunc_GetSize_nextdir
  776.  
  777.     FileFunc_GetSize_pushdir:
  778.     IfFileExists '$R8\$R7\*.*' 0 +3
  779.     Push '$R8\$R7'
  780.     IntOp $8 $8 + 1
  781.     FindNext $0 $R7
  782.     IfErrors 0 FileFunc_GetSize_pushdir
  783.     FindClose $0
  784.     StrCmp $8 0 FileFunc_GetSize_preend FileFunc_GetSize_nextdir
  785.  
  786.     FileFunc_GetSize_preend:
  787.     StrCmp $R3 '' FileFunc_GetSize_nosizeend
  788.     System::Int64Op $R3 / $1
  789.     Pop $R3
  790.     FileFunc_GetSize_nosizeend:
  791.     StrCpy $2 $R4
  792.     StrCpy $1 $R5
  793.     StrCpy $0 $R3
  794.     goto FileFunc_GetSize_end
  795.  
  796.     FileFunc_GetSize_error:
  797.     SetErrors
  798.     StrCpy $0 ''
  799.     StrCpy $1 ''
  800.     StrCpy $2 ''
  801.  
  802.     FileFunc_GetSize_end:
  803.     SetDetailsPrint both
  804.     Pop $R9
  805.     Pop $R8
  806.     Pop $R7
  807.     Pop $R6
  808.     Pop $R5
  809.     Pop $R4
  810.     Pop $R3
  811.     Pop $9
  812.     Pop $8
  813.     Pop $7
  814.     Pop $6
  815.     Pop $5
  816.     Pop $4
  817.     Pop $3
  818.     Exch $2
  819.     Exch
  820.     Exch $1
  821.     Exch 2
  822.     Exch $0
  823.  
  824.     !verbose pop
  825. !macroend
  826.  
  827. !define DriveSpace `!insertmacro DriveSpaceCall`
  828. !define un.DriveSpace `!insertmacro DriveSpaceCall`
  829.  
  830. !macro DriveSpace
  831. !macroend
  832.  
  833. !macro un.DriveSpace
  834. !macroend
  835.  
  836. !macro DriveSpace_
  837.     !verbose push
  838.     !verbose ${_FILEFUNC_VERBOSE}
  839.     
  840.     Exch $1
  841.     Exch
  842.     Exch $0
  843.     Exch
  844.     Push $2
  845.     Push $3
  846.     Push $4
  847.     Push $5
  848.     Push $6
  849.     ClearErrors
  850.  
  851.     StrCpy $2 $0 1 -1
  852.     StrCmp $2 '\' 0 +3
  853.     StrCpy $0 $0 -1
  854.     goto -3
  855.     IfFileExists '$0\NUL' 0 FileFunc_DriveSpace_error
  856.  
  857.     StrCpy $5 ''
  858.     StrCpy $6 ''
  859.  
  860.     FileFunc_DriveSpace_option:
  861.     StrCpy $2 $1 1
  862.     StrCpy $1 $1 '' 1
  863.     StrCmp $2 ' ' -2
  864.     StrCmp $2 '' FileFunc_DriveSpace_default
  865.     StrCmp $2 '/' 0 -4
  866.     StrCpy $3 -1
  867.     IntOp $3 $3 + 1
  868.     StrCpy $2 $1 1 $3
  869.     StrCmp $2 '' +2
  870.     StrCmp $2 '/' 0 -3
  871.     StrCpy $4 $1 $3
  872.     StrCpy $4 $4 '' 2
  873.     StrCpy $2 $4 1 -1
  874.     StrCmp $2 ' ' 0 +3
  875.     StrCpy $4 $4 -1
  876.     goto -3
  877.     StrCpy $2 $1 2
  878.     StrCpy $1 $1 '' $3
  879.  
  880.     StrCmp $2 'D=' 0 FileFunc_DriveSpace_unit
  881.     StrCpy $5 $4
  882.     StrCmp $5 '' +4
  883.     StrCmp $5 'T' +3
  884.     StrCmp $5 'O' +2
  885.     StrCmp $5 'F' 0 FileFunc_DriveSpace_error
  886.     goto FileFunc_DriveSpace_option
  887.  
  888.     FileFunc_DriveSpace_unit:
  889.     StrCmp $2 'S=' 0 FileFunc_DriveSpace_error
  890.     StrCpy $6 $4
  891.     goto FileFunc_DriveSpace_option
  892.  
  893.     FileFunc_DriveSpace_default:
  894.     StrCmp $5 '' 0 +2
  895.     StrCpy $5 'T'
  896.     StrCmp $6 '' 0 +3
  897.     StrCpy $6 '1'
  898.     goto FileFunc_DriveSpace_getspace
  899.  
  900.     StrCmp $6 'B' 0 +3
  901.     StrCpy $6 1
  902.     goto FileFunc_DriveSpace_getspace
  903.     StrCmp $6 'K' 0 +3
  904.     StrCpy $6 1024
  905.     goto FileFunc_DriveSpace_getspace
  906.     StrCmp $6 'M' 0 +3
  907.     StrCpy $6 1048576
  908.     goto FileFunc_DriveSpace_getspace
  909.     StrCmp $6 'G' 0 FileFunc_DriveSpace_error
  910.     StrCpy $6 1073741824
  911.  
  912.     FileFunc_DriveSpace_getspace:
  913.     System::Call 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l)i(r0,.r2,.r3,.)'
  914.  
  915.     StrCmp $5 T 0 +3
  916.     StrCpy $0 $3
  917.     goto FileFunc_DriveSpace_getsize
  918.     StrCmp $5 O 0 +4
  919.     System::Int64Op $3 - $2
  920.     Pop $0
  921.     goto FileFunc_DriveSpace_getsize
  922.     StrCmp $5 F 0 +2
  923.     StrCpy $0 $2
  924.  
  925.     FileFunc_DriveSpace_getsize:
  926.     System::Int64Op $0 / $6
  927.     Pop $0
  928.     goto FileFunc_DriveSpace_end
  929.  
  930.     FileFunc_DriveSpace_error:
  931.     SetErrors
  932.     StrCpy $0 ''
  933.  
  934.     FileFunc_DriveSpace_end:
  935.     Pop $6
  936.     Pop $5
  937.     Pop $4
  938.     Pop $3
  939.     Pop $2
  940.     Pop $1
  941.     Exch $0
  942.  
  943.     !verbose pop
  944. !macroend
  945.  
  946. !define GetDrives `!insertmacro GetDrivesCall`
  947. !define un.GetDrives `!insertmacro GetDrivesCall`
  948.  
  949. !macro GetDrives
  950. !macroend
  951.  
  952. !macro un.GetDrives
  953. !macroend
  954.  
  955. !macro GetDrives_
  956.     !verbose push
  957.     !verbose ${_FILEFUNC_VERBOSE}
  958.     
  959.     Exch $1
  960.     Exch
  961.     Exch $0
  962.     Exch
  963.     Push $2
  964.     Push $3
  965.     Push $4
  966.     Push $5
  967.     Push $6
  968.     Push $8
  969.     Push $9
  970.  
  971.     System::Alloc 1024
  972.     Pop $2
  973.     System::Call 'kernel32::GetLogicalDriveStringsA(i,i) i(1024, r2)'
  974.  
  975.     StrCmp $0 ALL FileFunc_GetDrives_drivestring
  976.     StrCmp $0 '' 0 FileFunc_GetDrives_typeset
  977.     StrCpy $0 ALL
  978.     goto FileFunc_GetDrives_drivestring
  979.  
  980.     FileFunc_GetDrives_typeset:
  981.     StrCpy $6 -1
  982.     IntOp $6 $6 + 1
  983.     StrCpy $8 $0 1 $6
  984.     StrCmp $8$0 '' FileFunc_GetDrives_enumex
  985.     StrCmp $8 '' +2
  986.     StrCmp $8 '+' 0 -4
  987.     StrCpy $8 $0 $6
  988.     IntOp $6 $6 + 1
  989.     StrCpy $0 $0 '' $6
  990.  
  991.     StrCmp $8 'FDD' 0 +3
  992.     StrCpy $6 2
  993.     goto FileFunc_GetDrives_drivestring
  994.     StrCmp $8 'HDD' 0 +3
  995.     StrCpy $6 3
  996.     goto FileFunc_GetDrives_drivestring
  997.     StrCmp $8 'NET' 0 +3
  998.     StrCpy $6 4
  999.     goto FileFunc_GetDrives_drivestring
  1000.     StrCmp $8 'CDROM' 0 +3
  1001.     StrCpy $6 5
  1002.     goto FileFunc_GetDrives_drivestring
  1003.     StrCmp $8 'RAM' 0 FileFunc_GetDrives_typeset
  1004.     StrCpy $6 6
  1005.  
  1006.     FileFunc_GetDrives_drivestring:
  1007.     StrCpy $3 $2
  1008.  
  1009.     FileFunc_GetDrives_enumok:
  1010.     System::Call 'kernel32::lstrlenA(t) i(i r3) .r4'
  1011.     StrCmp $4$0 '0ALL' FileFunc_GetDrives_enumex
  1012.     StrCmp $4 0 FileFunc_GetDrives_typeset
  1013.     System::Call 'kernel32::GetDriveTypeA(t) i(i r3) .r5'
  1014.  
  1015.     StrCmp $0 ALL +2
  1016.     StrCmp $5 $6 FileFunc_GetDrives_letter FileFunc_GetDrives_enumnext
  1017.     StrCmp $5 2 0 +3
  1018.     StrCpy $8 FDD
  1019.     goto FileFunc_GetDrives_letter
  1020.     StrCmp $5 3 0 +3
  1021.     StrCpy $8 HDD
  1022.     goto FileFunc_GetDrives_letter
  1023.     StrCmp $5 4 0 +3
  1024.     StrCpy $8 NET
  1025.     goto FileFunc_GetDrives_letter
  1026.     StrCmp $5 5 0 +3
  1027.     StrCpy $8 CDROM
  1028.     goto FileFunc_GetDrives_letter
  1029.     StrCmp $5 6 0 FileFunc_GetDrives_enumex
  1030.     StrCpy $8 RAM
  1031.  
  1032.     FileFunc_GetDrives_letter:
  1033.     System::Call '*$3(&t1024 .r9)'
  1034.  
  1035.     Push $0
  1036.     Push $1
  1037.     Push $2
  1038.     Push $3
  1039.     Push $4
  1040.     Push $5
  1041.     Push $6
  1042.     Push $8
  1043.     Call $1
  1044.     Pop $9
  1045.     Pop $8
  1046.     Pop $6
  1047.     Pop $5
  1048.     Pop $4
  1049.     Pop $3
  1050.     Pop $2
  1051.     Pop $1
  1052.     Pop $0
  1053.     StrCmp $9 'StopGetDrives' FileFunc_GetDrives_enumex
  1054.  
  1055.     FileFunc_GetDrives_enumnext:
  1056.     IntOp $3 $3 + $4
  1057.     IntOp $3 $3 + 1
  1058.     goto FileFunc_GetDrives_enumok
  1059.  
  1060.     FileFunc_GetDrives_enumex:
  1061.     System::Free $2
  1062.  
  1063.     Pop $9
  1064.     Pop $8
  1065.     Pop $6
  1066.     Pop $5
  1067.     Pop $4
  1068.     Pop $3
  1069.     Pop $2
  1070.     Pop $1
  1071.     Pop $0
  1072.     
  1073.     !verbose pop
  1074. !macroend
  1075.  
  1076. !define GetTime `!insertmacro GetTimeCall`
  1077. !define un.GetTime `!insertmacro GetTimeCall`
  1078.  
  1079. !macro GetTime
  1080. !macroend
  1081.  
  1082. !macro un.GetTime
  1083. !macroend
  1084.  
  1085. !macro GetTime_
  1086.     !verbose push
  1087.     !verbose ${_FILEFUNC_VERBOSE}
  1088.     
  1089.     Exch $1
  1090.     Exch
  1091.     Exch $0
  1092.     Exch
  1093.     Push $2
  1094.     Push $3
  1095.     Push $4
  1096.     Push $5
  1097.     Push $6
  1098.     Push $7
  1099.     ClearErrors
  1100.  
  1101.     StrCmp $1 'L' FileFunc_GetTime_gettime
  1102.     StrCmp $1 'A' FileFunc_GetTime_getfile
  1103.     StrCmp $1 'C' FileFunc_GetTime_getfile
  1104.     StrCmp $1 'M' FileFunc_GetTime_getfile
  1105.     StrCmp $1 'LS' FileFunc_GetTime_gettime
  1106.     StrCmp $1 'AS' FileFunc_GetTime_getfile
  1107.     StrCmp $1 'CS' FileFunc_GetTime_getfile
  1108.     StrCmp $1 'MS' FileFunc_GetTime_getfile
  1109.     goto FileFunc_GetTime_error
  1110.  
  1111.     FileFunc_GetTime_getfile:
  1112.     IfFileExists $0 0 FileFunc_GetTime_error
  1113.     System::Call '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r6'
  1114.     System::Call 'kernel32::FindFirstFileA(t,i)i(r0,r6) .r2'
  1115.     System::Call 'kernel32::FindClose(i)i(r2)'
  1116.  
  1117.     FileFunc_GetTime_gettime:
  1118.     System::Call '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
  1119.     StrCmp $1 'L' 0 FileFunc_GetTime_systemtime
  1120.     System::Call 'kernel32::GetLocalTime(i)i(r7)'
  1121.     goto FileFunc_GetTime_convert
  1122.     FileFunc_GetTime_systemtime:
  1123.     StrCmp $1 'LS' 0 FileFunc_GetTime_filetime
  1124.     System::Call 'kernel32::GetSystemTime(i)i(r7)'
  1125.     goto FileFunc_GetTime_convert
  1126.  
  1127.     FileFunc_GetTime_filetime:
  1128.     System::Call '*$6(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r4,.r3,.r2)'
  1129.     System::Free $6
  1130.     StrCmp $1 'A' 0 +3
  1131.     StrCpy $2 $3
  1132.     goto FileFunc_GetTime_tolocal
  1133.     StrCmp $1 'C' 0 +3
  1134.     StrCpy $2 $4
  1135.     goto FileFunc_GetTime_tolocal
  1136.     StrCmp $1 'M' FileFunc_GetTime_tolocal
  1137.  
  1138.     StrCmp $1 'AS' FileFunc_GetTime_tosystem
  1139.     StrCmp $1 'CS' 0 +3
  1140.     StrCpy $3 $4
  1141.     goto FileFunc_GetTime_tosystem
  1142.     StrCmp $1 'MS' 0 +3
  1143.     StrCpy $3 $2
  1144.     goto FileFunc_GetTime_tosystem
  1145.  
  1146.     FileFunc_GetTime_tolocal:
  1147.     System::Call 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
  1148.     FileFunc_GetTime_tosystem:
  1149.     System::Call 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'
  1150.  
  1151.     FileFunc_GetTime_convert:
  1152.     System::Call '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
  1153.     System::Free $7
  1154.  
  1155.     IntCmp $0 9 0 0 +2
  1156.     StrCpy $0 '0$0'
  1157.     IntCmp $1 9 0 0 +2
  1158.     StrCpy $1 '0$1'
  1159.     IntCmp $2 9 0 0 +2
  1160.     StrCpy $2 '0$2'
  1161.     IntCmp $6 9 0 0 +2
  1162.     StrCpy $6 '0$6'
  1163.  
  1164.     StrCmp $4 0 0 +3
  1165.     StrCpy $4 Sunday
  1166.     goto FileFunc_GetTime_end
  1167.     StrCmp $4 1 0 +3
  1168.     StrCpy $4 Monday
  1169.     goto FileFunc_GetTime_end
  1170.     StrCmp $4 2 0 +3
  1171.     StrCpy $4 Tuesday
  1172.     goto FileFunc_GetTime_end
  1173.     StrCmp $4 3 0 +3
  1174.     StrCpy $4 Wednesday
  1175.     goto FileFunc_GetTime_end
  1176.     StrCmp $4 4 0 +3
  1177.     StrCpy $4 Thursday
  1178.     goto FileFunc_GetTime_end
  1179.     StrCmp $4 5 0 +3
  1180.     StrCpy $4 Friday
  1181.     goto FileFunc_GetTime_end
  1182.     StrCmp $4 6 0 FileFunc_GetTime_error
  1183.     StrCpy $4 Saturday
  1184.     goto FileFunc_GetTime_end
  1185.  
  1186.     FileFunc_GetTime_error:
  1187.     SetErrors
  1188.     StrCpy $0 ''
  1189.     StrCpy $1 ''
  1190.     StrCpy $2 ''
  1191.     StrCpy $3 ''
  1192.     StrCpy $4 ''
  1193.     StrCpy $5 ''
  1194.     StrCpy $6 ''
  1195.  
  1196.     FileFunc_GetTime_end:
  1197.     Pop $7
  1198.     Exch $6
  1199.     Exch
  1200.     Exch $5
  1201.     Exch 2
  1202.     Exch $4
  1203.     Exch 3
  1204.     Exch $3
  1205.     Exch 4
  1206.     Exch $2
  1207.     Exch 5
  1208.     Exch $1
  1209.     Exch 6
  1210.     Exch $0
  1211.  
  1212.     !verbose pop
  1213. !macroend
  1214.  
  1215. !define GetFileAttributes `!insertmacro GetFileAttributesCall`
  1216. !define un.GetFileAttributes `!insertmacro GetFileAttributesCall`
  1217.  
  1218. !macro GetFileAttributes
  1219. !macroend
  1220.  
  1221. !macro un.GetFileAttributes
  1222. !macroend
  1223.  
  1224. !macro GetFileAttributes_
  1225.     !verbose push
  1226.     !verbose ${_FILEFUNC_VERBOSE}
  1227.     
  1228.     Exch $1
  1229.     Exch
  1230.     Exch $0
  1231.     Exch
  1232.     Push $2
  1233.     Push $3
  1234.     Push $4
  1235.     Push $5
  1236.  
  1237.     System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
  1238.     StrCmp $2 -1 FileFunc_GetFileAttributes_error
  1239.     StrCpy $3 ''
  1240.  
  1241.     IntOp $0 $2 & 0x4000
  1242.     IntCmp $0 0 +2
  1243.     StrCpy $3 'ENCRYPTED|'
  1244.  
  1245.     IntOp $0 $2 & 0x2000
  1246.     IntCmp $0 0 +2
  1247.     StrCpy $3 'NOT_CONTENT_INDEXED|$3'
  1248.  
  1249.     IntOp $0 $2 & 0x1000
  1250.     IntCmp $0 0 +2
  1251.     StrCpy $3 'OFFLINE|$3'
  1252.  
  1253.     IntOp $0 $2 & 0x0800
  1254.     IntCmp $0 0 +2
  1255.     StrCpy $3 'COMPRESSED|$3'
  1256.  
  1257.     IntOp $0 $2 & 0x0400
  1258.     IntCmp $0 0 +2
  1259.     StrCpy $3 'REPARSE_POINT|$3'
  1260.  
  1261.     IntOp $0 $2 & 0x0200
  1262.     IntCmp $0 0 +2
  1263.     StrCpy $3 'SPARSE_FILE|$3'
  1264.  
  1265.     IntOp $0 $2 & 0x0100
  1266.     IntCmp $0 0 +2
  1267.     StrCpy $3 'TEMPORARY|$3'
  1268.  
  1269.     IntOp $0 $2 & 0x0080
  1270.     IntCmp $0 0 +2
  1271.     StrCpy $3 'NORMAL|$3'
  1272.  
  1273.     IntOp $0 $2 & 0x0040
  1274.     IntCmp $0 0 +2
  1275.     StrCpy $3 'DEVICE|$3'
  1276.  
  1277.     IntOp $0 $2 & 0x0020
  1278.     IntCmp $0 0 +2
  1279.     StrCpy $3 'ARCHIVE|$3'
  1280.  
  1281.     IntOp $0 $2 & 0x0010
  1282.     IntCmp $0 0 +2
  1283.     StrCpy $3 'DIRECTORY|$3'
  1284.  
  1285.     IntOp $0 $2 & 0x0004
  1286.     IntCmp $0 0 +2
  1287.     StrCpy $3 'SYSTEM|$3'
  1288.  
  1289.     IntOp $0 $2 & 0x0002
  1290.     IntCmp $0 0 +2
  1291.     StrCpy $3 'HIDDEN|$3'
  1292.  
  1293.     IntOp $0 $2 & 0x0001
  1294.     IntCmp $0 0 +2
  1295.     StrCpy $3 'READONLY|$3'
  1296.  
  1297.     StrCpy $0 $3 -1
  1298.     StrCmp $1 '' FileFunc_GetFileAttributes_end
  1299.     StrCmp $1 'ALL' FileFunc_GetFileAttributes_end
  1300.  
  1301.     FileFunc_GetFileAttributes_attrcmp:
  1302.     StrCpy $5 0
  1303.     IntOp $5 $5 + 1
  1304.     StrCpy $4 $1 1 $5
  1305.     StrCmp $4 '' +2
  1306.     StrCmp $4 '|'  0 -3
  1307.     StrCpy $2 $1 $5
  1308.     IntOp $5 $5 + 1
  1309.     StrCpy $1 $1 '' $5
  1310.     StrLen $3 $2
  1311.     StrCpy $5 -1
  1312.     IntOp $5 $5 + 1
  1313.     StrCpy $4 $0 $3 $5
  1314.     StrCmp $4 '' FileFunc_GetFileAttributes_notfound
  1315.     StrCmp $4 $2 0 -3
  1316.     StrCmp $1 '' 0 FileFunc_GetFileAttributes_attrcmp
  1317.     StrCpy $0 1
  1318.     goto FileFunc_GetFileAttributes_end
  1319.  
  1320.     FileFunc_GetFileAttributes_notfound:
  1321.     StrCpy $0 0
  1322.     goto FileFunc_GetFileAttributes_end
  1323.  
  1324.     FileFunc_GetFileAttributes_error:
  1325.     SetErrors
  1326.     StrCpy $0 ''
  1327.  
  1328.     FileFunc_GetFileAttributes_end:
  1329.     Pop $5
  1330.     Pop $4
  1331.     Pop $3
  1332.     Pop $2
  1333.     Pop $1
  1334.     Exch $0
  1335.         
  1336.     !verbose pop
  1337. !macroend
  1338.  
  1339. !define GetFileVersion `!insertmacro GetFileVersionCall`
  1340. !define un.GetFileVersion `!insertmacro GetFileVersionCall`
  1341.  
  1342. !macro GetFileVersion
  1343. !macroend
  1344.  
  1345. !macro un.GetFileVersion
  1346. !macroend
  1347.  
  1348. !macro GetFileVersion_
  1349.     !verbose push
  1350.     !verbose ${_FILEFUNC_VERBOSE}
  1351.     
  1352.     Exch $0
  1353.     Push $1
  1354.     Push $2
  1355.     Push $3
  1356.     Push $4
  1357.     Push $5
  1358.     Push $6
  1359.     ClearErrors
  1360.  
  1361.     GetDllVersion '$0' $1 $2
  1362.     IfErrors FileFunc_GetFileVersion_error
  1363.     IntOp $3 $1 >> 16
  1364.     IntOp $3 $3 & 0x0000FFFF
  1365.     IntOp $4 $1 & 0x0000FFFF
  1366.     IntOp $5 $2 >> 16
  1367.     IntOp $5 $5 & 0x0000FFFF
  1368.     IntOp $6 $2 & 0x0000FFFF
  1369.     StrCpy $0 '$3.$4.$5.$6'
  1370.     goto FileFunc_GetFileVersion_end
  1371.  
  1372.     FileFunc_GetFileVersion_error:
  1373.     SetErrors
  1374.     StrCpy $0 ''
  1375.  
  1376.     FileFunc_GetFileVersion_end:
  1377.     Pop $6
  1378.     Pop $5
  1379.     Pop $4
  1380.     Pop $3
  1381.     Pop $2
  1382.     Pop $1
  1383.     Exch $0
  1384.  
  1385.     !verbose pop
  1386. !macroend
  1387.  
  1388. !define GetExeName `!insertmacro GetExeNameCall`
  1389. !define un.GetExeName `!insertmacro GetExeNameCall`
  1390.  
  1391. !macro GetExeName
  1392. !macroend
  1393.  
  1394. !macro un.GetExeName
  1395. !macroend
  1396.  
  1397. !macro GetExeName_
  1398.     !verbose push
  1399.     !verbose ${_FILEFUNC_VERBOSE}
  1400.     
  1401.     Push $0
  1402.     Push $1
  1403.     Push $2
  1404.     System::Call 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)'
  1405.     System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
  1406.     StrCmp $2 error +2
  1407.     StrCpy $0 $1
  1408.     Pop $2
  1409.     Pop $1
  1410.     Exch $0
  1411.  
  1412.     !verbose pop
  1413. !macroend
  1414.  
  1415. !define GetExePath `!insertmacro GetExePathCall`
  1416. !define un.GetExePath `!insertmacro GetExePathCall`
  1417.  
  1418. !macro GetExePath
  1419. !macroend
  1420.  
  1421. !macro un.GetExePath
  1422. !macroend
  1423.  
  1424. !macro GetExePath_
  1425.     !verbose push
  1426.     !verbose ${_FILEFUNC_VERBOSE}
  1427.     
  1428.     Push $0
  1429.     Push $1
  1430.     Push $2
  1431.     StrCpy $0 $EXEDIR
  1432.     System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
  1433.     StrCmp $2 error +2
  1434.     StrCpy $0 $1
  1435.     Pop $2
  1436.     Pop $1
  1437.     Exch $0
  1438.     
  1439.     !verbose pop
  1440. !macroend
  1441.  
  1442. !define GetParameters `!insertmacro GetParametersCall`
  1443. !define un.GetParameters `!insertmacro GetParametersCall`
  1444.  
  1445. !macro GetParameters
  1446. !macroend
  1447.  
  1448. !macro un.GetParameters
  1449. !macroend
  1450.  
  1451. !macro GetParameters_
  1452.     !verbose push
  1453.     !verbose ${_FILEFUNC_VERBOSE}
  1454.     
  1455.     ;cmdline-check
  1456.     StrCmp $CMDLINE "" 0 +3
  1457.     Push ""
  1458.     Return
  1459.  
  1460.     ;vars
  1461.     Push $0  ;tmp
  1462.     Push $1  ;length
  1463.     Push $2  ;parameter offset
  1464.     Push $3  ;separator
  1465.  
  1466.     ;length/offset
  1467.     StrLen $1 $CMDLINE
  1468.     StrCpy $2 2  ;start with third character
  1469.  
  1470.     ;separator
  1471.     StrCpy $3 $CMDLINE 1 ;first character
  1472.     StrCmp $3 '"' +2
  1473.     StrCpy $3 ' '
  1474.  
  1475.     FileFunc_GetParameters_token:  ;finding second separator
  1476.     IntCmp $2 $1 FileFunc_GetParameters_strip 0 FileFunc_GetParameters_strip
  1477.     StrCpy $0 $CMDLINE 1 $2
  1478.     IntOp $2 $2 + 1
  1479.     StrCmp $3 $0 0 FileFunc_GetParameters_token
  1480.  
  1481.     FileFunc_GetParameters_strip:  ;strip white space
  1482.     IntCmp $2 $1 FileFunc_GetParameters_copy 0 FileFunc_GetParameters_copy
  1483.     StrCpy $0 $CMDLINE 1 $2
  1484.     StrCmp $0 ' ' 0 FileFunc_GetParameters_copy
  1485.     IntOp $2 $2 + 1
  1486.     Goto FileFunc_GetParameters_strip
  1487.  
  1488.     FileFunc_GetParameters_copy:
  1489.     StrCpy $0 $CMDLINE "" $2
  1490.  
  1491.     ;strip white spaces from end
  1492.     FileFunc_GetParameters_rstrip:
  1493.     StrCpy $1 $0 1 -1
  1494.     StrCmp $1 ' ' 0 FileFunc_GetParameters_done
  1495.     StrCpy $0 $0 -1
  1496.     Goto FileFunc_GetParameters_rstrip
  1497.  
  1498.     FileFunc_GetParameters_done:
  1499.     Pop $3
  1500.     Pop $2
  1501.     Pop $1
  1502.     Exch $0
  1503.  
  1504.     !verbose pop
  1505. !macroend
  1506.  
  1507. !macro GetOptionsBody _FILEFUNC_S
  1508.  
  1509.     Exch $1
  1510.     Exch
  1511.     Exch $0
  1512.     Exch
  1513.     Push $2
  1514.     Push $3
  1515.     Push $4
  1516.     Push $5
  1517.     Push $6
  1518.     Push $7
  1519.     ClearErrors
  1520.  
  1521.     StrCpy $2 $1 '' 1
  1522.     StrCpy $1 $1 1
  1523.     StrLen $3 $2
  1524.     StrCpy $7 0
  1525.  
  1526.     FileFunc_GetOptions${_FILEFUNC_S}_begin:
  1527.     StrCpy $4 -1
  1528.     StrCpy $6 ''
  1529.  
  1530.     FileFunc_GetOptions${_FILEFUNC_S}_quote:
  1531.     IntOp $4 $4 + 1
  1532.     StrCpy $5 $0 1 $4
  1533.     StrCmp${_FILEFUNC_S} $5$7 '0' FileFunc_GetOptions${_FILEFUNC_S}_notfound
  1534.     StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_trimright
  1535.     StrCmp${_FILEFUNC_S} $5 '"' 0 +7
  1536.     StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1537.     StrCpy $6 '"'
  1538.     goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1539.     StrCmp${_FILEFUNC_S} $6 '"' 0 +3
  1540.     StrCpy $6 ''
  1541.     goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1542.     StrCmp${_FILEFUNC_S} $5 `'` 0 +7
  1543.     StrCmp${_FILEFUNC_S} $6 `` 0 +3
  1544.     StrCpy $6 `'`
  1545.     goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1546.     StrCmp${_FILEFUNC_S} $6 `'` 0 +3
  1547.     StrCpy $6 ``
  1548.     goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1549.     StrCmp${_FILEFUNC_S} $5 '`' 0 +7
  1550.     StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1551.     StrCpy $6 '`'
  1552.     goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1553.     StrCmp${_FILEFUNC_S} $6 '`' 0 +3
  1554.     StrCpy $6 ''
  1555.     goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1556.     StrCmp${_FILEFUNC_S} $6 '"' FileFunc_GetOptions${_FILEFUNC_S}_quote
  1557.     StrCmp${_FILEFUNC_S} $6 `'` FileFunc_GetOptions${_FILEFUNC_S}_quote
  1558.     StrCmp${_FILEFUNC_S} $6 '`' FileFunc_GetOptions${_FILEFUNC_S}_quote
  1559.     StrCmp${_FILEFUNC_S} $5 $1 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
  1560.     StrCmp${_FILEFUNC_S} $7 0 FileFunc_GetOptions${_FILEFUNC_S}_trimleft FileFunc_GetOptions${_FILEFUNC_S}_trimright
  1561.  
  1562.     FileFunc_GetOptions${_FILEFUNC_S}_trimleft:
  1563.     IntOp $4 $4 + 1
  1564.     StrCpy $5 $0 $3 $4
  1565.     StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_notfound
  1566.     StrCmp${_FILEFUNC_S} $5 $2 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
  1567.     IntOp $4 $4 + $3
  1568.     StrCpy $0 $0 '' $4
  1569.     StrCpy $4 $0 1
  1570.     StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1571.     StrCpy $0 $0 '' 1
  1572.     goto -3
  1573.     StrCpy $7 1
  1574.     goto FileFunc_GetOptions${_FILEFUNC_S}_begin
  1575.  
  1576.     FileFunc_GetOptions${_FILEFUNC_S}_trimright:
  1577.     StrCpy $0 $0 $4
  1578.     StrCpy $4 $0 1 -1
  1579.     StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1580.     StrCpy $0 $0 -1
  1581.     goto -3
  1582.     StrCpy $3 $0 1
  1583.     StrCpy $4 $0 1 -1
  1584.     StrCmp${_FILEFUNC_S} $3 $4 0 FileFunc_GetOptions${_FILEFUNC_S}_end
  1585.     StrCmp${_FILEFUNC_S} $3 '"' +3
  1586.     StrCmp${_FILEFUNC_S} $3 `'` +2
  1587.     StrCmp${_FILEFUNC_S} $3 '`' 0 FileFunc_GetOptions${_FILEFUNC_S}_end
  1588.     StrCpy $0 $0 -1 1
  1589.     goto FileFunc_GetOptions${_FILEFUNC_S}_end
  1590.  
  1591.     FileFunc_GetOptions${_FILEFUNC_S}_notfound:
  1592.     SetErrors
  1593.     StrCpy $0 ''
  1594.  
  1595.     FileFunc_GetOptions${_FILEFUNC_S}_end:
  1596.     Pop $7
  1597.     Pop $6
  1598.     Pop $5
  1599.     Pop $4
  1600.     Pop $3
  1601.     Pop $2
  1602.     Pop $1
  1603.     Exch $0
  1604.  
  1605. !macroend
  1606.  
  1607. !define GetOptions `!insertmacro GetOptionsCall`
  1608. !define un.GetOptions `!insertmacro GetOptionsCall`
  1609.  
  1610. !macro GetOptions
  1611. !macroend
  1612.  
  1613. !macro un.GetOptions
  1614. !macroend
  1615.  
  1616. !macro GetOptions_
  1617.     !verbose push
  1618.     !verbose ${_FILEFUNC_VERBOSE}
  1619.  
  1620.     !insertmacro GetOptionsBody ''
  1621.  
  1622.     !verbose pop
  1623. !macroend
  1624.  
  1625. !define GetOptionsS `!insertmacro GetOptionsSCall`
  1626. !define un.GetOptionsS `!insertmacro GetOptionsSCall`
  1627.  
  1628. !macro GetOptionsS
  1629. !macroend
  1630.  
  1631. !macro un.GetOptionsS
  1632. !macroend
  1633.  
  1634. !macro GetOptionsS_
  1635.     !verbose push
  1636.     !verbose ${_FILEFUNC_VERBOSE}
  1637.  
  1638.     !insertmacro GetOptionsBody 'S'
  1639.  
  1640.     !verbose pop
  1641. !macroend
  1642.  
  1643. !define GetRoot `!insertmacro GetRootCall`
  1644. !define un.GetRoot `!insertmacro GetRootCall`
  1645.  
  1646. !macro GetRoot
  1647. !macroend
  1648.  
  1649. !macro un.GetRoot
  1650. !macroend
  1651.  
  1652. !macro GetRoot_
  1653.     !verbose push
  1654.     !verbose ${_FILEFUNC_VERBOSE}
  1655.     
  1656.     Exch $0
  1657.     Push $1
  1658.     Push $2
  1659.     Push $3
  1660.  
  1661.     StrCpy $1 $0 2
  1662.     StrCmp $1 '\\' FileFunc_GetRoot_UNC
  1663.     StrCpy $2 $1 1 1
  1664.     StrCmp $2 ':' 0 FileFunc_GetRoot_empty
  1665.     StrCpy $0 $1
  1666.     goto FileFunc_GetRoot_end
  1667.  
  1668.     FileFunc_GetRoot_UNC:
  1669.     StrCpy $2 1
  1670.     StrCpy $3 ''
  1671.  
  1672.     FileFunc_GetRoot_loop:
  1673.     IntOp $2 $2 + 1
  1674.     StrCpy $1 $0 1 $2
  1675.     StrCmp $1$3 '' FileFunc_GetRoot_empty
  1676.     StrCmp $1 '' +5
  1677.     StrCmp $1 '\' 0 FileFunc_GetRoot_loop
  1678.     StrCmp $3 '1' +3
  1679.     StrCpy $3 '1'
  1680.     goto FileFunc_GetRoot_loop
  1681.     StrCpy $0 $0 $2
  1682.     StrCpy $2 $0 1 -1
  1683.     StrCmp $2 '\' 0 FileFunc_GetRoot_end
  1684.  
  1685.     FileFunc_GetRoot_empty:
  1686.     StrCpy $0 ''
  1687.  
  1688.     FileFunc_GetRoot_end:
  1689.     Pop $3
  1690.     Pop $2
  1691.     Pop $1
  1692.     Exch $0
  1693.  
  1694.     !verbose pop
  1695. !macroend
  1696.  
  1697. !define GetParent `!insertmacro GetParentCall`
  1698. !define un.GetParent `!insertmacro GetParentCall`
  1699.  
  1700. !macro GetParent
  1701. !macroend
  1702.  
  1703. !macro un.GetParent
  1704. !macroend
  1705.  
  1706. !macro GetParent_
  1707.     !verbose push
  1708.     !verbose ${_FILEFUNC_VERBOSE}
  1709.     
  1710.     Exch $0
  1711.     Push $1
  1712.     Push $2
  1713.  
  1714.     StrCpy $2 $0 1 -1
  1715.     StrCmp $2 '\' 0 +3
  1716.     StrCpy $0 $0 -1
  1717.     goto -3
  1718.  
  1719.     StrCpy $1 0
  1720.     IntOp $1 $1 - 1
  1721.     StrCpy $2 $0 1 $1
  1722.     StrCmp $2 '\' +2
  1723.     StrCmp $2 '' 0 -3
  1724.     StrCpy $0 $0 $1
  1725.  
  1726.     Pop $2
  1727.     Pop $1
  1728.     Exch $0
  1729.  
  1730.     !verbose pop
  1731. !macroend
  1732.  
  1733. !define GetFileName `!insertmacro GetFileNameCall`
  1734. !define un.GetFileName `!insertmacro GetFileNameCall`
  1735.  
  1736. !macro GetFileName
  1737. !macroend
  1738.  
  1739. !macro un.GetFileName
  1740. !macroend
  1741.  
  1742. !macro GetFileName_
  1743.     !verbose push
  1744.     !verbose ${_FILEFUNC_VERBOSE}
  1745.     
  1746.     Exch $0
  1747.     Push $1
  1748.     Push $2
  1749.  
  1750.     StrCpy $2 $0 1 -1
  1751.     StrCmp $2 '\' 0 +3
  1752.     StrCpy $0 $0 -1
  1753.     goto -3
  1754.  
  1755.     StrCpy $1 0
  1756.     IntOp $1 $1 - 1
  1757.     StrCpy $2 $0 1 $1
  1758.     StrCmp $2 '' FileFunc_GetFileName_end
  1759.     StrCmp $2 '\' 0 -3
  1760.     IntOp $1 $1 + 1
  1761.     StrCpy $0 $0 '' $1
  1762.  
  1763.     FileFunc_GetFileName_end:
  1764.     Pop $2
  1765.     Pop $1
  1766.     Exch $0
  1767.  
  1768.     !verbose pop
  1769. !macroend
  1770.  
  1771. !define GetBaseName `!insertmacro GetBaseNameCall`
  1772. !define un.GetBaseName `!insertmacro GetBaseNameCall`
  1773.  
  1774. !macro GetBaseName
  1775. !macroend
  1776.  
  1777. !macro un.GetBaseName
  1778. !macroend
  1779.  
  1780. !macro GetBaseName_
  1781.     !verbose push
  1782.     !verbose ${_FILEFUNC_VERBOSE}
  1783.     
  1784.     Exch $0
  1785.     Push $1
  1786.     Push $2
  1787.     Push $3
  1788.  
  1789.     StrCpy $1 0
  1790.     StrCpy $3 ''
  1791.  
  1792.     FileFunc_GetBaseName_loop:
  1793.     IntOp $1 $1 - 1
  1794.     StrCpy $2 $0 1 $1
  1795.     StrCmp $2 '' FileFunc_GetBaseName_trimpath
  1796.     StrCmp $2 '\' FileFunc_GetBaseName_trimpath
  1797.     StrCmp $3 'noext' FileFunc_GetBaseName_loop
  1798.     StrCmp $2 '.' 0 FileFunc_GetBaseName_loop
  1799.     StrCpy $0 $0 $1
  1800.     StrCpy $3 'noext'
  1801.     StrCpy $1 0
  1802.     goto FileFunc_GetBaseName_loop
  1803.  
  1804.     FileFunc_GetBaseName_trimpath:
  1805.     StrCmp $1 -1 FileFunc_GetBaseName_empty
  1806.     IntOp $1 $1 + 1
  1807.     StrCpy $0 $0 '' $1
  1808.     goto FileFunc_GetBaseName_end
  1809.  
  1810.     FileFunc_GetBaseName_empty:
  1811.     StrCpy $0 ''
  1812.  
  1813.     FileFunc_GetBaseName_end:
  1814.     Pop $3
  1815.     Pop $2
  1816.     Pop $1
  1817.     Exch $0
  1818.  
  1819.     !verbose pop
  1820. !macroend
  1821.  
  1822. !define GetFileExt `!insertmacro GetFileExtCall`
  1823. !define un.GetFileExt `!insertmacro GetFileExtCall`
  1824.  
  1825. !macro GetFileExt
  1826. !macroend
  1827.  
  1828. !macro un.GetFileExt
  1829. !macroend
  1830.  
  1831. !macro GetFileExt_
  1832.     !verbose push
  1833.     !verbose ${_FILEFUNC_VERBOSE}
  1834.     
  1835.     Exch $0
  1836.     Push $1
  1837.     Push $2
  1838.  
  1839.     StrCpy $1 0
  1840.  
  1841.     FileFunc_GetFileExt_loop:
  1842.     IntOp $1 $1 - 1
  1843.     StrCpy $2 $0 1 $1
  1844.     StrCmp $2 '' FileFunc_GetFileExt_empty
  1845.     StrCmp $2 '\' FileFunc_GetFileExt_empty
  1846.     StrCmp $2 '.' 0 FileFunc_GetFileExt_loop
  1847.  
  1848.     StrCmp $1 -1 FileFunc_GetFileExt_empty
  1849.     IntOp $1 $1 + 1
  1850.     StrCpy $0 $0 '' $1
  1851.     goto FileFunc_GetFileExt_end
  1852.  
  1853.     FileFunc_GetFileExt_empty:
  1854.     StrCpy $0 ''
  1855.  
  1856.     FileFunc_GetFileExt_end:
  1857.     Pop $2
  1858.     Pop $1
  1859.     Exch $0
  1860.  
  1861.     !verbose pop
  1862. !macroend
  1863.  
  1864. !define BannerTrimPath `!insertmacro BannerTrimPathCall`
  1865. !define un.BannerTrimPath `!insertmacro BannerTrimPathCall`
  1866.  
  1867. !macro BannerTrimPath
  1868. !macroend
  1869.  
  1870. !macro un.BannerTrimPath
  1871. !macroend
  1872.  
  1873. !macro BannerTrimPath_
  1874.     !verbose push
  1875.     !verbose ${_FILEFUNC_VERBOSE}
  1876.     
  1877.     Exch $1
  1878.     Exch
  1879.     Exch $0
  1880.     Exch
  1881.     Push $2
  1882.     Push $3
  1883.     Push $4
  1884.  
  1885.     StrCpy $3 $1 1 -1
  1886.     IntOp $1 $1 + 0
  1887.     StrLen $2 $0
  1888.     IntCmp $2 $1 FileFunc_BannerTrimPath_end FileFunc_BannerTrimPath_end
  1889.     IntOp $1 $1 - 3
  1890.     IntCmp $1 0 FileFunc_BannerTrimPath_empty FileFunc_BannerTrimPath_empty
  1891.     StrCmp $3 'A' FileFunc_BannerTrimPath_A-trim
  1892.     StrCmp $3 'B' FileFunc_BannerTrimPath_B-trim
  1893.     StrCmp $3 'C' FileFunc_BannerTrimPath_C-trim
  1894.     StrCmp $3 'D' FileFunc_BannerTrimPath_D-trim
  1895.  
  1896.     FileFunc_BannerTrimPath_A-trim:
  1897.     StrCpy $3 $0 1 1
  1898.     StrCpy $2 0
  1899.     StrCmp $3 ':' 0 +2
  1900.     IntOp $2 $2 + 2
  1901.  
  1902.     FileFunc_BannerTrimPath_loopleft:
  1903.     IntOp $2 $2 + 1
  1904.     StrCpy $3 $0 1 $2
  1905.     StrCmp $2 $1 FileFunc_BannerTrimPath_C-trim
  1906.     StrCmp $3 '\' 0 FileFunc_BannerTrimPath_loopleft
  1907.     StrCpy $3 $0 $2
  1908.     IntOp $2 $2 - $1
  1909.     IntCmp $2 0 FileFunc_BannerTrimPath_B-trim 0 FileFunc_BannerTrimPath_B-trim
  1910.  
  1911.     FileFunc_BannerTrimPath_loopright:
  1912.     IntOp $2 $2 + 1
  1913.     StrCpy $4 $0 1 $2
  1914.     StrCmp $2 0 FileFunc_BannerTrimPath_B-trim
  1915.     StrCmp $4 '\' 0 FileFunc_BannerTrimPath_loopright
  1916.     StrCpy $4 $0 '' $2
  1917.     StrCpy $0 '$3\...$4'
  1918.     goto FileFunc_BannerTrimPath_end
  1919.  
  1920.     FileFunc_BannerTrimPath_B-trim:
  1921.     StrCpy $2 $1
  1922.     IntOp $2 $2 - 1
  1923.     StrCmp $2 -1 FileFunc_BannerTrimPath_C-trim
  1924.     StrCpy $3 $0 1 $2
  1925.     StrCmp $3 '\' 0 -3
  1926.     StrCpy $0 $0 $2
  1927.     StrCpy $0 '$0\...'
  1928.     goto FileFunc_BannerTrimPath_end
  1929.  
  1930.     FileFunc_BannerTrimPath_C-trim:
  1931.     StrCpy $0 $0 $1
  1932.     StrCpy $0 '$0...'
  1933.     goto FileFunc_BannerTrimPath_end
  1934.  
  1935.     FileFunc_BannerTrimPath_D-trim:
  1936.     StrCpy $3 -1
  1937.     IntOp $3 $3 - 1
  1938.     StrCmp $3 -$2 FileFunc_BannerTrimPath_C-trim
  1939.     StrCpy $4 $0 1 $3
  1940.     StrCmp $4 '\' 0 -3
  1941.     StrCpy $4 $0 '' $3
  1942.     IntOp $3 $1 + $3
  1943.     IntCmp $3 2 FileFunc_BannerTrimPath_C-trim FileFunc_BannerTrimPath_C-trim
  1944.     StrCpy $0 $0 $3
  1945.     StrCpy $0 '$0...$4'
  1946.     goto FileFunc_BannerTrimPath_end
  1947.  
  1948.     FileFunc_BannerTrimPath_empty:
  1949.     StrCpy $0 ''
  1950.  
  1951.     FileFunc_BannerTrimPath_end:
  1952.     Pop $4
  1953.     Pop $3
  1954.     Pop $2
  1955.     Pop $1
  1956.     Exch $0
  1957.  
  1958.     !verbose pop
  1959. !macroend
  1960.  
  1961. !define DirState `!insertmacro DirStateCall`
  1962. !define un.DirState `!insertmacro DirStateCall`
  1963.  
  1964. !macro DirState
  1965. !macroend
  1966.  
  1967. !macro un.DirState
  1968. !macroend
  1969.  
  1970. !macro DirState_
  1971.     !verbose push
  1972.     !verbose ${_FILEFUNC_VERBOSE}
  1973.     
  1974.     Exch $0
  1975.     Push $1
  1976.     ClearErrors
  1977.  
  1978.     FindFirst $1 $0 '$0\*.*'
  1979.     IfErrors 0 +3
  1980.     StrCpy $0 -1
  1981.     goto FileFunc_DirState_end
  1982.     StrCmp $0 '.' 0 +4
  1983.     FindNext $1 $0
  1984.     StrCmp $0 '..' 0 +2
  1985.     FindNext $1 $0
  1986.     FindClose $1
  1987.     IfErrors 0 +3
  1988.     StrCpy $0 0
  1989.     goto FileFunc_DirState_end
  1990.     StrCpy $0 1
  1991.  
  1992.     FileFunc_DirState_end:
  1993.     Pop $1
  1994.     Exch $0
  1995.  
  1996.     !verbose pop
  1997. !macroend
  1998.  
  1999. !define RefreshShellIcons `!insertmacro RefreshShellIconsCall`
  2000. !define un.RefreshShellIcons `!insertmacro RefreshShellIconsCall`
  2001.  
  2002. !macro RefreshShellIcons
  2003. !macroend
  2004.  
  2005. !macro un.RefreshShellIcons
  2006. !macroend
  2007.  
  2008. !macro RefreshShellIcons_
  2009.     !verbose push
  2010.     !verbose ${_FILEFUNC_VERBOSE}
  2011.     
  2012.     System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
  2013.  
  2014.     !verbose pop
  2015. !macroend
  2016.  
  2017. !endif
  2018.