FileFunc.nsh 38 KB

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