SHOW:
|
|
- or go back to the newest paste.
| 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 @@ |
| 684 | + | |
| 685 | - | #include "lzma.h" |
| 685 | + | |
| 686 | - | #include "../miniclib.h" |
| 686 | + | |
| 687 | *size = (SizeT)gzread(b->File, b->Buffer, kInBufferSize); | |
| 688 | - | +tmpRead = 0; |
| 688 | + | |
| 689 | return LZMA_RESULT_OK; | |
| 690 | } | |
| 691 | - | /* wrap around whatever you want to send error messages to user, c function */ |
| 691 | + | |
| 692 | @@ -40,7 +42,7 @@ | |
| 693 | register long len = gzread(file, data, size); | |
| 694 | if (len != size) | |
| 695 | {
| |
| 696 | - PrintMessage("lzma: Can not read input file.");
| |
| 697 | + PrintMessage(_T2A("lzma: Can not read input file."));
| |
| 698 | return 0; | |
| 699 | } | |
| 700 | return 1; | |
| 701 | @@ -62,11 +64,15 @@ | |
| 702 | int lzma_init(gzFile infile, struct LZMAFile **lzmaFile) | |
| 703 | {
| |
| 704 | LZMAFile *inBuffer; | |
| 705 | + | |
| 706 | + totalRead = 0; | |
| 707 | + | |
| 708 | *lzmaFile = inBuffer = (LZMAFile *)malloc(sizeof(struct LZMAFile)); | |
| 709 | if (inBuffer == NULL) return -1; | |
| 710 | ||
| 711 | memset(inBuffer, 0, sizeof(LZMAFile)); | |
| 712 | inBuffer->File = infile; | |
| 713 | + | |
| 714 | inBuffer->InCallback.Read = LzmaReadCompressed; | |
| 715 | inBuffer->waitEOS = 1; | |
| 716 | ||
| 717 | @@ -95,7 +101,7 @@ | |
| 718 | /* Decode LZMA properties and allocate memory */ | |
| 719 | if (LzmaDecodeProperties(&(inBuffer->state.Properties), inBuffer->properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) | |
| 720 | {
| |
| 721 | - PrintMessage("Incorrect stream properties");
| |
| 722 | + PrintMessage(_T2A("Incorrect stream properties"));
| |
| 723 | return -1; | |
| 724 | } | |
| 725 | inBuffer->state.Probs = (CProb *)malloc(LzmaGetNumProbs(&(inBuffer->state.Properties)) * sizeof(CProb)); | |
| 726 | @@ -122,7 +128,8 @@ | |
| 727 | ||
| 728 | long lzma_read(struct LZMAFile *lzmaFile, | |
| 729 | unsigned char *buffer, | |
| 730 | - unsigned len) | |
| 731 | + unsigned len, | |
| 732 | + unsigned int *bytesRead) | |
| 733 | {
| |
| 734 | SizeT outProcessed; | |
| 735 | SizeT outAvail = len; | |
| 736 | @@ -134,9 +141,12 @@ | |
| 737 | res = LzmaDecode(&(lzmaFile->state), | |
| 738 | &(lzmaFile->InCallback), | |
| 739 | buffer, outAvail, &outProcessed); | |
| 740 | + | |
| 741 | + *bytesRead = totalRead; | |
| 742 | + | |
| 743 | if (res != 0) | |
| 744 | {
| |
| 745 | - PrintMessage("lzma_read: Decoding error (%d)", res);
| |
| 746 | + PrintMessage(_T2A("lzma_read: Decoding error (%d)"), res);
| |
| 747 | return -1; | |
| 748 | } | |
| 749 | ||
| 750 | @@ -149,7 +159,7 @@ | |
| 751 | {
| |
| 752 | if (!lzmaFile->waitEOS && (lzmaFile->outSize != 0 || lzmaFile->outSizeHigh != 0)) | |
| 753 | {
| |
| 754 | - PrintMessage("lzma_read: Unexpected EOS");
| |
| 755 | + PrintMessage(_T2A("lzma_read: Unexpected EOS"));
| |
| 756 | return -1; | |
| 757 | } | |
| 758 | } | |
| 759 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/lzma/lzma.h | |
| 760 | --- a/common/windows/nsis/plugins/untgz/lzma/lzma.h Wed Nov 21 10:28:12 2012 +0100 | |
| 761 | +++ b/common/windows/nsis/plugins/untgz/lzma/lzma.h Wed Nov 21 10:34:41 2012 +0100 | |
| 762 | @@ -7,6 +7,8 @@ | |
| 763 | typedef void * gzFile; | |
| 764 | int gzread(gzFile file, void * buf, unsigned len); | |
| 765 | ||
| 766 | +SizeT totalRead; | |
| 767 | + | |
| 768 | /* holds any information needed about stream */ | |
| 769 | struct LZMAFile; | |
| 770 | typedef struct LZMAFile LZMAFile; | |
| 771 | @@ -16,6 +18,7 @@ | |
| 772 | void lzma_cleanup(struct LZMAFile *lzmaFile); | |
| 773 | long lzma_read(struct LZMAFile *lzmaFile, | |
| 774 | unsigned char *buffer, | |
| 775 | - unsigned len); | |
| 776 | + unsigned len, | |
| 777 | + unsigned int *bytesRead); | |
| 778 | ||
| 779 | #endif /* _LZMA_H_ */ | |
| 780 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/miniclib.c | |
| 781 | --- a/common/windows/nsis/plugins/untgz/miniclib.c Wed Nov 21 10:28:12 2012 +0100 | |
| 782 | +++ b/common/windows/nsis/plugins/untgz/miniclib.c Wed Nov 21 10:34:41 2012 +0100 | |
| 783 | @@ -331,9 +331,9 @@ | |
| 784 | ||
| 785 | unsigned char staticCnvBuffer[1024*2]; /* temp buffer, holds ASCII & UNICODE string after conversion */ | |
| 786 | #ifdef UNICODE | |
| 787 | -char * _T2A(unsigned short *wideStr) | |
| 788 | +char * _T2A(void *wideStr) | |
| 789 | {
| |
| 790 | - WideCharToMultiByte(CP_ACP, 0, wideStr, -1, staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL); | |
| 791 | + WideCharToMultiByte(CP_ACP, 0, (unsigned short*)wideStr, -1, staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL); | |
| 792 | return (char *)staticCnvBuffer; | |
| 793 | } | |
| 794 | #endif | |
| 795 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/miniclib.h | |
| 796 | --- a/common/windows/nsis/plugins/untgz/miniclib.h Wed Nov 21 10:28:12 2012 +0100 | |
| 797 | +++ b/common/windows/nsis/plugins/untgz/miniclib.h Wed Nov 21 10:34:41 2012 +0100 | |
| 798 | @@ -33,7 +33,7 @@ | |
| 799 | #define _T(x) __T(x) | |
| 800 | #define _TEXT(x) __T(x) | |
| 801 | #endif | |
| 802 | -char * _T2A(unsigned short *str); | |
| 803 | +char * _T2A(void *str); | |
| 804 | #define _A2T(x) _A2U(x) | |
| 805 | #define _tcscat wcscat | |
| 806 | #define _tcscpy wcscpy | |
| 807 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/nsisUtils.c | |
| 808 | --- a/common/windows/nsis/plugins/untgz/nsisUtils.c Wed Nov 21 10:28:12 2012 +0100 | |
| 809 | +++ b/common/windows/nsis/plugins/untgz/nsisUtils.c Wed Nov 21 10:34:41 2012 +0100 | |
| 810 | @@ -29,6 +29,8 @@ | |
| 811 | static stack_t **g_stacktop; | |
| 812 | static TCHAR *g_variables; | |
| 813 | ||
| 814 | +static WPARAM g_beginRange; | |
| 815 | +static WPARAM g_endRange; | |
| 816 | ||
| 817 | #define EXDLL_INIT() { \
| |
| 818 | g_stringsize=string_size; \ | |
| 819 | @@ -81,6 +83,7 @@ | |
| 820 | {
| |
| 821 | g_hwndParent=hwndParent; | |
| 822 | g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,_T("#32770"),NULL),NULL,_T("SysListView32"),NULL);
| |
| 823 | + g_hwndProgressBar = FindWindowEx(FindWindowEx(g_hwndParent,NULL,_T("#32770"),NULL),NULL,_T("msctls_progress32"),NULL);
| |
| 824 | EXDLL_INIT(); | |
| 825 | } | |
| 826 | ||
| 827 | @@ -98,6 +101,19 @@ | |
| 828 | DetailPrint(buf); | |
| 829 | } | |
| 830 | ||
| 831 | +void _cdecl PrintProgressionBar(const unsigned long sofar, const unsigned long total) | |
| 832 | +{
| |
| 833 | + unsigned long position = 0; | |
| 834 | + unsigned long range = 0; | |
| 835 | + | |
| 836 | + if (total!=0) | |
| 837 | + position = g_beginRange + MulDiv(g_endRange-g_beginRange, sofar, total); | |
| 838 | + else | |
| 839 | + position = g_endRange; | |
| 840 | + | |
| 841 | + SendMessage(g_hwndProgressBar, PBM_SETPOS, (WPARAM)position, 0); | |
| 842 | +} | |
| 843 | + | |
| 844 | /* | |
| 845 | // cheat a little with argument stack | |
| 846 | // copies current stack item to str, where current top of | |
| 847 | @@ -207,7 +223,13 @@ | |
| 848 | } | |
| 849 | /* End KJD's Functions */ | |
| 850 | ||
| 851 | - | |
| 852 | +/* GB Set the limits of the progression for extraction */ | |
| 853 | +void InitProgressBarExtremities() | |
| 854 | +{
| |
| 855 | + g_beginRange = SendMessage(g_hwndProgressBar, PBM_GETPOS, 0, 0); | |
| 856 | + g_endRange = SendMessage(g_hwndProgressBar, PBM_GETRANGE, 0, 0); | |
| 857 | + g_endRange -= MulDiv(1, g_endRange-g_beginRange, 11); // We left some range to finish the install | |
| 858 | +} | |
| 859 | ||
| 860 | /* | |
| 861 | The following portions from [based upon] code in ExtractDLL NSIS plugin: | |
| 862 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/nsisUtils.h | |
| 863 | --- a/common/windows/nsis/plugins/untgz/nsisUtils.h Wed Nov 21 10:28:12 2012 +0100 | |
| 864 | +++ b/common/windows/nsis/plugins/untgz/nsisUtils.h Wed Nov 21 10:34:41 2012 +0100 | |
| 865 | @@ -48,11 +48,14 @@ | |
| 866 | /* global variables */ | |
| 867 | extern HWND g_hwndParent; | |
| 868 | extern HWND g_hwndList; | |
| 869 | +extern HWND g_hwndProgressBar; | |
| 870 | ||
| 871 | extern unsigned int g_stringsize; | |
| 872 | extern stack_t **g_stacktop; | |
| 873 | extern TCHAR *g_variables; | |
| 874 | ||
| 875 | +extern WPARAM g_beginRange; | |
| 876 | +extern WPARAM g_endRange; | |
| 877 | ||
| 878 | /* For page showing plug-ins */ | |
| 879 | #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) | |
| 880 | @@ -141,6 +144,13 @@ | |
| 881 | */ | |
| 882 | void _cdecl PrintMessage(const TCHAR *msg, ...); | |
| 883 | ||
| 884 | +void InitProgressBarExtremities(); | |
| 885 | + | |
| 886 | +/* | |
| 887 | + * | |
| 888 | + */ | |
| 889 | +void _cdecl PrintProgressionBar(const unsigned long sofar, const unsigned long total); | |
| 890 | + | |
| 891 | /* | |
| 892 | * Sets the status text | |
| 893 | */ | |
| 894 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untar.c | |
| 895 | --- a/common/windows/nsis/plugins/untgz/untar.c Wed Nov 21 10:28:12 2012 +0100 | |
| 896 | +++ b/common/windows/nsis/plugins/untgz/untar.c Wed Nov 21 10:34:41 2012 +0100 | |
| 897 | @@ -1,27 +1,27 @@ | |
| 898 | /* | |
| 899 | - * tgz_extract functions based on code within zlib library | |
| 900 | - * No additional copyright added, KJD <[email protected]> | |
| 901 | - * | |
| 902 | - * This software is provided 'as-is', without any express or implied | |
| 903 | - * warranty. In no event will the authors be held liable for any damages | |
| 904 | - * arising from the use of this software. | |
| 905 | - * | |
| 906 | - * untgz.c -- Display contents and/or extract file from | |
| 907 | - * a gzip'd TAR file | |
| 908 | - * written by "Pedro A. Aranda Guti\irrez" <[email protected]> | |
| 909 | - * adaptation to Unix by Jean-loup Gailly <[email protected]> | |
| 910 | - * various fixes by Cosmin Truta <[email protected]> | |
| 911 | +* tgz_extract functions based on code within zlib library | |
| 912 | +* No additional copyright added, KJD <[email protected]> | |
| 913 | +* | |
| 914 | +* This software is provided 'as-is', without any express or implied | |
| 915 | +* warranty. In no event will the authors be held liable for any damages | |
| 916 | +* arising from the use of this software. | |
| 917 | +* | |
| 918 | +* untgz.c -- Display contents and/or extract file from | |
| 919 | +* a gzip'd TAR file | |
| 920 | +* written by "Pedro A. Aranda Guti\irrez" <[email protected]> | |
| 921 | +* adaptation to Unix by Jean-loup Gailly <[email protected]> | |
| 922 | +* various fixes by Cosmin Truta <[email protected]> | |
| 923 | */ | |
| 924 | ||
| 925 | /* | |
| 926 | - For tar format see | |
| 927 | - http://cdrecord.berlios.de/old/private/man/star/star.4.html | |
| 928 | - http://www.mkssoftware.com/docs/man4/tar.4.asp | |
| 929 | - http://www.delorie.com/gnu/docs/tar/tar_toc.html | |
| 930 | +For tar format see | |
| 931 | +http://cdrecord.berlios.de/old/private/man/star/star.4.html | |
| 932 | +http://www.mkssoftware.com/docs/man4/tar.4.asp | |
| 933 | +http://www.delorie.com/gnu/docs/tar/tar_toc.html | |
| 934 | ||
| 935 | - TODO: | |
| 936 | - without -j there is a security issue as no checking is done to directories | |
| 937 | - change to better support -d option, presently we just chdir there | |
| 938 | +TODO: | |
| 939 | +without -j there is a security issue as no checking is done to directories | |
| 940 | +change to better support -d option, presently we just chdir there | |
| 941 | */ | |
| 942 | ||
| 943 | ||
| 944 | @@ -41,8 +41,8 @@ | |
| 945 | #define DIRTYPE '5' /* directory */ | |
| 946 | #define FIFOTYPE '6' /* FIFO special */ | |
| 947 | #define CONTTYPE '7' /* reserved, for compatibility with gnu tar, | |
| 948 | - treat as regular file, where it represents | |
| 949 | - a regular file, but saved contiguously on disk */ | |
| 950 | +treat as regular file, where it represents | |
| 951 | +a regular file, but saved contiguously on disk */ | |
| 952 | ||
| 953 | /* GNU tar extensions */ | |
| 954 | ||
| 955 | @@ -60,21 +60,21 @@ | |
| 956 | ||
| 957 | unsigned long getoct(char *p,int width) | |
| 958 | {
| |
| 959 | - unsigned long result = 0; | |
| 960 | - char c; | |
| 961 | - | |
| 962 | - while (width --) | |
| 963 | - {
| |
| 964 | - c = *p++; | |
| 965 | - if (c == ' ') /* ignore padding */ | |
| 966 | - continue; | |
| 967 | - if (c == 0) /* ignore padding, but also marks end of string */ | |
| 968 | - break; | |
| 969 | - if (c < '0' || c > '7') | |
| 970 | - return result; /* really an error, but we just ignore invalid values */ | |
| 971 | - result = result * 8 + (c - '0'); | |
| 972 | - } | |
| 973 | - return result; | |
| 974 | + unsigned long result = 0; | |
| 975 | + char c; | |
| 976 | + | |
| 977 | + while (width --) | |
| 978 | + {
| |
| 979 | + c = *p++; | |
| 980 | + if (c == ' ') /* ignore padding */ | |
| 981 | + continue; | |
| 982 | + if (c == 0) /* ignore padding, but also marks end of string */ | |
| 983 | + break; | |
| 984 | + if (c < '0' || c > '7') | |
| 985 | + return result; /* really an error, but we just ignore invalid values */ | |
| 986 | + result = result * 8 + (c - '0'); | |
| 987 | + } | |
| 988 | + return result; | |
| 989 | } | |
| 990 | ||
| 991 | /* regular expression matching */ | |
| 992 | @@ -83,65 +83,65 @@ | |
| 993 | ||
| 994 | int ExprMatch(char *string,char *expr) | |
| 995 | {
| |
| 996 | - while (1) | |
| 997 | - {
| |
| 998 | - if (ISSPECIAL(*expr)) | |
| 999 | + while (1) | |
| 1000 | {
| |
| 1001 | - if (*expr == '/') | |
| 1002 | - {
| |
| 1003 | - if (*string != '\\' && *string != '/') | |
| 1004 | - return 0; | |
| 1005 | - string ++; expr++; | |
| 1006 | - } | |
| 1007 | - else if (*expr == '*') | |
| 1008 | - {
| |
| 1009 | - if (*expr ++ == 0) | |
| 1010 | - return 1; | |
| 1011 | - while (*++string != *expr) | |
| 1012 | - if (*string == 0) | |
| 1013 | - return 0; | |
| 1014 | - } | |
| 1015 | + if (ISSPECIAL(*expr)) | |
| 1016 | + {
| |
| 1017 | + if (*expr == '/') | |
| 1018 | + {
| |
| 1019 | + if (*string != '\\' && *string != '/') | |
| 1020 | + return 0; | |
| 1021 | + string ++; expr++; | |
| 1022 | + } | |
| 1023 | + else if (*expr == '*') | |
| 1024 | + {
| |
| 1025 | + if (*expr ++ == 0) | |
| 1026 | + return 1; | |
| 1027 | + while (*++string != *expr) | |
| 1028 | + if (*string == 0) | |
| 1029 | + return 0; | |
| 1030 | + } | |
| 1031 | + } | |
| 1032 | + else | |
| 1033 | + {
| |
| 1034 | + if (*string != *expr) | |
| 1035 | + return 0; | |
| 1036 | + if (*expr++ == 0) | |
| 1037 | + return 1; | |
| 1038 | + string++; | |
| 1039 | + } | |
| 1040 | } | |
| 1041 | - else | |
| 1042 | - {
| |
| 1043 | - if (*string != *expr) | |
| 1044 | - return 0; | |
| 1045 | - if (*expr++ == 0) | |
| 1046 | - return 1; | |
| 1047 | - string++; | |
| 1048 | - } | |
| 1049 | - } | |
| 1050 | } | |
| 1051 | ||
| 1052 | ||
| 1053 | /* returns 0 on failed checksum, nonzero if probably ok | |
| 1054 | - it was noted that some versions of tar compute | |
| 1055 | - signed chksums, though unsigned appears to be the | |
| 1056 | - standard; chksum is simple sum of all bytes in header | |
| 1057 | - as integers (using at least 17 bits) with chksum | |
| 1058 | - values treated as ASCII spaces. | |
| 1059 | +it was noted that some versions of tar compute | |
| 1060 | +signed chksums, though unsigned appears to be the | |
| 1061 | +standard; chksum is simple sum of all bytes in header | |
| 1062 | +as integers (using at least 17 bits) with chksum | |
| 1063 | +values treated as ASCII spaces. | |
| 1064 | */ | |
| 1065 | int valid_checksum(struct tar_header *header) | |
| 1066 | {
| |
| 1067 | - unsigned hdrchksum = (unsigned)getoct(header->chksum,8); | |
| 1068 | - signed schksum = 0; | |
| 1069 | - unsigned uchksum = 0; | |
| 1070 | - int i; | |
| 1071 | + unsigned hdrchksum = (unsigned)getoct(header->chksum,8); | |
| 1072 | + signed schksum = 0; | |
| 1073 | + unsigned uchksum = 0; | |
| 1074 | + int i; | |
| 1075 | ||
| 1076 | - for (i=0; i < sizeof(struct tar_header); i++) | |
| 1077 | - {
| |
| 1078 | - unsigned char val = ((unsigned char *)header)[i]; | |
| 1079 | - if ((i >= 148) && (i < 156)) /* chksum */ | |
| 1080 | - {
| |
| 1081 | - val = ' '; | |
| 1082 | - } | |
| 1083 | - schksum += (signed char)val; | |
| 1084 | - uchksum += val; | |
| 1085 | - } | |
| 1086 | + for (i=0; i < sizeof(struct tar_header); i++) | |
| 1087 | + {
| |
| 1088 | + unsigned char val = ((unsigned char *)header)[i]; | |
| 1089 | + if ((i >= 148) && (i < 156)) /* chksum */ | |
| 1090 | + {
| |
| 1091 | + val = ' '; | |
| 1092 | + } | |
| 1093 | + schksum += (signed char)val; | |
| 1094 | + uchksum += val; | |
| 1095 | + } | |
| 1096 | ||
| 1097 | - if (hdrchksum == uchksum) return 1; | |
| 1098 | - if ((int)hdrchksum == schksum) return 2; | |
| 1099 | - return 0; | |
| 1100 | + if (hdrchksum == uchksum) return 1; | |
| 1101 | + if ((int)hdrchksum == schksum) return 2; | |
| 1102 | + return 0; | |
| 1103 | } | |
| 1104 | ||
| 1105 | ||
| 1106 | @@ -154,46 +154,46 @@ | |
| 1107 | ||
| 1108 | int makedir (char *newdir) | |
| 1109 | {
| |
| 1110 | - char *buffer = strdup(newdir); | |
| 1111 | - char *p; | |
| 1112 | - int len = strlen(buffer); | |
| 1113 | - | |
| 1114 | - if (len <= 0) {
| |
| 1115 | - free(buffer); | |
| 1116 | - return 0; | |
| 1117 | - } | |
| 1118 | - if (buffer[len-1] == '/') {
| |
| 1119 | - buffer[len-1] = '\0'; | |
| 1120 | - } | |
| 1121 | - if (CreateDirectoryA(buffer, NULL) != 0) | |
| 1122 | - {
| |
| 1123 | - free(buffer); | |
| 1124 | - return 1; | |
| 1125 | - } | |
| 1126 | + char *buffer = strdup(newdir); | |
| 1127 | + char *p; | |
| 1128 | + int len = strlen(buffer); | |
| 1129 | ||
| 1130 | - p = buffer+1; | |
| 1131 | - while (1) | |
| 1132 | - {
| |
| 1133 | - char hold; | |
| 1134 | - | |
| 1135 | - while(*p && *p != '\\' && *p != '/') | |
| 1136 | - p++; | |
| 1137 | - hold = *p; | |
| 1138 | - *p = 0; | |
| 1139 | - //if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT /* != EEXIST */)) | |
| 1140 | - if (!CreateDirectoryA(buffer, NULL) && !((GetLastError()==ERROR_FILE_EXISTS) || (GetLastError()==ERROR_ALREADY_EXISTS)) ) | |
| 1141 | - {
| |
| 1142 | - // fprintf(stderr,"Unable to create directory %s\n", buffer); | |
| 1143 | - PrintMessage(_T("Unable to create directory %s\n"), _A2T(buffer));
| |
| 1144 | - free(buffer); | |
| 1145 | - return 0; | |
| 1146 | - } | |
| 1147 | - if (hold == 0) | |
| 1148 | - break; | |
| 1149 | - *p++ = hold; | |
| 1150 | - } | |
| 1151 | - free(buffer); | |
| 1152 | - return 1; | |
| 1153 | + if (len <= 0) {
| |
| 1154 | + free(buffer); | |
| 1155 | + return 0; | |
| 1156 | + } | |
| 1157 | + if (buffer[len-1] == '/') {
| |
| 1158 | + buffer[len-1] = '\0'; | |
| 1159 | + } | |
| 1160 | + if (CreateDirectoryA(buffer, NULL) != 0) | |
| 1161 | + {
| |
| 1162 | + free(buffer); | |
| 1163 | + return 1; | |
| 1164 | + } | |
| 1165 | + | |
| 1166 | + p = buffer+1; | |
| 1167 | + while (1) | |
| 1168 | + {
| |
| 1169 | + char hold; | |
| 1170 | + | |
| 1171 | + while(*p && *p != '\\' && *p != '/') | |
| 1172 | + p++; | |
| 1173 | + hold = *p; | |
| 1174 | + *p = 0; | |
| 1175 | + //if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT /* != EEXIST */)) | |
| 1176 | + if (!CreateDirectoryA(buffer, NULL) && !((GetLastError()==ERROR_FILE_EXISTS) || (GetLastError()==ERROR_ALREADY_EXISTS)) ) | |
| 1177 | + {
| |
| 1178 | + // fprintf(stderr,"Unable to create directory %s\n", buffer); | |
| 1179 | + PrintMessage(_T("Unable to create directory %s\n"), _A2T(buffer));
| |
| 1180 | + free(buffer); | |
| 1181 | + return 0; | |
| 1182 | + } | |
| 1183 | + if (hold == 0) | |
| 1184 | + break; | |
| 1185 | + *p++ = hold; | |
| 1186 | + } | |
| 1187 | + free(buffer); | |
| 1188 | + return 1; | |
| 1189 | } | |
| 1190 | ||
| 1191 | ||
| 1192 | @@ -219,34 +219,34 @@ | |
| 1193 | ||
| 1194 | ||
| 1195 | /* NOTE: This should be modified to perform whatever steps | |
| 1196 | - deemed necessary to make embedded paths safe prior to | |
| 1197 | - creating directory or file of given [path]filename. | |
| 1198 | - Must modify fname in place, always leaving either | |
| 1199 | - same or smaller strlen than current string. | |
| 1200 | - Current version (if not #defined out) removes any | |
| 1201 | - leading parent (..) or root (/)(\) references. | |
| 1202 | +deemed necessary to make embedded paths safe prior to | |
| 1203 | +creating directory or file of given [path]filename. | |
| 1204 | +Must modify fname in place, always leaving either | |
| 1205 | +same or smaller strlen than current string. | |
| 1206 | +Current version (if not #defined out) removes any | |
| 1207 | +leading parent (..) or root (/)(\) references. | |
| 1208 | */ | |
| 1209 | void safetyStrip(char * fname) | |
| 1210 | {
| |
| 1211 | #if 0 | |
| 1212 | - /* strip root from path */ | |
| 1213 | - if ((*fname == '/') || (*fname == '\\')) | |
| 1214 | - {
| |
| 1215 | - MoveMemory(fname, fname+1, strlen(fname+1) + 1 ); | |
| 1216 | - } | |
| 1217 | + /* strip root from path */ | |
| 1218 | + if ((*fname == '/') || (*fname == '\\')) | |
| 1219 | + {
| |
| 1220 | + MoveMemory(fname, fname+1, strlen(fname+1) + 1 ); | |
| 1221 | + } | |
| 1222 | ||
| 1223 | - /* now strip leading ../ */ | |
| 1224 | - while ((*fname == '.') && (*(fname+1) == '.') && ((*(fname+2) == '/') || (*(fname+2) == '\\')) ) | |
| 1225 | - {
| |
| 1226 | - MoveMemory(fname, fname+3, strlen(fname+3) + 1 ); | |
| 1227 | - } | |
| 1228 | + /* now strip leading ../ */ | |
| 1229 | + while ((*fname == '.') && (*(fname+1) == '.') && ((*(fname+2) == '/') || (*(fname+2) == '\\')) ) | |
| 1230 | + {
| |
| 1231 | + MoveMemory(fname, fname+3, strlen(fname+3) + 1 ); | |
| 1232 | + } | |
| 1233 | #endif | |
| 1234 | } | |
| 1235 | ||
| 1236 | ||
| 1237 | /* combines elements from tar header to produce | |
| 1238 | - * full [long] filename; prefix + [/] + name | |
| 1239 | - */ | |
| 1240 | +* full [long] filename; prefix + [/] + name | |
| 1241 | +*/ | |
| 1242 | void getFullName(union tar_buffer *buffer, char *fname) | |
| 1243 | {
| |
| 1244 | int len = 0; | |
| 1245 | @@ -274,60 +274,60 @@ | |
| 1246 | ||
| 1247 | ||
| 1248 | /* returns a pointer to a static buffer | |
| 1249 | - * containing fname after removing all but | |
| 1250 | - * path_sep_cnt path separators | |
| 1251 | - * if there are less than path_sep_cnt | |
| 1252 | - * separators then all will still be there. | |
| 1253 | - */ | |
| 1254 | +* containing fname after removing all but | |
| 1255 | +* path_sep_cnt path separators | |
| 1256 | +* if there are less than path_sep_cnt | |
| 1257 | +* separators then all will still be there. | |
| 1258 | +*/ | |
| 1259 | char * stripPath(int path_sep_cnt, char *fname) | |
| 1260 | {
| |
| 1261 | - static char buffer[1024]; | |
| 1262 | - char *fname_use = fname + strlen(fname); | |
| 1263 | - register int i=path_sep_cnt; | |
| 1264 | - do | |
| 1265 | - {
| |
| 1266 | - if ( (*fname_use == '/') || (*fname_use == '\\') ) | |
| 1267 | - {
| |
| 1268 | - i--; | |
| 1269 | - if (i < 0) fname_use++; | |
| 1270 | - else fname_use--; | |
| 1271 | - } | |
| 1272 | - else | |
| 1273 | - fname_use--; | |
| 1274 | - } while ((i >= 0) && (fname_use > fname)); | |
| 1275 | - | |
| 1276 | - strcpy(buffer, fname_use); | |
| 1277 | - return buffer; | |
| 1278 | + static char buffer[1024]; | |
| 1279 | + char *fname_use = fname + strlen(fname); | |
| 1280 | + register int i=path_sep_cnt; | |
| 1281 | + do | |
| 1282 | + {
| |
| 1283 | + if ( (*fname_use == '/') || (*fname_use == '\\') ) | |
| 1284 | + {
| |
| 1285 | + i--; | |
| 1286 | + if (i < 0) fname_use++; | |
| 1287 | + else fname_use--; | |
| 1288 | + } | |
| 1289 | + else | |
| 1290 | + fname_use--; | |
| 1291 | + } while ((i >= 0) && (fname_use > fname)); | |
| 1292 | + | |
| 1293 | + strcpy(buffer, fname_use); | |
| 1294 | + return buffer; | |
| 1295 | } | |
| 1296 | ||
| 1297 | /* returns 1 if fname in list else return 0 | |
| 1298 | - * returns 0 if list is NULL or cnt is < 0 | |
| 1299 | - */ | |
| 1300 | +* returns 0 if list is NULL or cnt is < 0 | |
| 1301 | +*/ | |
| 1302 | int matchname (char *fname, int cnt, char *list[], int junkPaths) | |
| 1303 | {
| |
| 1304 | - register char *t; | |
| 1305 | - int i; | |
| 1306 | - int path_sep; | |
| 1307 | + register char *t; | |
| 1308 | + int i; | |
| 1309 | + int path_sep; | |
| 1310 | ||
| 1311 | - /* if nothing to compare with then return failure */ | |
| 1312 | - if ((list == NULL) || (cnt <= 0)) | |
| 1313 | - return 0; | |
| 1314 | + /* if nothing to compare with then return failure */ | |
| 1315 | + if ((list == NULL) || (cnt <= 0)) | |
| 1316 | + return 0; | |
| 1317 | ||
| 1318 | - for (i = 0; i < cnt; i++) | |
| 1319 | - {
| |
| 1320 | - /* get count of path components in current filelist entry */ | |
| 1321 | - path_sep = 0; | |
| 1322 | - if (!junkPaths) | |
| 1323 | + for (i = 0; i < cnt; i++) | |
| 1324 | {
| |
| 1325 | - for(t = list[i]; *t != '\0'; t++) | |
| 1326 | - if ((*t == '/') || (*t == '\\')) | |
| 1327 | - path_sep++; | |
| 1328 | + /* get count of path components in current filelist entry */ | |
| 1329 | + path_sep = 0; | |
| 1330 | + if (!junkPaths) | |
| 1331 | + {
| |
| 1332 | + for(t = list[i]; *t != '\0'; t++) | |
| 1333 | + if ((*t == '/') || (*t == '\\')) | |
| 1334 | + path_sep++; | |
| 1335 | + } | |
| 1336 | + if (ExprMatch(stripPath(path_sep, fname), list[i])) | |
| 1337 | + return 1; | |
| 1338 | } | |
| 1339 | - if (ExprMatch(stripPath(path_sep, fname), list[i])) | |
| 1340 | - return 1; | |
| 1341 | - } | |
| 1342 | ||
| 1343 | - return 0; /* no match */ | |
| 1344 | + return 0; /* no match */ | |
| 1345 | } | |
| 1346 | ||
| 1347 | ||
| 1348 | @@ -341,25 +341,25 @@ | |
| 1349 | void cnv_tar2win_time(time_t tartime, FILETIME *ftm) | |
| 1350 | {
| |
| 1351 | #ifdef HAS_LIBC_CAL_FUNCS | |
| 1352 | - FILETIME ftLocal; | |
| 1353 | - SYSTEMTIME st; | |
| 1354 | - struct tm localt; | |
| 1355 | - | |
| 1356 | - localt = *localtime(&tartime); | |
| 1357 | - | |
| 1358 | - st.wYear = (WORD)localt.tm_year+1900; | |
| 1359 | - st.wMonth = (WORD)localt.tm_mon+1; /* 1 based, not 0 based */ | |
| 1360 | - st.wDayOfWeek = (WORD)localt.tm_wday; | |
| 1361 | - st.wDay = (WORD)localt.tm_mday; | |
| 1362 | - st.wHour = (WORD)localt.tm_hour; | |
| 1363 | - st.wMinute = (WORD)localt.tm_min; | |
| 1364 | - st.wSecond = (WORD)localt.tm_sec; | |
| 1365 | - st.wMilliseconds = 0; | |
| 1366 | - SystemTimeToFileTime(&st,&ftLocal); | |
| 1367 | - LocalFileTimeToFileTime(&ftLocal,ftm); | |
| 1368 | + FILETIME ftLocal; | |
| 1369 | + SYSTEMTIME st; | |
| 1370 | + struct tm localt; | |
| 1371 | + | |
| 1372 | + localt = *localtime(&tartime); | |
| 1373 | + | |
| 1374 | + st.wYear = (WORD)localt.tm_year+1900; | |
| 1375 | + st.wMonth = (WORD)localt.tm_mon+1; /* 1 based, not 0 based */ | |
| 1376 | + st.wDayOfWeek = (WORD)localt.tm_wday; | |
| 1377 | + st.wDay = (WORD)localt.tm_mday; | |
| 1378 | + st.wHour = (WORD)localt.tm_hour; | |
| 1379 | + st.wMinute = (WORD)localt.tm_min; | |
| 1380 | + st.wSecond = (WORD)localt.tm_sec; | |
| 1381 | + st.wMilliseconds = 0; | |
| 1382 | + SystemTimeToFileTime(&st,&ftLocal); | |
| 1383 | + LocalFileTimeToFileTime(&ftLocal,ftm); | |
| 1384 | #else | |
| 1385 | // avoid casts further below | |
| 1386 | - LONGLONG *t = (LONGLONG *)ftm; | |
| 1387 | + LONGLONG *t = (LONGLONG *)ftm; | |
| 1388 | ||
| 1389 | // tartime == number of seconds since midnight Jan 1 1970 (00:00:00) | |
| 1390 | // convert to equivalent 100 nanosecond intervals | |
| 1391 | @@ -384,389 +384,399 @@ | |
| 1392 | gzFile infile; | |
| 1393 | ||
| 1394 | /* Initialize decompression library (if needed) | |
| 1395 | - 0=success, nonzero means error during initialization | |
| 1396 | - */ | |
| 1397 | +0=success, nonzero means error during initialization | |
| 1398 | +*/ | |
| 1399 | int cm_init(gzFile in, int cm) | |
| 1400 | {
| |
| 1401 | - infile = in; /* save gzFile for reading/cleanup */ | |
| 1402 | + infile = in; /* save gzFile for reading/cleanup */ | |
| 1403 | ||
| 1404 | - switch (cm) | |
| 1405 | - {
| |
| 1406 | + switch (cm) | |
| 1407 | + {
| |
| 1408 | #ifdef ENABLE_BZ2 | |
| 1409 | - case CM_BZ2: | |
| 1410 | - bzfile = BZ2_bzReadOpen(&bzerror, in, 0, 0, NULL, 0); | |
| 1411 | - return bzerror; | |
| 1412 | + case CM_BZ2: | |
| 1413 | + bzfile = BZ2_bzReadOpen(&bzerror, in, 0, 0, NULL, 0); | |
| 1414 | + return bzerror; | |
| 1415 | #endif | |
| 1416 | #ifdef ENABLE_LZMA | |
| 1417 | - case CM_LZMA: | |
| 1418 | - return lzma_init(in, &lzmaFile); | |
| 1419 | + case CM_LZMA: | |
| 1420 | + return lzma_init(in, &lzmaFile); | |
| 1421 | #endif | |
| 1422 | - default: /* CM_NONE, CM_GZ */ | |
| 1423 | - return 0; /* success */ | |
| 1424 | - } | |
| 1425 | + default: /* CM_NONE, CM_GZ */ | |
| 1426 | + return 0; /* success */ | |
| 1427 | + } | |
| 1428 | } | |
| 1429 | ||
| 1430 | ||
| 1431 | /* properly cleanup any resources decompression library allocated | |
| 1432 | - */ | |
| 1433 | +*/ | |
| 1434 | void cm_cleanup(int cm) | |
| 1435 | {
| |
| 1436 | - switch (cm) | |
| 1437 | - {
| |
| 1438 | + switch (cm) | |
| 1439 | + {
| |
| 1440 | #ifdef ENABLE_BZ2 | |
| 1441 | - case CM_BZ2: | |
| 1442 | - BZ2_bzReadClose(&bzerror, bzfile); | |
| 1443 | - break; | |
| 1444 | + case CM_BZ2: | |
| 1445 | + BZ2_bzReadClose(&bzerror, bzfile); | |
| 1446 | + break; | |
| 1447 | #endif | |
| 1448 | #ifdef ENABLE_LZMA | |
| 1449 | - case CM_LZMA: | |
| 1450 | - lzma_cleanup(lzmaFile); | |
| 1451 | - break; | |
| 1452 | + case CM_LZMA: | |
| 1453 | + lzma_cleanup(lzmaFile); | |
| 1454 | + break; | |
| 1455 | #endif | |
| 1456 | - default: /* CM_NONE, CM_GZ */ | |
| 1457 | - break; | |
| 1458 | - } | |
| 1459 | + default: /* CM_NONE, CM_GZ */ | |
| 1460 | + break; | |
| 1461 | + } | |
| 1462 | ||
| 1463 | - /* close the input stream */ | |
| 1464 | - if (gzclose(infile) != Z_OK) | |
| 1465 | - {
| |
| 1466 | - PrintMessage(_T("failed gzclose"));
| |
| 1467 | - /* return -1; */ | |
| 1468 | - } | |
| 1469 | + /* close the input stream */ | |
| 1470 | + if (gzclose(infile) != Z_OK) | |
| 1471 | + {
| |
| 1472 | + PrintMessage(_T("failed gzclose"));
| |
| 1473 | + /* return -1; */ | |
| 1474 | + } | |
| 1475 | } | |
| 1476 | ||
| 1477 | ||
| 1478 | /* Reads in a single TAR block | |
| 1479 | - */ | |
| 1480 | -long readBlock(int cm, void *buffer) | |
| 1481 | +*/ | |
| 1482 | +long readBlock(int cm, void *buffer, unsigned int *bytesBlockRead) | |
| 1483 | {
| |
| 1484 | - long len = -1; | |
| 1485 | - switch (cm) | |
| 1486 | - {
| |
| 1487 | + long len = -1; | |
| 1488 | + unsigned int bytesRead = 0; | |
| 1489 | + switch (cm) | |
| 1490 | + {
| |
| 1491 | #ifdef ENABLE_BZ2 | |
| 1492 | - case CM_BZ2: | |
| 1493 | - len = BZ2_bzRead(&bzerror, bzfile, buffer, BLOCKSIZE); | |
| 1494 | - break; | |
| 1495 | + case CM_BZ2: | |
| 1496 | + len = BZ2_bzRead(&bzerror, bzfile, buffer, BLOCKSIZE); | |
| 1497 | + break; | |
| 1498 | #endif | |
| 1499 | #ifdef ENABLE_LZMA | |
| 1500 | - case CM_LZMA: | |
| 1501 | - len = lzma_read(lzmaFile, buffer, BLOCKSIZE); | |
| 1502 | - break; | |
| 1503 | + case CM_LZMA: | |
| 1504 | + len = lzma_read(lzmaFile, buffer, BLOCKSIZE, &bytesRead); | |
| 1505 | + break; | |
| 1506 | #endif | |
| 1507 | - default: /* CM_NONE, CM_GZ */ | |
| 1508 | - len = gzread(infile, buffer, BLOCKSIZE); | |
| 1509 | - break; | |
| 1510 | - } | |
| 1511 | + default: /* CM_NONE, CM_GZ */ | |
| 1512 | + len = gzread(infile, buffer, BLOCKSIZE); | |
| 1513 | + break; | |
| 1514 | + } | |
| 1515 | ||
| 1516 | - /* check for read errors and abort */ | |
| 1517 | - if (len < 0) | |
| 1518 | - {
| |
| 1519 | - PrintMessage(_T("gzread: error decompressing"));
| |
| 1520 | - cm_cleanup(cm); | |
| 1521 | - return -1; | |
| 1522 | - } | |
| 1523 | - /* | |
| 1524 | - * Always expect complete blocks to process | |
| 1525 | - * the tar information. | |
| 1526 | - */ | |
| 1527 | - if (len != BLOCKSIZE) | |
| 1528 | - {
| |
| 1529 | - PrintMessage(_T("gzread: incomplete block read"));
| |
| 1530 | - cm_cleanup(cm); | |
| 1531 | - return -1; | |
| 1532 | - } | |
| 1533 | + /* check for read errors and abort */ | |
| 1534 | + if (len < 0) | |
| 1535 | + {
| |
| 1536 | + PrintMessage(_T("gzread: error decompressing"));
| |
| 1537 | + cm_cleanup(cm); | |
| 1538 | + return -1; | |
| 1539 | + } | |
| 1540 | + /* | |
| 1541 | + * Always expect complete blocks to process | |
| 1542 | + * the tar information. | |
| 1543 | + */ | |
| 1544 | + if (len != BLOCKSIZE) | |
| 1545 | + {
| |
| 1546 | + PrintMessage(_T("gzread: incomplete block read"));
| |
| 1547 | + cm_cleanup(cm); | |
| 1548 | + return -1; | |
| 1549 | + } | |
| 1550 | ||
| 1551 | - return len; /* success */ | |
| 1552 | + *bytesBlockRead = bytesRead; | |
| 1553 | + return len; /* success */ | |
| 1554 | } | |
| 1555 | ||
| 1556 | ||
| 1557 | /* Tar file extraction | |
| 1558 | - * gzFile in, handle of input tarball opened with gzopen | |
| 1559 | - * int cm, compressionMethod | |
| 1560 | - * int junkPaths, nonzero indicates to ignore stored path (don't create directories) | |
| 1561 | - * enum KeepMode keep, indicates to perform if file exists | |
| 1562 | - * int iCnt, char *iList[], argv style list of files to extract, {0,NULL} for all
| |
| 1563 | - * int xCnt, char *xList[], argv style list of files NOT to extract, {0,NULL} for none
| |
| 1564 | - * int failOnHardLinks, if nonzero then will treat failure to create a hard link same as | |
| 1565 | - * failure to create a regular file, 0 prints a warning if fails - note that hardlinks | |
| 1566 | - * will always fail on Windows prior to NT 5 (Win 2000) or later and non NTFS file systems. | |
| 1567 | - * | |
| 1568 | - * returns 0 (or positive value) on success | |
| 1569 | - * returns negative value on error, where | |
| 1570 | - * -1 means error reading from tarball | |
| 1571 | - * -2 means error extracting file from tarball | |
| 1572 | - * -3 means error creating hard link | |
| 1573 | - */ | |
| 1574 | -int tgz_extract(gzFile in, int cm, int junkPaths, enum KeepMode keep, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks) | |
| 1575 | +* gzFile in, handle of input tarball opened with gzopen | |
| 1576 | +* int cm, compressionMethod | |
| 1577 | +* int junkPaths, nonzero indicates to ignore stored path (don't create directories) | |
| 1578 | +* enum KeepMode keep, indicates to perform if file exists | |
| 1579 | +* int iCnt, char *iList[], argv style list of files to extract, {0,NULL} for all
| |
| 1580 | +* int xCnt, char *xList[], argv style list of files NOT to extract, {0,NULL} for none
| |
| 1581 | +* int failOnHardLinks, if nonzero then will treat failure to create a hard link same as | |
| 1582 | +* failure to create a regular file, 0 prints a warning if fails - note that hardlinks | |
| 1583 | +* will always fail on Windows prior to NT 5 (Win 2000) or later and non NTFS file systems. | |
| 1584 | +* | |
| 1585 | +* returns 0 (or positive value) on success | |
| 1586 | +* returns negative value on error, where | |
| 1587 | +* -1 means error reading from tarball | |
| 1588 | +* -2 means error extracting file from tarball | |
| 1589 | +* -3 means error creating hard link | |
| 1590 | +*/ | |
| 1591 | +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) | |
| 1592 | {
| |
| 1593 | - int getheader = 1; /* assume initial input has a tar header */ | |
| 1594 | - HANDLE outfile = INVALID_HANDLE_VALUE; | |
| 1595 | + int getheader = 1; /* assume initial input has a tar header */ | |
| 1596 | + HANDLE outfile = INVALID_HANDLE_VALUE; | |
| 1597 | ||
| 1598 | - union tar_buffer buffer; | |
| 1599 | - unsigned long remaining; | |
| 1600 | - char fname[BLOCKSIZE]; /* must be >= BLOCKSIZE bytes */ | |
| 1601 | - time_t tartime; | |
| 1602 | + union tar_buffer buffer; | |
| 1603 | + unsigned long remaining; | |
| 1604 | + char fname[BLOCKSIZE]; /* must be >= BLOCKSIZE bytes */ | |
| 1605 | + time_t tartime; | |
| 1606 | + long bytesRead = 0; | |
| 1607 | + unsigned int bytesReadSofar = 0; | |
| 1608 | + unsigned int bytesReadThisTime = 0; | |
| 1609 | ||
| 1610 | - /* do any prep work for extracting from compressed TAR file */ | |
| 1611 | - if (cm_init(in, cm)) | |
| 1612 | - {
| |
| 1613 | - PrintMessage(_T("tgz_extract: unable to initialize decompression method."));
| |
| 1614 | - cm_cleanup(cm); | |
| 1615 | - return -1; | |
| 1616 | - } | |
| 1617 | - | |
| 1618 | - while (1) | |
| 1619 | - {
| |
| 1620 | - if (readBlock(cm, &buffer) < 0) return -1; | |
| 1621 | - | |
| 1622 | - /* | |
| 1623 | - * If we have to get a tar header | |
| 1624 | - */ | |
| 1625 | - if (getheader >= 1) | |
| 1626 | - {
| |
| 1627 | - /* | |
| 1628 | - * if we met the end of the tar | |
| 1629 | - * or the end-of-tar block, | |
| 1630 | - * we are done | |
| 1631 | - */ | |
| 1632 | - if (/* (len == 0) || */ (buffer.header.name[0]== 0)) break; | |
| 1633 | + InitProgressBarExtremities(); | |
| 1634 | ||
| 1635 | - /* compute and check header checksum, support signed or unsigned */ | |
| 1636 | - if (!valid_checksum(&(buffer.header))) | |
| 1637 | - {
| |
| 1638 | - PrintMessage(_T("tgz_extract: bad header checksum"));
| |
| 1639 | - cm_cleanup(cm); | |
| 1640 | - return -1; | |
| 1641 | - } | |
| 1642 | + /* do any prep work for extracting from compressed TAR file */ | |
| 1643 | + if (cm_init(in, cm)) | |
| 1644 | + {
| |
| 1645 | + PrintMessage(_T("tgz_extract: unable to initialize decompression method."));
| |
| 1646 | + cm_cleanup(cm); | |
| 1647 | + return -1; | |
| 1648 | + } | |
| 1649 | ||
| 1650 | - /* store time, so we can set the timestamp on files */ | |
| 1651 | - tartime = (time_t)getoct(buffer.header.mtime,12); | |
| 1652 | + while (1) | |
| 1653 | + {
| |
| 1654 | + if ( (bytesRead = readBlock(cm, &buffer, &bytesReadThisTime)) < 0) | |
| 1655 | + return -1; | |
| 1656 | ||
| 1657 | - /* copy over filename chunk from header, avoiding overruns */ | |
| 1658 | - if (getheader == 1) /* use normal (short or posix long) filename from header */ | |
| 1659 | - {
| |
| 1660 | - /* NOTE: prepends any prefix, including separator, and ensures terminated */ | |
| 1661 | - getFullName(&buffer, fname); | |
| 1662 | - } | |
| 1663 | - else /* use (GNU) long filename that preceeded this header */ | |
| 1664 | - {
| |
| 1665 | + bytesReadSofar = bytesReadThisTime; | |
| 1666 | + /* | |
| 1667 | + * If we have to get a tar header | |
| 1668 | + */ | |
| 1669 | + if (getheader >= 1) | |
| 1670 | + {
| |
| 1671 | + /* | |
| 1672 | + * if we met the end of the tar | |
| 1673 | + * or the end-of-tar block, | |
| 1674 | + * we are done | |
| 1675 | + */ | |
| 1676 | + if (/* (len == 0) || */ (buffer.header.name[0]== 0)) break; | |
| 1677 | + | |
| 1678 | + /* compute and check header checksum, support signed or unsigned */ | |
| 1679 | + if (!valid_checksum(&(buffer.header))) | |
| 1680 | + {
| |
| 1681 | + PrintMessage(_T("tgz_extract: bad header checksum"));
| |
| 1682 | + cm_cleanup(cm); | |
| 1683 | + return -1; | |
| 1684 | + } | |
| 1685 | + | |
| 1686 | + /* store time, so we can set the timestamp on files */ | |
| 1687 | + tartime = (time_t)getoct(buffer.header.mtime,12); | |
| 1688 | + | |
| 1689 | + /* copy over filename chunk from header, avoiding overruns */ | |
| 1690 | + if (getheader == 1) /* use normal (short or posix long) filename from header */ | |
| 1691 | + {
| |
| 1692 | + /* NOTE: prepends any prefix, including separator, and ensures terminated */ | |
| 1693 | + getFullName(&buffer, fname); | |
| 1694 | + } | |
| 1695 | + else /* use (GNU) long filename that preceeded this header */ | |
| 1696 | + {
| |
| 1697 | #if 0 | |
| 1698 | - /* if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) */ | |
| 1699 | - char fs[SHORTNAMESIZE]; /* force strings to same max len, then compare */ | |
| 1700 | - lstrcpyn(fs, fname, SHORTNAMESIZE); | |
| 1701 | - fs[SHORTNAMESIZE-1] = '\0'; | |
| 1702 | - buffer.header.name[SHORTNAMESIZE-1] = '\0'; | |
| 1703 | - if (lstrcmp(fs, buffer.header.name) != 0) | |
| 1704 | - {
| |
| 1705 | - PrintMessage(_T("tgz_extract: mismatched long filename"));
| |
| 1706 | - cm_cleanup(cm); | |
| 1707 | - return -1; | |
| 1708 | - } | |
| 1709 | + /* if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) */ | |
| 1710 | + char fs[SHORTNAMESIZE]; /* force strings to same max len, then compare */ | |
| 1711 | + lstrcpyn(fs, fname, SHORTNAMESIZE); | |
| 1712 | + fs[SHORTNAMESIZE-1] = '\0'; | |
| 1713 | + buffer.header.name[SHORTNAMESIZE-1] = '\0'; | |
| 1714 | + if (lstrcmp(fs, buffer.header.name) != 0) | |
| 1715 | + {
| |
| 1716 | + PrintMessage(_T("tgz_extract: mismatched long filename"));
| |
| 1717 | + cm_cleanup(cm); | |
| 1718 | + return -1; | |
| 1719 | + } | |
| 1720 | #else | |
| 1721 | - PrintMessage(_T("tgz_extract: using GNU long filename [%s]"), _A2T(fname));
| |
| 1722 | + PrintMessage(_T("tgz_extract: using GNU long filename [%s]"), _A2T(fname));
| |
| 1723 | #endif | |
| 1724 | - } | |
| 1725 | - /* LogMessage("buffer.header.name is:"); LogMessage(fname); */
| |
| 1726 | + } | |
| 1727 | + /* LogMessage("buffer.header.name is:"); LogMessage(fname); */
| |
| 1728 | ||
| 1729 | ||
| 1730 | - switch (buffer.header.typeflag) | |
| 1731 | - {
| |
| 1732 | - case DIRTYPE: | |
| 1733 | - dirEntry: | |
| 1734 | - if (!junkPaths) | |
| 1735 | - {
| |
| 1736 | - safetyStrip(fname); | |
| 1737 | - makedir(fname); | |
| 1738 | - } | |
| 1739 | - break; | |
| 1740 | - case LNKTYPE: /* hard link */ | |
| 1741 | - case CONTTYPE: /* contiguous file, for compatibility treat as normal */ | |
| 1742 | - case REGTYPE: | |
| 1743 | - case AREGTYPE: | |
| 1744 | - /* Note: a file ending with a / may actually be a BSD tar directory entry */ | |
| 1745 | - if (fname[strlen(fname)-1] == '/') | |
| 1746 | - goto dirEntry; | |
| 1747 | + switch (buffer.header.typeflag) | |
| 1748 | + {
| |
| 1749 | + case DIRTYPE: | |
| 1750 | +dirEntry: | |
| 1751 | + if (!junkPaths) | |
| 1752 | + {
| |
| 1753 | + safetyStrip(fname); | |
| 1754 | + makedir(fname); | |
| 1755 | + } | |
| 1756 | + break; | |
| 1757 | + case LNKTYPE: /* hard link */ | |
| 1758 | + case CONTTYPE: /* contiguous file, for compatibility treat as normal */ | |
| 1759 | + case REGTYPE: | |
| 1760 | + case AREGTYPE: | |
| 1761 | + /* Note: a file ending with a / may actually be a BSD tar directory entry */ | |
| 1762 | + if (fname[strlen(fname)-1] == '/') | |
| 1763 | + goto dirEntry; | |
| 1764 | ||
| 1765 | - remaining = getoct(buffer.header.size,12); | |
| 1766 | - if ( /* add (remaining > 0) && to ignore 0 zero byte files */ | |
| 1767 | - ( (iList == NULL) || (matchname(fname, iCnt, iList, junkPaths)) ) && | |
| 1768 | - (!matchname(fname, xCnt, xList, junkPaths)) | |
| 1769 | - ) | |
| 1770 | - {
| |
| 1771 | - if (!junkPaths) /* if we want to use paths as stored */ | |
| 1772 | + remaining = getoct(buffer.header.size,12); | |
| 1773 | + if ( /* add (remaining > 0) && to ignore 0 zero byte files */ | |
| 1774 | + ( (iList == NULL) || (matchname(fname, iCnt, iList, junkPaths)) ) && | |
| 1775 | + (!matchname(fname, xCnt, xList, junkPaths)) | |
| 1776 | + ) | |
| 1777 | + {
| |
| 1778 | + if (!junkPaths) /* if we want to use paths as stored */ | |
| 1779 | {
| |
| 1780 | - /* try creating directory */ | |
| 1781 | - char *p = strrchr(fname, '/'); | |
| 1782 | - if (p != NULL) | |
| 1783 | - {
| |
| 1784 | - *p = '\0'; | |
| 1785 | - makedir(fname); | |
| 1786 | - *p = '/'; | |
| 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 | } | |
| 1797 | - else | |
| 1798 | + else | |
| 1799 | {
| |
| 1800 | - /* try ignoring directory */ | |
| 1801 | - char *p = strrchr(fname, '/'); | |
| 1802 | - if (p != NULL) | |
| 1803 | - {
| |
| 1804 | - /* be sure terminating '\0' is copied and */ | |
| 1805 | - /* use ansi memcpy equivalent that handles overlapping regions */ | |
| 1806 | - MoveMemory(fname, p+1, strlen(p+1) + 1 ); | |
| 1807 | - } | |
| 1808 | - } | |
| 1809 | - if (*fname) /* if after stripping path a fname still exists */ | |
| 1810 | - {
| |
| 1811 | - /* Attempt to open the output file and report action taken to user */ | |
| 1812 | - const TCHAR szERRMsg[] = _T("Error: Could not create file "),
| |
| 1813 | - szSUCMsg[] = _T("Writing "),
| |
| 1814 | - szSKPMsg[] = _T("Skipping ");
| |
| 1815 | - const TCHAR * szMsg = szSUCMsg; | |
| 1816 | + /* try ignoring directory */ | |
| 1817 | + char *p = strrchr(fname, '/'); | |
| 1818 | + if (p != NULL) | |
| 1819 | + {
| |
| 1820 | + /* be sure terminating '\0' is copied and */ | |
| 1821 | + /* use ansi memcpy equivalent that handles overlapping regions */ | |
| 1822 | + MoveMemory(fname, p+1, strlen(p+1) + 1 ); | |
| 1823 | + } | |
| 1824 | + } | |
| 1825 | + if (*fname) /* if after stripping path a fname still exists */ | |
| 1826 | + {
| |
| 1827 | + /* Attempt to open the output file and report action taken to user */ | |
| 1828 | + const TCHAR szERRMsg[] = _T("Error: Could not create file "),
| |
| 1829 | + szSUCMsg[] = _T("Writing "),
| |
| 1830 | + szSKPMsg[] = _T("Skipping ");
| |
| 1831 | + const TCHAR * szMsg = szSUCMsg; | |
| 1832 | ||
| 1833 | - safetyStrip(fname); | |
| 1834 | + safetyStrip(fname); | |
| 1835 | ||
| 1836 | - if (buffer.header.typeflag == LNKTYPE) | |
| 1837 | - {
| |
| 1838 | - outfile = INVALID_HANDLE_VALUE; | |
| 1839 | - /* create a hardlink if possible, else produce just a warning unless failOnHardLinks is true */ | |
| 1840 | - if (!MakeHardLink(fname, buffer.header.linkname)) | |
| 1841 | - {
| |
| 1842 | - PrintMessage(_T("Warning: unable to create hard link %s [%d]"), _A2T(fname), GetLastError());
| |
| 1843 | - if (failOnHardLinks) | |
| 1844 | + if (buffer.header.typeflag == LNKTYPE) | |
| 1845 | {
| |
| 1846 | - cm_cleanup(cm); | |
| 1847 | - return -3; | |
| 1848 | + outfile = INVALID_HANDLE_VALUE; | |
| 1849 | + /* create a hardlink if possible, else produce just a warning unless failOnHardLinks is true */ | |
| 1850 | + if (!MakeHardLink(fname, buffer.header.linkname)) | |
| 1851 | + {
| |
| 1852 | + PrintMessage(_T("Warning: unable to create hard link %s [%d]"), _A2T(fname), GetLastError());
| |
| 1853 | + if (failOnHardLinks) | |
| 1854 | + {
| |
| 1855 | + cm_cleanup(cm); | |
| 1856 | + return -3; | |
| 1857 | + } | |
| 1858 | + } | |
| 1859 | + else | |
| 1860 | + {
| |
| 1861 | + outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); | |
| 1862 | + goto setTimeAndCloseFile; | |
| 1863 | + } | |
| 1864 | + } else | |
| 1865 | + {
| |
| 1866 | + /* Open the file for writing mode, creating if doesn't exist and truncating if exists and overwrite mode */ | |
| 1867 | + outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,(keep==OVERWRITE)?CREATE_ALWAYS:CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); | |
| 1868 | + | |
| 1869 | + /* failed to open file, either valid error (like open) or it already exists and in a keep mode */ | |
| 1870 | + if (outfile == INVALID_HANDLE_VALUE) | |
| 1871 | + {
| |
| 1872 | + /* if skip existing or only update existing and failed to open becauses exists */ | |
| 1873 | + if ((keep!=OVERWRITE) && (GetLastError()==ERROR_FILE_EXISTS)) | |
| 1874 | + {
| |
| 1875 | + /* assume skipping initially (mode==SKIP or ==UPDATE with existing file newer) */ | |
| 1876 | + szMsg = szSKPMsg; /* and update output message accordingly */ | |
| 1877 | + | |
| 1878 | + /* if in update mode, check filetimes and reopen in overwrite mode */ | |
| 1879 | + if (keep == UPDATE) | |
| 1880 | + {
| |
| 1881 | + FILETIME ftm_a; | |
| 1882 | + HANDLE h; | |
| 1883 | + WIN32_FIND_DATAA ffData; | |
| 1884 | + | |
| 1885 | + cnv_tar2win_time(tartime, &ftm_a); /* archive file time */ | |
| 1886 | + h = FindFirstFileA(fname, &ffData); /* existing file time */ | |
| 1887 | + | |
| 1888 | + if (h!=INVALID_HANDLE_VALUE) | |
| 1889 | + FindClose(h); /* cleanup search handle */ | |
| 1890 | + else | |
| 1891 | + goto ERR_OPENING; | |
| 1892 | + | |
| 1893 | + /* compare date+times, is one in tarball newer? */ | |
| 1894 | + if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime))) | |
| 1895 | + {
| |
| 1896 | + outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); | |
| 1897 | + if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING; | |
| 1898 | + szMsg = szSUCMsg; | |
| 1899 | + } | |
| 1900 | + } | |
| 1901 | + } | |
| 1902 | + else /* in overwrite mode or failed for some other error than exists */ | |
| 1903 | + {
| |
| 1904 | +ERR_OPENING: | |
| 1905 | + PrintMessage(_T("%s%s [%d]"), szERRMsg, _A2T(fname), GetLastError());
| |
| 1906 | + cm_cleanup(cm); | |
| 1907 | + return -2; | |
| 1908 | + } | |
| 1909 | + } | |
| 1910 | + | |
| 1911 | + /* Inform user of current extraction action (writing, skipping file XYZ) */ | |
| 1912 | + PrintMessage(_T("%s%s"), szMsg, _A2T(fname));
| |
| 1913 | + PrintProgressionBar(bytesReadSofar, totalSize); // Ajout de GB | |
| 1914 | } | |
| 1915 | } | |
| 1916 | - else | |
| 1917 | + } | |
| 1918 | + else | |
| 1919 | + outfile = INVALID_HANDLE_VALUE; | |
| 1920 | + | |
| 1921 | + /* | |
| 1922 | + * could have no contents, in which case we close the file and set the times | |
| 1923 | + */ | |
| 1924 | + if (remaining > 0) | |
| 1925 | + getheader = 0; | |
| 1926 | + else | |
| 1927 | + {
| |
| 1928 | +setTimeAndCloseFile: | |
| 1929 | + getheader = 1; | |
| 1930 | + if (outfile != INVALID_HANDLE_VALUE) | |
| 1931 | {
| |
| 1932 | - outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); | |
| 1933 | - goto setTimeAndCloseFile; | |
| 1934 | + FILETIME ftm; | |
| 1935 | + | |
| 1936 | + cnv_tar2win_time(tartime, &ftm); | |
| 1937 | + SetFileTime(outfile,&ftm,NULL,&ftm); | |
| 1938 | + CloseHandle(outfile); | |
| 1939 | + outfile = INVALID_HANDLE_VALUE; | |
| 1940 | } | |
| 1941 | - } else | |
| 1942 | + } | |
| 1943 | + | |
| 1944 | + break; | |
| 1945 | + case GNUTYPE_LONGLINK: | |
| 1946 | + case GNUTYPE_LONGNAME: | |
| 1947 | {
| |
| 1948 | - /* Open the file for writing mode, creating if doesn't exist and truncating if exists and overwrite mode */ | |
| 1949 | - outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,(keep==OVERWRITE)?CREATE_ALWAYS:CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL); | |
| 1950 | + remaining = getoct(buffer.header.size,12); | |
| 1951 | + if (readBlock(cm, fname, &bytesReadThisTime) < 0) return -1; | |
| 1952 | + fname[BLOCKSIZE-1] = '\0'; | |
| 1953 | + if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining)) | |
| 1954 | + {
| |
| 1955 | + PrintMessage(_T("tgz_extract: invalid long name"));
| |
| 1956 | + cm_cleanup(cm); | |
| 1957 | + return -1; | |
| 1958 | + } | |
| 1959 | + getheader = 2; | |
| 1960 | + break; | |
| 1961 | + } | |
| 1962 | + default: | |
| 1963 | + /* | |
| 1964 | + if (action == TGZ_LIST) | |
| 1965 | + printf(" %s <---> %s\n",strtime(&tartime),fname);
| |
| 1966 | + */ | |
| 1967 | + break; | |
| 1968 | + } | |
| 1969 | + } | |
| 1970 | + else /* (getheader == 0) */ | |
| 1971 | + {
| |
| 1972 | + unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining; | |
| 1973 | + unsigned long bwritten; | |
| 1974 | ||
| 1975 | - /* failed to open file, either valid error (like open) or it already exists and in a keep mode */ | |
| 1976 | - if (outfile == INVALID_HANDLE_VALUE) | |
| 1977 | - {
| |
| 1978 | - /* if skip existing or only update existing and failed to open becauses exists */ | |
| 1979 | - if ((keep!=OVERWRITE) && (GetLastError()==ERROR_FILE_EXISTS)) | |
| 1980 | - {
| |
| 1981 | - /* assume skipping initially (mode==SKIP or ==UPDATE with existing file newer) */ | |
| 1982 | - szMsg = szSKPMsg; /* and update output message accordingly */ | |
| 1983 | + if (outfile != INVALID_HANDLE_VALUE) | |
| 1984 | + {
| |
| 1985 | + WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL); | |
| 1986 | + if (bwritten != bytes) | |
| 1987 | + {
| |
| 1988 | + PrintMessage(_T("Error: write failed for %s"), _A2T(fname));
| |
| 1989 | + CloseHandle(outfile); | |
| 1990 | + DeleteFileA(fname); | |
| 1991 | ||
| 1992 | - /* if in update mode, check filetimes and reopen in overwrite mode */ | |
| 1993 | - if (keep == UPDATE) | |
| 1994 | - {
| |
| 1995 | - FILETIME ftm_a; | |
| 1996 | - HANDLE h; | |
| 1997 | - WIN32_FIND_DATAA ffData; | |
| 1998 | - | |
| 1999 | - cnv_tar2win_time(tartime, &ftm_a); /* archive file time */ | |
| 2000 | - h = FindFirstFileA(fname, &ffData); /* existing file time */ | |
| 2001 | + cm_cleanup(cm); | |
| 2002 | + return -2; | |
| 2003 | + } | |
| 2004 | + } | |
| 2005 | + remaining -= bytes; | |
| 2006 | + if (remaining == 0) goto setTimeAndCloseFile; | |
| 2007 | + } | |
| 2008 | + } /* while(1) */ | |
| 2009 | ||
| 2010 | - if (h!=INVALID_HANDLE_VALUE) | |
| 2011 | - FindClose(h); /* cleanup search handle */ | |
| 2012 | - else | |
| 2013 | - goto ERR_OPENING; | |
| 2014 | + cm_cleanup(cm); | |
| 2015 | ||
| 2016 | - /* compare date+times, is one in tarball newer? */ | |
| 2017 | - if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime))) | |
| 2018 | - {
| |
| 2019 | - outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); | |
| 2020 | - if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING; | |
| 2021 | - szMsg = szSUCMsg; | |
| 2022 | - } | |
| 2023 | - } | |
| 2024 | - } | |
| 2025 | - else /* in overwrite mode or failed for some other error than exists */ | |
| 2026 | - {
| |
| 2027 | - ERR_OPENING: | |
| 2028 | - PrintMessage(_T("%s%s [%d]"), szERRMsg, _A2T(fname), GetLastError());
| |
| 2029 | - cm_cleanup(cm); | |
| 2030 | - return -2; | |
| 2031 | - } | |
| 2032 | - } | |
| 2033 | - | |
| 2034 | - /* Inform user of current extraction action (writing, skipping file XYZ) */ | |
| 2035 | - PrintMessage(_T("%s%s"), szMsg, _A2T(fname));
| |
| 2036 | - } | |
| 2037 | - } | |
| 2038 | - } | |
| 2039 | - else | |
| 2040 | - outfile = INVALID_HANDLE_VALUE; | |
| 2041 | - | |
| 2042 | - /* | |
| 2043 | - * could have no contents, in which case we close the file and set the times | |
| 2044 | - */ | |
| 2045 | - if (remaining > 0) | |
| 2046 | - getheader = 0; | |
| 2047 | - else | |
| 2048 | - {
| |
| 2049 | - setTimeAndCloseFile: | |
| 2050 | - getheader = 1; | |
| 2051 | - if (outfile != INVALID_HANDLE_VALUE) | |
| 2052 | - {
| |
| 2053 | - FILETIME ftm; | |
| 2054 | - | |
| 2055 | - cnv_tar2win_time(tartime, &ftm); | |
| 2056 | - SetFileTime(outfile,&ftm,NULL,&ftm); | |
| 2057 | - CloseHandle(outfile); | |
| 2058 | - outfile = INVALID_HANDLE_VALUE; | |
| 2059 | - } | |
| 2060 | - } | |
| 2061 | - | |
| 2062 | - break; | |
| 2063 | - case GNUTYPE_LONGLINK: | |
| 2064 | - case GNUTYPE_LONGNAME: | |
| 2065 | - {
| |
| 2066 | - remaining = getoct(buffer.header.size,12); | |
| 2067 | - if (readBlock(cm, fname) < 0) return -1; | |
| 2068 | - fname[BLOCKSIZE-1] = '\0'; | |
| 2069 | - if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining)) | |
| 2070 | - {
| |
| 2071 | - PrintMessage(_T("tgz_extract: invalid long name"));
| |
| 2072 | - cm_cleanup(cm); | |
| 2073 | - return -1; | |
| 2074 | - } | |
| 2075 | - getheader = 2; | |
| 2076 | - break; | |
| 2077 | - } | |
| 2078 | - default: | |
| 2079 | -/* | |
| 2080 | - if (action == TGZ_LIST) | |
| 2081 | - printf(" %s <---> %s\n",strtime(&tartime),fname);
| |
| 2082 | -*/ | |
| 2083 | - break; | |
| 2084 | - } | |
| 2085 | - } | |
| 2086 | - else /* (getheader == 0) */ | |
| 2087 | - {
| |
| 2088 | - unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining; | |
| 2089 | - unsigned long bwritten; | |
| 2090 | - | |
| 2091 | - if (outfile != INVALID_HANDLE_VALUE) | |
| 2092 | - {
| |
| 2093 | - WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL); | |
| 2094 | - if (bwritten != bytes) | |
| 2095 | - {
| |
| 2096 | - PrintMessage(_T("Error: write failed for %s"), _A2T(fname));
| |
| 2097 | - CloseHandle(outfile); | |
| 2098 | - DeleteFileA(fname); | |
| 2099 | - | |
| 2100 | - cm_cleanup(cm); | |
| 2101 | - return -2; | |
| 2102 | - } | |
| 2103 | - } | |
| 2104 | - remaining -= bytes; | |
| 2105 | - if (remaining == 0) goto setTimeAndCloseFile; | |
| 2106 | - } | |
| 2107 | - } /* while(1) */ | |
| 2108 | - | |
| 2109 | - cm_cleanup(cm); | |
| 2110 | - | |
| 2111 | - return 0; | |
| 2112 | + return 0; | |
| 2113 | } | |
| 2114 | ||
| 2115 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untar.h | |
| 2116 | --- a/common/windows/nsis/plugins/untgz/untar.h Wed Nov 21 10:28:12 2012 +0100 | |
| 2117 | +++ b/common/windows/nsis/plugins/untgz/untar.h Wed Nov 21 10:34:41 2012 +0100 | |
| 2118 | @@ -43,7 +43,7 @@ | |
| 2119 | }; | |
| 2120 | ||
| 2121 | /* actual extraction routine */ | |
| 2122 | -int tgz_extract(gzFile tgzFile, int cm, int junkPaths, enum KeepMode keep, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks); | |
| 2123 | +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); | |
| 2124 | ||
| 2125 | /* recursive make directory */ | |
| 2126 | /* abort if you get an ENOENT errno somewhere in the middle */ | |
| 2127 | @@ -95,6 +95,7 @@ | |
| 2128 | ||
| 2129 | /* uses filename & file contents and returns best guess of file type CM_* */ | |
| 2130 | int getFileType(const char *fname); | |
| 2131 | +unsigned long getFileSize(const char *fname); | |
| 2132 | ||
| 2133 | ||
| 2134 | /* !!!USER SUPPLIED!!! */ | |
| 2135 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untgz.cpp | |
| 2136 | --- a/common/windows/nsis/plugins/untgz/untgz.cpp Wed Nov 21 10:28:12 2012 +0100 | |
| 2137 | +++ b/common/windows/nsis/plugins/untgz/untgz.cpp Wed Nov 21 10:34:41 2012 +0100 | |
| 2138 | @@ -116,6 +116,7 @@ | |
| 2139 | ||
| 2140 | HWND g_hwndParent; | |
| 2141 | HWND g_hwndList; | |
| 2142 | +HWND g_hwndProgressBar; | |
| 2143 | ||
| 2144 | ||
| 2145 | // DLL entry point | |
| 2146 | @@ -194,7 +195,7 @@ | |
| 2147 | ||
| 2148 | ||
| 2149 | void argParse(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop, | |
| 2150 | - TCHAR *cmd, TCHAR *cmdline, gzFile *tgzFile, int *compressionMethod, | |
| 2151 | + TCHAR *cmd, TCHAR *cmdline, gzFile *tgzFile, int *compressionMethod, unsigned long *fileSize, | |
| 2152 | int *junkPaths, enum KeepMode *keep, TCHAR *basePath, int *failOnHardLinks) | |
| 2153 | {
| |
| 2154 | TCHAR buf[1024]; /* used for argument processor or other temp buffer */ | |
| 2155 | @@ -216,6 +217,7 @@ | |
| 2156 | /* initialize optional arguments to their general defaults */ | |
| 2157 | *tgzFile = 0; | |
| 2158 | *compressionMethod = CM_AUTO; | |
| 2159 | + *fileSize = 0; | |
| 2160 | *failOnHardLinks = 0; /* default to warn only */ | |
| 2161 | *keep = OVERWRITE; | |
| 2162 | *junkPaths = 0; /* keep path information by default */ | |
| 2163 | @@ -282,6 +284,8 @@ | |
| 2164 | _tcscat(cmdline, buf); | |
| 2165 | _tcscat(cmdline, _T("' "));
| |
| 2166 | ||
| 2167 | + *fileSize = getFileSize(_T2A(buf)); | |
| 2168 | + | |
| 2169 | /* if auto type specified then determine type */ | |
| 2170 | if (*compressionMethod == CM_AUTO) | |
| 2171 | *compressionMethod = getFileType(_T2A(buf)); | |
| 2172 | @@ -334,6 +338,7 @@ | |
| 2173 | TCHAR cmdline[1024]; /* just used to display to user */ | |
| 2174 | int junkPaths; /* default to extracting with paths -- highly insecure */ | |
| 2175 | int compressionMethod; /* gzip or other compressed tar file */ | |
| 2176 | + unsigned long fileSize; | |
| 2177 | int failOnHardLinks; | |
| 2178 | enum KeepMode keep; /* overwrite mode */ | |
| 2179 | gzFile tgzFile = NULL; /* the opened tarball (assuming argParse returns successfully) */ | |
| 2180 | @@ -345,7 +350,7 @@ | |
| 2181 | ||
| 2182 | /* do common stuff including parsing arguments up to filename to extract */ | |
| 2183 | argParse(hwndParent, string_size, variables, stacktop, | |
| 2184 | - funcName[mode], cmdline, &tgzFile, &compressionMethod, &junkPaths, &keep, NULL, &failOnHardLinks); | |
| 2185 | + funcName[mode], cmdline, &tgzFile, &compressionMethod, &fileSize, &junkPaths, &keep, NULL, &failOnHardLinks); | |
| 2186 | ||
| 2187 | /* check if everything up to now processed ok, exit if not */ | |
| 2188 | if (_tcscmp(getuservariable(INST_R0), ERR_SUCCESS) != 0) return; | |
| 2189 | @@ -417,10 +422,10 @@ | |
| 2190 | ||
| 2191 | ||
| 2192 | /* show user cmdline */ | |
| 2193 | - PrintMessage(cmdline); | |
| 2194 | + //Non user friendly PrintMessage(cmdline); | |
| 2195 | ||
| 2196 | /* actually perform the extraction */ | |
| 2197 | - if ((result = tgz_extract(tgzFile, compressionMethod, junkPaths, keep, iCnt, iList, xCnt, xList, failOnHardLinks)) < 0) | |
| 2198 | + if ((result = tgz_extract(tgzFile, compressionMethod, junkPaths, keep, fileSize, iCnt, iList, xCnt, xList, failOnHardLinks)) < 0) | |
| 2199 | {
| |
| 2200 | switch (result) | |
| 2201 | {
| |
| 2202 | diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untgz.dll | |
| 2203 | Binary file common/windows/nsis/plugins/untgz/untgz.dll has changed |