home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 March / PCWMAR09.iso / Software / Freeware / NSIS 2.41 / nsis-2.41-setup.exe / Include / FileFunc.nsh < prev    next >
Encoding:
Text File  |  2008-10-10  |  45.1 KB  |  2,454 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. !insertmacro FileFunction
  14.  3. [Section|Function]
  15.       ${FileFunction} "Param1" "Param2" "..." $var
  16.     [SectionEnd|FunctionEnd]
  17.  
  18.  
  19.  FileFunction=[Locate|GetSize|DriveSpace|GetDrives|GetTime|GetFileAttributes|
  20.                GetFileVersion|GetExeName|GetExePath|GetParameters|GetOptions|
  21.                GetOptionsS|GetRoot|GetParent|GetFileName|GetBaseName|GetFileExt|
  22.                BannerTrimPath|DirState|RefreshShellIcons]
  23.  
  24.  un.FileFunction=[un.Locate|un.GetSize|un.DriveSpace|un.GetDrives|un.GetTime|
  25.                   un.GetFileAttributes|un.GetFileVersion|un.GetExeName|
  26.                   un.GetExePath|un.GetParameters|un.GetOptions|un.GetOptionsS|
  27.                   un.GetRoot|un.GetParent|un.GetFileName|un.GetBaseName|
  28.                   un.GetFileExt|un.BannerTrimPath|un.DirState|un.RefreshShellIcons]
  29.  
  30. _____________________________________________________________________________
  31.  
  32.                        Thanks to:
  33. _____________________________________________________________________________
  34.  
  35. GetSize
  36.     KiCHiK (Function "FindFiles")
  37. DriveSpace
  38.     sunjammer (Function "CheckSpaceFree")
  39. GetDrives
  40.     deguix (Based on his idea of Function "DetectDrives")
  41. GetTime
  42.     Takhir (Script "StatTest") and deguix (Function "FileModifiedDate")
  43. GetFileVersion
  44.     KiCHiK (Based on his example for command "GetDLLVersion")
  45. GetParameters
  46.     sunjammer (Based on his Function "GetParameters")
  47. GetRoot
  48.     KiCHiK (Based on his Function "GetRoot")
  49. GetParent
  50.     sunjammer (Based on his Function "GetParent")
  51. GetFileName
  52.     KiCHiK (Based on his Function "GetFileName")
  53. GetBaseName
  54.     comperio (Based on his idea of Function "GetBaseName")
  55. GetFileExt
  56.     opher (author)
  57. RefreshShellIcons
  58.     jerome tremblay (author)
  59. */
  60.  
  61.  
  62. ;_____________________________________________________________________________
  63. ;
  64. ;                         Macros
  65. ;_____________________________________________________________________________
  66. ;
  67. ; Change log window verbosity (default: 3=no script)
  68. ;
  69. ; Example:
  70. ; !include "FileFunc.nsh"
  71. ; !insertmacro Locate
  72. ; ${FILEFUNC_VERBOSE} 4   # all verbosity
  73. ; !insertmacro VersionCompare
  74. ; ${FILEFUNC_VERBOSE} 3   # no script
  75.  
  76. !ifndef FILEFUNC_INCLUDED
  77. !define FILEFUNC_INCLUDED
  78.  
  79. !verbose push
  80. !verbose 3
  81. !ifndef _FILEFUNC_VERBOSE
  82.     !define _FILEFUNC_VERBOSE 3
  83. !endif
  84. !verbose ${_FILEFUNC_VERBOSE}
  85. !define FILEFUNC_VERBOSE `!insertmacro FILEFUNC_VERBOSE`
  86. !define _FILEFUNC_UN
  87. !define _FILEFUNC_S
  88. !verbose pop
  89.  
  90. !macro FILEFUNC_VERBOSE _VERBOSE
  91.     !verbose push
  92.     !verbose 3
  93.     !undef _FILEFUNC_VERBOSE
  94.     !define _FILEFUNC_VERBOSE ${_VERBOSE}
  95.     !verbose pop
  96. !macroend
  97.  
  98.  
  99. # Install. Case insensitive. #
  100.  
  101. !macro LocateCall _PATH _OPTIONS _FUNC
  102.     !verbose push
  103.     !verbose ${_FILEFUNC_VERBOSE}
  104.     Push $0
  105.     Push `${_PATH}`
  106.     Push `${_OPTIONS}`
  107.     GetFunctionAddress $0 `${_FUNC}`
  108.     Push `$0`
  109.     Call Locate
  110.     Pop $0
  111.     !verbose pop
  112. !macroend
  113.  
  114. !macro GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
  115.     !verbose push
  116.     !verbose ${_FILEFUNC_VERBOSE}
  117.     Push `${_PATH}`
  118.     Push `${_OPTIONS}`
  119.     Call GetSize
  120.     Pop ${_RESULT1}
  121.     Pop ${_RESULT2}
  122.     Pop ${_RESULT3}
  123.     !verbose pop
  124. !macroend
  125.  
  126. !macro DriveSpaceCall _DRIVE _OPTIONS _RESULT
  127.     !verbose push
  128.     !verbose ${_FILEFUNC_VERBOSE}
  129.     Push `${_DRIVE}`
  130.     Push `${_OPTIONS}`
  131.     Call DriveSpace
  132.     Pop ${_RESULT}
  133.     !verbose pop
  134. !macroend
  135.  
  136. !macro GetDrivesCall _DRV _FUNC
  137.     !verbose push
  138.     !verbose ${_FILEFUNC_VERBOSE}
  139.     Push $0
  140.     Push `${_DRV}`
  141.     GetFunctionAddress $0 `${_FUNC}`
  142.     Push `$0`
  143.     Call GetDrives
  144.     Pop $0
  145.     !verbose pop
  146. !macroend
  147.  
  148. !macro GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
  149.     !verbose push
  150.     !verbose ${_FILEFUNC_VERBOSE}
  151.     Push `${_FILE}`
  152.     Push `${_OPTION}`
  153.     Call GetTime
  154.     Pop ${_RESULT1}
  155.     Pop ${_RESULT2}
  156.     Pop ${_RESULT3}
  157.     Pop ${_RESULT4}
  158.     Pop ${_RESULT5}
  159.     Pop ${_RESULT6}
  160.     Pop ${_RESULT7}
  161.     !verbose pop
  162. !macroend
  163.  
  164. !macro GetFileAttributesCall _PATH _ATTR _RESULT
  165.     !verbose push
  166.     !verbose ${_FILEFUNC_VERBOSE}
  167.     Push `${_PATH}`
  168.     Push `${_ATTR}`
  169.     Call GetFileAttributes
  170.     Pop ${_RESULT}
  171.     !verbose pop
  172. !macroend
  173.  
  174. !macro GetFileVersionCall _FILE _RESULT
  175.     !verbose push
  176.     !verbose ${_FILEFUNC_VERBOSE}
  177.     Push `${_FILE}`
  178.     Call GetFileVersion
  179.     Pop ${_RESULT}
  180.     !verbose pop
  181. !macroend
  182.  
  183. !macro GetExeNameCall _RESULT
  184.     !verbose push
  185.     !verbose ${_FILEFUNC_VERBOSE}
  186.     Call GetExeName
  187.     Pop ${_RESULT}
  188.     !verbose pop
  189. !macroend
  190.  
  191. !macro GetExePathCall _RESULT
  192.     !verbose push
  193.     !verbose ${_FILEFUNC_VERBOSE}
  194.     Call GetExePath
  195.     Pop ${_RESULT}
  196.     !verbose pop
  197. !macroend
  198.  
  199. !macro GetParametersCall _RESULT
  200.     !verbose push
  201.     !verbose ${_FILEFUNC_VERBOSE}
  202.     Call GetParameters
  203.     Pop ${_RESULT}
  204.     !verbose pop
  205. !macroend
  206.  
  207. !macro GetOptionsCall _PARAMETERS _OPTION _RESULT
  208.     !verbose push
  209.     !verbose ${_FILEFUNC_VERBOSE}
  210.     Push `${_PARAMETERS}`
  211.     Push `${_OPTION}`
  212.     Call GetOptions
  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.     Call 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.     Call 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.     Call 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.     Call 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.     Call 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.     Call 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.     Call DirState
  277.     Pop ${_RESULT}
  278.     !verbose pop
  279. !macroend
  280.  
  281. !macro RefreshShellIconsCall
  282.     !verbose push
  283.     !verbose ${_FILEFUNC_VERBOSE}
  284.     Call RefreshShellIcons
  285.     !verbose pop
  286. !macroend
  287.  
  288. !macro Locate
  289.     !ifndef ${_FILEFUNC_UN}Locate
  290.         !verbose push
  291.         !verbose ${_FILEFUNC_VERBOSE}
  292.         !define ${_FILEFUNC_UN}Locate `!insertmacro ${_FILEFUNC_UN}LocateCall`
  293.  
  294.         Function ${_FILEFUNC_UN}Locate
  295.             Exch $2
  296.             Exch
  297.             Exch $1
  298.             Exch
  299.             Exch 2
  300.             Exch $0
  301.             Exch 2
  302.             Push $3
  303.             Push $4
  304.             Push $5
  305.             Push $6
  306.             Push $7
  307.             Push $8
  308.             Push $9
  309.             Push $R6
  310.             Push $R7
  311.             Push $R8
  312.             Push $R9
  313.             ClearErrors
  314.  
  315.             StrCpy $3 ''
  316.             StrCpy $4 ''
  317.             StrCpy $5 ''
  318.             StrCpy $6 ''
  319.             StrCpy $7 ''
  320.             StrCpy $8 0
  321.             StrCpy $R7 ''
  322.  
  323.             StrCpy $R9 $0 1 -1
  324.             StrCmp $R9 '\' 0 +3
  325.             StrCpy $0 $0 -1
  326.             goto -3
  327.             IfFileExists '$0\*.*' 0 error
  328.  
  329.             option:
  330.             StrCpy $R9 $1 1
  331.             StrCpy $1 $1 '' 1
  332.             StrCmp $R9 ' ' -2
  333.             StrCmp $R9 '' sizeset
  334.             StrCmp $R9 '/' 0 -4
  335.             StrCpy $9 -1
  336.             IntOp $9 $9 + 1
  337.             StrCpy $R9 $1 1 $9
  338.             StrCmp $R9 '' +2
  339.             StrCmp $R9 '/' 0 -3
  340.             StrCpy $R8 $1 $9
  341.             StrCpy $R8 $R8 '' 2
  342.             StrCpy $R9 $R8 '' -1
  343.             StrCmp $R9 ' ' 0 +3
  344.             StrCpy $R8 $R8 -1
  345.             goto -3
  346.             StrCpy $R9 $1 2
  347.             StrCpy $1 $1 '' $9
  348.  
  349.             StrCmp $R9 'L=' 0 mask
  350.             StrCpy $3 $R8
  351.             StrCmp $3 '' +6
  352.             StrCmp $3 'FD' +5
  353.             StrCmp $3 'F' +4
  354.             StrCmp $3 'D' +3
  355.             StrCmp $3 'DE' +2
  356.             StrCmp $3 'FDE' 0 error
  357.             goto option
  358.  
  359.             mask:
  360.             StrCmp $R9 'M=' 0 size
  361.             StrCpy $4 $R8
  362.             goto option
  363.  
  364.             size:
  365.             StrCmp $R9 'S=' 0 gotosubdir
  366.             StrCpy $6 $R8
  367.             goto option
  368.  
  369.             gotosubdir:
  370.             StrCmp $R9 'G=' 0 banner
  371.             StrCpy $7 $R8
  372.             StrCmp $7 '' +3
  373.             StrCmp $7 '1' +2
  374.             StrCmp $7 '0' 0 error
  375.             goto option
  376.  
  377.             banner:
  378.             StrCmp $R9 'B=' 0 error
  379.             StrCpy $R7 $R8
  380.             StrCmp $R7 '' +3
  381.             StrCmp $R7 '1' +2
  382.             StrCmp $R7 '0' 0 error
  383.             goto option
  384.  
  385.             sizeset:
  386.             StrCmp $6 '' default
  387.             StrCpy $9 0
  388.             StrCpy $R9 $6 1 $9
  389.             StrCmp $R9 '' +4
  390.             StrCmp $R9 ':' +3
  391.             IntOp $9 $9 + 1
  392.             goto -4
  393.             StrCpy $5 $6 $9
  394.             IntOp $9 $9 + 1
  395.             StrCpy $1 $6 1 -1
  396.             StrCpy $6 $6 -1 $9
  397.             StrCmp $5 '' +2
  398.             IntOp $5 $5 + 0
  399.             StrCmp $6 '' +2
  400.             IntOp $6 $6 + 0
  401.  
  402.             StrCmp $1 'B' 0 +3
  403.             StrCpy $1 1
  404.             goto default
  405.             StrCmp $1 'K' 0 +3
  406.             StrCpy $1 1024
  407.             goto default
  408.             StrCmp $1 'M' 0 +3
  409.             StrCpy $1 1048576
  410.             goto default
  411.             StrCmp $1 'G' 0 error
  412.             StrCpy $1 1073741824
  413.  
  414.             default:
  415.             StrCmp $3 '' 0 +2
  416.             StrCpy $3 'FD'
  417.             StrCmp $4 '' 0 +2
  418.             StrCpy $4 '*.*'
  419.             StrCmp $7 '' 0 +2
  420.             StrCpy $7 '1'
  421.             StrCmp $R7 '' 0 +2
  422.             StrCpy $R7 '0'
  423.             StrCpy $7 'G$7B$R7'
  424.  
  425.             StrCpy $8 1
  426.             Push $0
  427.             SetDetailsPrint textonly
  428.  
  429.             nextdir:
  430.             IntOp $8 $8 - 1
  431.             Pop $R8
  432.  
  433.             StrCpy $9 $7 2 2
  434.             StrCmp $9 'B0' +3
  435.             GetLabelAddress $9 findfirst
  436.             goto call
  437.             DetailPrint 'Search in: $R8'
  438.  
  439.             findfirst:
  440.             FindFirst $0 $R7 '$R8\$4'
  441.             IfErrors subdir
  442.             StrCmp $R7 '.' 0 dir
  443.             FindNext $0 $R7
  444.             StrCmp $R7 '..' 0 dir
  445.             FindNext $0 $R7
  446.             IfErrors 0 dir
  447.             FindClose $0
  448.             goto subdir
  449.  
  450.             dir:
  451.             IfFileExists '$R8\$R7\*.*' 0 file
  452.             StrCpy $R6 ''
  453.             StrCmp $3 'DE' +4
  454.             StrCmp $3 'FDE' +3
  455.             StrCmp $3 'FD' precall
  456.             StrCmp $3 'F' findnext precall
  457.             FindFirst $9 $R9 '$R8\$R7\*.*'
  458.             StrCmp $R9 '.' 0 +4
  459.             FindNext $9 $R9
  460.             StrCmp $R9 '..' 0 +2
  461.             FindNext $9 $R9
  462.             FindClose $9
  463.             IfErrors precall findnext
  464.  
  465.             file:
  466.             StrCmp $3 'FDE' +3
  467.             StrCmp $3 'FD' +2
  468.             StrCmp $3 'F' 0 findnext
  469.             StrCpy $R6 0
  470.             StrCmp $5$6 '' precall
  471.             FileOpen $9 '$R8\$R7' r
  472.             IfErrors +3
  473.             FileSeek $9 0 END $R6
  474.             FileClose $9
  475.             System::Int64Op $R6 / $1
  476.             Pop $R6
  477.             StrCmp $5 '' +2
  478.             IntCmp $R6 $5 0 findnext
  479.             StrCmp $6 '' +2
  480.             IntCmp $R6 $6 0 0 findnext
  481.  
  482.             precall:
  483.             StrCpy $9 0
  484.             StrCpy $R9 '$R8\$R7'
  485.  
  486.             call:
  487.             Push $0
  488.             Push $1
  489.             Push $2
  490.             Push $3
  491.             Push $4
  492.             Push $5
  493.             Push $6
  494.             Push $7
  495.             Push $8
  496.             Push $9
  497.             Push $R7
  498.             Push $R8
  499.             StrCmp $9 0 +4
  500.             StrCpy $R6 ''
  501.             StrCpy $R7 ''
  502.             StrCpy $R9 ''
  503.             Call $2
  504.             Pop $R9
  505.             Pop $R8
  506.             Pop $R7
  507.             Pop $9
  508.             Pop $8
  509.             Pop $7
  510.             Pop $6
  511.             Pop $5
  512.             Pop $4
  513.             Pop $3
  514.             Pop $2
  515.             Pop $1
  516.             Pop $0
  517.  
  518.             IfErrors 0 +3
  519.             FindClose $0
  520.             goto error
  521.             StrCmp $R9 'StopLocate' 0 +3
  522.             FindClose $0
  523.             goto clearstack
  524.             goto $9
  525.  
  526.             findnext:
  527.             FindNext $0 $R7
  528.             IfErrors 0 dir
  529.             FindClose $0
  530.  
  531.             subdir:
  532.             StrCpy $9 $7 2
  533.             StrCmp $9 'G0' end
  534.             FindFirst $0 $R7 '$R8\*.*'
  535.             StrCmp $R7 '.' 0 pushdir
  536.             FindNext $0 $R7
  537.             StrCmp $R7 '..' 0 pushdir
  538.             FindNext $0 $R7
  539.             IfErrors 0 pushdir
  540.             FindClose $0
  541.             StrCmp $8 0 end nextdir
  542.  
  543.             pushdir:
  544.             IfFileExists '$R8\$R7\*.*' 0 +3
  545.             Push '$R8\$R7'
  546.             IntOp $8 $8 + 1
  547.             FindNext $0 $R7
  548.             IfErrors 0 pushdir
  549.             FindClose $0
  550.             StrCmp $8 0 end nextdir
  551.  
  552.             error:
  553.             SetErrors
  554.  
  555.             clearstack:
  556.             StrCmp $8 0 end
  557.             IntOp $8 $8 - 1
  558.             Pop $R8
  559.             goto clearstack
  560.  
  561.             end:
  562.             SetDetailsPrint both
  563.             Pop $R9
  564.             Pop $R8
  565.             Pop $R7
  566.             Pop $R6
  567.             Pop $9
  568.             Pop $8
  569.             Pop $7
  570.             Pop $6
  571.             Pop $5
  572.             Pop $4
  573.             Pop $3
  574.             Pop $2
  575.             Pop $1
  576.             Pop $0
  577.         FunctionEnd
  578.  
  579.         !verbose pop
  580.     !endif
  581. !macroend
  582.  
  583. !macro GetSize
  584.     !ifndef ${_FILEFUNC_UN}GetSize
  585.         !verbose push
  586.         !verbose ${_FILEFUNC_VERBOSE}
  587.         !define ${_FILEFUNC_UN}GetSize `!insertmacro ${_FILEFUNC_UN}GetSizeCall`
  588.  
  589.         Function ${_FILEFUNC_UN}GetSize
  590.             Exch $1
  591.             Exch
  592.             Exch $0
  593.             Exch
  594.             Push $2
  595.             Push $3
  596.             Push $4
  597.             Push $5
  598.             Push $6
  599.             Push $7
  600.             Push $8
  601.             Push $9
  602.             Push $R3
  603.             Push $R4
  604.             Push $R5
  605.             Push $R6
  606.             Push $R7
  607.             Push $R8
  608.             Push $R9
  609.             ClearErrors
  610.  
  611.             StrCpy $R9 $0 1 -1
  612.             StrCmp $R9 '\' 0 +3
  613.             StrCpy $0 $0 -1
  614.             goto -3
  615.             IfFileExists '$0\*.*' 0 error
  616.  
  617.             StrCpy $3 ''
  618.             StrCpy $4 ''
  619.             StrCpy $5 ''
  620.             StrCpy $6 ''
  621.             StrCpy $8 0
  622.             StrCpy $R3 ''
  623.             StrCpy $R4 ''
  624.             StrCpy $R5 ''
  625.  
  626.             option:
  627.             StrCpy $R9 $1 1
  628.             StrCpy $1 $1 '' 1
  629.             StrCmp $R9 ' ' -2
  630.             StrCmp $R9 '' sizeset
  631.             StrCmp $R9 '/' 0 -4
  632.  
  633.             StrCpy $9 -1
  634.             IntOp $9 $9 + 1
  635.             StrCpy $R9 $1 1 $9
  636.             StrCmp $R9 '' +2
  637.             StrCmp $R9 '/' 0 -3
  638.             StrCpy $8 $1 $9
  639.             StrCpy $8 $8 '' 2
  640.             StrCpy $R9 $8 '' -1
  641.             StrCmp $R9 ' ' 0 +3
  642.             StrCpy $8 $8 -1
  643.             goto -3
  644.             StrCpy $R9 $1 2
  645.             StrCpy $1 $1 '' $9
  646.  
  647.             StrCmp $R9 'M=' 0 size
  648.             StrCpy $4 $8
  649.             goto option
  650.  
  651.             size:
  652.             StrCmp $R9 'S=' 0 gotosubdir
  653.             StrCpy $6 $8
  654.             goto option
  655.  
  656.             gotosubdir:
  657.             StrCmp $R9 'G=' 0 error
  658.             StrCpy $7 $8
  659.             StrCmp $7 '' +3
  660.             StrCmp $7 '1' +2
  661.             StrCmp $7 '0' 0 error
  662.             goto option
  663.  
  664.             sizeset:
  665.             StrCmp $6 '' default
  666.             StrCpy $9 0
  667.             StrCpy $R9 $6 1 $9
  668.             StrCmp $R9 '' +4
  669.             StrCmp $R9 ':' +3
  670.             IntOp $9 $9 + 1
  671.             goto -4
  672.             StrCpy $5 $6 $9
  673.             IntOp $9 $9 + 1
  674.             StrCpy $1 $6 1 -1
  675.             StrCpy $6 $6 -1 $9
  676.             StrCmp $5 '' +2
  677.             IntOp $5 $5 + 0
  678.             StrCmp $6 '' +2
  679.             IntOp $6 $6 + 0
  680.  
  681.             StrCmp $1 'B' 0 +4
  682.             StrCpy $1 1
  683.             StrCpy $2 bytes
  684.             goto default
  685.             StrCmp $1 'K' 0 +4
  686.             StrCpy $1 1024
  687.             StrCpy $2 Kb
  688.             goto default
  689.             StrCmp $1 'M' 0 +4
  690.             StrCpy $1 1048576
  691.             StrCpy $2 Mb
  692.             goto default
  693.             StrCmp $1 'G' 0 error
  694.             StrCpy $1 1073741824
  695.             StrCpy $2 Gb
  696.  
  697.             default:
  698.             StrCmp $4 '' 0 +2
  699.             StrCpy $4 '*.*'
  700.             StrCmp $7 '' 0 +2
  701.             StrCpy $7 '1'
  702.  
  703.             StrCpy $8 1
  704.             Push $0
  705.             SetDetailsPrint textonly
  706.  
  707.             nextdir:
  708.             IntOp $8 $8 - 1
  709.             Pop $R8
  710.             FindFirst $0 $R7 '$R8\$4'
  711.             IfErrors show
  712.             StrCmp $R7 '.' 0 dir
  713.             FindNext $0 $R7
  714.             StrCmp $R7 '..' 0 dir
  715.             FindNext $0 $R7
  716.             IfErrors 0 dir
  717.             FindClose $0
  718.             goto show
  719.  
  720.             dir:
  721.             IfFileExists '$R8\$R7\*.*' 0 file
  722.             IntOp $R5 $R5 + 1
  723.             goto findnext
  724.  
  725.             file:
  726.             StrCpy $R6 0
  727.             StrCmp $5$6 '' 0 +3
  728.             IntOp $R4 $R4 + 1
  729.             goto findnext
  730.             FileOpen $9 '$R8\$R7' r
  731.             IfErrors +3
  732.             FileSeek $9 0 END $R6
  733.             FileClose $9
  734.             StrCmp $5 '' +2
  735.             IntCmp $R6 $5 0 findnext
  736.             StrCmp $6 '' +2
  737.             IntCmp $R6 $6 0 0 findnext
  738.             IntOp $R4 $R4 + 1
  739.             System::Int64Op /NOUNLOAD $R3 + $R6
  740.             Pop $R3
  741.  
  742.             findnext:
  743.             FindNext $0 $R7
  744.             IfErrors 0 dir
  745.             FindClose $0
  746.  
  747.             show:
  748.             StrCmp $5$6 '' nosize
  749.             System::Int64Op /NOUNLOAD $R3 / $1
  750.             Pop $9
  751.             DetailPrint 'Size:$9 $2  Files:$R4  Folders:$R5'
  752.             goto subdir
  753.             nosize:
  754.             DetailPrint 'Files:$R4  Folders:$R5'
  755.  
  756.             subdir:
  757.             StrCmp $7 0 preend
  758.             FindFirst $0 $R7 '$R8\*.*'
  759.             StrCmp $R7 '.' 0 pushdir
  760.             FindNext $0 $R7
  761.             StrCmp $R7 '..' 0 pushdir
  762.             FindNext $0 $R7
  763.             IfErrors 0 pushdir
  764.             FindClose $0
  765.             StrCmp $8 0 preend nextdir
  766.  
  767.             pushdir:
  768.             IfFileExists '$R8\$R7\*.*' 0 +3
  769.             Push '$R8\$R7'
  770.             IntOp $8 $8 + 1
  771.             FindNext $0 $R7
  772.             IfErrors 0 pushdir
  773.             FindClose $0
  774.             StrCmp $8 0 preend nextdir
  775.  
  776.             preend:
  777.             StrCmp $R3 '' nosizeend
  778.             System::Int64Op $R3 / $1
  779.             Pop $R3
  780.             nosizeend:
  781.             StrCpy $2 $R4
  782.             StrCpy $1 $R5
  783.             StrCpy $0 $R3
  784.             goto end
  785.  
  786.             error:
  787.             SetErrors
  788.             StrCpy $0 ''
  789.             StrCpy $1 ''
  790.             StrCpy $2 ''
  791.  
  792.             end:
  793.             SetDetailsPrint both
  794.             Pop $R9
  795.             Pop $R8
  796.             Pop $R7
  797.             Pop $R6
  798.             Pop $R5
  799.             Pop $R4
  800.             Pop $R3
  801.             Pop $9
  802.             Pop $8
  803.             Pop $7
  804.             Pop $6
  805.             Pop $5
  806.             Pop $4
  807.             Pop $3
  808.             Exch $2
  809.             Exch
  810.             Exch $1
  811.             Exch 2
  812.             Exch $0
  813.         FunctionEnd
  814.  
  815.         !verbose pop
  816.     !endif
  817. !macroend
  818.  
  819. !macro DriveSpace
  820.     !ifndef ${_FILEFUNC_UN}DriveSpace
  821.         !verbose push
  822.         !verbose ${_FILEFUNC_VERBOSE}
  823.         !define ${_FILEFUNC_UN}DriveSpace `!insertmacro ${_FILEFUNC_UN}DriveSpaceCall`
  824.  
  825.         Function ${_FILEFUNC_UN}DriveSpace
  826.             Exch $1
  827.             Exch
  828.             Exch $0
  829.             Exch
  830.             Push $2
  831.             Push $3
  832.             Push $4
  833.             Push $5
  834.             Push $6
  835.             ClearErrors
  836.  
  837.             StrCpy $2 $0 1 -1
  838.             StrCmp $2 '\' 0 +3
  839.             StrCpy $0 $0 -1
  840.             goto -3
  841.             IfFileExists '$0\NUL' 0 error
  842.  
  843.             StrCpy $5 ''
  844.             StrCpy $6 ''
  845.  
  846.             option:
  847.             StrCpy $2 $1 1
  848.             StrCpy $1 $1 '' 1
  849.             StrCmp $2 ' ' -2
  850.             StrCmp $2 '' default
  851.             StrCmp $2 '/' 0 -4
  852.             StrCpy $3 -1
  853.             IntOp $3 $3 + 1
  854.             StrCpy $2 $1 1 $3
  855.             StrCmp $2 '' +2
  856.             StrCmp $2 '/' 0 -3
  857.             StrCpy $4 $1 $3
  858.             StrCpy $4 $4 '' 2
  859.             StrCpy $2 $4 1 -1
  860.             StrCmp $2 ' ' 0 +3
  861.             StrCpy $4 $4 -1
  862.             goto -3
  863.             StrCpy $2 $1 2
  864.             StrCpy $1 $1 '' $3
  865.  
  866.             StrCmp $2 'D=' 0 unit
  867.             StrCpy $5 $4
  868.             StrCmp $5 '' +4
  869.             StrCmp $5 'T' +3
  870.             StrCmp $5 'O' +2
  871.             StrCmp $5 'F' 0 error
  872.             goto option
  873.  
  874.             unit:
  875.             StrCmp $2 'S=' 0 error
  876.             StrCpy $6 $4
  877.             goto option
  878.  
  879.             default:
  880.             StrCmp $5 '' 0 +2
  881.             StrCpy $5 'T'
  882.             StrCmp $6 '' 0 +3
  883.             StrCpy $6 '1'
  884.             goto getspace
  885.  
  886.             StrCmp $6 'B' 0 +3
  887.             StrCpy $6 1
  888.             goto getspace
  889.             StrCmp $6 'K' 0 +3
  890.             StrCpy $6 1024
  891.             goto getspace
  892.             StrCmp $6 'M' 0 +3
  893.             StrCpy $6 1048576
  894.             goto getspace
  895.             StrCmp $6 'G' 0 error
  896.             StrCpy $6 1073741824
  897.  
  898.             getspace:
  899.             System::Call /NOUNLOAD 'kernel32::GetDiskFreeSpaceExA(t, *l, *l, *l)i(r0,.r2,.r3,.)'
  900.  
  901.             StrCmp $5 T 0 +3
  902.             StrCpy $0 $3
  903.             goto getsize
  904.             StrCmp $5 O 0 +4
  905.             System::Int64Op /NOUNLOAD $3 - $2
  906.             Pop $0
  907.             goto getsize
  908.             StrCmp $5 F 0 +2
  909.             StrCpy $0 $2
  910.  
  911.             getsize:
  912.             System::Int64Op $0 / $6
  913.             Pop $0
  914.             goto end
  915.  
  916.             error:
  917.             SetErrors
  918.             StrCpy $0 ''
  919.  
  920.             end:
  921.             Pop $6
  922.             Pop $5
  923.             Pop $4
  924.             Pop $3
  925.             Pop $2
  926.             Pop $1
  927.             Exch $0
  928.         FunctionEnd
  929.  
  930.         !verbose pop
  931.     !endif
  932. !macroend
  933.  
  934. !macro GetDrives
  935.     !ifndef ${_FILEFUNC_UN}GetDrives
  936.         !verbose push
  937.         !verbose ${_FILEFUNC_VERBOSE}
  938.         !define ${_FILEFUNC_UN}GetDrives `!insertmacro ${_FILEFUNC_UN}GetDrivesCall`
  939.  
  940.         Function ${_FILEFUNC_UN}GetDrives
  941.             Exch $1
  942.             Exch
  943.             Exch $0
  944.             Exch
  945.             Push $2
  946.             Push $3
  947.             Push $4
  948.             Push $5
  949.             Push $6
  950.             Push $8
  951.             Push $9
  952.  
  953.             System::Alloc /NOUNLOAD 1024
  954.             Pop $2
  955.             System::Call /NOUNLOAD 'kernel32::GetLogicalDriveStringsA(i,i) i(1024, r2)'
  956.  
  957.             StrCmp $0 ALL drivestring
  958.             StrCmp $0 '' 0 typeset
  959.             StrCpy $0 ALL
  960.             goto drivestring
  961.  
  962.             typeset:
  963.             StrCpy $6 -1
  964.             IntOp $6 $6 + 1
  965.             StrCpy $8 $0 1 $6
  966.             StrCmp $8$0 '' enumex
  967.             StrCmp $8 '' +2
  968.             StrCmp $8 '+' 0 -4
  969.             StrCpy $8 $0 $6
  970.             IntOp $6 $6 + 1
  971.             StrCpy $0 $0 '' $6
  972.  
  973.             StrCmp $8 'FDD' 0 +3
  974.             StrCpy $6 2
  975.             goto drivestring
  976.             StrCmp $8 'HDD' 0 +3
  977.             StrCpy $6 3
  978.             goto drivestring
  979.             StrCmp $8 'NET' 0 +3
  980.             StrCpy $6 4
  981.             goto drivestring
  982.             StrCmp $8 'CDROM' 0 +3
  983.             StrCpy $6 5
  984.             goto drivestring
  985.             StrCmp $8 'RAM' 0 typeset
  986.             StrCpy $6 6
  987.  
  988.             drivestring:
  989.             StrCpy $3 $2
  990.  
  991.             enumok:
  992.             System::Call /NOUNLOAD 'kernel32::lstrlenA(t) i(i r3) .r4'
  993.             StrCmp $4$0 '0ALL' enumex
  994.             StrCmp $4 0 typeset
  995.             System::Call /NOUNLOAD 'kernel32::GetDriveTypeA(t) i(i r3) .r5'
  996.  
  997.             StrCmp $0 ALL +2
  998.             StrCmp $5 $6 letter enumnext
  999.             StrCmp $5 2 0 +3
  1000.             StrCpy $8 FDD
  1001.             goto letter
  1002.             StrCmp $5 3 0 +3
  1003.             StrCpy $8 HDD
  1004.             goto letter
  1005.             StrCmp $5 4 0 +3
  1006.             StrCpy $8 NET
  1007.             goto letter
  1008.             StrCmp $5 5 0 +3
  1009.             StrCpy $8 CDROM
  1010.             goto letter
  1011.             StrCmp $5 6 0 enumex
  1012.             StrCpy $8 RAM
  1013.  
  1014.             letter:
  1015.             System::Call /NOUNLOAD '*$3(&t1024 .r9)'
  1016.  
  1017.             Push $0
  1018.             Push $1
  1019.             Push $2
  1020.             Push $3
  1021.             Push $4
  1022.             Push $5
  1023.             Push $6
  1024.             Push $8
  1025.             Call $1
  1026.             Pop $9
  1027.             Pop $8
  1028.             Pop $6
  1029.             Pop $5
  1030.             Pop $4
  1031.             Pop $3
  1032.             Pop $2
  1033.             Pop $1
  1034.             Pop $0
  1035.             StrCmp $9 'StopGetDrives' enumex
  1036.  
  1037.             enumnext:
  1038.             IntOp $3 $3 + $4
  1039.             IntOp $3 $3 + 1
  1040.             goto enumok
  1041.  
  1042.             enumex:
  1043.             System::Free $2
  1044.  
  1045.             Pop $9
  1046.             Pop $8
  1047.             Pop $6
  1048.             Pop $5
  1049.             Pop $4
  1050.             Pop $3
  1051.             Pop $2
  1052.             Pop $1
  1053.             Pop $0
  1054.         FunctionEnd
  1055.  
  1056.         !verbose pop
  1057.     !endif
  1058. !macroend
  1059.  
  1060. !macro GetTime
  1061.     !ifndef ${_FILEFUNC_UN}GetTime
  1062.         !verbose push
  1063.         !verbose ${_FILEFUNC_VERBOSE}
  1064.         !define ${_FILEFUNC_UN}GetTime `!insertmacro ${_FILEFUNC_UN}GetTimeCall`
  1065.  
  1066.         Function ${_FILEFUNC_UN}GetTime
  1067.             Exch $1
  1068.             Exch
  1069.             Exch $0
  1070.             Exch
  1071.             Push $2
  1072.             Push $3
  1073.             Push $4
  1074.             Push $5
  1075.             Push $6
  1076.             Push $7
  1077.             ClearErrors
  1078.  
  1079.             StrCmp $1 'L' gettime
  1080.             StrCmp $1 'A' getfile
  1081.             StrCmp $1 'C' getfile
  1082.             StrCmp $1 'M' getfile
  1083.             StrCmp $1 'LS' gettime
  1084.             StrCmp $1 'AS' getfile
  1085.             StrCmp $1 'CS' getfile
  1086.             StrCmp $1 'MS' getfile
  1087.             goto error
  1088.  
  1089.             getfile:
  1090.             IfFileExists $0 0 error
  1091.             System::Call /NOUNLOAD '*(i,l,l,l,i,i,i,i,&t260,&t14) i .r6'
  1092.             System::Call /NOUNLOAD 'kernel32::FindFirstFileA(t,i)i(r0,r6) .r2'
  1093.             System::Call /NOUNLOAD 'kernel32::FindClose(i)i(r2)'
  1094.  
  1095.             gettime:
  1096.             System::Call /NOUNLOAD '*(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2) i .r7'
  1097.             StrCmp $1 'L' 0 systemtime
  1098.             System::Call /NOUNLOAD 'kernel32::GetLocalTime(i)i(r7)'
  1099.             goto convert
  1100.             systemtime:
  1101.             StrCmp $1 'LS' 0 filetime
  1102.             System::Call /NOUNLOAD 'kernel32::GetSystemTime(i)i(r7)'
  1103.             goto convert
  1104.  
  1105.             filetime:
  1106.             System::Call /NOUNLOAD '*$6(i,l,l,l,i,i,i,i,&t260,&t14)i(,.r4,.r3,.r2)'
  1107.             System::Free /NOUNLOAD $6
  1108.             StrCmp $1 'A' 0 +3
  1109.             StrCpy $2 $3
  1110.             goto tolocal
  1111.             StrCmp $1 'C' 0 +3
  1112.             StrCpy $2 $4
  1113.             goto tolocal
  1114.             StrCmp $1 'M' tolocal
  1115.  
  1116.             StrCmp $1 'AS' tosystem
  1117.             StrCmp $1 'CS' 0 +3
  1118.             StrCpy $3 $4
  1119.             goto tosystem
  1120.             StrCmp $1 'MS' 0 +3
  1121.             StrCpy $3 $2
  1122.             goto tosystem
  1123.  
  1124.             tolocal:
  1125.             System::Call /NOUNLOAD 'kernel32::FileTimeToLocalFileTime(*l,*l)i(r2,.r3)'
  1126.             tosystem:
  1127.             System::Call /NOUNLOAD 'kernel32::FileTimeToSystemTime(*l,i)i(r3,r7)'
  1128.  
  1129.             convert:
  1130.             System::Call /NOUNLOAD '*$7(&i2,&i2,&i2,&i2,&i2,&i2,&i2,&i2)i(.r5,.r6,.r4,.r0,.r3,.r2,.r1,)'
  1131.             System::Free $7
  1132.  
  1133.             IntCmp $0 9 0 0 +2
  1134.             StrCpy $0 '0$0'
  1135.             IntCmp $1 9 0 0 +2
  1136.             StrCpy $1 '0$1'
  1137.             IntCmp $2 9 0 0 +2
  1138.             StrCpy $2 '0$2'
  1139.             IntCmp $6 9 0 0 +2
  1140.             StrCpy $6 '0$6'
  1141.  
  1142.             StrCmp $4 0 0 +3
  1143.             StrCpy $4 Sunday
  1144.             goto end
  1145.             StrCmp $4 1 0 +3
  1146.             StrCpy $4 Monday
  1147.             goto end
  1148.             StrCmp $4 2 0 +3
  1149.             StrCpy $4 Tuesday
  1150.             goto end
  1151.             StrCmp $4 3 0 +3
  1152.             StrCpy $4 Wednesday
  1153.             goto end
  1154.             StrCmp $4 4 0 +3
  1155.             StrCpy $4 Thursday
  1156.             goto end
  1157.             StrCmp $4 5 0 +3
  1158.             StrCpy $4 Friday
  1159.             goto end
  1160.             StrCmp $4 6 0 error
  1161.             StrCpy $4 Saturday
  1162.             goto end
  1163.  
  1164.             error:
  1165.             SetErrors
  1166.             StrCpy $0 ''
  1167.             StrCpy $1 ''
  1168.             StrCpy $2 ''
  1169.             StrCpy $3 ''
  1170.             StrCpy $4 ''
  1171.             StrCpy $5 ''
  1172.             StrCpy $6 ''
  1173.  
  1174.             end:
  1175.             Pop $7
  1176.             Exch $6
  1177.             Exch
  1178.             Exch $5
  1179.             Exch 2
  1180.             Exch $4
  1181.             Exch 3
  1182.             Exch $3
  1183.             Exch 4
  1184.             Exch $2
  1185.             Exch 5
  1186.             Exch $1
  1187.             Exch 6
  1188.             Exch $0
  1189.         FunctionEnd
  1190.  
  1191.         !verbose pop
  1192.     !endif
  1193. !macroend
  1194.  
  1195. !macro GetFileAttributes
  1196.     !ifndef ${_FILEFUNC_UN}GetFileAttributes
  1197.         !verbose push
  1198.         !verbose ${_FILEFUNC_VERBOSE}
  1199.         !define ${_FILEFUNC_UN}GetFileAttributes `!insertmacro ${_FILEFUNC_UN}GetFileAttributesCall`
  1200.  
  1201.         Function ${_FILEFUNC_UN}GetFileAttributes
  1202.             Exch $1
  1203.             Exch
  1204.             Exch $0
  1205.             Exch
  1206.             Push $2
  1207.             Push $3
  1208.             Push $4
  1209.             Push $5
  1210.  
  1211.             System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
  1212.             StrCmp $2 -1 error
  1213.             StrCpy $3 ''
  1214.  
  1215.             IntOp $0 $2 & 0x4000
  1216.             IntCmp $0 0 +2
  1217.             StrCpy $3 'ENCRYPTED|'
  1218.  
  1219.             IntOp $0 $2 & 0x2000
  1220.             IntCmp $0 0 +2
  1221.             StrCpy $3 'NOT_CONTENT_INDEXED|$3'
  1222.  
  1223.             IntOp $0 $2 & 0x1000
  1224.             IntCmp $0 0 +2
  1225.             StrCpy $3 'OFFLINE|$3'
  1226.  
  1227.             IntOp $0 $2 & 0x0800
  1228.             IntCmp $0 0 +2
  1229.             StrCpy $3 'COMPRESSED|$3'
  1230.  
  1231.             IntOp $0 $2 & 0x0400
  1232.             IntCmp $0 0 +2
  1233.             StrCpy $3 'REPARSE_POINT|$3'
  1234.  
  1235.             IntOp $0 $2 & 0x0200
  1236.             IntCmp $0 0 +2
  1237.             StrCpy $3 'SPARSE_FILE|$3'
  1238.  
  1239.             IntOp $0 $2 & 0x0100
  1240.             IntCmp $0 0 +2
  1241.             StrCpy $3 'TEMPORARY|$3'
  1242.  
  1243.             IntOp $0 $2 & 0x0080
  1244.             IntCmp $0 0 +2
  1245.             StrCpy $3 'NORMAL|$3'
  1246.  
  1247.             IntOp $0 $2 & 0x0040
  1248.             IntCmp $0 0 +2
  1249.             StrCpy $3 'DEVICE|$3'
  1250.  
  1251.             IntOp $0 $2 & 0x0020
  1252.             IntCmp $0 0 +2
  1253.             StrCpy $3 'ARCHIVE|$3'
  1254.  
  1255.             IntOp $0 $2 & 0x0010
  1256.             IntCmp $0 0 +2
  1257.             StrCpy $3 'DIRECTORY|$3'
  1258.  
  1259.             IntOp $0 $2 & 0x0004
  1260.             IntCmp $0 0 +2
  1261.             StrCpy $3 'SYSTEM|$3'
  1262.  
  1263.             IntOp $0 $2 & 0x0002
  1264.             IntCmp $0 0 +2
  1265.             StrCpy $3 'HIDDEN|$3'
  1266.  
  1267.             IntOp $0 $2 & 0x0001
  1268.             IntCmp $0 0 +2
  1269.             StrCpy $3 'READONLY|$3'
  1270.  
  1271.             StrCpy $0 $3 -1
  1272.             StrCmp $1 '' end
  1273.             StrCmp $1 'ALL' end
  1274.  
  1275.             attrcmp:
  1276.             StrCpy $5 0
  1277.             IntOp $5 $5 + 1
  1278.             StrCpy $4 $1 1 $5
  1279.             StrCmp $4 '' +2
  1280.             StrCmp $4 '|'  0 -3
  1281.             StrCpy $2 $1 $5
  1282.             IntOp $5 $5 + 1
  1283.             StrCpy $1 $1 '' $5
  1284.             StrLen $3 $2
  1285.             StrCpy $5 -1
  1286.             IntOp $5 $5 + 1
  1287.             StrCpy $4 $0 $3 $5
  1288.             StrCmp $4 '' notfound
  1289.             StrCmp $4 $2 0 -3
  1290.             StrCmp $1 '' 0 attrcmp
  1291.             StrCpy $0 1
  1292.             goto end
  1293.  
  1294.             notfound:
  1295.             StrCpy $0 0
  1296.             goto end
  1297.  
  1298.             error:
  1299.             SetErrors
  1300.             StrCpy $0 ''
  1301.  
  1302.             end:
  1303.             Pop $5
  1304.             Pop $4
  1305.             Pop $3
  1306.             Pop $2
  1307.             Pop $1
  1308.             Exch $0
  1309.         FunctionEnd
  1310.  
  1311.         !verbose pop
  1312.     !endif
  1313. !macroend
  1314.  
  1315. !macro GetFileVersion
  1316.     !ifndef ${_FILEFUNC_UN}GetFileVersion
  1317.         !verbose push
  1318.         !verbose ${_FILEFUNC_VERBOSE}
  1319.         !define ${_FILEFUNC_UN}GetFileVersion `!insertmacro ${_FILEFUNC_UN}GetFileVersionCall`
  1320.  
  1321.         Function ${_FILEFUNC_UN}GetFileVersion
  1322.             Exch $0
  1323.             Push $1
  1324.             Push $2
  1325.             Push $3
  1326.             Push $4
  1327.             Push $5
  1328.             Push $6
  1329.             ClearErrors
  1330.  
  1331.             GetDllVersion '$0' $1 $2
  1332.             IfErrors error
  1333.             IntOp $3 $1 >> 16
  1334.             IntOp $3 $3 & 0x0000FFFF
  1335.             IntOp $4 $1 & 0x0000FFFF
  1336.             IntOp $5 $2 >> 16
  1337.             IntOp $5 $5 & 0x0000FFFF
  1338.             IntOp $6 $2 & 0x0000FFFF
  1339.             StrCpy $0 '$3.$4.$5.$6'
  1340.             goto end
  1341.  
  1342.             error:
  1343.             SetErrors
  1344.             StrCpy $0 ''
  1345.  
  1346.             end:
  1347.             Pop $6
  1348.             Pop $5
  1349.             Pop $4
  1350.             Pop $3
  1351.             Pop $2
  1352.             Pop $1
  1353.             Exch $0
  1354.         FunctionEnd
  1355.  
  1356.         !verbose pop
  1357.     !endif
  1358. !macroend
  1359.  
  1360. !macro GetExeName
  1361.     !ifndef ${_FILEFUNC_UN}GetExeName
  1362.         !verbose push
  1363.         !verbose ${_FILEFUNC_VERBOSE}
  1364.         !define ${_FILEFUNC_UN}GetExeName `!insertmacro ${_FILEFUNC_UN}GetExeNameCall`
  1365.  
  1366.         Function ${_FILEFUNC_UN}GetExeName
  1367.             Push $0
  1368.             Push $1
  1369.             Push $2
  1370.             System::Call /NOUNLOAD 'kernel32::GetModuleFileNameA(i 0, t .r0, i 1024)'
  1371.             System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
  1372.             StrCmp $2 error +2
  1373.             StrCpy $0 $1
  1374.             Pop $2
  1375.             Pop $1
  1376.             Exch $0
  1377.         FunctionEnd
  1378.  
  1379.         !verbose pop
  1380.     !endif
  1381. !macroend
  1382.  
  1383. !macro GetExePath
  1384.     !ifndef ${_FILEFUNC_UN}GetExePath
  1385.         !verbose push
  1386.         !verbose ${_FILEFUNC_VERBOSE}
  1387.         !define ${_FILEFUNC_UN}GetExePath `!insertmacro ${_FILEFUNC_UN}GetExePathCall`
  1388.  
  1389.         Function ${_FILEFUNC_UN}GetExePath
  1390.             Push $0
  1391.             Push $1
  1392.             Push $2
  1393.             StrCpy $0 $EXEDIR
  1394.             System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2'
  1395.             StrCmp $2 error +2
  1396.             StrCpy $0 $1
  1397.             Pop $2
  1398.             Pop $1
  1399.             Exch $0
  1400.         FunctionEnd
  1401.  
  1402.         !verbose pop
  1403.     !endif
  1404. !macroend
  1405.  
  1406. !macro GetParameters
  1407.     !ifndef ${_FILEFUNC_UN}GetParameters
  1408.         !verbose push
  1409.         !verbose ${_FILEFUNC_VERBOSE}
  1410.         !define ${_FILEFUNC_UN}GetParameters `!insertmacro ${_FILEFUNC_UN}GetParametersCall`
  1411.  
  1412.         Function ${_FILEFUNC_UN}GetParameters
  1413.             ;cmdline-check
  1414.             StrCmp $CMDLINE "" 0 +3
  1415.             Push ""
  1416.             Return
  1417.  
  1418.             ;vars
  1419.             Push $0  ;tmp
  1420.             Push $1  ;length
  1421.             Push $2  ;parameter offset
  1422.             Push $3  ;separator
  1423.  
  1424.             ;length/offset
  1425.             StrLen $1 $CMDLINE
  1426.             StrCpy $2 2  ;start with third character
  1427.  
  1428.             ;separator
  1429.             StrCpy $3 $CMDLINE 1 ;first character
  1430.             StrCmp $3 '"' +2
  1431.             StrCpy $3 ' '
  1432.  
  1433.             token:  ;finding second separator
  1434.             IntCmp $2 $1 strip 0 strip
  1435.             StrCpy $0 $CMDLINE 1 $2
  1436.             IntOp $2 $2 + 1
  1437.             StrCmp $3 $0 0 token
  1438.  
  1439.             strip:  ;strip white space
  1440.             IntCmp $2 $1 copy 0 copy
  1441.             StrCpy $0 $CMDLINE 1 $2
  1442.             StrCmp $0 ' ' 0 copy
  1443.             IntOp $2 $2 + 1
  1444.             Goto strip
  1445.  
  1446.             copy:
  1447.             StrCpy $0 $CMDLINE "" $2
  1448.  
  1449.             ;strip white spaces from end
  1450.             rstrip:
  1451.             StrCpy $1 $0 1 -1
  1452.             StrCmp $1 ' ' 0 done
  1453.             StrCpy $0 $0 -1
  1454.             Goto rstrip
  1455.  
  1456.             done:
  1457.             Pop $3
  1458.             Pop $2
  1459.             Pop $1
  1460.             Exch $0
  1461.         FunctionEnd
  1462.  
  1463.         !verbose pop
  1464.     !endif
  1465. !macroend
  1466.  
  1467. !macro GetOptions
  1468.     !ifndef ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}
  1469.         !verbose push
  1470.         !verbose ${_FILEFUNC_VERBOSE}
  1471.         !define ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S} `!insertmacro ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}Call`
  1472.  
  1473.         Function ${_FILEFUNC_UN}GetOptions${_FILEFUNC_S}
  1474.             Exch $1
  1475.             Exch
  1476.             Exch $0
  1477.             Exch
  1478.             Push $2
  1479.             Push $3
  1480.             Push $4
  1481.             Push $5
  1482.             Push $6
  1483.             Push $7
  1484.             ClearErrors
  1485.  
  1486.             StrCpy $2 $1 '' 1
  1487.             StrCpy $1 $1 1
  1488.             StrLen $3 $2
  1489.             StrCpy $7 0
  1490.  
  1491.             begin:
  1492.             StrCpy $4 -1
  1493.             StrCpy $6 ''
  1494.  
  1495.             quote:
  1496.             IntOp $4 $4 + 1
  1497.             StrCpy $5 $0 1 $4
  1498.             StrCmp${_FILEFUNC_S} $5$7 '0' notfound
  1499.             StrCmp${_FILEFUNC_S} $5 '' trimright
  1500.             StrCmp${_FILEFUNC_S} $5 '"' 0 +7
  1501.             StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1502.             StrCpy $6 '"'
  1503.             goto quote
  1504.             StrCmp${_FILEFUNC_S} $6 '"' 0 +3
  1505.             StrCpy $6 ''
  1506.             goto quote
  1507.             StrCmp${_FILEFUNC_S} $5 `'` 0 +7
  1508.             StrCmp${_FILEFUNC_S} $6 `` 0 +3
  1509.             StrCpy $6 `'`
  1510.             goto quote
  1511.             StrCmp${_FILEFUNC_S} $6 `'` 0 +3
  1512.             StrCpy $6 ``
  1513.             goto quote
  1514.             StrCmp${_FILEFUNC_S} $5 '`' 0 +7
  1515.             StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1516.             StrCpy $6 '`'
  1517.             goto quote
  1518.             StrCmp${_FILEFUNC_S} $6 '`' 0 +3
  1519.             StrCpy $6 ''
  1520.             goto quote
  1521.             StrCmp${_FILEFUNC_S} $6 '"' quote
  1522.             StrCmp${_FILEFUNC_S} $6 `'` quote
  1523.             StrCmp${_FILEFUNC_S} $6 '`' quote
  1524.             StrCmp${_FILEFUNC_S} $5 $1 0 quote
  1525.             StrCmp${_FILEFUNC_S} $7 0 trimleft trimright
  1526.  
  1527.             trimleft:
  1528.             IntOp $4 $4 + 1
  1529.             StrCpy $5 $0 $3 $4
  1530.             StrCmp${_FILEFUNC_S} $5 '' notfound
  1531.             StrCmp${_FILEFUNC_S} $5 $2 0 quote
  1532.             IntOp $4 $4 + $3
  1533.             StrCpy $0 $0 '' $4
  1534.             StrCpy $4 $0 1
  1535.             StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1536.             StrCpy $0 $0 '' 1
  1537.             goto -3
  1538.             StrCpy $7 1
  1539.             goto begin
  1540.  
  1541.             trimright:
  1542.             StrCpy $0 $0 $4
  1543.             StrCpy $4 $0 1 -1
  1544.             StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1545.             StrCpy $0 $0 -1
  1546.             goto -3
  1547.             StrCpy $3 $0 1
  1548.             StrCpy $4 $0 1 -1
  1549.             StrCmp${_FILEFUNC_S} $3 $4 0 end
  1550.             StrCmp${_FILEFUNC_S} $3 '"' +3
  1551.             StrCmp${_FILEFUNC_S} $3 `'` +2
  1552.             StrCmp${_FILEFUNC_S} $3 '`' 0 end
  1553.             StrCpy $0 $0 -1 1
  1554.             goto end
  1555.  
  1556.             notfound:
  1557.             SetErrors
  1558.             StrCpy $0 ''
  1559.  
  1560.             end:
  1561.             Pop $7
  1562.             Pop $6
  1563.             Pop $5
  1564.             Pop $4
  1565.             Pop $3
  1566.             Pop $2
  1567.             Pop $1
  1568.             Exch $0
  1569.         FunctionEnd
  1570.  
  1571.         !verbose pop
  1572.     !endif
  1573. !macroend
  1574.  
  1575.  
  1576. !macro GetRoot
  1577.     !ifndef ${_FILEFUNC_UN}GetRoot
  1578.         !verbose push
  1579.         !verbose ${_FILEFUNC_VERBOSE}
  1580.         !define ${_FILEFUNC_UN}GetRoot `!insertmacro ${_FILEFUNC_UN}GetRootCall`
  1581.  
  1582.         Function ${_FILEFUNC_UN}GetRoot
  1583.             Exch $0
  1584.             Push $1
  1585.             Push $2
  1586.             Push $3
  1587.  
  1588.             StrCpy $1 $0 2
  1589.             StrCmp $1 '\\' UNC
  1590.             StrCpy $2 $1 1 1
  1591.             StrCmp $2 ':' 0 empty
  1592.             StrCpy $0 $1
  1593.             goto end
  1594.  
  1595.             UNC:
  1596.             StrCpy $2 1
  1597.             StrCpy $3 ''
  1598.  
  1599.             loop:
  1600.             IntOp $2 $2 + 1
  1601.             StrCpy $1 $0 1 $2
  1602.             StrCmp $1$3 '' empty
  1603.             StrCmp $1 '' +5
  1604.             StrCmp $1 '\' 0 loop
  1605.             StrCmp $3 '1' +3
  1606.             StrCpy $3 '1'
  1607.             goto loop
  1608.             StrCpy $0 $0 $2
  1609.             StrCpy $2 $0 1 -1
  1610.             StrCmp $2 '\' 0 end
  1611.  
  1612.             empty:
  1613.             StrCpy $0 ''
  1614.  
  1615.             end:
  1616.             Pop $3
  1617.             Pop $2
  1618.             Pop $1
  1619.             Exch $0
  1620.         FunctionEnd
  1621.  
  1622.         !verbose pop
  1623.     !endif
  1624. !macroend
  1625.  
  1626. !macro GetParent
  1627.     !ifndef ${_FILEFUNC_UN}GetParent
  1628.         !verbose push
  1629.         !verbose ${_FILEFUNC_VERBOSE}
  1630.         !define ${_FILEFUNC_UN}GetParent `!insertmacro ${_FILEFUNC_UN}GetParentCall`
  1631.  
  1632.         Function ${_FILEFUNC_UN}GetParent
  1633.             Exch $0
  1634.             Push $1
  1635.             Push $2
  1636.  
  1637.             StrCpy $2 $0 1 -1
  1638.             StrCmp $2 '\' 0 +3
  1639.             StrCpy $0 $0 -1
  1640.             goto -3
  1641.  
  1642.             StrCpy $1 0
  1643.             IntOp $1 $1 - 1
  1644.             StrCpy $2 $0 1 $1
  1645.             StrCmp $2 '\' +2
  1646.             StrCmp $2 '' 0 -3
  1647.             StrCpy $0 $0 $1
  1648.  
  1649.             Pop $2
  1650.             Pop $1
  1651.             Exch $0
  1652.         FunctionEnd
  1653.  
  1654.         !verbose pop
  1655.     !endif
  1656. !macroend
  1657.  
  1658. !macro GetFileName
  1659.     !ifndef ${_FILEFUNC_UN}GetFileName
  1660.         !verbose push
  1661.         !verbose ${_FILEFUNC_VERBOSE}
  1662.         !define ${_FILEFUNC_UN}GetFileName `!insertmacro ${_FILEFUNC_UN}GetFileNameCall`
  1663.  
  1664.         Function ${_FILEFUNC_UN}GetFileName
  1665.             Exch $0
  1666.             Push $1
  1667.             Push $2
  1668.  
  1669.             StrCpy $2 $0 1 -1
  1670.             StrCmp $2 '\' 0 +3
  1671.             StrCpy $0 $0 -1
  1672.             goto -3
  1673.  
  1674.             StrCpy $1 0
  1675.             IntOp $1 $1 - 1
  1676.             StrCpy $2 $0 1 $1
  1677.             StrCmp $2 '' end
  1678.             StrCmp $2 '\' 0 -3
  1679.             IntOp $1 $1 + 1
  1680.             StrCpy $0 $0 '' $1
  1681.  
  1682.             end:
  1683.             Pop $2
  1684.             Pop $1
  1685.             Exch $0
  1686.         FunctionEnd
  1687.  
  1688.         !verbose pop
  1689.     !endif
  1690. !macroend
  1691.  
  1692. !macro GetBaseName
  1693.     !ifndef ${_FILEFUNC_UN}GetBaseName
  1694.         !verbose push
  1695.         !verbose ${_FILEFUNC_VERBOSE}
  1696.         !define ${_FILEFUNC_UN}GetBaseName `!insertmacro ${_FILEFUNC_UN}GetBaseNameCall`
  1697.  
  1698.         Function ${_FILEFUNC_UN}GetBaseName
  1699.             Exch $0
  1700.             Push $1
  1701.             Push $2
  1702.             Push $3
  1703.  
  1704.             StrCpy $1 0
  1705.             StrCpy $3 ''
  1706.  
  1707.             loop:
  1708.             IntOp $1 $1 - 1
  1709.             StrCpy $2 $0 1 $1
  1710.             StrCmp $2 '' trimpath
  1711.             StrCmp $2 '\' trimpath
  1712.             StrCmp $3 'noext' loop
  1713.             StrCmp $2 '.' 0 loop
  1714.             StrCpy $0 $0 $1
  1715.             StrCpy $3 'noext'
  1716.             StrCpy $1 0
  1717.             goto loop
  1718.  
  1719.             trimpath:
  1720.             StrCmp $1 -1 empty
  1721.             IntOp $1 $1 + 1
  1722.             StrCpy $0 $0 '' $1
  1723.             goto end
  1724.  
  1725.             empty:
  1726.             StrCpy $0 ''
  1727.  
  1728.             end:
  1729.             Pop $3
  1730.             Pop $2
  1731.             Pop $1
  1732.             Exch $0
  1733.         FunctionEnd
  1734.  
  1735.         !verbose pop
  1736.     !endif
  1737. !macroend
  1738.  
  1739. !macro GetFileExt
  1740.     !ifndef ${_FILEFUNC_UN}GetFileExt
  1741.         !verbose push
  1742.         !verbose ${_FILEFUNC_VERBOSE}
  1743.         !define ${_FILEFUNC_UN}GetFileExt `!insertmacro ${_FILEFUNC_UN}GetFileExtCall`
  1744.  
  1745.         Function ${_FILEFUNC_UN}GetFileExt
  1746.             Exch $0
  1747.             Push $1
  1748.             Push $2
  1749.  
  1750.             StrCpy $1 0
  1751.  
  1752.             loop:
  1753.             IntOp $1 $1 - 1
  1754.             StrCpy $2 $0 1 $1
  1755.             StrCmp $2 '' empty
  1756.             StrCmp $2 '\' empty
  1757.             StrCmp $2 '.' 0 loop
  1758.  
  1759.             StrCmp $1 -1 empty
  1760.             IntOp $1 $1 + 1
  1761.             StrCpy $0 $0 '' $1
  1762.             goto end
  1763.  
  1764.             empty:
  1765.             StrCpy $0 ''
  1766.  
  1767.             end:
  1768.             Pop $2
  1769.             Pop $1
  1770.             Exch $0
  1771.         FunctionEnd
  1772.  
  1773.         !verbose pop
  1774.     !endif
  1775. !macroend
  1776.  
  1777. !macro BannerTrimPath
  1778.     !ifndef ${_FILEFUNC_UN}BannerTrimPath
  1779.         !verbose push
  1780.         !verbose ${_FILEFUNC_VERBOSE}
  1781.         !define ${_FILEFUNC_UN}BannerTrimPath `!insertmacro ${_FILEFUNC_UN}BannerTrimPathCall`
  1782.  
  1783.         Function ${_FILEFUNC_UN}BannerTrimPath
  1784.             Exch $1
  1785.             Exch
  1786.             Exch $0
  1787.             Exch
  1788.             Push $2
  1789.             Push $3
  1790.             Push $4
  1791.  
  1792.             StrCpy $3 $1 1 -1
  1793.             IntOp $1 $1 + 0
  1794.             StrLen $2 $0
  1795.             IntCmp $2 $1 end end
  1796.             IntOp $1 $1 - 3
  1797.             IntCmp $1 0 empty empty
  1798.             StrCmp $3 'A' A-trim
  1799.             StrCmp $3 'B' B-trim
  1800.             StrCmp $3 'C' C-trim
  1801.             StrCmp $3 'D' D-trim
  1802.  
  1803.             A-trim:
  1804.             StrCpy $3 $0 1 1
  1805.             StrCpy $2 0
  1806.             StrCmp $3 ':' 0 +2
  1807.             IntOp $2 $2 + 2
  1808.  
  1809.             loopleft:
  1810.             IntOp $2 $2 + 1
  1811.             StrCpy $3 $0 1 $2
  1812.             StrCmp $2 $1 C-trim
  1813.             StrCmp $3 '\' 0 loopleft
  1814.             StrCpy $3 $0 $2
  1815.             IntOp $2 $2 - $1
  1816.             IntCmp $2 0 B-trim 0 B-trim
  1817.  
  1818.             loopright:
  1819.             IntOp $2 $2 + 1
  1820.             StrCpy $4 $0 1 $2
  1821.             StrCmp $2 0 B-trim
  1822.             StrCmp $4 '\' 0 loopright
  1823.             StrCpy $4 $0 '' $2
  1824.             StrCpy $0 '$3\...$4'
  1825.             goto end
  1826.  
  1827.             B-trim:
  1828.             StrCpy $2 $1
  1829.             IntOp $2 $2 - 1
  1830.             StrCmp $2 -1 C-trim
  1831.             StrCpy $3 $0 1 $2
  1832.             StrCmp $3 '\' 0 -3
  1833.             StrCpy $0 $0 $2
  1834.             StrCpy $0 '$0\...'
  1835.             goto end
  1836.  
  1837.             C-trim:
  1838.             StrCpy $0 $0 $1
  1839.             StrCpy $0 '$0...'
  1840.             goto end
  1841.  
  1842.             D-trim:
  1843.             StrCpy $3 -1
  1844.             IntOp $3 $3 - 1
  1845.             StrCmp $3 -$2 C-trim
  1846.             StrCpy $4 $0 1 $3
  1847.             StrCmp $4 '\' 0 -3
  1848.             StrCpy $4 $0 '' $3
  1849.             IntOp $3 $1 + $3
  1850.             IntCmp $3 2 C-trim C-trim
  1851.             StrCpy $0 $0 $3
  1852.             StrCpy $0 '$0...$4'
  1853.             goto end
  1854.  
  1855.             empty:
  1856.             StrCpy $0 ''
  1857.  
  1858.             end:
  1859.             Pop $4
  1860.             Pop $3
  1861.             Pop $2
  1862.             Pop $1
  1863.             Exch $0
  1864.         FunctionEnd
  1865.  
  1866.         !verbose pop
  1867.     !endif
  1868. !macroend
  1869.  
  1870. !macro DirState
  1871.     !ifndef ${_FILEFUNC_UN}DirState
  1872.         !verbose push
  1873.         !verbose ${_FILEFUNC_VERBOSE}
  1874.         !define ${_FILEFUNC_UN}DirState `!insertmacro ${_FILEFUNC_UN}DirStateCall`
  1875.  
  1876.         Function ${_FILEFUNC_UN}DirState
  1877.             Exch $0
  1878.             Push $1
  1879.             ClearErrors
  1880.  
  1881.             FindFirst $1 $0 '$0\*.*'
  1882.             IfErrors 0 +3
  1883.             StrCpy $0 -1
  1884.             goto end
  1885.             StrCmp $0 '.' 0 +4
  1886.             FindNext $1 $0
  1887.             StrCmp $0 '..' 0 +2
  1888.             FindNext $1 $0
  1889.             FindClose $1
  1890.             IfErrors 0 +3
  1891.             StrCpy $0 0
  1892.             goto end
  1893.             StrCpy $0 1
  1894.  
  1895.             end:
  1896.             Pop $1
  1897.             Exch $0
  1898.         FunctionEnd
  1899.  
  1900.         !verbose pop
  1901.     !endif
  1902. !macroend
  1903.  
  1904. !macro RefreshShellIcons
  1905.     !ifndef ${_FILEFUNC_UN}RefreshShellIcons
  1906.         !verbose push
  1907.         !verbose ${_FILEFUNC_VERBOSE}
  1908.         !define ${_FILEFUNC_UN}RefreshShellIcons `!insertmacro ${_FILEFUNC_UN}RefreshShellIconsCall`
  1909.  
  1910.         Function ${_FILEFUNC_UN}RefreshShellIcons
  1911.             System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
  1912.         FunctionEnd
  1913.  
  1914.         !verbose pop
  1915.     !endif
  1916. !macroend
  1917.  
  1918.  
  1919. # Uninstall. Case insensitive. #
  1920.  
  1921. !macro un.LocateCall _PATH _OPTIONS _FUNC
  1922.     !verbose push
  1923.     !verbose ${_FILEFUNC_VERBOSE}
  1924.     Push $0
  1925.     Push `${_PATH}`
  1926.     Push `${_OPTIONS}`
  1927.     GetFunctionAddress $0 `${_FUNC}`
  1928.     Push `$0`
  1929.     Call un.Locate
  1930.     Pop $0
  1931.     !verbose pop
  1932. !macroend
  1933.  
  1934. !macro un.GetSizeCall _PATH _OPTIONS _RESULT1 _RESULT2 _RESULT3
  1935.     !verbose push
  1936.     !verbose ${_FILEFUNC_VERBOSE}
  1937.     Push `${_PATH}`
  1938.     Push `${_OPTIONS}`
  1939.     Call un.GetSize
  1940.     Pop ${_RESULT1}
  1941.     Pop ${_RESULT2}
  1942.     Pop ${_RESULT3}
  1943.     !verbose pop
  1944. !macroend
  1945.  
  1946. !macro un.DriveSpaceCall _DRIVE _OPTIONS _RESULT
  1947.     !verbose push
  1948.     !verbose ${_FILEFUNC_VERBOSE}
  1949.     Push `${_DRIVE}`
  1950.     Push `${_OPTIONS}`
  1951.     Call un.DriveSpace
  1952.     Pop ${_RESULT}
  1953.     !verbose pop
  1954. !macroend
  1955.  
  1956. !macro un.GetDrivesCall _DRV _FUNC
  1957.     !verbose push
  1958.     !verbose ${_FILEFUNC_VERBOSE}
  1959.     Push $0
  1960.     Push `${_DRV}`
  1961.     GetFunctionAddress $0 `${_FUNC}`
  1962.     Push `$0`
  1963.     Call un.GetDrives
  1964.     Pop $0
  1965.     !verbose pop
  1966. !macroend
  1967.  
  1968. !macro un.GetTimeCall _FILE _OPTION _RESULT1 _RESULT2 _RESULT3 _RESULT4 _RESULT5 _RESULT6 _RESULT7
  1969.     !verbose push
  1970.     !verbose ${_FILEFUNC_VERBOSE}
  1971.     Push `${_FILE}`
  1972.     Push `${_OPTION}`
  1973.     Call un.GetTime
  1974.     Pop ${_RESULT1}
  1975.     Pop ${_RESULT2}
  1976.     Pop ${_RESULT3}
  1977.     Pop ${_RESULT4}
  1978.     Pop ${_RESULT5}
  1979.     Pop ${_RESULT6}
  1980.     Pop ${_RESULT7}
  1981.     !verbose pop
  1982. !macroend
  1983.  
  1984. !macro un.GetFileAttributesCall _PATH _ATTR _RESULT
  1985.     !verbose push
  1986.     !verbose ${_FILEFUNC_VERBOSE}
  1987.     Push `${_PATH}`
  1988.     Push `${_ATTR}`
  1989.     Call un.GetFileAttributes
  1990.     Pop ${_RESULT}
  1991.     !verbose pop
  1992. !macroend
  1993.  
  1994. !macro un.GetFileVersionCall _FILE _RESULT
  1995.     !verbose push
  1996.     !verbose ${_FILEFUNC_VERBOSE}
  1997.     Push `${_FILE}`
  1998.     Call un.GetFileVersion
  1999.     Pop ${_RESULT}
  2000.     !verbose pop
  2001. !macroend
  2002.  
  2003. !macro un.GetExeNameCall _RESULT
  2004.     !verbose push
  2005.     !verbose ${_FILEFUNC_VERBOSE}
  2006.     Call un.GetExeName
  2007.     Pop ${_RESULT}
  2008.     !verbose pop
  2009. !macroend
  2010.  
  2011. !macro un.GetExePathCall _RESULT
  2012.     !verbose push
  2013.     !verbose ${_FILEFUNC_VERBOSE}
  2014.     Call un.GetExePath
  2015.     Pop ${_RESULT}
  2016.     !verbose pop
  2017. !macroend
  2018.  
  2019. !macro un.GetParametersCall _RESULT
  2020.     !verbose push
  2021.     !verbose ${_FILEFUNC_VERBOSE}
  2022.     Call un.GetParameters
  2023.     Pop ${_RESULT}
  2024.     !verbose pop
  2025. !macroend
  2026.  
  2027. !macro un.GetOptionsCall _PARAMETERS _OPTION _RESULT
  2028.     !verbose push
  2029.     !verbose ${_FILEFUNC_VERBOSE}
  2030.     Push `${_PARAMETERS}`
  2031.     Push `${_OPTION}`
  2032.     Call un.GetOptions
  2033.     Pop ${_RESULT}
  2034.     !verbose pop
  2035. !macroend
  2036.  
  2037. !macro un.GetRootCall _FULLPATH _RESULT
  2038.     !verbose push
  2039.     !verbose ${_FILEFUNC_VERBOSE}
  2040.     Push `${_FULLPATH}`
  2041.     Call un.GetRoot
  2042.     Pop ${_RESULT}
  2043.     !verbose pop
  2044. !macroend
  2045.  
  2046. !macro un.GetParentCall _PATHSTRING _RESULT
  2047.     !verbose push
  2048.     !verbose ${_FILEFUNC_VERBOSE}
  2049.     Push `${_PATHSTRING}`
  2050.     Call un.GetParent
  2051.     Pop ${_RESULT}
  2052.     !verbose pop
  2053. !macroend
  2054.  
  2055. !macro un.GetFileNameCall _PATHSTRING _RESULT
  2056.     !verbose push
  2057.     !verbose ${_FILEFUNC_VERBOSE}
  2058.     Push `${_PATHSTRING}`
  2059.     Call un.GetFileName
  2060.     Pop ${_RESULT}
  2061.     !verbose pop
  2062. !macroend
  2063.  
  2064. !macro un.GetBaseNameCall _FILESTRING _RESULT
  2065.     !verbose push
  2066.     !verbose ${_FILEFUNC_VERBOSE}
  2067.     Push `${_FILESTRING}`
  2068.     Call un.GetBaseName
  2069.     Pop ${_RESULT}
  2070.     !verbose pop
  2071. !macroend
  2072.  
  2073. !macro un.GetFileExtCall _FILESTRING _RESULT
  2074.     !verbose push
  2075.     !verbose ${_FILEFUNC_VERBOSE}
  2076.     Push `${_FILESTRING}`
  2077.     Call un.GetFileExt
  2078.     Pop ${_RESULT}
  2079.     !verbose pop
  2080. !macroend
  2081.  
  2082. !macro un.BannerTrimPathCall _PATH _LENGHT _RESULT
  2083.     !verbose push
  2084.     !verbose ${_FILEFUNC_VERBOSE}
  2085.     Push `${_PATH}`
  2086.     Push `${_LENGHT}`
  2087.     Call un.BannerTrimPath
  2088.     Pop ${_RESULT}
  2089.     !verbose pop
  2090. !macroend
  2091.  
  2092. !macro un.DirStateCall _PATH _RESULT
  2093.     !verbose push
  2094.     !verbose ${_FILEFUNC_VERBOSE}
  2095.     Push `${_PATH}`
  2096.     Call un.DirState
  2097.     Pop ${_RESULT}
  2098.     !verbose pop
  2099. !macroend
  2100.  
  2101. !macro un.RefreshShellIconsCall
  2102.     !verbose push
  2103.     !verbose ${_FILEFUNC_VERBOSE}
  2104.     Call un.RefreshShellIcons
  2105.     !verbose pop
  2106. !macroend
  2107.  
  2108. !macro un.Locate
  2109.     !ifndef un.Locate
  2110.         !verbose push
  2111.         !verbose ${_FILEFUNC_VERBOSE}
  2112.         !undef _FILEFUNC_UN
  2113.         !define _FILEFUNC_UN `un.`
  2114.  
  2115.         !insertmacro Locate
  2116.  
  2117.         !undef _FILEFUNC_UN
  2118.         !define _FILEFUNC_UN
  2119.         !verbose pop
  2120.     !endif
  2121. !macroend
  2122.  
  2123. !macro un.GetSize
  2124.     !ifndef un.GetSize
  2125.         !verbose push
  2126.         !verbose ${_FILEFUNC_VERBOSE}
  2127.         !undef _FILEFUNC_UN
  2128.         !define _FILEFUNC_UN `un.`
  2129.  
  2130.         !insertmacro GetSize
  2131.  
  2132.         !undef _FILEFUNC_UN
  2133.         !define _FILEFUNC_UN
  2134.         !verbose pop
  2135.     !endif
  2136. !macroend
  2137.  
  2138. !macro un.DriveSpace
  2139.     !ifndef un.DriveSpace
  2140.         !verbose push
  2141.         !verbose ${_FILEFUNC_VERBOSE}
  2142.         !undef _FILEFUNC_UN
  2143.         !define _FILEFUNC_UN `un.`
  2144.  
  2145.         !insertmacro DriveSpace
  2146.  
  2147.         !undef _FILEFUNC_UN
  2148.         !define _FILEFUNC_UN
  2149.         !verbose pop
  2150.     !endif
  2151. !macroend
  2152.  
  2153. !macro un.GetDrives
  2154.     !ifndef un.GetDrives
  2155.         !verbose push
  2156.         !verbose ${_FILEFUNC_VERBOSE}
  2157.         !undef _FILEFUNC_UN
  2158.         !define _FILEFUNC_UN `un.`
  2159.  
  2160.         !insertmacro GetDrives
  2161.  
  2162.         !undef _FILEFUNC_UN
  2163.         !define _FILEFUNC_UN
  2164.         !verbose pop
  2165.     !endif
  2166. !macroend
  2167.  
  2168. !macro un.GetTime
  2169.     !ifndef un.GetTime
  2170.         !verbose push
  2171.         !verbose ${_FILEFUNC_VERBOSE}
  2172.         !undef _FILEFUNC_UN
  2173.         !define _FILEFUNC_UN `un.`
  2174.  
  2175.         !insertmacro GetTime
  2176.  
  2177.         !undef _FILEFUNC_UN
  2178.         !define _FILEFUNC_UN
  2179.         !verbose pop
  2180.     !endif
  2181. !macroend
  2182.  
  2183. !macro un.GetFileAttributes
  2184.     !ifndef un.GetFileAttributes
  2185.         !verbose push
  2186.         !verbose ${_FILEFUNC_VERBOSE}
  2187.         !undef _FILEFUNC_UN
  2188.         !define _FILEFUNC_UN `un.`
  2189.  
  2190.         !insertmacro GetFileAttributes
  2191.  
  2192.         !undef _FILEFUNC_UN
  2193.         !define _FILEFUNC_UN
  2194.         !verbose pop
  2195.     !endif
  2196. !macroend
  2197.  
  2198. !macro un.GetFileVersion
  2199.     !ifndef un.GetFileVersion
  2200.         !verbose push
  2201.         !verbose ${_FILEFUNC_VERBOSE}
  2202.         !undef _FILEFUNC_UN
  2203.         !define _FILEFUNC_UN `un.`
  2204.  
  2205.         !insertmacro GetFileVersion
  2206.  
  2207.         !undef _FILEFUNC_UN
  2208.         !define _FILEFUNC_UN
  2209.         !verbose pop
  2210.     !endif
  2211. !macroend
  2212.  
  2213. !macro un.GetExeName
  2214.     !ifndef un.GetExeName
  2215.         !verbose push
  2216.         !verbose ${_FILEFUNC_VERBOSE}
  2217.         !undef _FILEFUNC_UN
  2218.         !define _FILEFUNC_UN `un.`
  2219.  
  2220.         !insertmacro GetExeName
  2221.  
  2222.         !undef _FILEFUNC_UN
  2223.         !define _FILEFUNC_UN
  2224.         !verbose pop
  2225.     !endif
  2226. !macroend
  2227.  
  2228. !macro un.GetExePath
  2229.     !ifndef un.GetExePath
  2230.         !verbose push
  2231.         !verbose ${_FILEFUNC_VERBOSE}
  2232.         !undef _FILEFUNC_UN
  2233.         !define _FILEFUNC_UN `un.`
  2234.  
  2235.         !insertmacro GetExePath
  2236.  
  2237.         !undef _FILEFUNC_UN
  2238.         !define _FILEFUNC_UN
  2239.         !verbose pop
  2240.     !endif
  2241. !macroend
  2242.  
  2243. !macro un.GetParameters
  2244.     !ifndef un.GetParameters
  2245.         !verbose push
  2246.         !verbose ${_FILEFUNC_VERBOSE}
  2247.         !undef _FILEFUNC_UN
  2248.         !define _FILEFUNC_UN `un.`
  2249.  
  2250.         !insertmacro GetParameters
  2251.  
  2252.         !undef _FILEFUNC_UN
  2253.         !define _FILEFUNC_UN
  2254.         !verbose pop
  2255.     !endif
  2256. !macroend
  2257.  
  2258. !macro un.GetOptions
  2259.     !ifndef un.GetOptions
  2260.         !verbose push
  2261.         !verbose ${_FILEFUNC_VERBOSE}
  2262.         !undef _FILEFUNC_UN
  2263.         !define _FILEFUNC_UN `un.`
  2264.  
  2265.         !insertmacro GetOptions
  2266.  
  2267.         !undef _FILEFUNC_UN
  2268.         !define _FILEFUNC_UN
  2269.         !verbose pop
  2270.     !endif
  2271. !macroend
  2272.  
  2273. !macro un.GetRoot
  2274.     !ifndef un.GetRoot
  2275.         !verbose push
  2276.         !verbose ${_FILEFUNC_VERBOSE}
  2277.         !undef _FILEFUNC_UN
  2278.         !define _FILEFUNC_UN `un.`
  2279.  
  2280.         !insertmacro GetRoot
  2281.  
  2282.         !undef _FILEFUNC_UN
  2283.         !define _FILEFUNC_UN
  2284.         !verbose pop
  2285.     !endif
  2286. !macroend
  2287.  
  2288. !macro un.GetParent
  2289.     !ifndef un.GetParent
  2290.         !verbose push
  2291.         !verbose ${_FILEFUNC_VERBOSE}
  2292.         !undef _FILEFUNC_UN
  2293.         !define _FILEFUNC_UN `un.`
  2294.  
  2295.         !insertmacro GetParent
  2296.  
  2297.         !undef _FILEFUNC_UN
  2298.         !define _FILEFUNC_UN
  2299.         !verbose pop
  2300.     !endif
  2301. !macroend
  2302.  
  2303. !macro un.GetFileName
  2304.     !ifndef un.GetFileName
  2305.         !verbose push
  2306.         !verbose ${_FILEFUNC_VERBOSE}
  2307.         !undef _FILEFUNC_UN
  2308.         !define _FILEFUNC_UN `un.`
  2309.  
  2310.         !insertmacro GetFileName
  2311.  
  2312.         !undef _FILEFUNC_UN
  2313.         !define _FILEFUNC_UN
  2314.         !verbose pop
  2315.     !endif
  2316. !macroend
  2317.  
  2318. !macro un.GetBaseName
  2319.     !ifndef un.GetBaseName
  2320.         !verbose push
  2321.         !verbose ${_FILEFUNC_VERBOSE}
  2322.         !undef _FILEFUNC_UN
  2323.         !define _FILEFUNC_UN `un.`
  2324.  
  2325.         !insertmacro GetBaseName
  2326.  
  2327.         !undef _FILEFUNC_UN
  2328.         !define _FILEFUNC_UN
  2329.         !verbose pop
  2330.     !endif
  2331. !macroend
  2332.  
  2333. !macro un.GetFileExt
  2334.     !ifndef un.GetFileExt
  2335.         !verbose push
  2336.         !verbose ${_FILEFUNC_VERBOSE}
  2337.         !undef _FILEFUNC_UN
  2338.         !define _FILEFUNC_UN `un.`
  2339.  
  2340.         !insertmacro GetFileExt
  2341.  
  2342.         !undef _FILEFUNC_UN
  2343.         !define _FILEFUNC_UN
  2344.         !verbose pop
  2345.     !endif
  2346. !macroend
  2347.  
  2348. !macro un.BannerTrimPath
  2349.     !ifndef un.BannerTrimPath
  2350.         !verbose push
  2351.         !verbose ${_FILEFUNC_VERBOSE}
  2352.         !undef _FILEFUNC_UN
  2353.         !define _FILEFUNC_UN `un.`
  2354.  
  2355.         !insertmacro BannerTrimPath
  2356.  
  2357.         !undef _FILEFUNC_UN
  2358.         !define _FILEFUNC_UN
  2359.         !verbose pop
  2360.     !endif
  2361. !macroend
  2362.  
  2363. !macro un.DirState
  2364.     !ifndef un.DirState
  2365.         !verbose push
  2366.         !verbose ${_FILEFUNC_VERBOSE}
  2367.         !undef _FILEFUNC_UN
  2368.         !define _FILEFUNC_UN `un.`
  2369.  
  2370.         !insertmacro DirState
  2371.  
  2372.         !undef _FILEFUNC_UN
  2373.         !define _FILEFUNC_UN
  2374.         !verbose pop
  2375.     !endif
  2376. !macroend
  2377.  
  2378. !macro un.RefreshShellIcons
  2379.     !ifndef un.RefreshShellIcons
  2380.         !verbose push
  2381.         !verbose ${_FILEFUNC_VERBOSE}
  2382.         !undef _FILEFUNC_UN
  2383.         !define _FILEFUNC_UN `un.`
  2384.  
  2385.         !insertmacro RefreshShellIcons
  2386.  
  2387.         !undef _FILEFUNC_UN
  2388.         !define _FILEFUNC_UN
  2389.         !verbose pop
  2390.     !endif
  2391. !macroend
  2392.  
  2393.  
  2394. # Install. Case sensitive. #
  2395.  
  2396. !macro GetOptionsSCall _PARAMETERS _OPTION _RESULT
  2397.     !verbose push
  2398.     !verbose ${_FILEFUNC_VERBOSE}
  2399.     Push `${_PARAMETERS}`
  2400.     Push `${_OPTION}`
  2401.     Call GetOptionsS
  2402.     Pop ${_RESULT}
  2403.     !verbose pop
  2404. !macroend
  2405.  
  2406. !macro GetOptionsS
  2407.     !ifndef GetOptionsS
  2408.         !verbose push
  2409.         !verbose ${_FILEFUNC_VERBOSE}
  2410.         !undef _FILEFUNC_S
  2411.         !define _FILEFUNC_S `S`
  2412.  
  2413.         !insertmacro GetOptions
  2414.  
  2415.         !undef _FILEFUNC_S
  2416.         !define _FILEFUNC_S
  2417.         !verbose pop
  2418.     !endif
  2419. !macroend
  2420.  
  2421.  
  2422. # Uninstall. Case sensitive. #
  2423.  
  2424. !macro un.GetOptionsSCall _PARAMETERS _OPTION _RESULT
  2425.     !verbose push
  2426.     !verbose ${_FILEFUNC_VERBOSE}
  2427.     Push `${_PARAMETERS}`
  2428.     Push `${_OPTION}`
  2429.     Call un.GetOptionsS
  2430.     Pop ${_RESULT}
  2431.     !verbose pop
  2432. !macroend
  2433.  
  2434. !macro un.GetOptionsS
  2435.     !ifndef un.GetOptionsS
  2436.         !verbose push
  2437.         !verbose ${_FILEFUNC_VERBOSE}
  2438.         !undef _FILEFUNC_UN
  2439.         !define _FILEFUNC_UN `un.`
  2440.         !undef _FILEFUNC_S
  2441.         !define _FILEFUNC_S `S`
  2442.  
  2443.         !insertmacro GetOptions
  2444.  
  2445.         !undef _FILEFUNC_UN
  2446.         !define _FILEFUNC_UN
  2447.         !undef _FILEFUNC_S
  2448.         !define _FILEFUNC_S
  2449.         !verbose pop
  2450.     !endif
  2451. !macroend
  2452.  
  2453. !endif
  2454.