FileFunc.nsh 38 KB

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