FileFunc.nsh 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012
  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.r5,&i2.r6,&i2.r4,&i2.r0,&i2.r3,&i2.r2,&i2.r1,&i2)'
  1006. System::Free $7
  1007. IntFmt $6 "%.2u" $6 ; Month
  1008. IntFmt $0 "%.2u" $0 ; Day
  1009. IntFmt $3 "%.2u" $3 ; Hour
  1010. IntFmt $2 "%.2u" $2 ; Minute
  1011. IntFmt $1 "%.2u" $1 ; Second
  1012. StrCmp $4 0 0 +3
  1013. StrCpy $4 Sunday
  1014. goto FileFunc_GetTime_end
  1015. StrCmp $4 1 0 +3
  1016. StrCpy $4 Monday
  1017. goto FileFunc_GetTime_end
  1018. StrCmp $4 2 0 +3
  1019. StrCpy $4 Tuesday
  1020. goto FileFunc_GetTime_end
  1021. StrCmp $4 3 0 +3
  1022. StrCpy $4 Wednesday
  1023. goto FileFunc_GetTime_end
  1024. StrCmp $4 4 0 +3
  1025. StrCpy $4 Thursday
  1026. goto FileFunc_GetTime_end
  1027. StrCmp $4 5 0 +3
  1028. StrCpy $4 Friday
  1029. goto FileFunc_GetTime_end
  1030. StrCmp $4 6 0 FileFunc_GetTime_error
  1031. StrCpy $4 Saturday
  1032. goto FileFunc_GetTime_end
  1033. FileFunc_GetTime_error:
  1034. SetErrors
  1035. StrCpy $0 ''
  1036. StrCpy $1 ''
  1037. StrCpy $2 ''
  1038. StrCpy $3 ''
  1039. StrCpy $4 ''
  1040. StrCpy $5 ''
  1041. StrCpy $6 ''
  1042. FileFunc_GetTime_end:
  1043. Pop $7
  1044. Exch $6
  1045. Exch
  1046. Exch $5
  1047. Exch 2
  1048. Exch $4
  1049. Exch 3
  1050. Exch $3
  1051. Exch 4
  1052. Exch $2
  1053. Exch 5
  1054. Exch $1
  1055. Exch 6
  1056. Exch $0
  1057. !verbose pop
  1058. !macroend
  1059. !define GetFileAttributes `!insertmacro GetFileAttributesCall`
  1060. !define un.GetFileAttributes `!insertmacro GetFileAttributesCall`
  1061. !macro GetFileAttributes
  1062. !macroend
  1063. !macro un.GetFileAttributes
  1064. !macroend
  1065. !macro GetFileAttributes_
  1066. !verbose push
  1067. !verbose ${_FILEFUNC_VERBOSE}
  1068. Exch $1
  1069. Exch
  1070. Exch $0
  1071. Exch
  1072. Push $2
  1073. Push $3
  1074. Push $4
  1075. Push $5
  1076. System::Call 'kernel32::GetFileAttributes(t r0)i .r2'
  1077. StrCmp $2 -1 FileFunc_GetFileAttributes_error
  1078. StrCpy $3 ''
  1079. IntOp $0 $2 & 0x4000
  1080. IntCmp $0 0 +2
  1081. StrCpy $3 'ENCRYPTED|'
  1082. IntOp $0 $2 & 0x2000
  1083. IntCmp $0 0 +2
  1084. StrCpy $3 'NOT_CONTENT_INDEXED|$3'
  1085. IntOp $0 $2 & 0x1000
  1086. IntCmp $0 0 +2
  1087. StrCpy $3 'OFFLINE|$3'
  1088. IntOp $0 $2 & 0x0800
  1089. IntCmp $0 0 +2
  1090. StrCpy $3 'COMPRESSED|$3'
  1091. IntOp $0 $2 & 0x0400
  1092. IntCmp $0 0 +2
  1093. StrCpy $3 'REPARSE_POINT|$3'
  1094. IntOp $0 $2 & 0x0200
  1095. IntCmp $0 0 +2
  1096. StrCpy $3 'SPARSE_FILE|$3'
  1097. IntOp $0 $2 & 0x0100
  1098. IntCmp $0 0 +2
  1099. StrCpy $3 'TEMPORARY|$3'
  1100. IntOp $0 $2 & 0x0080
  1101. IntCmp $0 0 +2
  1102. StrCpy $3 'NORMAL|$3'
  1103. IntOp $0 $2 & 0x0040
  1104. IntCmp $0 0 +2
  1105. StrCpy $3 'DEVICE|$3'
  1106. IntOp $0 $2 & 0x0020
  1107. IntCmp $0 0 +2
  1108. StrCpy $3 'ARCHIVE|$3'
  1109. IntOp $0 $2 & 0x0010
  1110. IntCmp $0 0 +2
  1111. StrCpy $3 'DIRECTORY|$3'
  1112. IntOp $0 $2 & 0x0004
  1113. IntCmp $0 0 +2
  1114. StrCpy $3 'SYSTEM|$3'
  1115. IntOp $0 $2 & 0x0002
  1116. IntCmp $0 0 +2
  1117. StrCpy $3 'HIDDEN|$3'
  1118. IntOp $0 $2 & 0x0001
  1119. IntCmp $0 0 +2
  1120. StrCpy $3 'READONLY|$3'
  1121. StrCpy $0 $3 -1
  1122. StrCmp $1 '' FileFunc_GetFileAttributes_end
  1123. StrCmp $1 'ALL' FileFunc_GetFileAttributes_end
  1124. FileFunc_GetFileAttributes_attrcmp:
  1125. StrCpy $5 0
  1126. IntOp $5 $5 + 1
  1127. StrCpy $4 $1 1 $5
  1128. StrCmp $4 '' +2
  1129. StrCmp $4 '|' 0 -3
  1130. StrCpy $2 $1 $5
  1131. IntOp $5 $5 + 1
  1132. StrCpy $1 $1 '' $5
  1133. StrLen $3 $2
  1134. StrCpy $5 -1
  1135. IntOp $5 $5 + 1
  1136. StrCpy $4 $0 $3 $5
  1137. StrCmp $4 '' FileFunc_GetFileAttributes_notfound
  1138. StrCmp $4 $2 0 -3
  1139. StrCmp $1 '' 0 FileFunc_GetFileAttributes_attrcmp
  1140. StrCpy $0 1
  1141. goto FileFunc_GetFileAttributes_end
  1142. FileFunc_GetFileAttributes_notfound:
  1143. StrCpy $0 0
  1144. goto FileFunc_GetFileAttributes_end
  1145. FileFunc_GetFileAttributes_error:
  1146. SetErrors
  1147. StrCpy $0 ''
  1148. FileFunc_GetFileAttributes_end:
  1149. Pop $5
  1150. Pop $4
  1151. Pop $3
  1152. Pop $2
  1153. Pop $1
  1154. Exch $0
  1155. !verbose pop
  1156. !macroend
  1157. !define GetFileVersion `!insertmacro GetFileVersionCall`
  1158. !define un.GetFileVersion `!insertmacro GetFileVersionCall`
  1159. !macro GetFileVersion
  1160. !macroend
  1161. !macro un.GetFileVersion
  1162. !macroend
  1163. !macro GetFileVersion_
  1164. !verbose push
  1165. !verbose ${_FILEFUNC_VERBOSE}
  1166. Exch $0
  1167. Push $1
  1168. Push $2
  1169. Push $3
  1170. Push $4
  1171. Push $5
  1172. Push $6
  1173. ClearErrors
  1174. GetDllVersion '$0' $1 $2
  1175. IfErrors FileFunc_GetFileVersion_error
  1176. IntOp $3 $1 >> 16
  1177. IntOp $3 $3 & 0x0000FFFF
  1178. IntOp $4 $1 & 0x0000FFFF
  1179. IntOp $5 $2 >> 16
  1180. IntOp $5 $5 & 0x0000FFFF
  1181. IntOp $6 $2 & 0x0000FFFF
  1182. StrCpy $0 '$3.$4.$5.$6'
  1183. goto FileFunc_GetFileVersion_end
  1184. FileFunc_GetFileVersion_error:
  1185. SetErrors
  1186. StrCpy $0 ''
  1187. FileFunc_GetFileVersion_end:
  1188. Pop $6
  1189. Pop $5
  1190. Pop $4
  1191. Pop $3
  1192. Pop $2
  1193. Pop $1
  1194. Exch $0
  1195. !verbose pop
  1196. !macroend
  1197. !define GetExeName `!insertmacro GetExeNameCall`
  1198. !define un.GetExeName `!insertmacro GetExeNameCall`
  1199. !macro GetExeName
  1200. !macroend
  1201. !macro un.GetExeName
  1202. !macroend
  1203. !macro GetExeName_
  1204. !verbose push
  1205. !verbose ${_FILEFUNC_VERBOSE}
  1206. Push $0
  1207. Push $1
  1208. Push $2
  1209. System::Call 'kernel32::GetModuleFileName(p 0, t.r0, i ${NSIS_MAX_STRLEN})'
  1210. System::Call 'kernel32::GetLongPathName(t r0, t.r1, i ${NSIS_MAX_STRLEN})i.r2'
  1211. StrCmp $2 error +2
  1212. StrCpy $0 $1
  1213. Pop $2
  1214. Pop $1
  1215. Exch $0
  1216. !verbose pop
  1217. !macroend
  1218. !define GetExePath `!insertmacro GetExePathCall`
  1219. !define un.GetExePath `!insertmacro GetExePathCall`
  1220. !macro GetExePath
  1221. !macroend
  1222. !macro un.GetExePath
  1223. !macroend
  1224. !macro GetExePath_
  1225. !verbose push
  1226. !verbose ${_FILEFUNC_VERBOSE}
  1227. Push $0
  1228. Push $1
  1229. Push $2
  1230. StrCpy $0 $EXEDIR
  1231. System::Call 'kernel32::GetLongPathName(t r0, t.r1, i ${NSIS_MAX_STRLEN})i.r2'
  1232. StrCmp $2 error +2
  1233. StrCpy $0 $1
  1234. Pop $2
  1235. Pop $1
  1236. Exch $0
  1237. !verbose pop
  1238. !macroend
  1239. !define GetParameters `!insertmacro GetParametersCall`
  1240. !define un.GetParameters `!insertmacro GetParametersCall`
  1241. !macro GetParameters
  1242. !macroend
  1243. !macro un.GetParameters
  1244. !macroend
  1245. !macro GetParameters_
  1246. !verbose push
  1247. !verbose ${_FILEFUNC_VERBOSE}
  1248. ;cmdline-check
  1249. StrCmp $CMDLINE "" 0 +3
  1250. Push ""
  1251. Return
  1252. ;vars
  1253. Push $0 ;tmp
  1254. Push $1 ;length
  1255. Push $2 ;parameter offset
  1256. Push $3 ;separator
  1257. ;length/offset
  1258. StrLen $1 $CMDLINE
  1259. StrCpy $2 2 ;start with third character
  1260. ;separator
  1261. StrCpy $3 $CMDLINE 1 ;first character
  1262. StrCmp $3 '"' +2
  1263. StrCpy $3 ' '
  1264. FileFunc_GetParameters_token: ;finding second separator
  1265. IntCmp $2 $1 FileFunc_GetParameters_strip 0 FileFunc_GetParameters_strip
  1266. StrCpy $0 $CMDLINE 1 $2
  1267. IntOp $2 $2 + 1
  1268. StrCmp $3 $0 0 FileFunc_GetParameters_token
  1269. FileFunc_GetParameters_strip: ;strip white space
  1270. IntCmp $2 $1 FileFunc_GetParameters_copy 0 FileFunc_GetParameters_copy
  1271. StrCpy $0 $CMDLINE 1 $2
  1272. StrCmp $0 ' ' 0 FileFunc_GetParameters_copy
  1273. IntOp $2 $2 + 1
  1274. Goto FileFunc_GetParameters_strip
  1275. FileFunc_GetParameters_copy:
  1276. StrCpy $0 $CMDLINE "" $2
  1277. ;strip white spaces from end
  1278. FileFunc_GetParameters_rstrip:
  1279. StrCpy $1 $0 1 -1
  1280. StrCmp $1 ' ' 0 FileFunc_GetParameters_done
  1281. StrCpy $0 $0 -1
  1282. Goto FileFunc_GetParameters_rstrip
  1283. FileFunc_GetParameters_done:
  1284. Pop $3
  1285. Pop $2
  1286. Pop $1
  1287. Exch $0
  1288. !verbose pop
  1289. !macroend
  1290. !macro GetOptionsBody _FILEFUNC_S
  1291. Exch $1
  1292. Exch
  1293. Exch $0
  1294. Exch
  1295. Push $2
  1296. Push $3
  1297. Push $4
  1298. Push $5
  1299. Push $6
  1300. Push $7
  1301. ClearErrors
  1302. StrCpy $2 $1 '' 1
  1303. StrCpy $1 $1 1
  1304. StrLen $3 $2
  1305. StrCpy $7 0
  1306. FileFunc_GetOptions${_FILEFUNC_S}_begin:
  1307. StrCpy $4 -1
  1308. StrCpy $6 ''
  1309. FileFunc_GetOptions${_FILEFUNC_S}_quote:
  1310. IntOp $4 $4 + 1
  1311. StrCpy $5 $0 1 $4
  1312. StrCmp${_FILEFUNC_S} $5$7 '0' FileFunc_GetOptions${_FILEFUNC_S}_notfound
  1313. StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_trimright
  1314. StrCmp${_FILEFUNC_S} $5 '"' 0 +7
  1315. StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1316. StrCpy $6 '"'
  1317. goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1318. StrCmp${_FILEFUNC_S} $6 '"' 0 +3
  1319. StrCpy $6 ''
  1320. goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1321. StrCmp${_FILEFUNC_S} $5 `'` 0 +7
  1322. StrCmp${_FILEFUNC_S} $6 `` 0 +3
  1323. StrCpy $6 `'`
  1324. goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1325. StrCmp${_FILEFUNC_S} $6 `'` 0 +3
  1326. StrCpy $6 ``
  1327. goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1328. StrCmp${_FILEFUNC_S} $5 '`' 0 +7
  1329. StrCmp${_FILEFUNC_S} $6 '' 0 +3
  1330. StrCpy $6 '`'
  1331. goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1332. StrCmp${_FILEFUNC_S} $6 '`' 0 +3
  1333. StrCpy $6 ''
  1334. goto FileFunc_GetOptions${_FILEFUNC_S}_quote
  1335. StrCmp${_FILEFUNC_S} $6 '"' FileFunc_GetOptions${_FILEFUNC_S}_quote
  1336. StrCmp${_FILEFUNC_S} $6 `'` FileFunc_GetOptions${_FILEFUNC_S}_quote
  1337. StrCmp${_FILEFUNC_S} $6 '`' FileFunc_GetOptions${_FILEFUNC_S}_quote
  1338. StrCmp${_FILEFUNC_S} $5 $1 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
  1339. StrCmp${_FILEFUNC_S} $7 0 FileFunc_GetOptions${_FILEFUNC_S}_trimleft FileFunc_GetOptions${_FILEFUNC_S}_trimright
  1340. FileFunc_GetOptions${_FILEFUNC_S}_trimleft:
  1341. IntOp $4 $4 + 1
  1342. StrCpy $5 $0 $3 $4
  1343. StrCmp${_FILEFUNC_S} $5 '' FileFunc_GetOptions${_FILEFUNC_S}_notfound
  1344. StrCmp${_FILEFUNC_S} $5 $2 0 FileFunc_GetOptions${_FILEFUNC_S}_quote
  1345. IntOp $4 $4 + $3
  1346. StrCpy $0 $0 '' $4
  1347. StrCpy $4 $0 1
  1348. StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1349. StrCpy $0 $0 '' 1
  1350. goto -3
  1351. StrCpy $7 1
  1352. goto FileFunc_GetOptions${_FILEFUNC_S}_begin
  1353. FileFunc_GetOptions${_FILEFUNC_S}_trimright:
  1354. StrCpy $0 $0 $4
  1355. StrCpy $4 $0 1 -1
  1356. StrCmp${_FILEFUNC_S} $4 ' ' 0 +3
  1357. StrCpy $0 $0 -1
  1358. goto -3
  1359. StrCpy $3 $0 1
  1360. StrCpy $4 $0 1 -1
  1361. StrCmp${_FILEFUNC_S} $3 $4 0 FileFunc_GetOptions${_FILEFUNC_S}_end
  1362. StrCmp${_FILEFUNC_S} $3 '"' +3
  1363. StrCmp${_FILEFUNC_S} $3 `'` +2
  1364. StrCmp${_FILEFUNC_S} $3 '`' 0 FileFunc_GetOptions${_FILEFUNC_S}_end
  1365. StrCpy $0 $0 -1 1
  1366. goto FileFunc_GetOptions${_FILEFUNC_S}_end
  1367. FileFunc_GetOptions${_FILEFUNC_S}_notfound:
  1368. SetErrors
  1369. StrCpy $0 ''
  1370. FileFunc_GetOptions${_FILEFUNC_S}_end:
  1371. Pop $7
  1372. Pop $6
  1373. Pop $5
  1374. Pop $4
  1375. Pop $3
  1376. Pop $2
  1377. Pop $1
  1378. Exch $0
  1379. !macroend
  1380. !define GetOptions `!insertmacro GetOptionsCall`
  1381. !define un.GetOptions `!insertmacro GetOptionsCall`
  1382. !macro GetOptions
  1383. !macroend
  1384. !macro un.GetOptions
  1385. !macroend
  1386. !macro GetOptions_
  1387. !verbose push
  1388. !verbose ${_FILEFUNC_VERBOSE}
  1389. !insertmacro GetOptionsBody ''
  1390. !verbose pop
  1391. !macroend
  1392. !define GetOptionsS `!insertmacro GetOptionsSCall`
  1393. !define un.GetOptionsS `!insertmacro GetOptionsSCall`
  1394. !macro GetOptionsS
  1395. !macroend
  1396. !macro un.GetOptionsS
  1397. !macroend
  1398. !macro GetOptionsS_
  1399. !verbose push
  1400. !verbose ${_FILEFUNC_VERBOSE}
  1401. !insertmacro GetOptionsBody 'S'
  1402. !verbose pop
  1403. !macroend
  1404. !define GetRoot `!insertmacro GetRootCall`
  1405. !define un.GetRoot `!insertmacro GetRootCall`
  1406. !macro GetRoot
  1407. !macroend
  1408. !macro un.GetRoot
  1409. !macroend
  1410. !macro GetRoot_
  1411. !verbose push
  1412. !verbose ${_FILEFUNC_VERBOSE}
  1413. Exch $0
  1414. Push $1
  1415. Push $2
  1416. Push $3
  1417. StrCpy $1 $0 2
  1418. StrCmp $1 '\\' FileFunc_GetRoot_UNC
  1419. StrCpy $2 $1 1 1
  1420. StrCmp $2 ':' 0 FileFunc_GetRoot_empty
  1421. StrCpy $0 $1
  1422. goto FileFunc_GetRoot_end
  1423. FileFunc_GetRoot_UNC:
  1424. StrCpy $2 1
  1425. StrCpy $3 ''
  1426. FileFunc_GetRoot_loop:
  1427. IntOp $2 $2 + 1
  1428. StrCpy $1 $0 1 $2
  1429. StrCmp $1$3 '' FileFunc_GetRoot_empty
  1430. StrCmp $1 '' +5
  1431. StrCmp $1 '\' 0 FileFunc_GetRoot_loop
  1432. StrCmp $3 '1' +3
  1433. StrCpy $3 '1'
  1434. goto FileFunc_GetRoot_loop
  1435. StrCpy $0 $0 $2
  1436. StrCpy $2 $0 1 -1
  1437. StrCmp $2 '\' 0 FileFunc_GetRoot_end
  1438. FileFunc_GetRoot_empty:
  1439. StrCpy $0 ''
  1440. FileFunc_GetRoot_end:
  1441. Pop $3
  1442. Pop $2
  1443. Pop $1
  1444. Exch $0
  1445. !verbose pop
  1446. !macroend
  1447. !define GetParent `!insertmacro GetParentCall`
  1448. !define un.GetParent `!insertmacro GetParentCall`
  1449. !macro GetParent
  1450. !macroend
  1451. !macro un.GetParent
  1452. !macroend
  1453. !macro GetParent_
  1454. !verbose push
  1455. !verbose ${_FILEFUNC_VERBOSE}
  1456. Exch $0
  1457. Push $1
  1458. Push $2
  1459. StrCpy $2 $0 1 -1
  1460. StrCmp $2 '\' 0 +3
  1461. StrCpy $0 $0 -1
  1462. goto -3
  1463. StrCpy $1 0
  1464. IntOp $1 $1 - 1
  1465. StrCpy $2 $0 1 $1
  1466. StrCmp $2 '\' +2
  1467. StrCmp $2 '' 0 -3
  1468. StrCpy $0 $0 $1
  1469. Pop $2
  1470. Pop $1
  1471. Exch $0
  1472. !verbose pop
  1473. !macroend
  1474. !define GetFileName `!insertmacro GetFileNameCall`
  1475. !define un.GetFileName `!insertmacro GetFileNameCall`
  1476. !macro GetFileName
  1477. !macroend
  1478. !macro un.GetFileName
  1479. !macroend
  1480. !macro GetFileName_
  1481. !verbose push
  1482. !verbose ${_FILEFUNC_VERBOSE}
  1483. Exch $0
  1484. Push $1
  1485. Push $2
  1486. StrCpy $2 $0 1 -1
  1487. StrCmp $2 '\' 0 +3
  1488. StrCpy $0 $0 -1
  1489. goto -3
  1490. StrCpy $1 0
  1491. IntOp $1 $1 - 1
  1492. StrCpy $2 $0 1 $1
  1493. StrCmp $2 '' FileFunc_GetFileName_end
  1494. StrCmp $2 '\' 0 -3
  1495. IntOp $1 $1 + 1
  1496. StrCpy $0 $0 '' $1
  1497. FileFunc_GetFileName_end:
  1498. Pop $2
  1499. Pop $1
  1500. Exch $0
  1501. !verbose pop
  1502. !macroend
  1503. !define GetBaseName `!insertmacro GetBaseNameCall`
  1504. !define un.GetBaseName `!insertmacro GetBaseNameCall`
  1505. !macro GetBaseName
  1506. !macroend
  1507. !macro un.GetBaseName
  1508. !macroend
  1509. !macro GetBaseName_
  1510. !verbose push
  1511. !verbose ${_FILEFUNC_VERBOSE}
  1512. Exch $0
  1513. Push $1
  1514. Push $2
  1515. Push $3
  1516. StrCpy $1 0
  1517. StrCpy $3 ''
  1518. FileFunc_GetBaseName_loop:
  1519. IntOp $1 $1 - 1
  1520. StrCpy $2 $0 1 $1
  1521. StrCmp $2 '' FileFunc_GetBaseName_trimpath
  1522. StrCmp $2 '\' FileFunc_GetBaseName_trimpath
  1523. StrCmp $3 'noext' FileFunc_GetBaseName_loop
  1524. StrCmp $2 '.' 0 FileFunc_GetBaseName_loop
  1525. StrCpy $0 $0 $1
  1526. StrCpy $3 'noext'
  1527. StrCpy $1 0
  1528. goto FileFunc_GetBaseName_loop
  1529. FileFunc_GetBaseName_trimpath:
  1530. StrCmp $1 -1 FileFunc_GetBaseName_empty
  1531. IntOp $1 $1 + 1
  1532. StrCpy $0 $0 '' $1
  1533. goto FileFunc_GetBaseName_end
  1534. FileFunc_GetBaseName_empty:
  1535. StrCpy $0 ''
  1536. FileFunc_GetBaseName_end:
  1537. Pop $3
  1538. Pop $2
  1539. Pop $1
  1540. Exch $0
  1541. !verbose pop
  1542. !macroend
  1543. !define GetFileExt `!insertmacro GetFileExtCall`
  1544. !define un.GetFileExt `!insertmacro GetFileExtCall`
  1545. !macro GetFileExt
  1546. !macroend
  1547. !macro un.GetFileExt
  1548. !macroend
  1549. !macro GetFileExt_
  1550. !verbose push
  1551. !verbose ${_FILEFUNC_VERBOSE}
  1552. Exch $0
  1553. Push $1
  1554. Push $2
  1555. StrCpy $1 0
  1556. FileFunc_GetFileExt_loop:
  1557. IntOp $1 $1 - 1
  1558. StrCpy $2 $0 1 $1
  1559. StrCmp $2 '' FileFunc_GetFileExt_empty
  1560. StrCmp $2 '\' FileFunc_GetFileExt_empty
  1561. StrCmp $2 '.' 0 FileFunc_GetFileExt_loop
  1562. StrCmp $1 -1 FileFunc_GetFileExt_empty
  1563. IntOp $1 $1 + 1
  1564. StrCpy $0 $0 '' $1
  1565. goto FileFunc_GetFileExt_end
  1566. FileFunc_GetFileExt_empty:
  1567. StrCpy $0 ''
  1568. FileFunc_GetFileExt_end:
  1569. Pop $2
  1570. Pop $1
  1571. Exch $0
  1572. !verbose pop
  1573. !macroend
  1574. !define BannerTrimPath `!insertmacro BannerTrimPathCall`
  1575. !define un.BannerTrimPath `!insertmacro BannerTrimPathCall`
  1576. !macro BannerTrimPath
  1577. !macroend
  1578. !macro un.BannerTrimPath
  1579. !macroend
  1580. !macro BannerTrimPath_
  1581. !verbose push
  1582. !verbose ${_FILEFUNC_VERBOSE}
  1583. Exch $1
  1584. Exch
  1585. Exch $0
  1586. Exch
  1587. Push $2
  1588. Push $3
  1589. Push $4
  1590. StrCpy $3 $1 1 -1
  1591. IntOp $1 $1 + 0
  1592. StrLen $2 $0
  1593. IntCmp $2 $1 FileFunc_BannerTrimPath_end FileFunc_BannerTrimPath_end
  1594. IntOp $1 $1 - 3
  1595. IntCmp $1 0 FileFunc_BannerTrimPath_empty FileFunc_BannerTrimPath_empty
  1596. StrCmp $3 'A' FileFunc_BannerTrimPath_A-trim
  1597. StrCmp $3 'B' FileFunc_BannerTrimPath_B-trim
  1598. StrCmp $3 'C' FileFunc_BannerTrimPath_C-trim
  1599. StrCmp $3 'D' FileFunc_BannerTrimPath_D-trim
  1600. FileFunc_BannerTrimPath_A-trim:
  1601. StrCpy $3 $0 1 1
  1602. StrCpy $2 0
  1603. StrCmp $3 ':' 0 +2
  1604. IntOp $2 $2 + 2
  1605. FileFunc_BannerTrimPath_loopleft:
  1606. IntOp $2 $2 + 1
  1607. StrCpy $3 $0 1 $2
  1608. StrCmp $2 $1 FileFunc_BannerTrimPath_C-trim
  1609. StrCmp $3 '\' 0 FileFunc_BannerTrimPath_loopleft
  1610. StrCpy $3 $0 $2
  1611. IntOp $2 $2 - $1
  1612. IntCmp $2 0 FileFunc_BannerTrimPath_B-trim 0 FileFunc_BannerTrimPath_B-trim
  1613. FileFunc_BannerTrimPath_loopright:
  1614. IntOp $2 $2 + 1
  1615. StrCpy $4 $0 1 $2
  1616. StrCmp $2 0 FileFunc_BannerTrimPath_B-trim
  1617. StrCmp $4 '\' 0 FileFunc_BannerTrimPath_loopright
  1618. StrCpy $4 $0 '' $2
  1619. StrCpy $0 '$3\...$4'
  1620. goto FileFunc_BannerTrimPath_end
  1621. FileFunc_BannerTrimPath_B-trim:
  1622. StrCpy $2 $1
  1623. IntOp $2 $2 - 1
  1624. StrCmp $2 -1 FileFunc_BannerTrimPath_C-trim
  1625. StrCpy $3 $0 1 $2
  1626. StrCmp $3 '\' 0 -3
  1627. StrCpy $0 $0 $2
  1628. StrCpy $0 '$0\...'
  1629. goto FileFunc_BannerTrimPath_end
  1630. FileFunc_BannerTrimPath_C-trim:
  1631. StrCpy $0 $0 $1
  1632. StrCpy $0 '$0...'
  1633. goto FileFunc_BannerTrimPath_end
  1634. FileFunc_BannerTrimPath_D-trim:
  1635. StrCpy $3 -1
  1636. IntOp $3 $3 - 1
  1637. StrCmp $3 -$2 FileFunc_BannerTrimPath_C-trim
  1638. StrCpy $4 $0 1 $3
  1639. StrCmp $4 '\' 0 -3
  1640. StrCpy $4 $0 '' $3
  1641. IntOp $3 $1 + $3
  1642. IntCmp $3 2 FileFunc_BannerTrimPath_C-trim FileFunc_BannerTrimPath_C-trim
  1643. StrCpy $0 $0 $3
  1644. StrCpy $0 '$0...$4'
  1645. goto FileFunc_BannerTrimPath_end
  1646. FileFunc_BannerTrimPath_empty:
  1647. StrCpy $0 ''
  1648. FileFunc_BannerTrimPath_end:
  1649. Pop $4
  1650. Pop $3
  1651. Pop $2
  1652. Pop $1
  1653. Exch $0
  1654. !verbose pop
  1655. !macroend
  1656. !define DirState `!insertmacro DirStateCall`
  1657. !define un.DirState `!insertmacro DirStateCall`
  1658. !macro DirState
  1659. !macroend
  1660. !macro un.DirState
  1661. !macroend
  1662. !macro DirState_
  1663. !verbose push
  1664. !verbose ${_FILEFUNC_VERBOSE}
  1665. Exch $0
  1666. Push $1
  1667. ClearErrors
  1668. FindFirst $1 $0 '$0\*.*'
  1669. IfErrors 0 +3
  1670. StrCpy $0 -1
  1671. goto FileFunc_DirState_end
  1672. StrCmp $0 '.' 0 +4
  1673. FindNext $1 $0
  1674. StrCmp $0 '..' 0 +2
  1675. FindNext $1 $0
  1676. FindClose $1
  1677. IfErrors 0 +3
  1678. StrCpy $0 0
  1679. goto FileFunc_DirState_end
  1680. StrCpy $0 1
  1681. FileFunc_DirState_end:
  1682. Pop $1
  1683. Exch $0
  1684. !verbose pop
  1685. !macroend
  1686. !define RefreshShellIcons `!insertmacro RefreshShellIconsCall`
  1687. !define un.RefreshShellIcons `!insertmacro RefreshShellIconsCall`
  1688. !macro RefreshShellIcons
  1689. !macroend
  1690. !macro un.RefreshShellIcons
  1691. !macroend
  1692. !macro RefreshShellIcons_
  1693. !verbose push
  1694. !verbose ${_FILEFUNC_VERBOSE}
  1695. System::Call 'shell32::SHChangeNotify(i 0x08000000, i 0, i 0, i 0)'
  1696. !verbose pop
  1697. !macroend
  1698. !verbose pop
  1699. !endif