Advertisement
Guest User

ProgressBarUntgzPluginNSIS

a guest
Nov 21st, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 63.40 KB | None | 0 0
  1. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/MSVC9/untgz.sln
  2. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  3. +++ b/common/windows/nsis/plugins/untgz/MSVC9/untgz.sln Wed Nov 21 10:34:41 2012 +0100
  4. @@ -0,0 +1,20 @@
  5. +
  6. +Microsoft Visual Studio Solution File, Format Version 10.00
  7. +# Visual Studio 2008
  8. +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "untgz", "untgz.vcproj", "{85D0D38F-6037-4435-9FFE-96570F86763A}"
  9. +EndProject
  10. +Global
  11. +   GlobalSection(SolutionConfigurationPlatforms) = preSolution
  12. +       Debug|Win32 = Debug|Win32
  13. +       Release|Win32 = Release|Win32
  14. +   EndGlobalSection
  15. +   GlobalSection(ProjectConfigurationPlatforms) = postSolution
  16. +       {85D0D38F-6037-4435-9FFE-96570F86763A}.Debug|Win32.ActiveCfg = Debug|Win32
  17. +       {85D0D38F-6037-4435-9FFE-96570F86763A}.Debug|Win32.Build.0 = Debug|Win32
  18. +       {85D0D38F-6037-4435-9FFE-96570F86763A}.Release|Win32.ActiveCfg = Release|Win32
  19. +       {85D0D38F-6037-4435-9FFE-96570F86763A}.Release|Win32.Build.0 = Release|Win32
  20. +   EndGlobalSection
  21. +   GlobalSection(SolutionProperties) = preSolution
  22. +       HideSolutionNode = FALSE
  23. +   EndGlobalSection
  24. +EndGlobal
  25. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/MSVC9/untgz.vcproj
  26. --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
  27. +++ b/common/windows/nsis/plugins/untgz/MSVC9/untgz.vcproj  Wed Nov 21 10:34:41 2012 +0100
  28. @@ -0,0 +1,625 @@
  29. +<?xml version="1.0" encoding="Windows-1252"?>
  30. +<VisualStudioProject
  31. +   ProjectType="Visual C++"
  32. +   Version="9,00"
  33. +   Name="untgz"
  34. +   ProjectGUID="{85D0D38F-6037-4435-9FFE-96570F86763A}"
  35. +   RootNamespace="untgz"
  36. +   TargetFrameworkVersion="131072"
  37. +   >
  38. +   <Platforms>
  39. +       <Platform
  40. +           Name="Win32"
  41. +       />
  42. +   </Platforms>
  43. +   <ToolFiles>
  44. +   </ToolFiles>
  45. +   <Configurations>
  46. +       <Configuration
  47. +           Name="Debug|Win32"
  48. +           OutputDirectory="$(SolutionDir)$(ConfigurationName)"
  49. +           IntermediateDirectory="$(ConfigurationName)"
  50. +           ConfigurationType="2"
  51. +           UseOfMFC="0"
  52. +           ATLMinimizesCRunTimeLibraryUsage="false"
  53. +           CharacterSet="1"
  54. +           >
  55. +           <Tool
  56. +               Name="VCPreBuildEventTool"
  57. +           />
  58. +           <Tool
  59. +               Name="VCCustomBuildTool"
  60. +           />
  61. +           <Tool
  62. +               Name="VCXMLDataGeneratorTool"
  63. +           />
  64. +           <Tool
  65. +               Name="VCWebServiceProxyGeneratorTool"
  66. +           />
  67. +           <Tool
  68. +               Name="VCMIDLTool"
  69. +               PreprocessorDefinitions="_DEBUG"
  70. +               SuppressStartupBanner="true"
  71. +               TargetEnvironment="1"
  72. +               HeaderFileName=""
  73. +           />
  74. +           <Tool
  75. +               Name="VCCLCompilerTool"
  76. +               AdditionalOptions="/Gs16000"
  77. +               Optimization="0"
  78. +               AdditionalIncludeDirectories="./lzma;./bz2;./zlib"
  79. +               PreprocessorDefinitions="_DEBUG;_WIN32;EXEHEAD;WIN32;_WINDOWS;NSIS_COMPRESS_USE_ZLIB"
  80. +               MinimalRebuild="true"
  81. +               ExceptionHandling="0"
  82. +               RuntimeLibrary="3"
  83. +               BufferSecurityCheck="false"
  84. +               BrowseInformation="1"
  85. +               WarningLevel="3"
  86. +               SuppressStartupBanner="true"
  87. +               DebugInformationFormat="4"
  88. +               OmitDefaultLibName="true"
  89. +           />
  90. +           <Tool
  91. +               Name="VCManagedResourceCompilerTool"
  92. +           />
  93. +           <Tool
  94. +               Name="VCResourceCompilerTool"
  95. +               PreprocessorDefinitions="_DEBUG"
  96. +               Culture="0"
  97. +           />
  98. +           <Tool
  99. +               Name="VCPreLinkEventTool"
  100. +           />
  101. +           <Tool
  102. +               Name="VCLinkerTool"
  103. +               IgnoreImportLibrary="true"
  104. +               AdditionalDependencies="user32.lib"
  105. +               LinkIncremental="2"
  106. +               SuppressStartupBanner="true"
  107. +               IgnoreAllDefaultLibraries="true"
  108. +               GenerateDebugInformation="true"
  109. +               OptimizeForWindows98="0"
  110. +               RandomizedBaseAddress="1"
  111. +               DataExecutionPrevention="0"
  112. +               TargetMachine="1"
  113. +           />
  114. +           <Tool
  115. +               Name="VCALinkTool"
  116. +           />
  117. +           <Tool
  118. +               Name="VCManifestTool"
  119. +           />
  120. +           <Tool
  121. +               Name="VCXDCMakeTool"
  122. +           />
  123. +           <Tool
  124. +               Name="VCBscMakeTool"
  125. +           />
  126. +           <Tool
  127. +               Name="VCFxCopTool"
  128. +           />
  129. +           <Tool
  130. +               Name="VCAppVerifierTool"
  131. +           />
  132. +           <Tool
  133. +               Name="VCPostBuildEventTool"
  134. +           />
  135. +       </Configuration>
  136. +       <Configuration
  137. +           Name="Release|Win32"
  138. +           OutputDirectory="$(SolutionDir)$(ConfigurationName)"
  139. +           IntermediateDirectory="$(ConfigurationName)"
  140. +           ConfigurationType="2"
  141. +           UseOfMFC="0"
  142. +           ATLMinimizesCRunTimeLibraryUsage="false"
  143. +           CharacterSet="1"
  144. +           >
  145. +           <Tool
  146. +               Name="VCPreBuildEventTool"
  147. +           />
  148. +           <Tool
  149. +               Name="VCCustomBuildTool"
  150. +           />
  151. +           <Tool
  152. +               Name="VCXMLDataGeneratorTool"
  153. +           />
  154. +           <Tool
  155. +               Name="VCWebServiceProxyGeneratorTool"
  156. +           />
  157. +           <Tool
  158. +               Name="VCMIDLTool"
  159. +               PreprocessorDefinitions="NDEBUG"
  160. +               SuppressStartupBanner="true"
  161. +               TargetEnvironment="1"
  162. +               HeaderFileName=""
  163. +           />
  164. +           <Tool
  165. +               Name="VCCLCompilerTool"
  166. +               AdditionalOptions="/Gs16000"
  167. +               Optimization="1"
  168. +               EnableIntrinsicFunctions="true"
  169. +               WholeProgramOptimization="true"
  170. +               AdditionalIncludeDirectories="./lzma;./bz2;./zlib"
  171. +               PreprocessorDefinitions="NDEBUG;_WIN32;EXEHEAD;WIN32;_WINDOWS;NSIS_COMPRESS_USE_ZLIB"
  172. +               RuntimeLibrary="2"
  173. +               BufferSecurityCheck="false"
  174. +               EnableFunctionLevelLinking="true"
  175. +               WarningLevel="3"
  176. +               DebugInformationFormat="3"
  177. +           />
  178. +           <Tool
  179. +               Name="VCManagedResourceCompilerTool"
  180. +           />
  181. +           <Tool
  182. +               Name="VCResourceCompilerTool"
  183. +               PreprocessorDefinitions="NDEBUG"
  184. +               Culture="0"
  185. +           />
  186. +           <Tool
  187. +               Name="VCPreLinkEventTool"
  188. +           />
  189. +           <Tool
  190. +               Name="VCLinkerTool"
  191. +               IgnoreImportLibrary="false"
  192. +               AdditionalDependencies="user32.lib"
  193. +               LinkIncremental="0"
  194. +               SuppressStartupBanner="true"
  195. +               IgnoreAllDefaultLibraries="false"
  196. +               GenerateDebugInformation="true"
  197. +               OptimizeReferences="2"
  198. +               EnableCOMDATFolding="2"
  199. +               OptimizeForWindows98="0"
  200. +               RandomizedBaseAddress="2"
  201. +               DataExecutionPrevention="2"
  202. +               TargetMachine="1"
  203. +           />
  204. +           <Tool
  205. +               Name="VCALinkTool"
  206. +           />
  207. +           <Tool
  208. +               Name="VCManifestTool"
  209. +           />
  210. +           <Tool
  211. +               Name="VCXDCMakeTool"
  212. +           />
  213. +           <Tool
  214. +               Name="VCBscMakeTool"
  215. +           />
  216. +           <Tool
  217. +               Name="VCFxCopTool"
  218. +           />
  219. +           <Tool
  220. +               Name="VCAppVerifierTool"
  221. +           />
  222. +           <Tool
  223. +               Name="VCPostBuildEventTool"
  224. +           />
  225. +       </Configuration>
  226. +   </Configurations>
  227. +   <References>
  228. +   </References>
  229. +   <Files>
  230. +       <Filter
  231. +           Name="Source Files"
  232. +           Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
  233. +           >
  234. +           <File
  235. +               RelativePath="..\zlib\adler32.c"
  236. +               >
  237. +               <FileConfiguration
  238. +                   Name="Debug|Win32"
  239. +                   >
  240. +                   <Tool
  241. +                       Name="VCCLCompilerTool"
  242. +                       AdditionalIncludeDirectories=""
  243. +                       PreprocessorDefinitions=""
  244. +                   />
  245. +               </FileConfiguration>
  246. +               <FileConfiguration
  247. +                   Name="Release|Win32"
  248. +                   >
  249. +                   <Tool
  250. +                       Name="VCCLCompilerTool"
  251. +                       AdditionalIncludeDirectories=""
  252. +                       PreprocessorDefinitions=""
  253. +                   />
  254. +               </FileConfiguration>
  255. +           </File>
  256. +           <File
  257. +               RelativePath="..\bz2\blocksort.c"
  258. +               >
  259. +           </File>
  260. +           <File
  261. +               RelativePath="..\bz2\bzlib.c"
  262. +               >
  263. +           </File>
  264. +           <File
  265. +               RelativePath="..\zlib\crc32.c"
  266. +               >
  267. +               <FileConfiguration
  268. +                   Name="Debug|Win32"
  269. +                   >
  270. +                   <Tool
  271. +                       Name="VCCLCompilerTool"
  272. +                       AdditionalIncludeDirectories=""
  273. +                       PreprocessorDefinitions=""
  274. +                   />
  275. +               </FileConfiguration>
  276. +               <FileConfiguration
  277. +                   Name="Release|Win32"
  278. +                   >
  279. +                   <Tool
  280. +                       Name="VCCLCompilerTool"
  281. +                       AdditionalIncludeDirectories=""
  282. +                       PreprocessorDefinitions=""
  283. +                   />
  284. +               </FileConfiguration>
  285. +           </File>
  286. +           <File
  287. +               RelativePath="..\bz2\crctable.c"
  288. +               >
  289. +           </File>
  290. +           <File
  291. +               RelativePath="..\bz2\decompress.c"
  292. +               >
  293. +           </File>
  294. +           <File
  295. +               RelativePath="..\filetype.cpp"
  296. +               >
  297. +           </File>
  298. +           <File
  299. +               RelativePath="..\zlib\gzio.c"
  300. +               >
  301. +               <FileConfiguration
  302. +                   Name="Debug|Win32"
  303. +                   >
  304. +                   <Tool
  305. +                       Name="VCCLCompilerTool"
  306. +                       AdditionalIncludeDirectories=""
  307. +                       PreprocessorDefinitions=""
  308. +                   />
  309. +               </FileConfiguration>
  310. +               <FileConfiguration
  311. +                   Name="Release|Win32"
  312. +                   >
  313. +                   <Tool
  314. +                       Name="VCCLCompilerTool"
  315. +                       AdditionalIncludeDirectories=""
  316. +                       PreprocessorDefinitions=""
  317. +                   />
  318. +               </FileConfiguration>
  319. +           </File>
  320. +           <File
  321. +               RelativePath="..\bz2\huffman.c"
  322. +               >
  323. +               <FileConfiguration
  324. +                   Name="Debug|Win32"
  325. +                   >
  326. +                   <Tool
  327. +                       Name="VCCLCompilerTool"
  328. +                       OmitFramePointers="false"
  329. +                       SmallerTypeCheck="false"
  330. +                       OmitDefaultLibName="true"
  331. +                   />
  332. +               </FileConfiguration>
  333. +           </File>
  334. +           <File
  335. +               RelativePath="..\zlib\inffast.c"
  336. +               >
  337. +               <FileConfiguration
  338. +                   Name="Debug|Win32"
  339. +                   >
  340. +                   <Tool
  341. +                       Name="VCCLCompilerTool"
  342. +                       AdditionalIncludeDirectories=""
  343. +                       PreprocessorDefinitions=""
  344. +                   />
  345. +               </FileConfiguration>
  346. +               <FileConfiguration
  347. +                   Name="Release|Win32"
  348. +                   >
  349. +                   <Tool
  350. +                       Name="VCCLCompilerTool"
  351. +                       AdditionalIncludeDirectories=""
  352. +                       PreprocessorDefinitions=""
  353. +                   />
  354. +               </FileConfiguration>
  355. +           </File>
  356. +           <File
  357. +               RelativePath="..\zlib\inflate.c"
  358. +               >
  359. +               <FileConfiguration
  360. +                   Name="Debug|Win32"
  361. +                   >
  362. +                   <Tool
  363. +                       Name="VCCLCompilerTool"
  364. +                       AdditionalIncludeDirectories=""
  365. +                       PreprocessorDefinitions=""
  366. +                   />
  367. +               </FileConfiguration>
  368. +               <FileConfiguration
  369. +                   Name="Release|Win32"
  370. +                   >
  371. +                   <Tool
  372. +                       Name="VCCLCompilerTool"
  373. +                       AdditionalIncludeDirectories=""
  374. +                       PreprocessorDefinitions=""
  375. +                   />
  376. +               </FileConfiguration>
  377. +           </File>
  378. +           <File
  379. +               RelativePath="..\zlib\inftrees.c"
  380. +               >
  381. +               <FileConfiguration
  382. +                   Name="Debug|Win32"
  383. +                   >
  384. +                   <Tool
  385. +                       Name="VCCLCompilerTool"
  386. +                       AdditionalIncludeDirectories=""
  387. +                       PreprocessorDefinitions=""
  388. +                   />
  389. +               </FileConfiguration>
  390. +               <FileConfiguration
  391. +                   Name="Release|Win32"
  392. +                   >
  393. +                   <Tool
  394. +                       Name="VCCLCompilerTool"
  395. +                       AdditionalIncludeDirectories=""
  396. +                       PreprocessorDefinitions=""
  397. +                   />
  398. +               </FileConfiguration>
  399. +           </File>
  400. +           <File
  401. +               RelativePath="..\lzma\lzma.c"
  402. +               >
  403. +               <FileConfiguration
  404. +                   Name="Debug|Win32"
  405. +                   >
  406. +                   <Tool
  407. +                       Name="VCCLCompilerTool"
  408. +                       AdditionalIncludeDirectories=""
  409. +                       PreprocessorDefinitions=""
  410. +                   />
  411. +               </FileConfiguration>
  412. +               <FileConfiguration
  413. +                   Name="Release|Win32"
  414. +                   >
  415. +                   <Tool
  416. +                       Name="VCCLCompilerTool"
  417. +                       AdditionalIncludeDirectories=""
  418. +                       PreprocessorDefinitions=""
  419. +                   />
  420. +               </FileConfiguration>
  421. +           </File>
  422. +           <File
  423. +               RelativePath="..\lzma\LzmaDecode.c"
  424. +               >
  425. +               <FileConfiguration
  426. +                   Name="Debug|Win32"
  427. +                   >
  428. +                   <Tool
  429. +                       Name="VCCLCompilerTool"
  430. +                       AdditionalIncludeDirectories=""
  431. +                       PreprocessorDefinitions=""
  432. +                   />
  433. +               </FileConfiguration>
  434. +               <FileConfiguration
  435. +                   Name="Release|Win32"
  436. +                   >
  437. +                   <Tool
  438. +                       Name="VCCLCompilerTool"
  439. +                       AdditionalIncludeDirectories=""
  440. +                       PreprocessorDefinitions=""
  441. +                   />
  442. +               </FileConfiguration>
  443. +           </File>
  444. +           <File
  445. +               RelativePath="..\miniclib.c"
  446. +               >
  447. +               <FileConfiguration
  448. +                   Name="Debug|Win32"
  449. +                   >
  450. +                   <Tool
  451. +                       Name="VCCLCompilerTool"
  452. +                       AdditionalIncludeDirectories=""
  453. +                       PreprocessorDefinitions=""
  454. +                   />
  455. +               </FileConfiguration>
  456. +               <FileConfiguration
  457. +                   Name="Release|Win32"
  458. +                   >
  459. +                   <Tool
  460. +                       Name="VCCLCompilerTool"
  461. +                       WholeProgramOptimization="false"
  462. +                       AdditionalIncludeDirectories=""
  463. +                       PreprocessorDefinitions=""
  464. +                   />
  465. +               </FileConfiguration>
  466. +           </File>
  467. +           <File
  468. +               RelativePath="..\nsisUtils.c"
  469. +               >
  470. +               <FileConfiguration
  471. +                   Name="Debug|Win32"
  472. +                   >
  473. +                   <Tool
  474. +                       Name="VCCLCompilerTool"
  475. +                       AdditionalIncludeDirectories=""
  476. +                       PreprocessorDefinitions=""
  477. +                   />
  478. +               </FileConfiguration>
  479. +               <FileConfiguration
  480. +                   Name="Release|Win32"
  481. +                   >
  482. +                   <Tool
  483. +                       Name="VCCLCompilerTool"
  484. +                       AdditionalIncludeDirectories=""
  485. +                       PreprocessorDefinitions=""
  486. +                   />
  487. +               </FileConfiguration>
  488. +           </File>
  489. +           <File
  490. +               RelativePath="..\bz2\randtable.c"
  491. +               >
  492. +           </File>
  493. +           <File
  494. +               RelativePath="..\untar.c"
  495. +               >
  496. +               <FileConfiguration
  497. +                   Name="Debug|Win32"
  498. +                   >
  499. +                   <Tool
  500. +                       Name="VCCLCompilerTool"
  501. +                       AdditionalIncludeDirectories=""
  502. +                       PreprocessorDefinitions=""
  503. +                   />
  504. +               </FileConfiguration>
  505. +               <FileConfiguration
  506. +                   Name="Release|Win32"
  507. +                   >
  508. +                   <Tool
  509. +                       Name="VCCLCompilerTool"
  510. +                       AdditionalIncludeDirectories=""
  511. +                       PreprocessorDefinitions=""
  512. +                   />
  513. +               </FileConfiguration>
  514. +           </File>
  515. +           <File
  516. +               RelativePath="..\untgz.cpp"
  517. +               >
  518. +               <FileConfiguration
  519. +                   Name="Debug|Win32"
  520. +                   >
  521. +                   <Tool
  522. +                       Name="VCCLCompilerTool"
  523. +                       AdditionalIncludeDirectories=""
  524. +                       PreprocessorDefinitions=""
  525. +                   />
  526. +               </FileConfiguration>
  527. +               <FileConfiguration
  528. +                   Name="Release|Win32"
  529. +                   >
  530. +                   <Tool
  531. +                       Name="VCCLCompilerTool"
  532. +                       AdditionalIncludeDirectories=""
  533. +                       PreprocessorDefinitions=""
  534. +                   />
  535. +               </FileConfiguration>
  536. +           </File>
  537. +           <File
  538. +               RelativePath="..\zlib\zutil.c"
  539. +               >
  540. +               <FileConfiguration
  541. +                   Name="Debug|Win32"
  542. +                   >
  543. +                   <Tool
  544. +                       Name="VCCLCompilerTool"
  545. +                       AdditionalIncludeDirectories=""
  546. +                       PreprocessorDefinitions=""
  547. +                   />
  548. +               </FileConfiguration>
  549. +               <FileConfiguration
  550. +                   Name="Release|Win32"
  551. +                   >
  552. +                   <Tool
  553. +                       Name="VCCLCompilerTool"
  554. +                       AdditionalIncludeDirectories=""
  555. +                       PreprocessorDefinitions=""
  556. +                   />
  557. +               </FileConfiguration>
  558. +           </File>
  559. +       </Filter>
  560. +       <Filter
  561. +           Name="Header Files"
  562. +           Filter="h;hpp;hxx;hm;inl"
  563. +           >
  564. +           <File
  565. +               RelativePath="..\bz2\bz2.h"
  566. +               >
  567. +           </File>
  568. +           <File
  569. +               RelativePath="..\bz2\bzlib_private.h"
  570. +               >
  571. +           </File>
  572. +           <File
  573. +               RelativePath="..\zlib\crc32.h"
  574. +               >
  575. +           </File>
  576. +           <File
  577. +               RelativePath="..\zlib\inffast.h"
  578. +               >
  579. +           </File>
  580. +           <File
  581. +               RelativePath="..\zlib\inffixed.h"
  582. +               >
  583. +           </File>
  584. +           <File
  585. +               RelativePath="..\zlib\inflate.h"
  586. +               >
  587. +           </File>
  588. +           <File
  589. +               RelativePath="..\zlib\inftrees.h"
  590. +               >
  591. +           </File>
  592. +           <File
  593. +               RelativePath="..\lzma\lzma.h"
  594. +               >
  595. +           </File>
  596. +           <File
  597. +               RelativePath="..\lzma\LzmaDecode.h"
  598. +               >
  599. +           </File>
  600. +           <File
  601. +               RelativePath="..\miniclib.h"
  602. +               >
  603. +           </File>
  604. +           <File
  605. +               RelativePath="..\nsisUtils.h"
  606. +               >
  607. +           </File>
  608. +           <File
  609. +               RelativePath="..\untar.h"
  610. +               >
  611. +           </File>
  612. +           <File
  613. +               RelativePath="..\zlib\zconf.h"
  614. +               >
  615. +           </File>
  616. +           <File
  617. +               RelativePath="..\zlib\zlib.h"
  618. +               >
  619. +           </File>
  620. +           <File
  621. +               RelativePath="..\zlib\zutil.h"
  622. +               >
  623. +           </File>
  624. +       </Filter>
  625. +       <Filter
  626. +           Name="Resource Files"
  627. +           Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
  628. +           >
  629. +           <File
  630. +               RelativePath="..\untgz.rc"
  631. +               >
  632. +               <FileConfiguration
  633. +                   Name="Debug|Win32"
  634. +                   >
  635. +                   <Tool
  636. +                       Name="VCResourceCompilerTool"
  637. +                       PreprocessorDefinitions=""
  638. +                   />
  639. +               </FileConfiguration>
  640. +               <FileConfiguration
  641. +                   Name="Release|Win32"
  642. +                   >
  643. +                   <Tool
  644. +                       Name="VCResourceCompilerTool"
  645. +                       PreprocessorDefinitions=""
  646. +                   />
  647. +               </FileConfiguration>
  648. +           </File>
  649. +       </Filter>
  650. +   </Files>
  651. +   <Globals>
  652. +   </Globals>
  653. +</VisualStudioProject>
  654. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/filetype.cpp
  655. --- a/common/windows/nsis/plugins/untgz/filetype.cpp    Wed Nov 21 10:28:12 2012 +0100
  656. +++ b/common/windows/nsis/plugins/untgz/filetype.cpp    Wed Nov 21 10:34:41 2012 +0100
  657. @@ -14,6 +14,23 @@
  658.     otherwise if 1st byte valid PROPERTY return CM_LZMA else CM_GZ
  659.  */
  660.  
  661. +unsigned long getFileSize(const char *fname)
  662. +{
  663. +   FILE *f = NULL;
  664. +   size_t size = 0;
  665. +
  666. +   if ((f = fopen(fname, "rb")) != NULL)
  667. +   {
  668. +       fseek(f, 0, SEEK_END); // seek to end of file
  669. +       size = ftell(f); // get current file pointer
  670. +       fseek(f, 0, SEEK_SET);
  671. +
  672. +       fclose(f);
  673. +   }
  674. +  
  675. +   return static_cast<unsigned long>(size);
  676. +}
  677. +
  678.  int getFileType(const char *fname)
  679.  {
  680.      /* read in chunk of data and try to make determination */
  681. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/lzma/lzma.c
  682. --- a/common/windows/nsis/plugins/untgz/lzma/lzma.c Wed Nov 21 10:28:12 2012 +0100
  683. +++ b/common/windows/nsis/plugins/untgz/lzma/lzma.c Wed Nov 21 10:34:41 2012 +0100
  684. @@ -1,6 +1,7 @@
  685.  #include "lzma.h"
  686.  #include "../miniclib.h"
  687.  
  688. +tmpRead = 0;
  689.  
  690.  /* !!!USER SUPPLIED!!! */
  691.  /* wrap around whatever you want to send error messages to user, c function */
  692. @@ -31,6 +32,7 @@
  693.    LZMAFile *b = (LZMAFile *)object;
  694.    *buffer = b->Buffer;
  695.    *size = (SizeT)gzread(b->File, b->Buffer, kInBufferSize);
  696. +  totalRead += *size;
  697.    return LZMA_RESULT_OK;
  698.  }
  699.  
  700. @@ -40,7 +42,7 @@
  701.    register long len = gzread(file, data, size);
  702.    if (len != size)
  703.    {
  704. -    PrintMessage("lzma: Can not read input file.");
  705. +    PrintMessage(_T2A("lzma: Can not read input file."));
  706.      return 0;
  707.    }
  708.    return 1;
  709. @@ -62,11 +64,15 @@
  710.  int lzma_init(gzFile infile, struct LZMAFile **lzmaFile)
  711.  {
  712.    LZMAFile *inBuffer;
  713. +
  714. +  totalRead = 0;
  715. +
  716.    *lzmaFile = inBuffer = (LZMAFile *)malloc(sizeof(struct LZMAFile));
  717.    if (inBuffer == NULL) return -1;
  718.  
  719.    memset(inBuffer, 0, sizeof(LZMAFile));
  720.    inBuffer->File = infile;
  721. +
  722.    inBuffer->InCallback.Read = LzmaReadCompressed;
  723.    inBuffer->waitEOS = 1;
  724.  
  725. @@ -95,7 +101,7 @@
  726.    /* Decode LZMA properties and allocate memory */
  727.    if (LzmaDecodeProperties(&(inBuffer->state.Properties), inBuffer->properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK)
  728.    {
  729. -    PrintMessage("Incorrect stream properties");
  730. +    PrintMessage(_T2A("Incorrect stream properties"));
  731.      return -1;
  732.    }
  733.    inBuffer->state.Probs = (CProb *)malloc(LzmaGetNumProbs(&(inBuffer->state.Properties)) * sizeof(CProb));
  734. @@ -122,7 +128,8 @@
  735.  
  736.  long lzma_read(struct LZMAFile *lzmaFile,
  737.                 unsigned char *buffer,
  738. -               unsigned len)
  739. +               unsigned len,
  740. +              unsigned int *bytesRead)
  741.  {
  742.    SizeT outProcessed;
  743.    SizeT outAvail = len;
  744. @@ -134,9 +141,12 @@
  745.    res = LzmaDecode(&(lzmaFile->state),
  746.          &(lzmaFile->InCallback),
  747.          buffer, outAvail, &outProcessed);
  748. +
  749. +  *bytesRead = totalRead;
  750. +
  751.    if (res != 0)
  752.    {
  753. -    PrintMessage("lzma_read: Decoding error (%d)", res);
  754. +    PrintMessage(_T2A("lzma_read: Decoding error (%d)"), res);
  755.      return -1;
  756.    }
  757.        
  758. @@ -149,7 +159,7 @@
  759.    {
  760.      if (!lzmaFile->waitEOS && (lzmaFile->outSize != 0 || lzmaFile->outSizeHigh != 0))
  761.      {
  762. -      PrintMessage("lzma_read: Unexpected EOS");
  763. +      PrintMessage(_T2A("lzma_read: Unexpected EOS"));
  764.        return -1;
  765.      }
  766.    }
  767. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/lzma/lzma.h
  768. --- a/common/windows/nsis/plugins/untgz/lzma/lzma.h Wed Nov 21 10:28:12 2012 +0100
  769. +++ b/common/windows/nsis/plugins/untgz/lzma/lzma.h Wed Nov 21 10:34:41 2012 +0100
  770. @@ -7,6 +7,8 @@
  771.  typedef void * gzFile;
  772.  int gzread(gzFile file, void * buf, unsigned len);
  773.  
  774. +SizeT totalRead;
  775. +
  776.  /* holds any information needed about stream */
  777.  struct LZMAFile;
  778.  typedef struct LZMAFile LZMAFile;
  779. @@ -16,6 +18,7 @@
  780.  void lzma_cleanup(struct LZMAFile *lzmaFile);
  781.  long lzma_read(struct LZMAFile *lzmaFile,
  782.                 unsigned char *buffer,
  783. -               unsigned len);
  784. +               unsigned len,
  785. +              unsigned int *bytesRead);
  786.  
  787.  #endif /* _LZMA_H_ */
  788. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/miniclib.c
  789. --- a/common/windows/nsis/plugins/untgz/miniclib.c  Wed Nov 21 10:28:12 2012 +0100
  790. +++ b/common/windows/nsis/plugins/untgz/miniclib.c  Wed Nov 21 10:34:41 2012 +0100
  791. @@ -331,9 +331,9 @@
  792.  
  793.  unsigned char staticCnvBuffer[1024*2]; /* temp buffer, holds ASCII & UNICODE string after conversion */
  794.  #ifdef UNICODE
  795. -char * _T2A(unsigned short *wideStr)
  796. +char * _T2A(void *wideStr)
  797.  {
  798. -   WideCharToMultiByte(CP_ACP, 0, wideStr, -1, staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL);
  799. +   WideCharToMultiByte(CP_ACP, 0, (unsigned short*)wideStr, -1, staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL);
  800.     return (char *)staticCnvBuffer;
  801.  }
  802.  #endif
  803. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/miniclib.h
  804. --- a/common/windows/nsis/plugins/untgz/miniclib.h  Wed Nov 21 10:28:12 2012 +0100
  805. +++ b/common/windows/nsis/plugins/untgz/miniclib.h  Wed Nov 21 10:34:41 2012 +0100
  806. @@ -33,7 +33,7 @@
  807.  #define _T(x)    __T(x)
  808.  #define _TEXT(x) __T(x)
  809.  #endif
  810. -char * _T2A(unsigned short *str);
  811. +char * _T2A(void *str);
  812.  #define _A2T(x) _A2U(x)
  813.  #define _tcscat wcscat
  814.  #define _tcscpy wcscpy
  815. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/nsisUtils.c
  816. --- a/common/windows/nsis/plugins/untgz/nsisUtils.c Wed Nov 21 10:28:12 2012 +0100
  817. +++ b/common/windows/nsis/plugins/untgz/nsisUtils.c Wed Nov 21 10:34:41 2012 +0100
  818. @@ -29,6 +29,8 @@
  819.  static stack_t **g_stacktop;
  820.  static TCHAR *g_variables;
  821.  
  822. +static WPARAM g_beginRange;
  823. +static WPARAM g_endRange;
  824.  
  825.  #define EXDLL_INIT()           {  \
  826.          g_stringsize=string_size; \
  827. @@ -81,6 +83,7 @@
  828.  {
  829.    g_hwndParent=hwndParent;
  830.    g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,_T("#32770"),NULL),NULL,_T("SysListView32"),NULL);
  831. +  g_hwndProgressBar = FindWindowEx(FindWindowEx(g_hwndParent,NULL,_T("#32770"),NULL),NULL,_T("msctls_progress32"),NULL);
  832.    EXDLL_INIT();
  833.  }
  834.  
  835. @@ -98,6 +101,19 @@
  836.    DetailPrint(buf);
  837.  }
  838.  
  839. +void _cdecl PrintProgressionBar(const unsigned long sofar, const unsigned long total)
  840. +{
  841. +   unsigned long position = 0;
  842. +   unsigned long range = 0;
  843. +
  844. +   if (total!=0)
  845. +       position = g_beginRange + MulDiv(g_endRange-g_beginRange, sofar, total);
  846. +   else
  847. +       position = g_endRange;
  848. +
  849. +   SendMessage(g_hwndProgressBar, PBM_SETPOS, (WPARAM)position, 0);
  850. +}
  851. +
  852.  /*
  853.  // cheat a little with argument stack
  854.  // copies current stack item to str, where current top of
  855. @@ -207,7 +223,13 @@
  856.  }
  857.  /* End KJD's Functions */
  858.  
  859. -
  860. +/* GB Set the limits of the progression for extraction */
  861. +void InitProgressBarExtremities()
  862. +{
  863. +   g_beginRange = SendMessage(g_hwndProgressBar, PBM_GETPOS, 0, 0);
  864. +   g_endRange = SendMessage(g_hwndProgressBar, PBM_GETRANGE, 0, 0);
  865. +   g_endRange -= MulDiv(1, g_endRange-g_beginRange, 11); // We left some range to finish the install
  866. +}
  867.  
  868.  /*
  869.    The following portions from [based upon] code in ExtractDLL NSIS plugin:
  870. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/nsisUtils.h
  871. --- a/common/windows/nsis/plugins/untgz/nsisUtils.h Wed Nov 21 10:28:12 2012 +0100
  872. +++ b/common/windows/nsis/plugins/untgz/nsisUtils.h Wed Nov 21 10:34:41 2012 +0100
  873. @@ -48,11 +48,14 @@
  874.  /* global variables */
  875.  extern HWND g_hwndParent;
  876.  extern HWND g_hwndList;
  877. +extern HWND g_hwndProgressBar;
  878.  
  879.  extern unsigned int g_stringsize;
  880.  extern stack_t **g_stacktop;
  881.  extern TCHAR *g_variables;
  882.  
  883. +extern WPARAM g_beginRange;
  884. +extern WPARAM g_endRange;
  885.  
  886.  /* For page showing plug-ins */
  887.  #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
  888. @@ -141,6 +144,13 @@
  889.   */
  890.  void _cdecl PrintMessage(const TCHAR *msg, ...);
  891.  
  892. +void InitProgressBarExtremities();
  893. +
  894. +/*
  895. + *
  896. + */
  897. +void _cdecl PrintProgressionBar(const unsigned long sofar, const unsigned long total);
  898. +
  899.  /*
  900.   * Sets the status text
  901.   */
  902. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untar.c
  903. --- a/common/windows/nsis/plugins/untgz/untar.c Wed Nov 21 10:28:12 2012 +0100
  904. +++ b/common/windows/nsis/plugins/untgz/untar.c Wed Nov 21 10:34:41 2012 +0100
  905. @@ -1,27 +1,27 @@
  906.  /*
  907. - * tgz_extract functions based on code within zlib library
  908. - * No additional copyright added, KJD <jeremyd@computer.org>
  909. - *
  910. - *   This software is provided 'as-is', without any express or implied
  911. - *   warranty.  In no event will the authors be held liable for any damages
  912. - *   arising from the use of this software.
  913. - *
  914. - * untgz.c -- Display contents and/or extract file from
  915. - * a gzip'd TAR file
  916. - * written by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
  917. - * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
  918. - * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
  919. +* tgz_extract functions based on code within zlib library
  920. +* No additional copyright added, KJD <jeremyd@computer.org>
  921. +*
  922. +*   This software is provided 'as-is', without any express or implied
  923. +*   warranty.  In no event will the authors be held liable for any damages
  924. +*   arising from the use of this software.
  925. +*
  926. +* untgz.c -- Display contents and/or extract file from
  927. +* a gzip'd TAR file
  928. +* written by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
  929. +* adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
  930. +* various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
  931.  */
  932.  
  933.  /*
  934. -  For tar format see
  935. -  http://cdrecord.berlios.de/old/private/man/star/star.4.html
  936. -  http://www.mkssoftware.com/docs/man4/tar.4.asp
  937. -  http://www.delorie.com/gnu/docs/tar/tar_toc.html
  938. +For tar format see
  939. +http://cdrecord.berlios.de/old/private/man/star/star.4.html
  940. +http://www.mkssoftware.com/docs/man4/tar.4.asp
  941. +http://www.delorie.com/gnu/docs/tar/tar_toc.html
  942.  
  943. -  TODO:
  944. -    without -j there is a security issue as no checking is done to directories
  945. -    change to better support -d option, presently we just chdir there
  946. +TODO:
  947. +without -j there is a security issue as no checking is done to directories
  948. +change to better support -d option, presently we just chdir there
  949.  */
  950.  
  951.  
  952. @@ -41,8 +41,8 @@
  953.  #define DIRTYPE  '5'       /* directory */
  954.  #define FIFOTYPE '6'       /* FIFO special */
  955.  #define CONTTYPE '7'       /* reserved, for compatibility with gnu tar,
  956. -                               treat as regular file, where it represents
  957. -                               a regular file, but saved contiguously on disk */
  958. +treat as regular file, where it represents
  959. +a regular file, but saved contiguously on disk */
  960.  
  961.  /* GNU tar extensions */
  962.  
  963. @@ -60,21 +60,21 @@
  964.  
  965.  unsigned long getoct(char *p,int width)
  966.  {
  967. -  unsigned long result = 0;
  968. -  char c;
  969. -  
  970. -  while (width --)
  971. -    {
  972. -      c = *p++;
  973. -      if (c == ' ') /* ignore padding */
  974. -        continue;
  975. -      if (c == 0)   /* ignore padding, but also marks end of string */
  976. -        break;
  977. -      if (c < '0' || c > '7')
  978. -        return result; /* really an error, but we just ignore invalid values */
  979. -      result = result * 8 + (c - '0');
  980. -    }
  981. -  return result;
  982. +   unsigned long result = 0;
  983. +   char c;
  984. +
  985. +   while (width --)
  986. +   {
  987. +       c = *p++;
  988. +       if (c == ' ') /* ignore padding */
  989. +           continue;
  990. +       if (c == 0)   /* ignore padding, but also marks end of string */
  991. +           break;
  992. +       if (c < '0' || c > '7')
  993. +           return result; /* really an error, but we just ignore invalid values */
  994. +       result = result * 8 + (c - '0');
  995. +   }
  996. +   return result;
  997.  }
  998.  
  999.  /* regular expression matching */
  1000. @@ -83,65 +83,65 @@
  1001.  
  1002.  int ExprMatch(char *string,char *expr)
  1003.  {
  1004. -  while (1)
  1005. -    {
  1006. -      if (ISSPECIAL(*expr))
  1007. +   while (1)
  1008.     {
  1009. -     if (*expr == '/')
  1010. -       {
  1011. -         if (*string != '\\' && *string != '/')
  1012. -       return 0;
  1013. -         string ++; expr++;
  1014. -       }
  1015. -     else if (*expr == '*')
  1016. -       {
  1017. -         if (*expr ++ == 0)
  1018. -       return 1;
  1019. -         while (*++string != *expr)
  1020. -       if (*string == 0)
  1021. -         return 0;
  1022. -       }
  1023. +       if (ISSPECIAL(*expr))
  1024. +       {
  1025. +           if (*expr == '/')
  1026. +           {
  1027. +               if (*string != '\\' && *string != '/')
  1028. +                   return 0;
  1029. +               string ++; expr++;
  1030. +           }
  1031. +           else if (*expr == '*')
  1032. +           {
  1033. +               if (*expr ++ == 0)
  1034. +                   return 1;
  1035. +               while (*++string != *expr)
  1036. +                   if (*string == 0)
  1037. +                       return 0;
  1038. +           }
  1039. +       }
  1040. +       else
  1041. +       {
  1042. +           if (*string != *expr)
  1043. +               return 0;
  1044. +           if (*expr++ == 0)
  1045. +               return 1;
  1046. +           string++;
  1047. +       }
  1048.     }
  1049. -      else
  1050. -   {
  1051. -     if (*string != *expr)
  1052. -       return 0;
  1053. -     if (*expr++ == 0)
  1054. -       return 1;
  1055. -     string++;
  1056. -   }
  1057. -    }
  1058.  }
  1059.  
  1060.  
  1061.  /* returns 0 on failed checksum, nonzero if probably ok
  1062. -   it was noted that some versions of tar compute
  1063. -   signed chksums, though unsigned appears to be the
  1064. -   standard; chksum is simple sum of all bytes in header
  1065. -   as integers (using at least 17 bits) with chksum
  1066. -   values treated as ASCII spaces.
  1067. +it was noted that some versions of tar compute
  1068. +signed chksums, though unsigned appears to be the
  1069. +standard; chksum is simple sum of all bytes in header
  1070. +as integers (using at least 17 bits) with chksum
  1071. +values treated as ASCII spaces.
  1072.  */
  1073.  int valid_checksum(struct tar_header *header)
  1074.  {
  1075. -  unsigned hdrchksum = (unsigned)getoct(header->chksum,8);
  1076. -  signed schksum = 0;
  1077. -  unsigned uchksum = 0;
  1078. -  int i;
  1079. +   unsigned hdrchksum = (unsigned)getoct(header->chksum,8);
  1080. +   signed schksum = 0;
  1081. +   unsigned uchksum = 0;
  1082. +   int i;
  1083.  
  1084. -  for (i=0; i < sizeof(struct tar_header); i++)
  1085. -  {
  1086. -    unsigned char val = ((unsigned char *)header)[i];
  1087. -    if ((i >= 148) && (i < 156)) /* chksum */
  1088. -    {
  1089. -      val = ' ';
  1090. -    }
  1091. -    schksum += (signed char)val;
  1092. -    uchksum += val;
  1093. -  }
  1094. +   for (i=0; i < sizeof(struct tar_header); i++)
  1095. +   {
  1096. +       unsigned char val = ((unsigned char *)header)[i];
  1097. +       if ((i >= 148) && (i < 156)) /* chksum */
  1098. +       {
  1099. +           val = ' ';
  1100. +       }
  1101. +       schksum += (signed char)val;
  1102. +       uchksum += val;
  1103. +   }
  1104.  
  1105. -  if (hdrchksum == uchksum) return 1;
  1106. -  if ((int)hdrchksum == schksum) return 2;
  1107. -  return 0;
  1108. +   if (hdrchksum == uchksum) return 1;
  1109. +   if ((int)hdrchksum == schksum) return 2;
  1110. +   return 0;
  1111.  }
  1112.  
  1113.  
  1114. @@ -154,46 +154,46 @@
  1115.  
  1116.  int makedir (char *newdir)
  1117.  {
  1118. -  char *buffer = strdup(newdir);
  1119. -  char *p;
  1120. -  int  len = strlen(buffer);
  1121. -  
  1122. -  if (len <= 0) {
  1123. -    free(buffer);
  1124. -    return 0;
  1125. -  }
  1126. -  if (buffer[len-1] == '/') {
  1127. -    buffer[len-1] = '\0';
  1128. -  }
  1129. -  if (CreateDirectoryA(buffer, NULL) != 0)
  1130. -    {
  1131. -      free(buffer);
  1132. -      return 1;
  1133. -    }
  1134. +   char *buffer = strdup(newdir);
  1135. +   char *p;
  1136. +   int  len = strlen(buffer);
  1137.  
  1138. -  p = buffer+1;
  1139. -  while (1)
  1140. -    {
  1141. -      char hold;
  1142. -      
  1143. -      while(*p && *p != '\\' && *p != '/')
  1144. -        p++;
  1145. -      hold = *p;
  1146. -      *p = 0;
  1147. -      //if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT /* != EEXIST */))
  1148. -      if (!CreateDirectoryA(buffer, NULL) && !((GetLastError()==ERROR_FILE_EXISTS) || (GetLastError()==ERROR_ALREADY_EXISTS)) )
  1149. -      {
  1150. -        // fprintf(stderr,"Unable to create directory %s\n", buffer);
  1151. -        PrintMessage(_T("Unable to create directory %s\n"), _A2T(buffer));
  1152. -        free(buffer);
  1153. -     return 0;
  1154. -      }
  1155. -      if (hold == 0)
  1156. -        break;
  1157. -      *p++ = hold;
  1158. -    }
  1159. -  free(buffer);
  1160. -  return 1;
  1161. +   if (len <= 0) {
  1162. +       free(buffer);
  1163. +       return 0;
  1164. +   }
  1165. +   if (buffer[len-1] == '/') {
  1166. +       buffer[len-1] = '\0';
  1167. +   }
  1168. +   if (CreateDirectoryA(buffer, NULL) != 0)
  1169. +   {
  1170. +       free(buffer);
  1171. +       return 1;
  1172. +   }
  1173. +
  1174. +   p = buffer+1;
  1175. +   while (1)
  1176. +   {
  1177. +       char hold;
  1178. +
  1179. +       while(*p && *p != '\\' && *p != '/')
  1180. +           p++;
  1181. +       hold = *p;
  1182. +       *p = 0;
  1183. +       //if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT /* != EEXIST */))
  1184. +       if (!CreateDirectoryA(buffer, NULL) && !((GetLastError()==ERROR_FILE_EXISTS) || (GetLastError()==ERROR_ALREADY_EXISTS)) )
  1185. +       {
  1186. +           // fprintf(stderr,"Unable to create directory %s\n", buffer);
  1187. +           PrintMessage(_T("Unable to create directory %s\n"), _A2T(buffer));
  1188. +           free(buffer);
  1189. +           return 0;
  1190. +       }
  1191. +       if (hold == 0)
  1192. +           break;
  1193. +       *p++ = hold;
  1194. +   }
  1195. +   free(buffer);
  1196. +   return 1;
  1197.  }
  1198.  
  1199.  
  1200. @@ -219,34 +219,34 @@
  1201.  
  1202.  
  1203.  /* NOTE: This should be modified to perform whatever steps
  1204. -   deemed necessary to make embedded paths safe prior to
  1205. -   creating directory or file of given [path]filename.
  1206. -   Must modify fname in place, always leaving either
  1207. -   same or smaller strlen than current string.
  1208. -   Current version (if not #defined out) removes any
  1209. -   leading parent (..) or root (/)(\) references.
  1210. +deemed necessary to make embedded paths safe prior to
  1211. +creating directory or file of given [path]filename.
  1212. +Must modify fname in place, always leaving either
  1213. +same or smaller strlen than current string.
  1214. +Current version (if not #defined out) removes any
  1215. +leading parent (..) or root (/)(\) references.
  1216.  */
  1217.  void safetyStrip(char * fname)
  1218.  {
  1219.  #if 0
  1220. -  /* strip root from path */
  1221. -  if ((*fname == '/') || (*fname == '\\'))
  1222. -  {
  1223. -    MoveMemory(fname, fname+1, strlen(fname+1) + 1 );
  1224. -  }
  1225. +   /* strip root from path */
  1226. +   if ((*fname == '/') || (*fname == '\\'))
  1227. +   {
  1228. +       MoveMemory(fname, fname+1, strlen(fname+1) + 1 );
  1229. +   }
  1230.  
  1231. -  /* now strip leading ../ */
  1232. -  while ((*fname == '.') && (*(fname+1) == '.') && ((*(fname+2) == '/') || (*(fname+2) == '\\')) )
  1233. -  {
  1234. -    MoveMemory(fname, fname+3, strlen(fname+3) + 1 );
  1235. -  }
  1236. +   /* now strip leading ../ */
  1237. +   while ((*fname == '.') && (*(fname+1) == '.') && ((*(fname+2) == '/') || (*(fname+2) == '\\')) )
  1238. +   {
  1239. +       MoveMemory(fname, fname+3, strlen(fname+3) + 1 );
  1240. +   }
  1241.  #endif
  1242.  }
  1243.  
  1244.  
  1245.  /* combines elements from tar header to produce
  1246. - * full [long] filename; prefix + [/] + name
  1247. - */
  1248. +* full [long] filename; prefix + [/] + name
  1249. +*/
  1250.  void getFullName(union tar_buffer *buffer, char *fname)
  1251.  {
  1252.     int len = 0;
  1253. @@ -274,60 +274,60 @@
  1254.  
  1255.  
  1256.  /* returns a pointer to a static buffer
  1257. - * containing fname after removing all but
  1258. - * path_sep_cnt path separators
  1259. - * if there are less than path_sep_cnt
  1260. - * separators then all will still be there.
  1261. - */
  1262. +* containing fname after removing all but
  1263. +* path_sep_cnt path separators
  1264. +* if there are less than path_sep_cnt
  1265. +* separators then all will still be there.
  1266. +*/
  1267.  char * stripPath(int path_sep_cnt, char *fname)
  1268.  {
  1269. -  static char buffer[1024];
  1270. -  char *fname_use = fname + strlen(fname);
  1271. -  register int i=path_sep_cnt;
  1272. -  do
  1273. -  {
  1274. -    if ( (*fname_use == '/') || (*fname_use == '\\') )
  1275. -   {
  1276. -      i--;
  1277. -     if (i < 0) fname_use++;
  1278. -     else fname_use--;
  1279. -    }
  1280. -   else
  1281. -      fname_use--;
  1282. -  } while ((i >= 0) && (fname_use > fname));
  1283. -  
  1284. -  strcpy(buffer, fname_use);
  1285. -  return buffer;
  1286. +   static char buffer[1024];
  1287. +   char *fname_use = fname + strlen(fname);
  1288. +   register int i=path_sep_cnt;
  1289. +   do
  1290. +   {
  1291. +       if ( (*fname_use == '/') || (*fname_use == '\\') )
  1292. +       {
  1293. +           i--;
  1294. +           if (i < 0) fname_use++;
  1295. +           else fname_use--;
  1296. +       }
  1297. +       else
  1298. +           fname_use--;
  1299. +   } while ((i >= 0) && (fname_use > fname));
  1300. +
  1301. +   strcpy(buffer, fname_use);
  1302. +   return buffer;
  1303.  }
  1304.  
  1305.  /* returns 1 if fname in list else return 0
  1306. - * returns 0 if list is NULL or cnt is < 0
  1307. - */
  1308. +* returns 0 if list is NULL or cnt is < 0
  1309. +*/
  1310.  int matchname (char *fname, int cnt, char *list[], int junkPaths)
  1311.  {
  1312. -  register char *t;
  1313. -  int i;
  1314. -  int path_sep;
  1315. +   register char *t;
  1316. +   int i;
  1317. +   int path_sep;
  1318.  
  1319. -  /* if nothing to compare with then return failure */
  1320. -  if ((list == NULL) || (cnt <= 0))
  1321. -    return 0;
  1322. +   /* if nothing to compare with then return failure */
  1323. +   if ((list == NULL) || (cnt <= 0))
  1324. +       return 0;
  1325.  
  1326. -  for (i = 0; i < cnt; i++)
  1327. -  {
  1328. -    /* get count of path components in current filelist entry */
  1329. -    path_sep = 0;
  1330. -    if (!junkPaths)
  1331. +   for (i = 0; i < cnt; i++)
  1332.     {
  1333. -      for(t = list[i]; *t != '\0'; t++)
  1334. -        if ((*t == '/') || (*t == '\\'))
  1335. -          path_sep++;
  1336. +       /* get count of path components in current filelist entry */
  1337. +       path_sep = 0;
  1338. +       if (!junkPaths)
  1339. +       {
  1340. +           for(t = list[i]; *t != '\0'; t++)
  1341. +               if ((*t == '/') || (*t == '\\'))
  1342. +                   path_sep++;
  1343. +       }
  1344. +       if (ExprMatch(stripPath(path_sep, fname), list[i]))
  1345. +           return 1;
  1346.     }
  1347. -    if (ExprMatch(stripPath(path_sep, fname), list[i]))
  1348. -      return 1;
  1349. -  }
  1350.  
  1351. -  return 0; /* no match */
  1352. +   return 0; /* no match */
  1353.  }
  1354.  
  1355.  
  1356. @@ -341,25 +341,25 @@
  1357.  void cnv_tar2win_time(time_t tartime, FILETIME *ftm)
  1358.  {
  1359.  #ifdef HAS_LIBC_CAL_FUNCS
  1360. -         FILETIME ftLocal;
  1361. -         SYSTEMTIME st;
  1362. -         struct tm localt;
  1363. -
  1364. -         localt = *localtime(&tartime);
  1365. -        
  1366. -         st.wYear = (WORD)localt.tm_year+1900;
  1367. -         st.wMonth = (WORD)localt.tm_mon+1;    /* 1 based, not 0 based */
  1368. -         st.wDayOfWeek = (WORD)localt.tm_wday;
  1369. -         st.wDay = (WORD)localt.tm_mday;
  1370. -         st.wHour = (WORD)localt.tm_hour;
  1371. -         st.wMinute = (WORD)localt.tm_min;
  1372. -         st.wSecond = (WORD)localt.tm_sec;
  1373. -         st.wMilliseconds = 0;
  1374. -         SystemTimeToFileTime(&st,&ftLocal);
  1375. -         LocalFileTimeToFileTime(&ftLocal,ftm);
  1376. +   FILETIME ftLocal;
  1377. +   SYSTEMTIME st;
  1378. +   struct tm localt;
  1379. +
  1380. +   localt = *localtime(&tartime);
  1381. +
  1382. +   st.wYear = (WORD)localt.tm_year+1900;
  1383. +   st.wMonth = (WORD)localt.tm_mon+1;    /* 1 based, not 0 based */
  1384. +   st.wDayOfWeek = (WORD)localt.tm_wday;
  1385. +   st.wDay = (WORD)localt.tm_mday;
  1386. +   st.wHour = (WORD)localt.tm_hour;
  1387. +   st.wMinute = (WORD)localt.tm_min;
  1388. +   st.wSecond = (WORD)localt.tm_sec;
  1389. +   st.wMilliseconds = 0;
  1390. +   SystemTimeToFileTime(&st,&ftLocal);
  1391. +   LocalFileTimeToFileTime(&ftLocal,ftm);
  1392.  #else
  1393.     // avoid casts further below
  1394. -    LONGLONG *t = (LONGLONG *)ftm;
  1395. +   LONGLONG *t = (LONGLONG *)ftm;
  1396.  
  1397.     // tartime == number of seconds since midnight Jan 1 1970 (00:00:00)
  1398.     // convert to equivalent 100 nanosecond intervals
  1399. @@ -384,389 +384,399 @@
  1400.  gzFile infile;
  1401.  
  1402.  /* Initialize decompression library (if needed)
  1403. -   0=success, nonzero means error during initialization
  1404. - */
  1405. +0=success, nonzero means error during initialization
  1406. +*/
  1407.  int cm_init(gzFile in, int cm)
  1408.  {
  1409. -  infile = in; /* save gzFile for reading/cleanup */
  1410. +   infile = in; /* save gzFile for reading/cleanup */
  1411.  
  1412. -  switch (cm)
  1413. -  {
  1414. +   switch (cm)
  1415. +   {
  1416.  #ifdef ENABLE_BZ2
  1417. -    case CM_BZ2:
  1418. -      bzfile = BZ2_bzReadOpen(&bzerror, in, 0, 0, NULL, 0);
  1419. -   return bzerror;
  1420. +   case CM_BZ2:
  1421. +       bzfile = BZ2_bzReadOpen(&bzerror, in, 0, 0, NULL, 0);
  1422. +       return bzerror;
  1423.  #endif
  1424.  #ifdef ENABLE_LZMA
  1425. -    case CM_LZMA:
  1426. -      return lzma_init(in, &lzmaFile);
  1427. +   case CM_LZMA:
  1428. +       return lzma_init(in, &lzmaFile);
  1429.  #endif
  1430. -    default: /* CM_NONE, CM_GZ */
  1431. -      return 0; /* success */
  1432. -  }
  1433. +   default: /* CM_NONE, CM_GZ */
  1434. +       return 0; /* success */
  1435. +   }
  1436.  }
  1437.  
  1438.  
  1439.  /* properly cleanup any resources decompression library allocated
  1440. - */
  1441. +*/
  1442.  void cm_cleanup(int cm)
  1443.  {
  1444. -  switch (cm)
  1445. -  {
  1446. +   switch (cm)
  1447. +   {
  1448.  #ifdef ENABLE_BZ2
  1449. -    case CM_BZ2:
  1450. -      BZ2_bzReadClose(&bzerror, bzfile);
  1451. -      break;
  1452. +   case CM_BZ2:
  1453. +       BZ2_bzReadClose(&bzerror, bzfile);
  1454. +       break;
  1455.  #endif
  1456.  #ifdef ENABLE_LZMA
  1457. -    case CM_LZMA:
  1458. -      lzma_cleanup(lzmaFile);
  1459. -      break;
  1460. +   case CM_LZMA:
  1461. +       lzma_cleanup(lzmaFile);
  1462. +       break;
  1463.  #endif
  1464. -    default: /* CM_NONE, CM_GZ */
  1465. -      break;
  1466. -  }
  1467. +   default: /* CM_NONE, CM_GZ */
  1468. +       break;
  1469. +   }
  1470.  
  1471. -  /* close the input stream */
  1472. -  if (gzclose(infile) != Z_OK)
  1473. -  {
  1474. -    PrintMessage(_T("failed gzclose"));
  1475. -    /* return -1; */
  1476. -  }
  1477. +   /* close the input stream */
  1478. +   if (gzclose(infile) != Z_OK)
  1479. +   {
  1480. +       PrintMessage(_T("failed gzclose"));
  1481. +       /* return -1; */
  1482. +   }
  1483.  }
  1484.  
  1485.  
  1486.  /* Reads in a single TAR block
  1487. - */
  1488. -long readBlock(int cm, void *buffer)
  1489. +*/
  1490. +long readBlock(int cm, void *buffer, unsigned int *bytesBlockRead)
  1491.  {
  1492. -  long len = -1;
  1493. -  switch (cm)
  1494. -  {
  1495. +   long len = -1;
  1496. +   unsigned int bytesRead = 0;
  1497. +   switch (cm)
  1498. +   {
  1499.  #ifdef ENABLE_BZ2
  1500. -    case CM_BZ2:
  1501. -   len = BZ2_bzRead(&bzerror, bzfile, buffer, BLOCKSIZE);
  1502. -      break;
  1503. +   case CM_BZ2:
  1504. +       len = BZ2_bzRead(&bzerror, bzfile, buffer, BLOCKSIZE);
  1505. +       break;
  1506.  #endif
  1507.  #ifdef ENABLE_LZMA
  1508. -    case CM_LZMA:
  1509. -      len = lzma_read(lzmaFile, buffer, BLOCKSIZE);
  1510. -      break;
  1511. +   case CM_LZMA:
  1512. +       len = lzma_read(lzmaFile, buffer, BLOCKSIZE, &bytesRead);
  1513. +       break;
  1514.  #endif
  1515. -    default: /* CM_NONE, CM_GZ */
  1516. -      len = gzread(infile, buffer, BLOCKSIZE);
  1517. -      break;
  1518. -  }
  1519. +   default: /* CM_NONE, CM_GZ */
  1520. +       len = gzread(infile, buffer, BLOCKSIZE);
  1521. +       break;
  1522. +   }
  1523.  
  1524. -  /* check for read errors and abort */
  1525. -  if (len < 0)
  1526. -  {
  1527. -    PrintMessage(_T("gzread: error decompressing"));
  1528. -    cm_cleanup(cm);
  1529. -    return -1;
  1530. -  }
  1531. -  /*
  1532. -   * Always expect complete blocks to process
  1533. -   * the tar information.
  1534. -   */
  1535. -  if (len != BLOCKSIZE)
  1536. -  {
  1537. -    PrintMessage(_T("gzread: incomplete block read"));
  1538. -    cm_cleanup(cm);
  1539. -    return -1;
  1540. -  }
  1541. +   /* check for read errors and abort */
  1542. +   if (len < 0)
  1543. +   {
  1544. +       PrintMessage(_T("gzread: error decompressing"));
  1545. +       cm_cleanup(cm);
  1546. +       return -1;
  1547. +   }
  1548. +   /*
  1549. +   * Always expect complete blocks to process
  1550. +   * the tar information.
  1551. +   */
  1552. +   if (len != BLOCKSIZE)
  1553. +   {
  1554. +       PrintMessage(_T("gzread: incomplete block read"));
  1555. +       cm_cleanup(cm);
  1556. +       return -1;
  1557. +   }
  1558.  
  1559. -  return len; /* success */
  1560. +   *bytesBlockRead = bytesRead;
  1561. +   return len; /* success */
  1562.  }
  1563.  
  1564.  
  1565.  /* Tar file extraction
  1566. - * gzFile in, handle of input tarball opened with gzopen
  1567. - * int cm, compressionMethod
  1568. - * int junkPaths, nonzero indicates to ignore stored path (don't create directories)
  1569. - * enum KeepMode keep, indicates to perform if file exists
  1570. - * int iCnt, char *iList[], argv style list of files to extract, {0,NULL} for all
  1571. - * int xCnt, char *xList[], argv style list of files NOT to extract, {0,NULL} for none
  1572. - * int failOnHardLinks, if nonzero then will treat failure to create a hard link same as
  1573. - *   failure to create a regular file, 0 prints a warning if fails - note that hardlinks
  1574. - *   will always fail on Windows prior to NT 5 (Win 2000) or later and non NTFS file systems.
  1575. - *
  1576. - * returns 0 (or positive value) on success
  1577. - * returns negative value on error, where
  1578. - *   -1 means error reading from tarball
  1579. - *   -2 means error extracting file from tarball
  1580. - *   -3 means error creating hard link
  1581. - */
  1582. -int tgz_extract(gzFile in, int cm, int junkPaths, enum KeepMode keep, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks)
  1583. +* gzFile in, handle of input tarball opened with gzopen
  1584. +* int cm, compressionMethod
  1585. +* int junkPaths, nonzero indicates to ignore stored path (don't create directories)
  1586. +* enum KeepMode keep, indicates to perform if file exists
  1587. +* int iCnt, char *iList[], argv style list of files to extract, {0,NULL} for all
  1588. +* int xCnt, char *xList[], argv style list of files NOT to extract, {0,NULL} for none
  1589. +* int failOnHardLinks, if nonzero then will treat failure to create a hard link same as
  1590. +*   failure to create a regular file, 0 prints a warning if fails - note that hardlinks
  1591. +*   will always fail on Windows prior to NT 5 (Win 2000) or later and non NTFS file systems.
  1592. +*
  1593. +* returns 0 (or positive value) on success
  1594. +* returns negative value on error, where
  1595. +*   -1 means error reading from tarball
  1596. +*   -2 means error extracting file from tarball
  1597. +*   -3 means error creating hard link
  1598. +*/
  1599. +int tgz_extract(gzFile in, int cm, int junkPaths, enum KeepMode keep, unsigned long totalSize, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks)
  1600.  {
  1601. -  int           getheader = 1;    /* assume initial input has a tar header */
  1602. -  HANDLE        outfile = INVALID_HANDLE_VALUE;
  1603. +   int           getheader = 1;    /* assume initial input has a tar header */
  1604. +   HANDLE        outfile = INVALID_HANDLE_VALUE;
  1605.  
  1606. -  union         tar_buffer buffer;
  1607. -  unsigned long remaining;
  1608. -  char          fname[BLOCKSIZE]; /* must be >= BLOCKSIZE bytes */
  1609. -  time_t        tartime;
  1610. +   union         tar_buffer buffer;
  1611. +   unsigned long remaining;
  1612. +   char          fname[BLOCKSIZE]; /* must be >= BLOCKSIZE bytes */
  1613. +   time_t        tartime;
  1614. +   long bytesRead = 0;
  1615. +   unsigned int bytesReadSofar = 0;
  1616. +   unsigned int bytesReadThisTime = 0;
  1617.  
  1618. -  /* do any prep work for extracting from compressed TAR file */
  1619. -  if (cm_init(in, cm))
  1620. -  {
  1621. -    PrintMessage(_T("tgz_extract: unable to initialize decompression method."));
  1622. -    cm_cleanup(cm);
  1623. -    return -1;
  1624. -  }
  1625. -  
  1626. -  while (1)
  1627. -  {
  1628. -    if (readBlock(cm, &buffer) < 0) return -1;
  1629. -      
  1630. -    /*
  1631. -     * If we have to get a tar header
  1632. -     */
  1633. -    if (getheader >= 1)
  1634. -    {
  1635. -      /*
  1636. -       * if we met the end of the tar
  1637. -       * or the end-of-tar block,
  1638. -       * we are done
  1639. -       */
  1640. -      if (/* (len == 0)  || */ (buffer.header.name[0]== 0)) break;
  1641. +   InitProgressBarExtremities();
  1642.  
  1643. -      /* compute and check header checksum, support signed or unsigned */
  1644. -      if (!valid_checksum(&(buffer.header)))
  1645. -      {
  1646. -        PrintMessage(_T("tgz_extract: bad header checksum"));
  1647. -        cm_cleanup(cm);
  1648. -        return -1;
  1649. -      }
  1650. +   /* do any prep work for extracting from compressed TAR file */
  1651. +   if (cm_init(in, cm))
  1652. +   {
  1653. +       PrintMessage(_T("tgz_extract: unable to initialize decompression method."));
  1654. +       cm_cleanup(cm);
  1655. +       return -1;
  1656. +   }
  1657.  
  1658. -      /* store time, so we can set the timestamp on files */
  1659. -      tartime = (time_t)getoct(buffer.header.mtime,12);
  1660. +   while (1)
  1661. +   {
  1662. +       if ( (bytesRead = readBlock(cm, &buffer, &bytesReadThisTime)) < 0)
  1663. +           return -1;
  1664.  
  1665. -      /* copy over filename chunk from header, avoiding overruns */
  1666. -      if (getheader == 1) /* use normal (short or posix long) filename from header */
  1667. -      {
  1668. -        /* NOTE: prepends any prefix, including separator, and ensures terminated */
  1669. -       getFullName(&buffer, fname);
  1670. -      }
  1671. -      else /* use (GNU) long filename that preceeded this header */
  1672. -      {
  1673. +       bytesReadSofar = bytesReadThisTime;
  1674. +       /*
  1675. +       * If we have to get a tar header
  1676. +       */
  1677. +       if (getheader >= 1)
  1678. +       {
  1679. +           /*
  1680. +           * if we met the end of the tar
  1681. +           * or the end-of-tar block,
  1682. +           * we are done
  1683. +           */
  1684. +           if (/* (len == 0)  || */ (buffer.header.name[0]== 0)) break;
  1685. +
  1686. +           /* compute and check header checksum, support signed or unsigned */
  1687. +           if (!valid_checksum(&(buffer.header)))
  1688. +           {
  1689. +               PrintMessage(_T("tgz_extract: bad header checksum"));
  1690. +               cm_cleanup(cm);
  1691. +               return -1;
  1692. +           }
  1693. +
  1694. +           /* store time, so we can set the timestamp on files */
  1695. +           tartime = (time_t)getoct(buffer.header.mtime,12);
  1696. +
  1697. +           /* copy over filename chunk from header, avoiding overruns */
  1698. +           if (getheader == 1) /* use normal (short or posix long) filename from header */
  1699. +           {
  1700. +               /* NOTE: prepends any prefix, including separator, and ensures terminated */
  1701. +               getFullName(&buffer, fname);
  1702. +           }
  1703. +           else /* use (GNU) long filename that preceeded this header */
  1704. +           {
  1705.  #if 0
  1706. -        /* if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) */
  1707. -        char fs[SHORTNAMESIZE];   /* force strings to same max len, then compare */
  1708. -        lstrcpyn(fs, fname, SHORTNAMESIZE);
  1709. -        fs[SHORTNAMESIZE-1] = '\0';
  1710. -        buffer.header.name[SHORTNAMESIZE-1] = '\0';
  1711. -        if (lstrcmp(fs, buffer.header.name) != 0)
  1712. -        {
  1713. -          PrintMessage(_T("tgz_extract: mismatched long filename"));
  1714. -          cm_cleanup(cm);
  1715. -          return -1;
  1716. -        }
  1717. +               /* if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) */
  1718. +               char fs[SHORTNAMESIZE];   /* force strings to same max len, then compare */
  1719. +               lstrcpyn(fs, fname, SHORTNAMESIZE);
  1720. +               fs[SHORTNAMESIZE-1] = '\0';
  1721. +               buffer.header.name[SHORTNAMESIZE-1] = '\0';
  1722. +               if (lstrcmp(fs, buffer.header.name) != 0)
  1723. +               {
  1724. +                   PrintMessage(_T("tgz_extract: mismatched long filename"));
  1725. +                   cm_cleanup(cm);
  1726. +                   return -1;
  1727. +               }
  1728.  #else
  1729. -       PrintMessage(_T("tgz_extract: using GNU long filename [%s]"), _A2T(fname));
  1730. +               PrintMessage(_T("tgz_extract: using GNU long filename [%s]"), _A2T(fname));
  1731.  #endif
  1732. -      }
  1733. -      /* LogMessage("buffer.header.name is:");  LogMessage(fname); */
  1734. +           }
  1735. +           /* LogMessage("buffer.header.name is:");  LogMessage(fname); */
  1736.  
  1737.  
  1738. -      switch (buffer.header.typeflag)
  1739. -      {
  1740. -        case DIRTYPE:
  1741. -         dirEntry:
  1742. -          if (!junkPaths)
  1743. -          {
  1744. -            safetyStrip(fname);
  1745. -            makedir(fname);
  1746. -          }
  1747. -         break;
  1748. -       case LNKTYPE:   /* hard link */
  1749. -       case CONTTYPE:  /* contiguous file, for compatibility treat as normal */
  1750. -        case REGTYPE:
  1751. -        case AREGTYPE:
  1752. -         /* Note: a file ending with a / may actually be a BSD tar directory entry */
  1753. -         if (fname[strlen(fname)-1] == '/')
  1754. -           goto dirEntry;
  1755. +           switch (buffer.header.typeflag)
  1756. +           {
  1757. +           case DIRTYPE:
  1758. +dirEntry:
  1759. +               if (!junkPaths)
  1760. +               {
  1761. +                   safetyStrip(fname);
  1762. +                   makedir(fname);
  1763. +               }
  1764. +               break;
  1765. +           case LNKTYPE:   /* hard link */
  1766. +           case CONTTYPE:  /* contiguous file, for compatibility treat as normal */
  1767. +           case REGTYPE:
  1768. +           case AREGTYPE:
  1769. +               /* Note: a file ending with a / may actually be a BSD tar directory entry */
  1770. +               if (fname[strlen(fname)-1] == '/')
  1771. +                   goto dirEntry;
  1772.  
  1773. -         remaining = getoct(buffer.header.size,12);
  1774. -         if ( /* add (remaining > 0) && to ignore 0 zero byte files */
  1775. -               ( (iList == NULL) || (matchname(fname, iCnt, iList, junkPaths)) ) &&
  1776. -               (!matchname(fname, xCnt, xList, junkPaths))
  1777. -             )
  1778. -         {
  1779. -             if (!junkPaths) /* if we want to use paths as stored */
  1780. +               remaining = getoct(buffer.header.size,12);
  1781. +               if ( /* add (remaining > 0) && to ignore 0 zero byte files */
  1782. +                   ( (iList == NULL) || (matchname(fname, iCnt, iList, junkPaths)) ) &&
  1783. +                   (!matchname(fname, xCnt, xList, junkPaths))
  1784. +                   )
  1785. +               {
  1786. +                   if (!junkPaths) /* if we want to use paths as stored */
  1787.               {
  1788. -                 /* try creating directory */
  1789. -                 char *p = strrchr(fname, '/');
  1790. -                 if (p != NULL)
  1791. -                 {
  1792. -                   *p = '\0';
  1793. -                   makedir(fname);
  1794. -                   *p = '/';
  1795. -                 }
  1796. +                 /* try creating directory */
  1797. +                 char *p = strrchr(fname, '/');
  1798. +                 if (p != NULL)
  1799. +                 {
  1800. +                     *p = '\0';
  1801. +                     makedir(fname);
  1802. +                     *p = '/';
  1803. +                 }
  1804.               }
  1805. -             else
  1806. +                   else
  1807.               {
  1808. -                 /* try ignoring directory */
  1809. -                 char *p = strrchr(fname, '/');
  1810. -                 if (p != NULL)
  1811. -                 {
  1812. -                   /* be sure terminating '\0' is copied and */
  1813. -                   /* use ansi memcpy equivalent that handles overlapping regions */
  1814. -                   MoveMemory(fname, p+1, strlen(p+1) + 1 );
  1815. -                 }
  1816. -             }
  1817. -             if (*fname) /* if after stripping path a fname still exists */
  1818. -             {
  1819. -               /* Attempt to open the output file and report action taken to user */
  1820. -               const TCHAR szERRMsg[] = _T("Error: Could not create file "),
  1821. -                           szSUCMsg[] = _T("Writing "),
  1822. -                           szSKPMsg[] = _T("Skipping ");
  1823. -               const TCHAR * szMsg = szSUCMsg;
  1824. +                 /* try ignoring directory */
  1825. +                 char *p = strrchr(fname, '/');
  1826. +                 if (p != NULL)
  1827. +                 {
  1828. +                     /* be sure terminating '\0' is copied and */
  1829. +                     /* use ansi memcpy equivalent that handles overlapping regions */
  1830. +                     MoveMemory(fname, p+1, strlen(p+1) + 1 );
  1831. +                 }
  1832. +                   }
  1833. +                   if (*fname) /* if after stripping path a fname still exists */
  1834. +                   {
  1835. +                       /* Attempt to open the output file and report action taken to user */
  1836. +                       const TCHAR szERRMsg[] = _T("Error: Could not create file "),
  1837. +                           szSUCMsg[] = _T("Writing "),
  1838. +                           szSKPMsg[] = _T("Skipping ");
  1839. +                       const TCHAR * szMsg = szSUCMsg;
  1840.  
  1841. -               safetyStrip(fname);
  1842. +                       safetyStrip(fname);
  1843.  
  1844. -               if (buffer.header.typeflag == LNKTYPE)
  1845. -               {
  1846. -                   outfile = INVALID_HANDLE_VALUE;
  1847. -                   /* create a hardlink if possible, else produce just a warning unless failOnHardLinks is true */
  1848. -                   if (!MakeHardLink(fname, buffer.header.linkname))
  1849. -                   {
  1850. -                       PrintMessage(_T("Warning: unable to create hard link %s [%d]"), _A2T(fname), GetLastError());
  1851. -                       if (failOnHardLinks)
  1852. +                       if (buffer.header.typeflag == LNKTYPE)
  1853.                         {
  1854. -                           cm_cleanup(cm);
  1855. -                           return -3;
  1856. +                           outfile = INVALID_HANDLE_VALUE;
  1857. +                           /* create a hardlink if possible, else produce just a warning unless failOnHardLinks is true */
  1858. +                           if (!MakeHardLink(fname, buffer.header.linkname))
  1859. +                           {
  1860. +                               PrintMessage(_T("Warning: unable to create hard link %s [%d]"), _A2T(fname), GetLastError());
  1861. +                               if (failOnHardLinks)
  1862. +                               {
  1863. +                                   cm_cleanup(cm);
  1864. +                                   return -3;
  1865. +                               }
  1866. +                           }
  1867. +                           else
  1868. +                           {
  1869. +                               outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
  1870. +                               goto setTimeAndCloseFile;
  1871. +                           }
  1872. +                       } else
  1873. +                       {
  1874. +                           /* Open the file for writing mode, creating if doesn't exist and truncating if exists and overwrite mode */
  1875. +                           outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,(keep==OVERWRITE)?CREATE_ALWAYS:CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
  1876. +
  1877. +                           /* failed to open file, either valid error (like open) or it already exists and in a keep mode */
  1878. +                           if (outfile == INVALID_HANDLE_VALUE)
  1879. +                           {
  1880. +                               /* if skip existing or only update existing and failed to open becauses exists */
  1881. +                               if ((keep!=OVERWRITE) && (GetLastError()==ERROR_FILE_EXISTS))
  1882. +                               {
  1883. +                                   /* assume skipping initially (mode==SKIP or ==UPDATE with existing file newer) */
  1884. +                                   szMsg = szSKPMsg; /* and update output message accordingly */
  1885. +
  1886. +                                   /* if in update mode, check filetimes and reopen in overwrite mode */
  1887. +                                   if (keep == UPDATE)
  1888. +                                   {
  1889. +                                       FILETIME ftm_a;
  1890. +                                       HANDLE h;
  1891. +                                       WIN32_FIND_DATAA ffData;
  1892. +
  1893. +                                       cnv_tar2win_time(tartime, &ftm_a); /* archive file time */
  1894. +                                       h = FindFirstFileA(fname, &ffData); /* existing file time */
  1895. +
  1896. +                                       if (h!=INVALID_HANDLE_VALUE)
  1897. +                                           FindClose(h);  /* cleanup search handle */
  1898. +                                       else
  1899. +                                           goto ERR_OPENING;
  1900. +
  1901. +                                       /* compare date+times, is one in tarball newer? */
  1902. +                                       if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime)))
  1903. +                                       {
  1904. +                                           outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
  1905. +                                           if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING;
  1906. +                                           szMsg = szSUCMsg;
  1907. +                                       }
  1908. +                                   }
  1909. +                               }
  1910. +                               else /* in overwrite mode or failed for some other error than exists */
  1911. +                               {
  1912. +ERR_OPENING:
  1913. +                                   PrintMessage(_T("%s%s [%d]"), szERRMsg, _A2T(fname), GetLastError());
  1914. +                                   cm_cleanup(cm);
  1915. +                                   return -2;
  1916. +                               }
  1917. +                           }
  1918. +
  1919. +                           /* Inform user of current extraction action (writing, skipping file XYZ) */
  1920. +                           PrintMessage(_T("%s%s"), szMsg, _A2T(fname));
  1921. +                           PrintProgressionBar(bytesReadSofar, totalSize); // Ajout de GB
  1922.                         }
  1923.                     }
  1924. -                   else
  1925. +               }
  1926. +               else
  1927. +                   outfile = INVALID_HANDLE_VALUE;
  1928. +
  1929. +               /*
  1930. +               * could have no contents, in which case we close the file and set the times
  1931. +               */
  1932. +               if (remaining > 0)
  1933. +                   getheader = 0;
  1934. +               else
  1935. +               {
  1936. +setTimeAndCloseFile:
  1937. +                   getheader = 1;
  1938. +                   if (outfile != INVALID_HANDLE_VALUE)
  1939.                     {
  1940. -                       outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
  1941. -                       goto setTimeAndCloseFile;
  1942. +                       FILETIME ftm;
  1943. +
  1944. +                       cnv_tar2win_time(tartime, &ftm);
  1945. +                       SetFileTime(outfile,&ftm,NULL,&ftm);
  1946. +                       CloseHandle(outfile);
  1947. +                       outfile = INVALID_HANDLE_VALUE;
  1948.                     }
  1949. -               } else
  1950. +               }
  1951. +
  1952. +               break;
  1953. +           case GNUTYPE_LONGLINK:
  1954. +           case GNUTYPE_LONGNAME:
  1955.                 {
  1956. -               /* Open the file for writing mode, creating if doesn't exist and truncating if exists and overwrite mode */
  1957. -               outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,(keep==OVERWRITE)?CREATE_ALWAYS:CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
  1958. +                   remaining = getoct(buffer.header.size,12);
  1959. +                   if (readBlock(cm, fname, &bytesReadThisTime) < 0) return -1;
  1960. +                   fname[BLOCKSIZE-1] = '\0';
  1961. +                   if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining))
  1962. +                   {
  1963. +                       PrintMessage(_T("tgz_extract: invalid long name"));
  1964. +                       cm_cleanup(cm);
  1965. +                       return -1;
  1966. +                   }
  1967. +                   getheader = 2;
  1968. +                   break;
  1969. +               }
  1970. +           default:
  1971. +               /*
  1972. +               if (action == TGZ_LIST)
  1973. +               printf(" %s     <---> %s\n",strtime(&tartime),fname);
  1974. +               */
  1975. +               break;
  1976. +           }
  1977. +       }
  1978. +       else  /* (getheader == 0) */
  1979. +       {
  1980. +           unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
  1981. +           unsigned long bwritten;
  1982.  
  1983. -               /* failed to open file, either valid error (like open) or it already exists and in a keep mode */
  1984. -               if (outfile == INVALID_HANDLE_VALUE)
  1985. -               {
  1986. -                 /* if skip existing or only update existing and failed to open becauses exists */
  1987. -                 if ((keep!=OVERWRITE) && (GetLastError()==ERROR_FILE_EXISTS))
  1988. -                 {
  1989. -                   /* assume skipping initially (mode==SKIP or ==UPDATE with existing file newer) */
  1990. -                   szMsg = szSKPMsg; /* and update output message accordingly */
  1991. +           if (outfile != INVALID_HANDLE_VALUE)
  1992. +           {
  1993. +               WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL);
  1994. +               if (bwritten != bytes)
  1995. +               {
  1996. +                   PrintMessage(_T("Error: write failed for %s"), _A2T(fname));
  1997. +                   CloseHandle(outfile);
  1998. +                   DeleteFileA(fname);
  1999.  
  2000. -                   /* if in update mode, check filetimes and reopen in overwrite mode */
  2001. -                   if (keep == UPDATE)
  2002. -                   {
  2003. -                     FILETIME ftm_a;
  2004. -                      HANDLE h;
  2005. -                      WIN32_FIND_DATAA ffData;
  2006. -
  2007. -                     cnv_tar2win_time(tartime, &ftm_a); /* archive file time */
  2008. -                     h = FindFirstFileA(fname, &ffData); /* existing file time */
  2009. +                   cm_cleanup(cm);
  2010. +                   return -2;
  2011. +               }
  2012. +           }
  2013. +           remaining -= bytes;
  2014. +           if (remaining == 0) goto setTimeAndCloseFile;
  2015. +       }
  2016. +   } /* while(1) */
  2017.  
  2018. -                      if (h!=INVALID_HANDLE_VALUE)
  2019. -                        FindClose(h);  /* cleanup search handle */
  2020. -                      else
  2021. -                        goto ERR_OPENING;
  2022. +   cm_cleanup(cm);
  2023.  
  2024. -                      /* compare date+times, is one in tarball newer? */
  2025. -                      if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime)))
  2026. -                      {
  2027. -                        outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
  2028. -                        if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING;
  2029. -                        szMsg = szSUCMsg;
  2030. -                      }
  2031. -                   }
  2032. -                 }
  2033. -                 else /* in overwrite mode or failed for some other error than exists */
  2034. -                 {
  2035. -                    ERR_OPENING:
  2036. -                   PrintMessage(_T("%s%s [%d]"), szERRMsg, _A2T(fname), GetLastError());
  2037. -                   cm_cleanup(cm);
  2038. -                   return -2;
  2039. -                 }
  2040. -               }
  2041. -
  2042. -               /* Inform user of current extraction action (writing, skipping file XYZ) */
  2043. -               PrintMessage(_T("%s%s"), szMsg, _A2T(fname));
  2044. -               }
  2045. -             }
  2046. -         }
  2047. -         else
  2048. -             outfile = INVALID_HANDLE_VALUE;
  2049. -
  2050. -         /*
  2051. -          * could have no contents, in which case we close the file and set the times
  2052. -          */
  2053. -         if (remaining > 0)
  2054. -             getheader = 0;
  2055. -         else
  2056. -         {
  2057. -             setTimeAndCloseFile:
  2058. -             getheader = 1;
  2059. -             if (outfile != INVALID_HANDLE_VALUE)
  2060. -             {
  2061. -                 FILETIME ftm;
  2062. -
  2063. -                 cnv_tar2win_time(tartime, &ftm);
  2064. -                 SetFileTime(outfile,&ftm,NULL,&ftm);
  2065. -                 CloseHandle(outfile);
  2066. -                 outfile = INVALID_HANDLE_VALUE;
  2067. -             }
  2068. -         }
  2069. -
  2070. -         break;
  2071. -       case GNUTYPE_LONGLINK:
  2072. -       case GNUTYPE_LONGNAME:
  2073. -       {
  2074. -         remaining = getoct(buffer.header.size,12);
  2075. -         if (readBlock(cm, fname) < 0) return -1;
  2076. -         fname[BLOCKSIZE-1] = '\0';
  2077. -         if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining))
  2078. -         {
  2079. -             PrintMessage(_T("tgz_extract: invalid long name"));
  2080. -             cm_cleanup(cm);
  2081. -             return -1;
  2082. -         }
  2083. -         getheader = 2;
  2084. -         break;
  2085. -       }
  2086. -        default:
  2087. -/*
  2088. -         if (action == TGZ_LIST)
  2089. -             printf(" %s     <---> %s\n",strtime(&tartime),fname);
  2090. -*/
  2091. -         break;
  2092. -      }
  2093. -    }
  2094. -    else  /* (getheader == 0) */
  2095. -    {
  2096. -      unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
  2097. -     unsigned long bwritten;
  2098. -
  2099. -      if (outfile != INVALID_HANDLE_VALUE)
  2100. -      {
  2101. -          WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL);
  2102. -         if (bwritten != bytes)
  2103. -          {
  2104. -             PrintMessage(_T("Error: write failed for %s"), _A2T(fname));
  2105. -              CloseHandle(outfile);
  2106. -              DeleteFileA(fname);
  2107. -
  2108. -              cm_cleanup(cm);
  2109. -              return -2;
  2110. -          }
  2111. -      }
  2112. -      remaining -= bytes;
  2113. -      if (remaining == 0) goto setTimeAndCloseFile;
  2114. -    }
  2115. -  } /* while(1) */
  2116. -  
  2117. -  cm_cleanup(cm);
  2118. -
  2119. -  return 0;
  2120. +   return 0;
  2121.  }
  2122.  
  2123. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untar.h
  2124. --- a/common/windows/nsis/plugins/untgz/untar.h Wed Nov 21 10:28:12 2012 +0100
  2125. +++ b/common/windows/nsis/plugins/untgz/untar.h Wed Nov 21 10:34:41 2012 +0100
  2126. @@ -43,7 +43,7 @@
  2127.  };
  2128.  
  2129.  /* actual extraction routine */
  2130. -int tgz_extract(gzFile tgzFile, int cm, int junkPaths, enum KeepMode keep, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks);
  2131. +int tgz_extract(gzFile tgzFile, int cm, int junkPaths, enum KeepMode keep, unsigned long totalSize, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks);
  2132.  
  2133.  /* recursive make directory */
  2134.  /* abort if you get an ENOENT errno somewhere in the middle */
  2135. @@ -95,6 +95,7 @@
  2136.  
  2137.  /* uses filename & file contents and returns best guess of file type CM_* */
  2138.  int getFileType(const char *fname);
  2139. +unsigned long getFileSize(const char *fname);
  2140.  
  2141.  
  2142.  /* !!!USER SUPPLIED!!! */
  2143. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untgz.cpp
  2144. --- a/common/windows/nsis/plugins/untgz/untgz.cpp   Wed Nov 21 10:28:12 2012 +0100
  2145. +++ b/common/windows/nsis/plugins/untgz/untgz.cpp   Wed Nov 21 10:34:41 2012 +0100
  2146. @@ -116,6 +116,7 @@
  2147.  
  2148.  HWND g_hwndParent;
  2149.  HWND g_hwndList;
  2150. +HWND g_hwndProgressBar;
  2151.  
  2152.  
  2153.  // DLL entry point
  2154. @@ -194,7 +195,7 @@
  2155.  
  2156.  
  2157.  void argParse(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop,
  2158. -              TCHAR *cmd, TCHAR *cmdline, gzFile *tgzFile, int *compressionMethod,
  2159. +              TCHAR *cmd, TCHAR *cmdline, gzFile *tgzFile, int *compressionMethod, unsigned long *fileSize,
  2160.                int *junkPaths, enum KeepMode *keep, TCHAR *basePath, int *failOnHardLinks)
  2161.  {
  2162.    TCHAR buf[1024];     /* used for argument processor or other temp buffer */
  2163. @@ -216,6 +217,7 @@
  2164.    /* initialize optional arguments to their general defaults */
  2165.    *tgzFile = 0;
  2166.    *compressionMethod = CM_AUTO;
  2167. +  *fileSize = 0;
  2168.    *failOnHardLinks = 0; /* default to warn only                */
  2169.    *keep = OVERWRITE;
  2170.    *junkPaths = 0;       /* keep path information by default    */
  2171. @@ -282,6 +284,8 @@
  2172.    _tcscat(cmdline, buf);  
  2173.    _tcscat(cmdline, _T("' "));
  2174.  
  2175. +  *fileSize = getFileSize(_T2A(buf));
  2176. +
  2177.    /* if auto type specified then determine type */
  2178.    if (*compressionMethod == CM_AUTO)
  2179.      *compressionMethod = getFileType(_T2A(buf));
  2180. @@ -334,6 +338,7 @@
  2181.    TCHAR cmdline[1024];     /* just used to display to user */
  2182.    int junkPaths;          /* default to extracting with paths -- highly insecure */
  2183.    int compressionMethod;  /* gzip or other compressed tar file */
  2184. +  unsigned long fileSize;
  2185.    int failOnHardLinks;
  2186.    enum KeepMode keep;     /* overwrite mode */
  2187.    gzFile tgzFile = NULL;  /* the opened tarball (assuming argParse returns successfully) */
  2188. @@ -345,7 +350,7 @@
  2189.  
  2190.    /* do common stuff including parsing arguments up to filename to extract */
  2191.    argParse(hwndParent, string_size, variables, stacktop,
  2192. -           funcName[mode], cmdline, &tgzFile, &compressionMethod, &junkPaths, &keep, NULL, &failOnHardLinks);
  2193. +           funcName[mode], cmdline, &tgzFile, &compressionMethod, &fileSize, &junkPaths, &keep, NULL, &failOnHardLinks);
  2194.  
  2195.    /* check if everything up to now processed ok, exit if not */
  2196.    if (_tcscmp(getuservariable(INST_R0), ERR_SUCCESS) != 0) return;
  2197. @@ -417,10 +422,10 @@
  2198.  
  2199.  
  2200.    /* show user cmdline */
  2201. -  PrintMessage(cmdline);
  2202. +  //Non user friendly PrintMessage(cmdline);
  2203.  
  2204.    /* actually perform the extraction */
  2205. -  if ((result = tgz_extract(tgzFile, compressionMethod, junkPaths, keep, iCnt, iList, xCnt, xList, failOnHardLinks)) < 0)
  2206. +  if ((result = tgz_extract(tgzFile, compressionMethod, junkPaths, keep, fileSize, iCnt, iList, xCnt, xList, failOnHardLinks)) < 0)
  2207.    {
  2208.     switch (result)
  2209.     {
  2210. diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untgz.dll
  2211. Binary file common/windows/nsis/plugins/untgz/untgz.dll has changed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement