commit 992985114082d053ded432b72b3302b938442932 Author: Robert McGovern Date: Tue Nov 10 16:48:42 2009 +0100 Adding initial files which contains the unrar.3.9.6 sources and a patch for the Makefile diff --git a/English.lproj/InfoPlist.strings b/English.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/English.lproj/MainMenu.xib b/English.lproj/MainMenu.xib new file mode 100644 index 0000000..5fd2812 --- /dev/null +++ b/English.lproj/MainMenu.xib @@ -0,0 +1,4119 @@ + + + + 1060 + 10A324 + 719 + 1015 + 418.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 719 + + + YES + + + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + YES + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + QuietUnrar + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + QuietUnrar + + YES + + + About QuietUnrar + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide QuietUnrar + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit QuietUnrar + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + YES + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + YES + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + QuietUnrar Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + 15 + 2 + {{335, 390}, {480, 360}} + 1954021376 + QuietUnrar + NSWindow + + {1.79769e+308, 1.79769e+308} + + + 256 + {480, 360} + + + {{0, 0}, {1920, 1178}} + {1.79769e+308, 1.79769e+308} + + + QuietUnrarAppDelegate + + + NSFontManager + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + terminate: + + + + 449 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + delegate + + + + 495 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + window + + + + 532 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + + + 80 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + YES + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + YES + + + + + + 451 + + + YES + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + YES + + + + + + 491 + + + YES + + + + + + 492 + + + + + 494 + + + + + 496 + + + YES + + + + + + 497 + + + YES + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + YES + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + YES + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + + + YES + + YES + -3.IBPluginDependency + 112.IBPluginDependency + 112.ImportedFromIB2 + 124.IBPluginDependency + 124.ImportedFromIB2 + 125.IBPluginDependency + 125.ImportedFromIB2 + 125.editorWindowContentRectSynchronizationRect + 126.IBPluginDependency + 126.ImportedFromIB2 + 129.IBPluginDependency + 129.ImportedFromIB2 + 130.IBPluginDependency + 130.ImportedFromIB2 + 130.editorWindowContentRectSynchronizationRect + 131.IBPluginDependency + 131.ImportedFromIB2 + 134.IBPluginDependency + 134.ImportedFromIB2 + 136.IBPluginDependency + 136.ImportedFromIB2 + 143.IBPluginDependency + 143.ImportedFromIB2 + 144.IBPluginDependency + 144.ImportedFromIB2 + 145.IBPluginDependency + 145.ImportedFromIB2 + 149.IBPluginDependency + 149.ImportedFromIB2 + 150.IBPluginDependency + 150.ImportedFromIB2 + 19.IBPluginDependency + 19.ImportedFromIB2 + 195.IBPluginDependency + 195.ImportedFromIB2 + 196.IBPluginDependency + 196.ImportedFromIB2 + 197.IBPluginDependency + 197.ImportedFromIB2 + 198.IBPluginDependency + 198.ImportedFromIB2 + 199.IBPluginDependency + 199.ImportedFromIB2 + 200.IBEditorWindowLastContentRect + 200.IBPluginDependency + 200.ImportedFromIB2 + 200.editorWindowContentRectSynchronizationRect + 201.IBPluginDependency + 201.ImportedFromIB2 + 202.IBPluginDependency + 202.ImportedFromIB2 + 203.IBPluginDependency + 203.ImportedFromIB2 + 204.IBPluginDependency + 204.ImportedFromIB2 + 205.IBEditorWindowLastContentRect + 205.IBPluginDependency + 205.ImportedFromIB2 + 205.editorWindowContentRectSynchronizationRect + 206.IBPluginDependency + 206.ImportedFromIB2 + 207.IBPluginDependency + 207.ImportedFromIB2 + 208.IBPluginDependency + 208.ImportedFromIB2 + 209.IBPluginDependency + 209.ImportedFromIB2 + 210.IBPluginDependency + 210.ImportedFromIB2 + 211.IBPluginDependency + 211.ImportedFromIB2 + 212.IBPluginDependency + 212.ImportedFromIB2 + 212.editorWindowContentRectSynchronizationRect + 213.IBPluginDependency + 213.ImportedFromIB2 + 214.IBPluginDependency + 214.ImportedFromIB2 + 215.IBPluginDependency + 215.ImportedFromIB2 + 216.IBPluginDependency + 216.ImportedFromIB2 + 217.IBPluginDependency + 217.ImportedFromIB2 + 218.IBPluginDependency + 218.ImportedFromIB2 + 219.IBPluginDependency + 219.ImportedFromIB2 + 220.IBEditorWindowLastContentRect + 220.IBPluginDependency + 220.ImportedFromIB2 + 220.editorWindowContentRectSynchronizationRect + 221.IBPluginDependency + 221.ImportedFromIB2 + 23.IBPluginDependency + 23.ImportedFromIB2 + 236.IBPluginDependency + 236.ImportedFromIB2 + 239.IBPluginDependency + 239.ImportedFromIB2 + 24.IBEditorWindowLastContentRect + 24.IBPluginDependency + 24.ImportedFromIB2 + 24.editorWindowContentRectSynchronizationRect + 29.IBEditorWindowLastContentRect + 29.IBPluginDependency + 29.ImportedFromIB2 + 29.WindowOrigin + 29.editorWindowContentRectSynchronizationRect + 295.IBPluginDependency + 296.IBEditorWindowLastContentRect + 296.IBPluginDependency + 296.editorWindowContentRectSynchronizationRect + 297.IBPluginDependency + 298.IBPluginDependency + 346.IBPluginDependency + 346.ImportedFromIB2 + 348.IBPluginDependency + 348.ImportedFromIB2 + 349.IBEditorWindowLastContentRect + 349.IBPluginDependency + 349.ImportedFromIB2 + 349.editorWindowContentRectSynchronizationRect + 350.IBPluginDependency + 350.ImportedFromIB2 + 351.IBPluginDependency + 351.ImportedFromIB2 + 354.IBPluginDependency + 354.ImportedFromIB2 + 371.IBEditorWindowLastContentRect + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 371.windowTemplate.maxSize + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 450.IBPluginDependency + 451.IBEditorWindowLastContentRect + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 457.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 462.IBPluginDependency + 465.IBPluginDependency + 466.IBPluginDependency + 485.IBPluginDependency + 490.IBPluginDependency + 491.IBEditorWindowLastContentRect + 491.IBPluginDependency + 492.IBPluginDependency + 496.IBPluginDependency + 497.IBEditorWindowLastContentRect + 497.IBPluginDependency + 498.IBPluginDependency + 499.IBPluginDependency + 5.IBPluginDependency + 5.ImportedFromIB2 + 500.IBPluginDependency + 501.IBPluginDependency + 502.IBPluginDependency + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 506.IBPluginDependency + 507.IBPluginDependency + 508.IBEditorWindowLastContentRect + 508.IBPluginDependency + 509.IBPluginDependency + 510.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 513.IBPluginDependency + 514.IBPluginDependency + 515.IBPluginDependency + 516.IBPluginDependency + 517.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.IBEditorWindowLastContentRect + 81.IBPluginDependency + 81.ImportedFromIB2 + 81.editorWindowContentRectSynchronizationRect + 82.IBPluginDependency + 82.ImportedFromIB2 + 83.IBPluginDependency + 83.ImportedFromIB2 + 92.IBPluginDependency + 92.ImportedFromIB2 + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{522, 812}, {146, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{436, 809}, {64, 6}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{753, 187}, {275, 113}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {275, 83}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{547, 180}, {254, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{187, 434}, {243, 243}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {167, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{753, 217}, {238, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {241, 103}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{654, 239}, {194, 73}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{525, 802}, {197, 73}} + {{380, 836}, {512, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + + {74, 862} + {{6, 978}, {478, 20}} + com.apple.InterfaceBuilder.CocoaPlugin + {{604, 269}, {231, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + {{475, 832}, {234, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{746, 287}, {220, 133}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{608, 612}, {215, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{380, 496}, {480, 360}} + com.apple.InterfaceBuilder.CocoaPlugin + {{380, 496}, {480, 360}} + + {{33, 99}, {480, 360}} + {3.40282e+38, 3.40282e+38} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{591, 420}, {83, 43}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{523, 2}, {178, 283}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{753, 197}, {170, 63}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{725, 289}, {246, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{674, 260}, {204, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{878, 180}, {164, 173}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + {{286, 129}, {275, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{23, 794}, {245, 183}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + {{452, 109}, {196, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + {{145, 474}, {199, 203}} + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + + + + + YES + + + YES + + + + + YES + + + YES + + + + 532 + + + + YES + + QuietUnrarAppDelegate + NSObject + + window + NSWindow + + + IBProjectSource + QuietUnrarAppDelegate.h + + + + + YES + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSApplicationScripting.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSColorPanel.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSHelpManager.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSPageLayout.h + + + + NSApplication + + IBFrameworkSource + AppKit.framework/Headers/NSUserInterfaceItemSearching.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocument + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentScripting.h + + + + NSDocumentController + NSObject + + YES + + YES + clearRecentDocuments: + newDocument: + openDocument: + saveAllDocuments: + + + YES + id + id + id + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFontManager + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontManager.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSAccessibility.h + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDictionaryController.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSDragging.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSFontPanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSKeyValueBinding.h + + + + NSObject + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSNibLoading.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSOutlineView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSPasteboard.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSSavePanel.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSToolbarItem.h + + + + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSError.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFileManager.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyValueObserving.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSKeyedArchiver.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObject.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSObjectScripting.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSPortCoder.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSRunLoop.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptClassDescription.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptKeyValueCoding.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptObjectSpecifiers.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSScriptWhoseTests.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSThread.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURL.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLConnection.h + + + + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSURLDownload.h + + + + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSInterfaceStyle.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSClipView.h + + + + NSView + + + + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSRulerView.h + + + + NSView + NSResponder + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSDrawer.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + NSWindow + + IBFrameworkSource + AppKit.framework/Headers/NSWindowScripting.h + + + + + 0 + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + ../QuietUnrar.xcodeproj + 3 + + diff --git a/QuietUnrar-Info.plist b/QuietUnrar-Info.plist new file mode 100644 index 0000000..1766c04 --- /dev/null +++ b/QuietUnrar-Info.plist @@ -0,0 +1,281 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + rar + r00 + r01 + r02 + r03 + r04 + r05 + r06 + r07 + r08 + r09 + r10 + r11 + r12 + r13 + r14 + r15 + r16 + r17 + r18 + r19 + r20 + r21 + r22 + r23 + r24 + r25 + r26 + r27 + r28 + r29 + r30 + r31 + r32 + r33 + r34 + r35 + r36 + r37 + r38 + r39 + r40 + r41 + r42 + r43 + r44 + r45 + r46 + r47 + r48 + r49 + r50 + r51 + r52 + r53 + r54 + r55 + r56 + r57 + r58 + r59 + r60 + r61 + r62 + r63 + r64 + r65 + r66 + r67 + r68 + r69 + r70 + r71 + r72 + r73 + r74 + r75 + r76 + r77 + r78 + r79 + r80 + r81 + r82 + r83 + r84 + r85 + r86 + r87 + r88 + r89 + r90 + r91 + r92 + r93 + r94 + r95 + r96 + r97 + r98 + r99 + + CFBundleTypeIconFile + + CFBundleTypeName + RAR Archive + CFBundleTypeRole + Viewer + LSItemContentTypes + + com.rarlab.rar-archive + + NSDocumentClass + ZipDocument + + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.yourcompany.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + UTImportedTypeDeclarations + + + UTTypeConformsTo + + public.data + public.archive + + UTTypeDescription + RAR Archive + UTTypeIconFile + RAR + UTTypeIdentifier + com.rarlab.rar-archive + UTTypeTagSpecification + + public.filename-extension + + rar + r00 + r01 + r02 + r03 + r04 + r05 + r06 + r07 + r08 + r09 + r10 + r11 + r12 + r13 + r14 + r15 + r16 + r17 + r18 + r19 + r20 + r21 + r22 + r23 + r24 + r25 + r26 + r27 + r28 + r29 + r30 + r31 + r32 + r33 + r34 + r35 + r36 + r37 + r38 + r39 + r40 + r41 + r42 + r43 + r44 + r45 + r46 + r47 + r48 + r49 + r50 + r51 + r52 + r53 + r54 + r55 + r56 + r57 + r58 + r59 + r60 + r61 + r62 + r63 + r64 + r65 + r66 + r67 + r68 + r69 + r70 + r71 + r72 + r73 + r74 + r75 + r76 + r77 + r78 + r79 + r80 + r81 + r82 + r83 + r84 + r85 + r86 + r87 + r88 + r89 + r90 + r91 + r92 + r93 + r94 + r95 + r96 + r97 + r98 + r99 + + public.mime-type + + application/x-rar + application/x-rar-compressed + + + + + + diff --git a/QuietUnrar.xcodeproj/project.pbxproj b/QuietUnrar.xcodeproj/project.pbxproj new file mode 100644 index 0000000..d8096c3 --- /dev/null +++ b/QuietUnrar.xcodeproj/project.pbxproj @@ -0,0 +1,610 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 256AC3DA0F4B6AC300CF3369 /* QuietUnrarAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */; }; + 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + D4A49691105435BE00BE38AE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; + D4A49692105435C100BE38AE /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; }; + D4A96E2110545E9A0091ECB4 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4A96E2010545E9A0091ECB4 /* Carbon.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + D4A4964C10541CFF00BE38AE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = D4A4962A105419AA00BE38AE; + remoteInfo = libunrar; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + D4A4965210541D2600BE38AE /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 7; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; + 1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; + 256AC3D80F4B6AC300CF3369 /* QuietUnrarAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuietUnrarAppDelegate.h; sourceTree = ""; }; + 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuietUnrarAppDelegate.m; sourceTree = ""; }; + 256AC3F00F4B6AF500CF3369 /* QuietUnrar_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuietUnrar_Prefix.pch; sourceTree = ""; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; + 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* QuietUnrar-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "QuietUnrar-Info.plist"; sourceTree = ""; }; + 8D1107320486CEB800E47090 /* QuietUnrar.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = QuietUnrar.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D4A495741054177300BE38AE /* arccmt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arccmt.cpp; path = libunrar/arccmt.cpp; sourceTree = ""; }; + D4A495751054177300BE38AE /* archive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = archive.cpp; path = libunrar/archive.cpp; sourceTree = ""; }; + D4A495761054177300BE38AE /* archive.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = archive.hpp; path = libunrar/archive.hpp; sourceTree = ""; }; + D4A495771054177300BE38AE /* arcread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = arcread.cpp; path = libunrar/arcread.cpp; sourceTree = ""; }; + D4A495781054177300BE38AE /* array.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = array.hpp; path = libunrar/array.hpp; sourceTree = ""; }; + D4A495791054177300BE38AE /* beosea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = beosea.cpp; path = libunrar/beosea.cpp; sourceTree = ""; }; + D4A4957A1054177300BE38AE /* cmddata.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cmddata.cpp; path = libunrar/cmddata.cpp; sourceTree = ""; }; + D4A4957B1054177300BE38AE /* cmddata.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = cmddata.hpp; path = libunrar/cmddata.hpp; sourceTree = ""; }; + D4A4957C1054177300BE38AE /* coder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = coder.cpp; path = libunrar/coder.cpp; sourceTree = ""; }; + D4A4957D1054177300BE38AE /* coder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = coder.hpp; path = libunrar/coder.hpp; sourceTree = ""; }; + D4A4957E1054177300BE38AE /* compress.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = compress.hpp; path = libunrar/compress.hpp; sourceTree = ""; }; + D4A4957F1054177300BE38AE /* consio.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = consio.cpp; path = libunrar/consio.cpp; sourceTree = ""; }; + D4A495801054177300BE38AE /* consio.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = consio.hpp; path = libunrar/consio.hpp; sourceTree = ""; }; + D4A495811054177300BE38AE /* crc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = crc.cpp; path = libunrar/crc.cpp; sourceTree = ""; }; + D4A495821054177300BE38AE /* crc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = crc.hpp; path = libunrar/crc.hpp; sourceTree = ""; }; + D4A495831054177300BE38AE /* crypt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = crypt.cpp; path = libunrar/crypt.cpp; sourceTree = ""; }; + D4A495841054177300BE38AE /* crypt.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = crypt.hpp; path = libunrar/crypt.hpp; sourceTree = ""; }; + D4A495851054177300BE38AE /* dll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = dll.cpp; path = libunrar/dll.cpp; sourceTree = ""; }; + D4A495861054177300BE38AE /* dll.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = dll.hpp; path = libunrar/dll.hpp; sourceTree = ""; }; + D4A495871054177300BE38AE /* encname.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = encname.cpp; path = libunrar/encname.cpp; sourceTree = ""; }; + D4A495881054177300BE38AE /* encname.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = encname.hpp; path = libunrar/encname.hpp; sourceTree = ""; }; + D4A495891054177300BE38AE /* errhnd.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = errhnd.cpp; path = libunrar/errhnd.cpp; sourceTree = ""; }; + D4A4958A1054177300BE38AE /* errhnd.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = errhnd.hpp; path = libunrar/errhnd.hpp; sourceTree = ""; }; + D4A4958B1054177300BE38AE /* extinfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = extinfo.cpp; path = libunrar/extinfo.cpp; sourceTree = ""; }; + D4A4958C1054177300BE38AE /* extinfo.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = extinfo.hpp; path = libunrar/extinfo.hpp; sourceTree = ""; }; + D4A4958D1054177300BE38AE /* extract.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = extract.cpp; path = libunrar/extract.cpp; sourceTree = ""; }; + D4A4958E1054177300BE38AE /* extract.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = extract.hpp; path = libunrar/extract.hpp; sourceTree = ""; }; + D4A4958F1054177300BE38AE /* filcreat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filcreat.cpp; path = libunrar/filcreat.cpp; sourceTree = ""; }; + D4A495901054177300BE38AE /* filcreat.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = filcreat.hpp; path = libunrar/filcreat.hpp; sourceTree = ""; }; + D4A495911054177300BE38AE /* file.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = file.cpp; path = libunrar/file.cpp; sourceTree = ""; }; + D4A495921054177300BE38AE /* file.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = file.hpp; path = libunrar/file.hpp; sourceTree = ""; }; + D4A495931054177300BE38AE /* filefn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filefn.cpp; path = libunrar/filefn.cpp; sourceTree = ""; }; + D4A495941054177300BE38AE /* filefn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = filefn.hpp; path = libunrar/filefn.hpp; sourceTree = ""; }; + D4A495951054177300BE38AE /* filestr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = filestr.cpp; path = libunrar/filestr.cpp; sourceTree = ""; }; + D4A495961054177300BE38AE /* filestr.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = filestr.hpp; path = libunrar/filestr.hpp; sourceTree = ""; }; + D4A495971054177300BE38AE /* find.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = find.cpp; path = libunrar/find.cpp; sourceTree = ""; }; + D4A495981054177300BE38AE /* find.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = find.hpp; path = libunrar/find.hpp; sourceTree = ""; }; + D4A495991054177300BE38AE /* getbits.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = getbits.cpp; path = libunrar/getbits.cpp; sourceTree = ""; }; + D4A4959A1054177300BE38AE /* getbits.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = getbits.hpp; path = libunrar/getbits.hpp; sourceTree = ""; }; + D4A4959B1054177300BE38AE /* global.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = global.cpp; path = libunrar/global.cpp; sourceTree = ""; }; + D4A4959C1054177300BE38AE /* global.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = global.hpp; path = libunrar/global.hpp; sourceTree = ""; }; + D4A4959D1054177300BE38AE /* headers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = headers.hpp; path = libunrar/headers.hpp; sourceTree = ""; }; + D4A4959E1054177300BE38AE /* isnt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = isnt.cpp; path = libunrar/isnt.cpp; sourceTree = ""; }; + D4A4959F1054177300BE38AE /* isnt.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = isnt.hpp; path = libunrar/isnt.hpp; sourceTree = ""; }; + D4A495A01054177300BE38AE /* list.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = list.cpp; path = libunrar/list.cpp; sourceTree = ""; }; + D4A495A11054177300BE38AE /* list.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = list.hpp; path = libunrar/list.hpp; sourceTree = ""; }; + D4A495A21054177300BE38AE /* loclang.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = loclang.hpp; path = libunrar/loclang.hpp; sourceTree = ""; }; + D4A495A31054177300BE38AE /* log.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = log.cpp; path = libunrar/log.cpp; sourceTree = ""; }; + D4A495A41054177300BE38AE /* log.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = log.hpp; path = libunrar/log.hpp; sourceTree = ""; }; + D4A495A51054177300BE38AE /* makefile.unix */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = makefile.unix; path = libunrar/makefile.unix; sourceTree = ""; }; + D4A495A61054177300BE38AE /* match.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = match.cpp; path = libunrar/match.cpp; sourceTree = ""; }; + D4A495A71054177300BE38AE /* match.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = match.hpp; path = libunrar/match.hpp; sourceTree = ""; }; + D4A495A81054177300BE38AE /* model.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = model.cpp; path = libunrar/model.cpp; sourceTree = ""; }; + D4A495A91054177300BE38AE /* model.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = model.hpp; path = libunrar/model.hpp; sourceTree = ""; }; + D4A495AA1054177300BE38AE /* options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = options.cpp; path = libunrar/options.cpp; sourceTree = ""; }; + D4A495AB1054177300BE38AE /* options.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = options.hpp; path = libunrar/options.hpp; sourceTree = ""; }; + D4A495AC1054177300BE38AE /* os.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = os.hpp; path = libunrar/os.hpp; sourceTree = ""; }; + D4A495AD1054177300BE38AE /* os2ea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = os2ea.cpp; path = libunrar/os2ea.cpp; sourceTree = ""; }; + D4A495AE1054177300BE38AE /* pathfn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = pathfn.cpp; path = libunrar/pathfn.cpp; sourceTree = ""; }; + D4A495AF1054177300BE38AE /* pathfn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = pathfn.hpp; path = libunrar/pathfn.hpp; sourceTree = ""; }; + D4A495B01054177300BE38AE /* rar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rar.cpp; path = libunrar/rar.cpp; sourceTree = ""; }; + D4A495B11054177300BE38AE /* rar.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rar.hpp; path = libunrar/rar.hpp; sourceTree = ""; }; + D4A495B21054177300BE38AE /* rardefs.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rardefs.hpp; path = libunrar/rardefs.hpp; sourceTree = ""; }; + D4A495B31054177300BE38AE /* rarlang.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rarlang.hpp; path = libunrar/rarlang.hpp; sourceTree = ""; }; + D4A495B41054177300BE38AE /* raros.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = raros.hpp; path = libunrar/raros.hpp; sourceTree = ""; }; + D4A495B51054177300BE38AE /* rartypes.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rartypes.hpp; path = libunrar/rartypes.hpp; sourceTree = ""; }; + D4A495B61054177300BE38AE /* rarvm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rarvm.cpp; path = libunrar/rarvm.cpp; sourceTree = ""; }; + D4A495B71054177300BE38AE /* rarvm.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rarvm.hpp; path = libunrar/rarvm.hpp; sourceTree = ""; }; + D4A495B81054177300BE38AE /* rarvmtbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rarvmtbl.cpp; path = libunrar/rarvmtbl.cpp; sourceTree = ""; }; + D4A495B91054177300BE38AE /* rawread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rawread.cpp; path = libunrar/rawread.cpp; sourceTree = ""; }; + D4A495BA1054177300BE38AE /* rawread.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rawread.hpp; path = libunrar/rawread.hpp; sourceTree = ""; }; + D4A495BB1054177300BE38AE /* rdwrfn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rdwrfn.cpp; path = libunrar/rdwrfn.cpp; sourceTree = ""; }; + D4A495BC1054177300BE38AE /* rdwrfn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rdwrfn.hpp; path = libunrar/rdwrfn.hpp; sourceTree = ""; }; + D4A495BD1054177300BE38AE /* recvol.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = recvol.cpp; path = libunrar/recvol.cpp; sourceTree = ""; }; + D4A495BE1054177300BE38AE /* recvol.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = recvol.hpp; path = libunrar/recvol.hpp; sourceTree = ""; }; + D4A495BF1054177300BE38AE /* resource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = resource.cpp; path = libunrar/resource.cpp; sourceTree = ""; }; + D4A495C01054177300BE38AE /* resource.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = resource.hpp; path = libunrar/resource.hpp; sourceTree = ""; }; + D4A495C11054177300BE38AE /* rijndael.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rijndael.cpp; path = libunrar/rijndael.cpp; sourceTree = ""; }; + D4A495C21054177300BE38AE /* rijndael.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rijndael.hpp; path = libunrar/rijndael.hpp; sourceTree = ""; }; + D4A495C31054177300BE38AE /* rs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = rs.cpp; path = libunrar/rs.cpp; sourceTree = ""; }; + D4A495C41054177300BE38AE /* rs.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = rs.hpp; path = libunrar/rs.hpp; sourceTree = ""; }; + D4A495C51054177300BE38AE /* savepos.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = savepos.cpp; path = libunrar/savepos.cpp; sourceTree = ""; }; + D4A495C61054177300BE38AE /* savepos.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = savepos.hpp; path = libunrar/savepos.hpp; sourceTree = ""; }; + D4A495C71054177300BE38AE /* scantree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = scantree.cpp; path = libunrar/scantree.cpp; sourceTree = ""; }; + D4A495C81054177300BE38AE /* scantree.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = scantree.hpp; path = libunrar/scantree.hpp; sourceTree = ""; }; + D4A495C91054177300BE38AE /* sha1.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = sha1.cpp; path = libunrar/sha1.cpp; sourceTree = ""; }; + D4A495CA1054177300BE38AE /* sha1.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = sha1.hpp; path = libunrar/sha1.hpp; sourceTree = ""; }; + D4A495CB1054177300BE38AE /* smallfn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = smallfn.cpp; path = libunrar/smallfn.cpp; sourceTree = ""; }; + D4A495CC1054177300BE38AE /* smallfn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = smallfn.hpp; path = libunrar/smallfn.hpp; sourceTree = ""; }; + D4A495CD1054177300BE38AE /* strfn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = strfn.cpp; path = libunrar/strfn.cpp; sourceTree = ""; }; + D4A495CE1054177300BE38AE /* strfn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = strfn.hpp; path = libunrar/strfn.hpp; sourceTree = ""; }; + D4A495CF1054177300BE38AE /* strlist.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = strlist.cpp; path = libunrar/strlist.cpp; sourceTree = ""; }; + D4A495D01054177300BE38AE /* strlist.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = strlist.hpp; path = libunrar/strlist.hpp; sourceTree = ""; }; + D4A495D11054177300BE38AE /* suballoc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = suballoc.cpp; path = libunrar/suballoc.cpp; sourceTree = ""; }; + D4A495D21054177300BE38AE /* suballoc.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = suballoc.hpp; path = libunrar/suballoc.hpp; sourceTree = ""; }; + D4A495D31054177300BE38AE /* system.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = system.cpp; path = libunrar/system.cpp; sourceTree = ""; }; + D4A495D41054177300BE38AE /* system.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = system.hpp; path = libunrar/system.hpp; sourceTree = ""; }; + D4A495D51054177300BE38AE /* timefn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = timefn.cpp; path = libunrar/timefn.cpp; sourceTree = ""; }; + D4A495D61054177300BE38AE /* timefn.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = timefn.hpp; path = libunrar/timefn.hpp; sourceTree = ""; }; + D4A495D71054177300BE38AE /* ulinks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ulinks.cpp; path = libunrar/ulinks.cpp; sourceTree = ""; }; + D4A495D81054177300BE38AE /* ulinks.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ulinks.hpp; path = libunrar/ulinks.hpp; sourceTree = ""; }; + D4A495D91054177300BE38AE /* unicode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = unicode.cpp; path = libunrar/unicode.cpp; sourceTree = ""; }; + D4A495DA1054177300BE38AE /* unicode.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = unicode.hpp; path = libunrar/unicode.hpp; sourceTree = ""; }; + D4A495DB1054177300BE38AE /* unios2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = unios2.cpp; path = libunrar/unios2.cpp; sourceTree = ""; }; + D4A495DC1054177300BE38AE /* unpack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = unpack.cpp; path = libunrar/unpack.cpp; sourceTree = ""; }; + D4A495DD1054177300BE38AE /* unpack.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = unpack.hpp; path = libunrar/unpack.hpp; sourceTree = ""; }; + D4A495DE1054177300BE38AE /* unpack15.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = unpack15.cpp; path = libunrar/unpack15.cpp; sourceTree = ""; }; + D4A495DF1054177300BE38AE /* unpack20.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = unpack20.cpp; path = libunrar/unpack20.cpp; sourceTree = ""; }; + D4A495E01054177300BE38AE /* uowners.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = uowners.cpp; path = libunrar/uowners.cpp; sourceTree = ""; }; + D4A495E11054177300BE38AE /* version.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = version.hpp; path = libunrar/version.hpp; sourceTree = ""; }; + D4A495E21054177300BE38AE /* volume.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = volume.cpp; path = libunrar/volume.cpp; sourceTree = ""; }; + D4A495E31054177300BE38AE /* volume.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = volume.hpp; path = libunrar/volume.hpp; sourceTree = ""; }; + D4A495E41054177300BE38AE /* win32acl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = win32acl.cpp; path = libunrar/win32acl.cpp; sourceTree = ""; }; + D4A495E51054177300BE38AE /* win32stm.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = win32stm.cpp; path = libunrar/win32stm.cpp; sourceTree = ""; }; + D4A96E2010545E9A0091ECB4 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 8D11072E0486CEB800E47090 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, + D4A96E2110545E9A0091ECB4 /* Carbon.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 256AC3D80F4B6AC300CF3369 /* QuietUnrarAppDelegate.h */, + 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */, + ); + name = Classes; + sourceTree = ""; + }; + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */, + ); + name = "Linked Frameworks"; + sourceTree = ""; + }; + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 29B97324FDCFA39411CA2CEA /* AppKit.framework */, + 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */, + 29B97325FDCFA39411CA2CEA /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 8D1107320486CEB800E47090 /* QuietUnrar.app */, + ); + name = Products; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* QuietUnrar */ = { + isa = PBXGroup; + children = ( + 080E96DDFE201D6D7F000001 /* Classes */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + D4A96E2010545E9A0091ECB4 /* Carbon.framework */, + ); + name = QuietUnrar; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + D4A494191054167B00BE38AE /* libunrar */, + 256AC3F00F4B6AF500CF3369 /* QuietUnrar_Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 8D1107310486CEB800E47090 /* QuietUnrar-Info.plist */, + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */, + ); + name = Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + 1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */, + 1058C7A2FEA54F0111CA2CBB /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + D4A494191054167B00BE38AE /* libunrar */ = { + isa = PBXGroup; + children = ( + D4A495741054177300BE38AE /* arccmt.cpp */, + D4A495751054177300BE38AE /* archive.cpp */, + D4A495761054177300BE38AE /* archive.hpp */, + D4A495771054177300BE38AE /* arcread.cpp */, + D4A495781054177300BE38AE /* array.hpp */, + D4A495791054177300BE38AE /* beosea.cpp */, + D4A4957A1054177300BE38AE /* cmddata.cpp */, + D4A4957B1054177300BE38AE /* cmddata.hpp */, + D4A4957C1054177300BE38AE /* coder.cpp */, + D4A4957D1054177300BE38AE /* coder.hpp */, + D4A4957E1054177300BE38AE /* compress.hpp */, + D4A4957F1054177300BE38AE /* consio.cpp */, + D4A495801054177300BE38AE /* consio.hpp */, + D4A495811054177300BE38AE /* crc.cpp */, + D4A495821054177300BE38AE /* crc.hpp */, + D4A495831054177300BE38AE /* crypt.cpp */, + D4A495841054177300BE38AE /* crypt.hpp */, + D4A495851054177300BE38AE /* dll.cpp */, + D4A495861054177300BE38AE /* dll.hpp */, + D4A495871054177300BE38AE /* encname.cpp */, + D4A495881054177300BE38AE /* encname.hpp */, + D4A495891054177300BE38AE /* errhnd.cpp */, + D4A4958A1054177300BE38AE /* errhnd.hpp */, + D4A4958B1054177300BE38AE /* extinfo.cpp */, + D4A4958C1054177300BE38AE /* extinfo.hpp */, + D4A4958D1054177300BE38AE /* extract.cpp */, + D4A4958E1054177300BE38AE /* extract.hpp */, + D4A4958F1054177300BE38AE /* filcreat.cpp */, + D4A495901054177300BE38AE /* filcreat.hpp */, + D4A495911054177300BE38AE /* file.cpp */, + D4A495921054177300BE38AE /* file.hpp */, + D4A495931054177300BE38AE /* filefn.cpp */, + D4A495941054177300BE38AE /* filefn.hpp */, + D4A495951054177300BE38AE /* filestr.cpp */, + D4A495961054177300BE38AE /* filestr.hpp */, + D4A495971054177300BE38AE /* find.cpp */, + D4A495981054177300BE38AE /* find.hpp */, + D4A495991054177300BE38AE /* getbits.cpp */, + D4A4959A1054177300BE38AE /* getbits.hpp */, + D4A4959B1054177300BE38AE /* global.cpp */, + D4A4959C1054177300BE38AE /* global.hpp */, + D4A4959D1054177300BE38AE /* headers.hpp */, + D4A4959E1054177300BE38AE /* isnt.cpp */, + D4A4959F1054177300BE38AE /* isnt.hpp */, + D4A495A01054177300BE38AE /* list.cpp */, + D4A495A11054177300BE38AE /* list.hpp */, + D4A495A21054177300BE38AE /* loclang.hpp */, + D4A495A31054177300BE38AE /* log.cpp */, + D4A495A41054177300BE38AE /* log.hpp */, + D4A495A51054177300BE38AE /* makefile.unix */, + D4A495A61054177300BE38AE /* match.cpp */, + D4A495A71054177300BE38AE /* match.hpp */, + D4A495A81054177300BE38AE /* model.cpp */, + D4A495A91054177300BE38AE /* model.hpp */, + D4A495AA1054177300BE38AE /* options.cpp */, + D4A495AB1054177300BE38AE /* options.hpp */, + D4A495AC1054177300BE38AE /* os.hpp */, + D4A495AD1054177300BE38AE /* os2ea.cpp */, + D4A495AE1054177300BE38AE /* pathfn.cpp */, + D4A495AF1054177300BE38AE /* pathfn.hpp */, + D4A495B01054177300BE38AE /* rar.cpp */, + D4A495B11054177300BE38AE /* rar.hpp */, + D4A495B21054177300BE38AE /* rardefs.hpp */, + D4A495B31054177300BE38AE /* rarlang.hpp */, + D4A495B41054177300BE38AE /* raros.hpp */, + D4A495B51054177300BE38AE /* rartypes.hpp */, + D4A495B61054177300BE38AE /* rarvm.cpp */, + D4A495B71054177300BE38AE /* rarvm.hpp */, + D4A495B81054177300BE38AE /* rarvmtbl.cpp */, + D4A495B91054177300BE38AE /* rawread.cpp */, + D4A495BA1054177300BE38AE /* rawread.hpp */, + D4A495BB1054177300BE38AE /* rdwrfn.cpp */, + D4A495BC1054177300BE38AE /* rdwrfn.hpp */, + D4A495BD1054177300BE38AE /* recvol.cpp */, + D4A495BE1054177300BE38AE /* recvol.hpp */, + D4A495BF1054177300BE38AE /* resource.cpp */, + D4A495C01054177300BE38AE /* resource.hpp */, + D4A495C11054177300BE38AE /* rijndael.cpp */, + D4A495C21054177300BE38AE /* rijndael.hpp */, + D4A495C31054177300BE38AE /* rs.cpp */, + D4A495C41054177300BE38AE /* rs.hpp */, + D4A495C51054177300BE38AE /* savepos.cpp */, + D4A495C61054177300BE38AE /* savepos.hpp */, + D4A495C71054177300BE38AE /* scantree.cpp */, + D4A495C81054177300BE38AE /* scantree.hpp */, + D4A495C91054177300BE38AE /* sha1.cpp */, + D4A495CA1054177300BE38AE /* sha1.hpp */, + D4A495CB1054177300BE38AE /* smallfn.cpp */, + D4A495CC1054177300BE38AE /* smallfn.hpp */, + D4A495CD1054177300BE38AE /* strfn.cpp */, + D4A495CE1054177300BE38AE /* strfn.hpp */, + D4A495CF1054177300BE38AE /* strlist.cpp */, + D4A495D01054177300BE38AE /* strlist.hpp */, + D4A495D11054177300BE38AE /* suballoc.cpp */, + D4A495D21054177300BE38AE /* suballoc.hpp */, + D4A495D31054177300BE38AE /* system.cpp */, + D4A495D41054177300BE38AE /* system.hpp */, + D4A495D51054177300BE38AE /* timefn.cpp */, + D4A495D61054177300BE38AE /* timefn.hpp */, + D4A495D71054177300BE38AE /* ulinks.cpp */, + D4A495D81054177300BE38AE /* ulinks.hpp */, + D4A495D91054177300BE38AE /* unicode.cpp */, + D4A495DA1054177300BE38AE /* unicode.hpp */, + D4A495DB1054177300BE38AE /* unios2.cpp */, + D4A495DC1054177300BE38AE /* unpack.cpp */, + D4A495DD1054177300BE38AE /* unpack.hpp */, + D4A495DE1054177300BE38AE /* unpack15.cpp */, + D4A495DF1054177300BE38AE /* unpack20.cpp */, + D4A495E01054177300BE38AE /* uowners.cpp */, + D4A495E11054177300BE38AE /* version.hpp */, + D4A495E21054177300BE38AE /* volume.cpp */, + D4A495E31054177300BE38AE /* volume.hpp */, + D4A495E41054177300BE38AE /* win32acl.cpp */, + D4A495E51054177300BE38AE /* win32stm.cpp */, + ); + name = libunrar; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXLegacyTarget section */ + D4A4962A105419AA00BE38AE /* libunrar */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "-f makefile.unix lib $(ACTION)"; + buildConfigurationList = D4A4962D105419C800BE38AE /* Build configuration list for PBXLegacyTarget "libunrar" */; + buildPhases = ( + ); + buildToolPath = /usr/bin/make; + buildWorkingDirectory = ./libunrar/; + dependencies = ( + ); + name = libunrar; + passBuildSettingsInEnvironment = 1; + productName = libunrar; + }; +/* End PBXLegacyTarget section */ + +/* Begin PBXNativeTarget section */ + 8D1107260486CEB800E47090 /* QuietUnrar */ = { + isa = PBXNativeTarget; + buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "QuietUnrar" */; + buildPhases = ( + 8D11072C0486CEB800E47090 /* Sources */, + 8D11072E0486CEB800E47090 /* Frameworks */, + D4A4965210541D2600BE38AE /* CopyFiles */, + D4A49697105435C700BE38AE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + D4A4964D10541CFF00BE38AE /* PBXTargetDependency */, + ); + name = QuietUnrar; + productInstallPath = "$(HOME)/Applications"; + productName = QuietUnrar; + productReference = 8D1107320486CEB800E47090 /* QuietUnrar.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "QuietUnrar" */; + compatibilityVersion = "Xcode 3.2"; + hasScannedForEncodings = 1; + mainGroup = 29B97314FDCFA39411CA2CEA /* QuietUnrar */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8D1107260486CEB800E47090 /* QuietUnrar */, + D4A4962A105419AA00BE38AE /* libunrar */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + D4A49697105435C700BE38AE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D4A49692105435C100BE38AE /* MainMenu.xib in Resources */, + D4A49691105435BE00BE38AE /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 8D11072C0486CEB800E47090 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 8D11072D0486CEB800E47090 /* main.m in Sources */, + 256AC3DA0F4B6AC300CF3369 /* QuietUnrarAppDelegate.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + D4A4964D10541CFF00BE38AE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = D4A4962A105419AA00BE38AE /* libunrar */; + targetProxy = D4A4964C10541CFF00BE38AE /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 089C165DFE840E0CC02AAC07 /* English */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 1DDD58150DA1D0A300B32029 /* English */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + C01FCF4B08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_FIX_AND_CONTINUE = YES; + GCC_MODEL_TUNING = G5; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = QuietUnrar_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = _UNIX; + INFOPLIST_FILE = "QuietUnrar-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = QuietUnrar; + }; + name = Debug; + }; + C01FCF4C08A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_MODEL_TUNING = G5; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = QuietUnrar_Prefix.pch; + GCC_PREPROCESSOR_DEFINITIONS = _UNIX; + INFOPLIST_FILE = "QuietUnrar-Info.plist"; + INSTALL_PATH = "$(HOME)/Applications"; + PRODUCT_NAME = QuietUnrar; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_GC = required; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + ONLY_ACTIVE_ARCH = YES; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_GC = required; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = macosx10.6; + VALID_ARCHS = "i386 x86_64"; + }; + name = Release; + }; + D4A4962B105419AA00BE38AE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + PRODUCT_NAME = libunrar; + }; + name = Debug; + }; + D4A4962C105419AA00BE38AE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_FIX_AND_CONTINUE = NO; + PRODUCT_NAME = libunrar; + ZERO_LINK = NO; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "QuietUnrar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4B08A954540054247B /* Debug */, + C01FCF4C08A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "QuietUnrar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D4A4962D105419C800BE38AE /* Build configuration list for PBXLegacyTarget "libunrar" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D4A4962B105419AA00BE38AE /* Debug */, + D4A4962C105419AA00BE38AE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/QuietUnrar.xcodeproj/rob.mode1v3 b/QuietUnrar.xcodeproj/rob.mode1v3 new file mode 100644 index 0000000..614f4de --- /dev/null +++ b/QuietUnrar.xcodeproj/rob.mode1v3 @@ -0,0 +1,1449 @@ + + + + + ActivePerspectiveName + Project + AllowedModules + + + BundleLoadPath + + MaxInstances + n + Module + PBXSmartGroupTreeModule + Name + Groups and Files Outline View + + + BundleLoadPath + + MaxInstances + n + Module + PBXNavigatorGroup + Name + Editor + + + BundleLoadPath + + MaxInstances + n + Module + XCTaskListModule + Name + Task List + + + BundleLoadPath + + MaxInstances + n + Module + XCDetailModule + Name + File and Smart Group Detail Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXBuildResultsModule + Name + Detailed Build Results Viewer + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXProjectFindModule + Name + Project Batch Find Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCProjectFormatConflictsModule + Name + Project Format Conflicts List + + + BundleLoadPath + + MaxInstances + n + Module + PBXBookmarksModule + Name + Bookmarks Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXClassBrowserModule + Name + Class Browser + + + BundleLoadPath + + MaxInstances + n + Module + PBXCVSModule + Name + Source Code Control Tool + + + BundleLoadPath + + MaxInstances + n + Module + PBXDebugBreakpointsModule + Name + Debug Breakpoints Tool + + + BundleLoadPath + + MaxInstances + n + Module + XCDockableInspector + Name + Inspector + + + BundleLoadPath + + MaxInstances + n + Module + PBXOpenQuicklyModule + Name + Open Quickly Tool + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugSessionModule + Name + Debugger + + + BundleLoadPath + + MaxInstances + 1 + Module + PBXDebugCLIModule + Name + Debug Console + + + BundleLoadPath + + MaxInstances + n + Module + XCSnapshotModule + Name + Snapshots Tool + + + BundlePath + /Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources + Description + DefaultDescriptionKey + DockingSystemVisible + + Extension + mode1v3 + FavBarConfig + + PBXProjectModuleGUID + D4A4963D10541A1C00BE38AE + XCBarModuleItemNames + + XCBarModuleItems + + + FirstTimeWindowDisplayed + + Identifier + com.apple.perspectives.project.mode1v3 + MajorVersion + 33 + MinorVersion + 0 + Name + Default + Notifications + + OpenEditors + + + Content + + PBXProjectModuleGUID + D40FFE1D105828A50070BCAF + PBXProjectModuleLabel + NSApplication.h + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + D40FFE1E105828A50070BCAF + PBXProjectModuleLabel + NSApplication.h + _historyCapacity + 0 + bookmark + D4C9D7EB10A9B7A20005973D + history + + D40FFE21105828A50070BCAF + + + SplitCount + 1 + + StatusBarVisibility + + + Geometry + + Frame + {{0, 20}, {877, 658}} + PBXModuleWindowStatusBarHidden2 + + RubberWindowFrame + 64 74 877 699 0 0 1280 778 + + + + PerspectiveWidths + + -1 + -1 + + Perspectives + + + ChosenToolbarItems + + active-combo-popup + action + NSToolbarFlexibleSpaceItem + debugger-enable-breakpoints + build-and-go + com.apple.ide.PBXToolbarStopButton + get-info + NSToolbarFlexibleSpaceItem + com.apple.pbx.toolbar.searchfield + + ControllerClassBaseName + + IconName + WindowOfProjectWithEditor + Identifier + perspective.project + IsVertical + + Layout + + + BecomeActive + + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 29B97317FDCFA39411CA2CEA + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 14 + 13 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 610}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 628}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 89 109 972 669 0 0 1280 778 + + Module + PBXSmartGroupTreeModule + Proportion + 203pt + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20306471E060097A5F4 + PBXProjectModuleLabel + QuietUnrarAppDelegate.m + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CE0B20406471E060097A5F4 + PBXProjectModuleLabel + QuietUnrarAppDelegate.m + _historyCapacity + 0 + bookmark + D4C9D7E810A9B7A20005973D + history + + D4A4963610541A1C00BE38AE + D4A4965D105433E000BE38AE + D4A496731054350F00BE38AE + D4A96E4C1054628D0091ECB4 + D4A96E4D1054628D0091ECB4 + D4A96E4E1054628D0091ECB4 + D4A96E4F1054628D0091ECB4 + D40FFE1C105828A50070BCAF + + + SplitCount + 1 + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {764, 423}} + RubberWindowFrame + 89 109 972 669 0 0 1280 778 + + Module + PBXNavigatorGroup + Proportion + 423pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CE0B20506471E060097A5F4 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{0, 428}, {764, 200}} + RubberWindowFrame + 89 109 972 669 0 0 1280 778 + + Module + XCDetailModule + Proportion + 200pt + + + Proportion + 764pt + + + Name + Project + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + XCModuleDock + PBXNavigatorGroup + XCDetailModule + + TableOfContents + + D4C9D7E910A9B7A20005973D + 1CE0B1FE06471DED0097A5F4 + D4C9D7EA10A9B7A20005973D + 1CE0B20306471E060097A5F4 + 1CE0B20506471E060097A5F4 + + ToolbarConfigUserDefaultsMinorVersion + 2 + ToolbarConfiguration + xcode.toolbar.config.defaultV3 + + + ControllerClassBaseName + + IconName + WindowOfProject + Identifier + perspective.morph + IsVertical + 0 + Layout + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C37FBAC04509CD000000102 + 1C37FAAC04509CD000000102 + 1C08E77C0454961000C914BD + 1C37FABC05509CD000000102 + 1C37FABC05539CD112110102 + E2644B35053B69B200211256 + 1C37FABC04509CD000100104 + 1CC0EA4004350EF90044410B + 1CC0EA4004350EF90041110B + + PBXProjectModuleGUID + 11E0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + yes + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 186 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 29B97314FDCFA39411CA2CEA + 1C37FABC05509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {186, 337}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 1 + XCSharingToken + com.apple.Xcode.GFSharingToken + + GeometryConfiguration + + Frame + {{0, 0}, {203, 355}} + GroupTreeTableConfiguration + + MainColumn + 186 + + RubberWindowFrame + 373 269 690 397 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 100% + + + Name + Morph + PreferredWidth + 300 + ServiceClasses + + XCModuleDock + PBXSmartGroupTreeModule + + TableOfContents + + 11E0B1FE06471DED0097A5F4 + + ToolbarConfiguration + xcode.toolbar.config.default.shortV3 + + + PerspectivesBarVisible + + ShelfIsVisible + + SourceDescription + file at '/Developer/Library/PrivateFrameworks/DevToolsInterface.framework/Resources/XCPerspectivesSpecificationMode1.xcperspec' + StatusbarIsVisible + + TimeStamp + 0.0 + ToolbarConfigUserDefaultsMinorVersion + 2 + ToolbarDisplayMode + 1 + ToolbarIsVisible + + ToolbarSizeMode + 1 + Type + Perspectives + UpdateMessage + The Default Workspace in this version of Xcode now includes support to hide and show the detail view (what has been referred to as the "Metro-Morph" feature). You must discard your current Default Workspace settings and update to the latest Default Workspace in order to gain this feature. Do you wish to update to the latest Workspace defaults for project '%@'? + WindowJustification + 5 + WindowOrderList + + D4C9D7F410A9B7A20005973D + D4C9D7F510A9B7A20005973D + D4C9D7F610A9B7A20005973D + 1CD10A99069EF8BA00B06720 + D4A49630105419F700BE38AE + D40FFE1D105828A50070BCAF + 1C78EAAD065D492600B07095 + /Users/rob/Programming/Projects - Mine/QuietUnrar/QuietUnrar.xcodeproj + + WindowString + 89 109 972 669 0 0 1280 778 + WindowToolsV3 + + + FirstTimeWindowDisplayed + + Identifier + windowTool.build + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528F0623707200166675 + PBXProjectModuleLabel + + StatusBarVisibility + + + GeometryConfiguration + + Frame + {{0, 0}, {677, 267}} + RubberWindowFrame + 121 156 677 549 0 0 1280 778 + + Module + PBXNavigatorGroup + Proportion + 267pt + + + ContentConfiguration + + PBXProjectModuleGUID + XCMainBuildResultsModuleGUID + PBXProjectModuleLabel + Build Results + XCBuildResultsTrigger_Collapse + 1021 + XCBuildResultsTrigger_Open + 1011 + + GeometryConfiguration + + Frame + {{0, 272}, {677, 236}} + RubberWindowFrame + 121 156 677 549 0 0 1280 778 + + Module + PBXBuildResultsModule + Proportion + 236pt + + + Proportion + 508pt + + + Name + Build Results + ServiceClasses + + PBXBuildResultsModule + + StatusbarIsVisible + + TableOfContents + + D4A49630105419F700BE38AE + D4C9D7EC10A9B7A20005973D + 1CD0528F0623707200166675 + XCMainBuildResultsModuleGUID + + ToolbarConfiguration + xcode.toolbar.config.buildV3 + WindowContentMinSize + 486 300 + WindowString + 121 156 677 549 0 0 1280 778 + WindowToolGUID + D4A49630105419F700BE38AE + WindowToolIsVisible + + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debugger + IsVertical + + Layout + + + Dock + + + ContentConfiguration + + Debugger + + HorizontalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {316, 201}} + {{316, 0}, {378, 201}} + + + VerticalSplitView + + _collapsingFrameDimension + 0.0 + _indexOfCollapsedView + 0 + _percentageOfCollapsedView + 0.0 + isCollapsed + yes + sizes + + {{0, 0}, {694, 201}} + {{0, 201}, {694, 180}} + + + + LauncherConfigVersion + 8 + PBXProjectModuleGUID + 1C162984064C10D400B95A72 + PBXProjectModuleLabel + Debug - GLUTExamples (Underwater) + + GeometryConfiguration + + DebugConsoleVisible + None + DebugConsoleWindowFrame + {{200, 200}, {500, 300}} + DebugSTDIOWindowFrame + {{200, 200}, {500, 300}} + Frame + {{0, 0}, {694, 381}} + PBXDebugSessionStackFrameViewKey + + DebugVariablesTableConfiguration + + Name + 120 + Value + 85 + Summary + 148 + + Frame + {{316, 0}, {378, 201}} + RubberWindowFrame + 68 278 694 422 0 0 1280 778 + + RubberWindowFrame + 68 278 694 422 0 0 1280 778 + + Module + PBXDebugSessionModule + Proportion + 381pt + + + Proportion + 381pt + + + Name + Debugger + ServiceClasses + + PBXDebugSessionModule + + StatusbarIsVisible + + TableOfContents + + 1CD10A99069EF8BA00B06720 + D4C9D7ED10A9B7A20005973D + 1C162984064C10D400B95A72 + D4C9D7EE10A9B7A20005973D + D4C9D7EF10A9B7A20005973D + D4C9D7F010A9B7A20005973D + D4C9D7F110A9B7A20005973D + D4C9D7F210A9B7A20005973D + + ToolbarConfiguration + xcode.toolbar.config.debugV3 + WindowString + 68 278 694 422 0 0 1280 778 + WindowToolGUID + 1CD10A99069EF8BA00B06720 + WindowToolIsVisible + + + + Identifier + windowTool.find + Layout + + + Dock + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1CDD528C0622207200134675 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1CD0528D0623707200166675 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {781, 167}} + RubberWindowFrame + 62 385 781 470 0 0 1440 878 + + Module + PBXNavigatorGroup + Proportion + 781pt + + + Proportion + 50% + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD0528E0623707200166675 + PBXProjectModuleLabel + Project Find + + GeometryConfiguration + + Frame + {{8, 0}, {773, 254}} + RubberWindowFrame + 62 385 781 470 0 0 1440 878 + + Module + PBXProjectFindModule + Proportion + 50% + + + Proportion + 428pt + + + Name + Project Find + ServiceClasses + + PBXProjectFindModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C530D57069F1CE1000CFCEE + 1C530D58069F1CE1000CFCEE + 1C530D59069F1CE1000CFCEE + 1CDD528C0622207200134675 + 1C530D5A069F1CE1000CFCEE + 1CE0B1FE06471DED0097A5F4 + 1CD0528E0623707200166675 + + WindowString + 62 385 781 470 0 0 1440 878 + WindowToolGUID + 1C530D57069F1CE1000CFCEE + WindowToolIsVisible + 0 + + + Identifier + MENUSEPARATOR + + + FirstTimeWindowDisplayed + + Identifier + windowTool.debuggerConsole + IsVertical + + Layout + + + Dock + + + BecomeActive + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAAC065D492600B07095 + PBXProjectModuleLabel + Debugger Console + + GeometryConfiguration + + Frame + {{0, 0}, {817, 308}} + RubberWindowFrame + 68 351 817 349 0 0 1280 778 + + Module + PBXDebugCLIModule + Proportion + 308pt + + + Proportion + 308pt + + + Name + Debugger Console + ServiceClasses + + PBXDebugCLIModule + + StatusbarIsVisible + + TableOfContents + + 1C78EAAD065D492600B07095 + D4C9D7F310A9B7A20005973D + 1C78EAAC065D492600B07095 + + ToolbarConfiguration + xcode.toolbar.config.consoleV3 + WindowString + 68 351 817 349 0 0 1280 778 + WindowToolGUID + 1C78EAAD065D492600B07095 + WindowToolIsVisible + + + + Identifier + windowTool.snapshots + Layout + + + Dock + + + Module + XCSnapshotModule + Proportion + 100% + + + Proportion + 100% + + + Name + Snapshots + ServiceClasses + + XCSnapshotModule + + StatusbarIsVisible + Yes + ToolbarConfiguration + xcode.toolbar.config.snapshots + WindowString + 315 824 300 550 0 0 1440 878 + WindowToolIsVisible + Yes + + + Identifier + windowTool.scm + Layout + + + Dock + + + ContentConfiguration + + PBXProjectModuleGUID + 1C78EAB2065D492600B07095 + PBXProjectModuleLabel + <No Editor> + PBXSplitModuleInNavigatorKey + + Split0 + + PBXProjectModuleGUID + 1C78EAB3065D492600B07095 + + SplitCount + 1 + + StatusBarVisibility + 1 + + GeometryConfiguration + + Frame + {{0, 0}, {452, 0}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + + Module + PBXNavigatorGroup + Proportion + 0pt + + + BecomeActive + 1 + ContentConfiguration + + PBXProjectModuleGUID + 1CD052920623707200166675 + PBXProjectModuleLabel + SCM + + GeometryConfiguration + + ConsoleFrame + {{0, 259}, {452, 0}} + Frame + {{0, 7}, {452, 259}} + RubberWindowFrame + 743 379 452 308 0 0 1280 1002 + TableConfiguration + + Status + 30 + FileName + 199 + Path + 197.0950012207031 + + TableFrame + {{0, 0}, {452, 250}} + + Module + PBXCVSModule + Proportion + 262pt + + + Proportion + 266pt + + + Name + SCM + ServiceClasses + + PBXCVSModule + + StatusbarIsVisible + 1 + TableOfContents + + 1C78EAB4065D492600B07095 + 1C78EAB5065D492600B07095 + 1C78EAB2065D492600B07095 + 1CD052920623707200166675 + + ToolbarConfiguration + xcode.toolbar.config.scm + WindowString + 743 379 452 308 0 0 1280 1002 + + + Identifier + windowTool.breakpoints + IsVertical + 0 + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + PBXBottomSmartGroupGIDs + + 1C77FABC04509CD000000102 + + PBXProjectModuleGUID + 1CE0B1FE06471DED0097A5F4 + PBXProjectModuleLabel + Files + PBXProjectStructureProvided + no + PBXSmartGroupTreeModuleColumnData + + PBXSmartGroupTreeModuleColumnWidthsKey + + 168 + + PBXSmartGroupTreeModuleColumnsKey_v4 + + MainColumn + + + PBXSmartGroupTreeModuleOutlineStateKey_v7 + + PBXSmartGroupTreeModuleOutlineStateExpansionKey + + 1C77FABC04509CD000000102 + + PBXSmartGroupTreeModuleOutlineStateSelectionKey + + + 0 + + + PBXSmartGroupTreeModuleOutlineStateVisibleRectKey + {{0, 0}, {168, 350}} + + PBXTopSmartGroupGIDs + + XCIncludePerspectivesSwitch + 0 + + GeometryConfiguration + + Frame + {{0, 0}, {185, 368}} + GroupTreeTableConfiguration + + MainColumn + 168 + + RubberWindowFrame + 315 424 744 409 0 0 1440 878 + + Module + PBXSmartGroupTreeModule + Proportion + 185pt + + + ContentConfiguration + + PBXProjectModuleGUID + 1CA1AED706398EBD00589147 + PBXProjectModuleLabel + Detail + + GeometryConfiguration + + Frame + {{190, 0}, {554, 368}} + RubberWindowFrame + 315 424 744 409 0 0 1440 878 + + Module + XCDetailModule + Proportion + 554pt + + + Proportion + 368pt + + + MajorVersion + 3 + MinorVersion + 0 + Name + Breakpoints + ServiceClasses + + PBXSmartGroupTreeModule + XCDetailModule + + StatusbarIsVisible + 1 + TableOfContents + + 1CDDB66807F98D9800BB5817 + 1CDDB66907F98D9800BB5817 + 1CE0B1FE06471DED0097A5F4 + 1CA1AED706398EBD00589147 + + ToolbarConfiguration + xcode.toolbar.config.breakpointsV3 + WindowString + 315 424 744 409 0 0 1440 878 + WindowToolGUID + 1CDDB66807F98D9800BB5817 + WindowToolIsVisible + 1 + + + Identifier + windowTool.debugAnimator + Layout + + + Dock + + + Module + PBXNavigatorGroup + Proportion + 100% + + + Proportion + 100% + + + Name + Debug Visualizer + ServiceClasses + + PBXNavigatorGroup + + StatusbarIsVisible + 1 + ToolbarConfiguration + xcode.toolbar.config.debugAnimatorV3 + WindowString + 100 100 700 500 0 0 1280 1002 + + + Identifier + windowTool.bookmarks + Layout + + + Dock + + + Module + PBXBookmarksModule + Proportion + 100% + + + Proportion + 100% + + + Name + Bookmarks + ServiceClasses + + PBXBookmarksModule + + StatusbarIsVisible + 0 + WindowString + 538 42 401 187 0 0 1280 1002 + + + Identifier + windowTool.projectFormatConflicts + Layout + + + Dock + + + Module + XCProjectFormatConflictsModule + Proportion + 100% + + + Proportion + 100% + + + Name + Project Format Conflicts + ServiceClasses + + XCProjectFormatConflictsModule + + StatusbarIsVisible + 0 + WindowContentMinSize + 450 300 + WindowString + 50 850 472 307 0 0 1440 877 + + + Identifier + windowTool.classBrowser + Layout + + + Dock + + + BecomeActive + 1 + ContentConfiguration + + OptionsSetName + Hierarchy, all classes + PBXProjectModuleGUID + 1CA6456E063B45B4001379D8 + PBXProjectModuleLabel + Class Browser - NSObject + + GeometryConfiguration + + ClassesFrame + {{0, 0}, {374, 96}} + ClassesTreeTableConfiguration + + PBXClassNameColumnIdentifier + 208 + PBXClassBookColumnIdentifier + 22 + + Frame + {{0, 0}, {630, 331}} + MembersFrame + {{0, 105}, {374, 395}} + MembersTreeTableConfiguration + + PBXMemberTypeIconColumnIdentifier + 22 + PBXMemberNameColumnIdentifier + 216 + PBXMemberTypeColumnIdentifier + 97 + PBXMemberBookColumnIdentifier + 22 + + PBXModuleWindowStatusBarHidden2 + 1 + RubberWindowFrame + 385 179 630 352 0 0 1440 878 + + Module + PBXClassBrowserModule + Proportion + 332pt + + + Proportion + 332pt + + + Name + Class Browser + ServiceClasses + + PBXClassBrowserModule + + StatusbarIsVisible + 0 + TableOfContents + + 1C0AD2AF069F1E9B00FABCE6 + 1C0AD2B0069F1E9B00FABCE6 + 1CA6456E063B45B4001379D8 + + ToolbarConfiguration + xcode.toolbar.config.classbrowser + WindowString + 385 179 630 352 0 0 1440 878 + WindowToolGUID + 1C0AD2AF069F1E9B00FABCE6 + WindowToolIsVisible + 0 + + + Identifier + windowTool.refactoring + IncludeInToolsMenu + 0 + Layout + + + Dock + + + BecomeActive + 1 + GeometryConfiguration + + Frame + {0, 0}, {500, 335} + RubberWindowFrame + {0, 0}, {500, 335} + + Module + XCRefactoringModule + Proportion + 100% + + + Proportion + 100% + + + Name + Refactoring + ServiceClasses + + XCRefactoringModule + + WindowString + 200 200 500 356 0 0 1920 1200 + + + + diff --git a/QuietUnrar.xcodeproj/rob.pbxuser b/QuietUnrar.xcodeproj/rob.pbxuser new file mode 100644 index 0000000..bd8bee8 --- /dev/null +++ b/QuietUnrar.xcodeproj/rob.pbxuser @@ -0,0 +1,346 @@ +// !$*UTF8*$! +{ + 089C165DFE840E0CC02AAC07 /* English */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {703, 404}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 45}"; + }; + }; + 256AC3D80F4B6AC300CF3369 /* QuietUnrarAppDelegate.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {670, 403}}"; + sepNavSelRange = "{469, 0}"; + sepNavVisRange = "{180, 436}"; + }; + }; + 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {740, 572}}"; + sepNavSelRange = "{720, 0}"; + sepNavVisRange = "{295, 827}"; + sepNavWindowFrame = "{{85, 21}, {877, 731}}"; + }; + }; + 29B97313FDCFA39411CA2CEA /* Project object */ = { + activeBuildConfigurationName = Debug; + activeExecutable = D4A4940C1054167200BE38AE /* QuietUnrar */; + activeTarget = 8D1107260486CEB800E47090 /* QuietUnrar */; + addToTargets = ( + 8D1107260486CEB800E47090 /* QuietUnrar */, + ); + codeSenseManager = D4A4941B1054167B00BE38AE /* Code sense */; + executables = ( + D4A4940C1054167200BE38AE /* QuietUnrar */, + ); + perUserDictionary = { + PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID; + PBXFileTableDataSourceColumnWidthsKey = ( + 22, + 300, + 413, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXExecutablesDataSource_ActiveFlagID, + PBXExecutablesDataSource_NameID, + PBXExecutablesDataSource_CommentsID, + ); + }; + PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 525, + 20, + 48, + 43, + 43, + 20, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + PBXFileDataSource_Target_ColumnID, + ); + }; + PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = { + PBXFileTableDataSourceColumnSortingDirectionKey = "-1"; + PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID; + PBXFileTableDataSourceColumnWidthsKey = ( + 20, + 485, + 60, + 20, + 48, + 43, + 43, + ); + PBXFileTableDataSourceColumnsKey = ( + PBXFileDataSource_FiletypeID, + PBXFileDataSource_Filename_ColumnID, + PBXTargetDataSource_PrimaryAttribute, + PBXFileDataSource_Built_ColumnID, + PBXFileDataSource_ObjectSize_ColumnID, + PBXFileDataSource_Errors_ColumnID, + PBXFileDataSource_Warnings_ColumnID, + ); + }; + PBXPerProjectTemplateStateSaveDate = 279557910; + PBXWorkspaceStateSaveDate = 279557910; + }; + perUserProjectItems = { + D40FFE1C105828A50070BCAF = D40FFE1C105828A50070BCAF /* PBXTextBookmark */; + D40FFE1F105828A50070BCAF = D40FFE1F105828A50070BCAF /* PBXTextBookmark */; + D40FFE21105828A50070BCAF = D40FFE21105828A50070BCAF /* PBXTextBookmark */; + D4A4963610541A1C00BE38AE = D4A4963610541A1C00BE38AE /* PBXTextBookmark */; + D4A4965D105433E000BE38AE = D4A4965D105433E000BE38AE /* PBXTargetBookmark */; + D4A496731054350F00BE38AE = D4A496731054350F00BE38AE /* PBXTextBookmark */; + D4A96E4C1054628D0091ECB4 = D4A96E4C1054628D0091ECB4 /* PBXTextBookmark */; + D4A96E4D1054628D0091ECB4 = D4A96E4D1054628D0091ECB4 /* PBXTextBookmark */; + D4A96E4E1054628D0091ECB4 = D4A96E4E1054628D0091ECB4 /* PBXTextBookmark */; + D4A96E4F1054628D0091ECB4 = D4A96E4F1054628D0091ECB4 /* PBXTextBookmark */; + D4A96E511054628D0091ECB4 = D4A96E511054628D0091ECB4 /* PBXTextBookmark */; + D4C9D7E810A9B7A20005973D /* PBXTextBookmark */ = D4C9D7E810A9B7A20005973D /* PBXTextBookmark */; + D4C9D7EB10A9B7A20005973D /* PBXTextBookmark */ = D4C9D7EB10A9B7A20005973D /* PBXTextBookmark */; + }; + sourceControlManager = D4A4941A1054167B00BE38AE /* Source Control */; + userBuildSettings = { + }; + }; + 29B97316FDCFA39411CA2CEA /* main.m */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {633, 195}}"; + sepNavSelRange = "{191, 0}"; + sepNavVisRange = "{29, 213}"; + }; + }; + 8D1107260486CEB800E47090 /* QuietUnrar */ = { + activeExec = 0; + executables = ( + D4A4940C1054167200BE38AE /* QuietUnrar */, + ); + }; + 8D1107310486CEB800E47090 /* QuietUnrar-Info.plist */ = { + uiCtxt = { + sepNavWindowFrame = "{{53, 47}, {877, 731}}"; + }; + }; + D40FFE1C105828A50070BCAF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */; + name = "QuietUnrarAppDelegate.m: 29"; + rLen = 0; + rLoc = 720; + rType = 0; + vrLen = 882; + vrLoc = 235; + }; + D40FFE1F105828A50070BCAF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = D40FFE20105828A50070BCAF /* NSApplication.h */; + rLen = 1; + rLoc = 85; + rType = 1; + }; + D40FFE20105828A50070BCAF /* NSApplication.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = NSApplication.h; + path = /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSApplication.h; + sourceTree = ""; + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {3652, 5811}}"; + sepNavSelRange = "{3400, 68}"; + sepNavVisRange = "{13091, 2293}"; + }; + }; + D40FFE21105828A50070BCAF /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = D40FFE22105828A50070BCAF /* NSApplication.h */; + name = "NSApplication.h: 86"; + rLen = 68; + rLoc = 3400; + rType = 0; + vrLen = 2333; + vrLoc = 13122; + }; + D40FFE22105828A50070BCAF /* NSApplication.h */ = { + isa = PBXFileReference; + lastKnownFileType = sourcecode.c.h; + name = NSApplication.h; + path = /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSApplication.h; + sourceTree = ""; + }; + D4A4940C1054167200BE38AE /* QuietUnrar */ = { + isa = PBXExecutable; + activeArgIndices = ( + ); + argumentStrings = ( + ); + autoAttachOnCrash = 1; + breakpointsEnabled = 0; + configStateDict = { + }; + customDataFormattersEnabled = 1; + dataTipCustomDataFormattersEnabled = 1; + dataTipShowTypeColumn = 1; + dataTipSortType = 0; + debuggerPlugin = GDBDebugging; + disassemblyDisplayState = 0; + dylibVariantSuffix = ""; + enableDebugStr = 1; + environmentEntries = ( + ); + executableSystemSymbolLevel = 0; + executableUserSymbolLevel = 0; + libgmallocEnabled = 0; + name = QuietUnrar; + savedGlobals = { + }; + showTypeColumn = 0; + sourceDirectories = ( + ); + startupPath = "<>"; + variableFormatDictionary = { + }; + }; + D4A4941A1054167B00BE38AE /* Source Control */ = { + isa = PBXSourceControlManager; + fallbackIsa = XCSourceControlManager; + isSCMEnabled = 0; + scmConfiguration = { + repositoryNamesForRoots = { + "" = ""; + }; + }; + }; + D4A4941B1054167B00BE38AE /* Code sense */ = { + isa = PBXCodeSenseManager; + indexTemplatePath = ""; + }; + D4A495741054177300BE38AE /* arccmt.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {703, 2847}}"; + sepNavSelRange = "{386, 0}"; + sepNavVisRange = "{70, 690}"; + }; + }; + D4A4957F1054177300BE38AE /* consio.cpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {703, 3718}}"; + sepNavSelRange = "{3913, 14}"; + sepNavVisRange = "{3683, 678}"; + }; + }; + D4A495861054177300BE38AE /* dll.hpp */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {616, 1950}}"; + sepNavSelRange = "{2499, 0}"; + sepNavVisRange = "{2236, 490}"; + }; + }; + D4A4962A105419AA00BE38AE /* libunrar */ = { + activeExec = 0; + }; + D4A4963610541A1C00BE38AE /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = D4A495741054177300BE38AE /* arccmt.cpp */; + name = "arccmt.cpp: 20"; + rLen = 0; + rLoc = 386; + rType = 0; + vrLen = 690; + vrLoc = 70; + }; + D4A4965D105433E000BE38AE /* PBXTargetBookmark */ = { + isa = PBXTargetBookmark; + trg = D4A4962A105419AA00BE38AE /* libunrar */; + }; + D4A496731054350F00BE38AE /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = D4A495861054177300BE38AE /* dll.hpp */; + name = "dll.hpp: 12"; + rLen = 0; + rLoc = 337; + rType = 0; + vrLen = 828; + vrLoc = 0; + }; + D4A96E4C1054628D0091ECB4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 089C165DFE840E0CC02AAC07 /* English */; + name = "InfoPlist.strings: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 45; + vrLoc = 0; + }; + D4A96E4D1054628D0091ECB4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 29B97316FDCFA39411CA2CEA /* main.m */; + name = "main.m: 1"; + rLen = 0; + rLoc = 0; + rType = 0; + vrLen = 252; + vrLoc = 0; + }; + D4A96E4E1054628D0091ECB4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = D4A4957F1054177300BE38AE /* consio.cpp */; + name = "consio.cpp: 184"; + rLen = 14; + rLoc = 3913; + rType = 0; + vrLen = 678; + vrLoc = 3683; + }; + D4A96E4F1054628D0091ECB4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 256AC3D80F4B6AC300CF3369 /* QuietUnrarAppDelegate.h */; + name = "QuietUnrarAppDelegate.h: 20"; + rLen = 0; + rLoc = 371; + rType = 0; + vrLen = 616; + vrLoc = 0; + }; + D4A96E511054628D0091ECB4 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */; + name = "QuietUnrarAppDelegate.m: 11"; + rLen = 0; + rLoc = 230; + rType = 0; + vrLen = 863; + vrLoc = 0; + }; + D4C9D7E810A9B7A20005973D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 256AC3D90F4B6AC300CF3369 /* QuietUnrarAppDelegate.m */; + name = "QuietUnrarAppDelegate.m: 29"; + rLen = 0; + rLoc = 720; + rType = 0; + vrLen = 827; + vrLoc = 295; + }; + D4C9D7EB10A9B7A20005973D /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = D40FFE20105828A50070BCAF /* NSApplication.h */; + name = "NSApplication.h: 86"; + rLen = 68; + rLoc = 3400; + rType = 0; + vrLen = 2293; + vrLoc = 13091; + }; +} diff --git a/QuietUnrarAppDelegate.h b/QuietUnrarAppDelegate.h new file mode 100644 index 0000000..5064943 --- /dev/null +++ b/QuietUnrarAppDelegate.h @@ -0,0 +1,30 @@ +// +// QuietUnrarAppDelegate.h +// QuietUnrar +// +// Created by Robert McGovern on 2009/09/06. +// Copyright 2009 Tarasis. All rights reserved. +// + +#import + +enum +{ + kVKC_Shift = 56, + kVKC_Option = 58, + kVKC_Control = 59, + kVKC_rShift = 60, /* Right-hand modifiers; not implemented */ + kVKC_rOption = 61, + kVKC_rControl = 62, + kVKC_Command = 55, +}; + +#define KEYMAP_GET(m, index) ((((uint8_t*)(m))[(index) >> 3] & (1L << ((index) & 7))) ? 1 : 0) + +@interface QuietUnrarAppDelegate : NSObject { + NSWindow *window; +} + +@property (assign) IBOutlet NSWindow *window; + +@end diff --git a/QuietUnrarAppDelegate.m b/QuietUnrarAppDelegate.m new file mode 100644 index 0000000..a9a89c0 --- /dev/null +++ b/QuietUnrarAppDelegate.m @@ -0,0 +1,43 @@ +// +// QuietUnrarAppDelegate.m +// QuietUnrar +// +// Created by Robert McGovern on 2009/09/06. +// Copyright 2009 Tarasis. All rights reserved. +// + +#import +#import "QuietUnrarAppDelegate.h" +#import "libunrar/dll.hpp" + +@implementation QuietUnrarAppDelegate + +@synthesize window; + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application + KeyMap map; + GetKeys(map); + NSLog(@"Shift or Right Shift: %d", KEYMAP_GET(map, kVKC_Shift) || KEYMAP_GET(map, kVKC_rShift)); +} + +- (BOOL)application:(id)sender openFileWithoutUI:(NSString *)filename { + NSLog(@"openFileWithoutUI with file: %@", filename); + return YES; +} + +- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename { + NSLog(@"openFile: %@", filename); + return YES; +} + +//- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { +// for (NSString * filename in filenames) { +// NSLog(@"openFiles: %@", filename); +// } +// +// // If we get passed files don't open the UI +// [sender replyToOpenOrPrint:NSApplicationDelegateReplySuccess]; +//} + +@end diff --git a/QuietUnrar_Prefix.pch b/QuietUnrar_Prefix.pch new file mode 100644 index 0000000..d212878 --- /dev/null +++ b/QuietUnrar_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'QuietUnrar' target in the 'QuietUnrar' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/docs/unrardll.webarchive b/docs/unrardll.webarchive new file mode 100644 index 0000000..8ba26c3 Binary files /dev/null and b/docs/unrardll.webarchive differ diff --git a/libunrar/arccmt.cpp b/libunrar/arccmt.cpp new file mode 100644 index 0000000..0960425 --- /dev/null +++ b/libunrar/arccmt.cpp @@ -0,0 +1,217 @@ +bool Archive::GetComment(Array *CmtData,Array *CmtDataW) +{ + if (!MainComment) + return(false); + SaveFilePos SavePos(*this); + +#ifndef SFX_MODULE + ushort CmtLength; + if (OldFormat) + { + Seek(SFXSize+SIZEOF_OLDMHD,SEEK_SET); + CmtLength=GetByte(); + CmtLength+=(GetByte()<<8); + } + else +#endif + { + if (NewMhd.Flags & MHD_COMMENT) + { + Seek(SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD,SEEK_SET); + ReadHeader(); + } + else + { + Seek(SFXSize+SIZEOF_MARKHEAD+NewMhd.HeadSize,SEEK_SET); + return(SearchSubBlock(SUBHEAD_TYPE_CMT)!=0 && ReadCommentData(CmtData,CmtDataW)!=0); + } +#ifndef SFX_MODULE + if (CommHead.HeadCRC!=HeaderCRC) + { + Log(FileName,St(MLogCommHead)); + Alarm(); + return(false); + } + CmtLength=CommHead.HeadSize-SIZEOF_COMMHEAD; +#endif + } +#ifndef SFX_MODULE + if (OldFormat && (OldMhd.Flags & MHD_PACK_COMMENT) || !OldFormat && CommHead.Method!=0x30) + { + if (!OldFormat && (CommHead.UnpVer < 15 || CommHead.UnpVer > UNP_VER || CommHead.Method > 0x35)) + return(false); + ComprDataIO DataIO; + Unpack Unpack(&DataIO); + Unpack.Init(); + DataIO.SetTestMode(true); + uint UnpCmtLength; + if (OldFormat) + { +#ifdef NOCRYPT + return(false); +#else + UnpCmtLength=GetByte(); + UnpCmtLength+=(GetByte()<<8); + CmtLength-=2; + DataIO.SetCmt13Encryption(); +#endif + } + else + UnpCmtLength=CommHead.UnpSize; + DataIO.SetFiles(this,NULL); + DataIO.EnableShowProgress(false); + DataIO.SetPackedSizeToRead(CmtLength); + Unpack.SetDestSize(UnpCmtLength); + Unpack.DoUnpack(CommHead.UnpVer,false); + + if (!OldFormat && ((~DataIO.UnpFileCRC)&0xffff)!=CommHead.CommCRC) + { + Log(FileName,St(MLogCommBrk)); + Alarm(); + return(false); + } + else + { + byte *UnpData; + size_t UnpDataSize; + DataIO.GetUnpackedData(&UnpData,&UnpDataSize); + CmtData->Alloc(UnpDataSize); + memcpy(&((*CmtData)[0]),UnpData,UnpDataSize); + } + } + else + { + CmtData->Alloc(CmtLength); + + Read(&((*CmtData)[0]),CmtLength); + if (!OldFormat && CommHead.CommCRC!=(~CRC(0xffffffff,&((*CmtData)[0]),CmtLength)&0xffff)) + { + Log(FileName,St(MLogCommBrk)); + Alarm(); + CmtData->Reset(); + return(false); + } + } +#endif +#if defined(_WIN_32) && !defined(_WIN_CE) + if (CmtData->Size()>0) + { + size_t CmtSize=CmtData->Size(); + OemToCharBuff((char *)CmtData->Addr(),(char *)CmtData->Addr(),(DWORD)CmtSize); + + if (CmtDataW!=NULL) + { + CmtDataW->Alloc(CmtSize+1); + CmtData->Push(0); + CharToWide((char *)CmtData->Addr(),CmtDataW->Addr(),CmtSize+1); + CmtData->Alloc(CmtSize); + CmtDataW->Alloc(strlenw(CmtDataW->Addr())); + } + } +#endif + return(CmtData->Size()>0); +} + + +size_t Archive::ReadCommentData(Array *CmtData,Array *CmtDataW) +{ + bool Unicode=SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE; + if (!ReadSubData(CmtData,NULL)) + return(0); + size_t CmtSize=CmtData->Size(); + if (Unicode) + { + CmtSize/=2; + Array DataW(CmtSize+1); + RawToWide(CmtData->Addr(),DataW.Addr(),CmtSize); + DataW[CmtSize]=0; + size_t DestSize=CmtSize*4; + CmtData->Alloc(DestSize+1); + WideToChar(DataW.Addr(),(char *)CmtData->Addr(),DestSize); + (*CmtData)[DestSize]=0; + CmtSize=strlen((char *)CmtData->Addr()); + CmtData->Alloc(CmtSize); + if (CmtDataW!=NULL) + { + *CmtDataW=DataW; + CmtDataW->Alloc(CmtSize); + } + } + else + if (CmtDataW!=NULL) + { + CmtData->Push(0); + CmtDataW->Alloc(CmtSize+1); + CharToWide((char *)CmtData->Addr(),CmtDataW->Addr(),CmtSize+1); + CmtData->Alloc(CmtSize); + CmtDataW->Alloc(strlenw(CmtDataW->Addr())); + } + return(CmtSize); +} + + +void Archive::ViewComment() +{ +#ifndef GUI + if (Cmd->DisableComment) + return; + Array CmtBuf; + if (GetComment(&CmtBuf,NULL)) + { + size_t CmtSize=CmtBuf.Size(); + char *ChPtr=(char *)memchr(&CmtBuf[0],0x1A,CmtSize); + if (ChPtr!=NULL) + CmtSize=ChPtr-(char *)&CmtBuf[0]; + mprintf("\n"); + OutComment((char *)&CmtBuf[0],CmtSize); + } +#endif +} + + +#ifndef SFX_MODULE +void Archive::ViewFileComment() +{ + if (!(NewLhd.Flags & LHD_COMMENT) || Cmd->DisableComment || OldFormat) + return; +#ifndef GUI + mprintf(St(MFileComment)); +#endif + const int MaxSize=0x8000; + Array CmtBuf(MaxSize); + SaveFilePos SavePos(*this); + Seek(CurBlockPos+SIZEOF_NEWLHD+NewLhd.NameSize,SEEK_SET); + int64 SaveCurBlockPos=CurBlockPos; + int64 SaveNextBlockPos=NextBlockPos; + + size_t Size=ReadHeader(); + + CurBlockPos=SaveCurBlockPos; + NextBlockPos=SaveNextBlockPos; + + if (Size<7 || CommHead.HeadType!=COMM_HEAD) + return; + if (CommHead.HeadCRC!=HeaderCRC) + { +#ifndef GUI + Log(FileName,St(MLogCommHead)); +#endif + return; + } + if (CommHead.UnpVer < 15 || CommHead.UnpVer > UNP_VER || + CommHead.Method > 0x30 || CommHead.UnpSize > MaxSize) + return; + Read(&CmtBuf[0],CommHead.UnpSize); + if (CommHead.CommCRC!=((~CRC(0xffffffff,&CmtBuf[0],CommHead.UnpSize)&0xffff))) + { + Log(FileName,St(MLogBrokFCmt)); + } + else + { + OutComment(&CmtBuf[0],CommHead.UnpSize); +#ifndef GUI + mprintf("\n"); +#endif + } +} +#endif diff --git a/libunrar/archive.cpp b/libunrar/archive.cpp new file mode 100644 index 0000000..5f807b5 --- /dev/null +++ b/libunrar/archive.cpp @@ -0,0 +1,267 @@ +#include "rar.hpp" + +#ifndef SHELL_EXT +#include "arccmt.cpp" +#endif + + +Archive::Archive(RAROptions *InitCmd) +{ + Cmd=InitCmd==NULL ? &DummyCmd:InitCmd; + OpenShared=Cmd->OpenShared; + OldFormat=false; + Solid=false; + Volume=false; + MainComment=false; + Locked=false; + Signed=false; + NotFirstVolume=false; + SFXSize=0; + LatestTime.Reset(); + Protected=false; + Encrypted=false; + BrokenFileHeader=false; + LastReadBlock=0; + + CurBlockPos=0; + NextBlockPos=0; + + RecoveryPos=SIZEOF_MARKHEAD; + RecoverySectors=-1; + + memset(&NewMhd,0,sizeof(NewMhd)); + NewMhd.HeadType=MAIN_HEAD; + NewMhd.HeadSize=SIZEOF_NEWMHD; + HeaderCRC=0; + VolWrite=0; + AddingFilesSize=0; + AddingHeadersSize=0; +#if !defined(SHELL_EXT) && !defined(NOCRYPT) + *HeadersSalt=0; + *SubDataSalt=0; +#endif + *FirstVolumeName=0; + *FirstVolumeNameW=0; + + Splitting=false; + NewArchive=false; + + SilentOpen=false; + +} + + +#ifndef SHELL_EXT +void Archive::CheckArc(bool EnableBroken) +{ + if (!IsArchive(EnableBroken)) + { + Log(FileName,St(MBadArc),FileName); + ErrHandler.Exit(FATAL_ERROR); + } +} +#endif + + +#if !defined(SHELL_EXT) && !defined(SFX_MODULE) +void Archive::CheckOpen(char *Name,wchar *NameW) +{ + TOpen(Name,NameW); + CheckArc(false); +} +#endif + + +bool Archive::WCheckOpen(char *Name,wchar *NameW) +{ + if (!WOpen(Name,NameW)) + return(false); + if (!IsArchive(false)) + { +#ifndef SHELL_EXT + Log(FileName,St(MNotRAR),FileName); +#endif + Close(); + return(false); + } + return(true); +} + + +bool Archive::IsSignature(byte *D) +{ + bool Valid=false; + if (D[0]==0x52) +#ifndef SFX_MODULE + if (D[1]==0x45 && D[2]==0x7e && D[3]==0x5e) + { + OldFormat=true; + Valid=true; + } + else +#endif + if (D[1]==0x61 && D[2]==0x72 && D[3]==0x21 && D[4]==0x1a && D[5]==0x07 && D[6]==0x00) + { + OldFormat=false; + Valid=true; + } + return(Valid); +} + + +bool Archive::IsArchive(bool EnableBroken) +{ + Encrypted=false; +#ifndef SFX_MODULE + if (IsDevice()) + { +#ifndef SHELL_EXT + Log(FileName,St(MInvalidName),FileName); +#endif + return(false); + } +#endif + if (Read(MarkHead.Mark,SIZEOF_MARKHEAD)!=SIZEOF_MARKHEAD) + return(false); + SFXSize=0; + if (IsSignature(MarkHead.Mark)) + { + if (OldFormat) + Seek(0,SEEK_SET); + } + else + { + Array Buffer(MAXSFXSIZE); + long CurPos=(long)Tell(); + int ReadSize=Read(&Buffer[0],Buffer.Size()-16); + for (int I=0;I0 && CurPos<28 && ReadSize>31) + { + char *D=&Buffer[28-CurPos]; + if (D[0]!=0x52 || D[1]!=0x53 || D[2]!=0x46 || D[3]!=0x58) + continue; + } + SFXSize=CurPos+I; + Seek(SFXSize,SEEK_SET); + if (!OldFormat) + Read(MarkHead.Mark,SIZEOF_MARKHEAD); + break; + } + if (SFXSize==0) + return(false); + } + ReadHeader(); + SeekToNext(); +#ifndef SFX_MODULE + if (OldFormat) + { + NewMhd.Flags=OldMhd.Flags & 0x3f; + NewMhd.HeadSize=OldMhd.HeadSize; + } + else +#endif + { + if (HeaderCRC!=NewMhd.HeadCRC) + { +#ifndef SHELL_EXT + Log(FileName,St(MLogMainHead)); +#endif + Alarm(); + if (!EnableBroken) + return(false); + } + } + Volume=(NewMhd.Flags & MHD_VOLUME); + Solid=(NewMhd.Flags & MHD_SOLID)!=0; + MainComment=(NewMhd.Flags & MHD_COMMENT)!=0; + Locked=(NewMhd.Flags & MHD_LOCK)!=0; + Signed=(NewMhd.PosAV!=0); + Protected=(NewMhd.Flags & MHD_PROTECT)!=0; + Encrypted=(NewMhd.Flags & MHD_PASSWORD)!=0; + + if (NewMhd.EncryptVer>UNP_VER) + { +#ifdef RARDLL + Cmd->DllError=ERAR_UNKNOWN_FORMAT; +#else + ErrHandler.SetErrorCode(WARNING); + #if !defined(SILENT) && !defined(SFX_MODULE) + Log(FileName,St(MUnknownMeth),FileName); + Log(FileName,St(MVerRequired),NewMhd.EncryptVer/10,NewMhd.EncryptVer%10); + #endif +#endif + return(false); + } +#ifdef RARDLL + SilentOpen=true; +#endif + + //if not encrypted, we'll check it below + NotFirstVolume=Encrypted && (NewMhd.Flags & MHD_FIRSTVOLUME)==0; + + if (!SilentOpen || !Encrypted) + { + SaveFilePos SavePos(*this); + int64 SaveCurBlockPos=CurBlockPos,SaveNextBlockPos=NextBlockPos; + + NotFirstVolume=false; + while (ReadHeader()!=0) + { + int HeaderType=GetHeaderType(); + if (HeaderType==NEWSUB_HEAD) + { + if (SubHead.CmpName(SUBHEAD_TYPE_CMT)) + MainComment=true; + if ((SubHead.Flags & LHD_SPLIT_BEFORE) || + Volume && (NewMhd.Flags & MHD_FIRSTVOLUME)==0) + NotFirstVolume=true; + } + else + { + if (HeaderType==FILE_HEAD && ((NewLhd.Flags & LHD_SPLIT_BEFORE)!=0 || + Volume && NewLhd.UnpVer>=29 && (NewMhd.Flags & MHD_FIRSTVOLUME)==0)) + NotFirstVolume=true; + break; + } + SeekToNext(); + } + CurBlockPos=SaveCurBlockPos; + NextBlockPos=SaveNextBlockPos; + } + if (!Volume || !NotFirstVolume) + { + strcpy(FirstVolumeName,FileName); + strcpyw(FirstVolumeNameW,FileNameW); + } + + return(true); +} + + + + +void Archive::SeekToNext() +{ + Seek(NextBlockPos,SEEK_SET); +} + + +#ifndef SFX_MODULE +int Archive::GetRecoverySize(bool Required) +{ + if (!Protected) + return(0); + if (RecoverySectors!=-1 || !Required) + return(RecoverySectors); + SaveFilePos SavePos(*this); + Seek(SFXSize,SEEK_SET); + SearchSubBlock(SUBHEAD_TYPE_RR); + return(RecoverySectors); +} +#endif + + + + diff --git a/libunrar/archive.hpp b/libunrar/archive.hpp new file mode 100644 index 0000000..fa1bf35 --- /dev/null +++ b/libunrar/archive.hpp @@ -0,0 +1,126 @@ +#ifndef _RAR_ARCHIVE_ +#define _RAR_ARCHIVE_ + +class Pack; + +enum {EN_LOCK=1,EN_VOL=2,EN_FIRSTVOL=4}; + +class Archive:public File +{ + private: + bool IsSignature(byte *D); + void UpdateLatestTime(FileHeader *CurBlock); + void ConvertNameCase(char *Name); + void ConvertNameCase(wchar *Name); + void ConvertUnknownHeader(); + size_t ReadOldHeader(); + void UnexpEndArcMsg(); + +#if !defined(SHELL_EXT) && !defined(NOCRYPT) + CryptData HeadersCrypt; + byte HeadersSalt[SALT_SIZE]; +#endif +#ifndef SHELL_EXT + ComprDataIO SubDataIO; + byte SubDataSalt[SALT_SIZE]; +#endif + RAROptions *Cmd,DummyCmd; + + MarkHeader MarkHead; + OldMainHeader OldMhd; + + int RecoverySectors; + int64 RecoveryPos; + + RarTime LatestTime; + int LastReadBlock; + int CurHeaderType; + + bool SilentOpen; + public: + Archive(RAROptions *InitCmd=NULL); + bool IsArchive(bool EnableBroken); + size_t SearchBlock(int BlockType); + size_t SearchSubBlock(const char *Type); + int ReadBlock(int BlockType); + void WriteBlock(int BlockType,BaseBlock *wb=NULL); + int PrepareNamesToWrite(char *Name,wchar *NameW,char *DestName,byte *DestNameW); + void SetLhdSize(); + size_t ReadHeader(); + void CheckArc(bool EnableBroken); + void CheckOpen(char *Name,wchar *NameW=NULL); + bool WCheckOpen(char *Name,wchar *NameW=NULL); + bool TestLock(int Mode); + void MakeTemp(); + void CopyMainHeader(Archive &Src,bool CopySFX=true,char *NameToDisplay=NULL); + bool ProcessToFileHead(Archive &Src,bool LastBlockAdded, + Pack *Pack=NULL,const char *SkipName=NULL); + void TmpToArc(Archive &Src); + void CloseNew(int AdjustRecovery,bool CloseVolume); + void WriteEndBlock(bool CloseVolume); + void CopyFileRecord(Archive &Src); + void CopyArchiveData(Archive &Src); + bool GetComment(Array *CmtData,Array *CmtDataW); + void ViewComment(); + void ViewFileComment(); + void SetLatestTime(RarTime *NewTime); + void SeekToNext(); + bool CheckAccess(); + bool IsArcDir(); + bool IsArcLabel(); + void ConvertAttributes(); + int GetRecoverySize(bool Required); + void VolSubtractHeaderSize(size_t SubSize); + void AddSubData(byte *SrcData,size_t DataSize,File *SrcFile,const char *Name,bool AllowSplit); + bool ReadSubData(Array *UnpData,File *DestFile); + int GetHeaderType() {return(CurHeaderType);}; + size_t ReadCommentData(Array *CmtData,Array *CmtDataW); + void WriteCommentData(byte *Data,size_t DataSize,bool FileComment); + RAROptions* GetRAROptions() {return(Cmd);} + void SetSilentOpen(bool Mode) {SilentOpen=Mode;} + + BaseBlock ShortBlock; + MainHeader NewMhd; + FileHeader NewLhd; + EndArcHeader EndArcHead; + SubBlockHeader SubBlockHead; + FileHeader SubHead; + CommentHeader CommHead; + ProtectHeader ProtectHead; + AVHeader AVHead; + SignHeader SignHead; + UnixOwnersHeader UOHead; + MacFInfoHeader MACHead; + EAHeader EAHead; + StreamHeader StreamHead; + + int64 CurBlockPos; + int64 NextBlockPos; + + bool OldFormat; + bool Solid; + bool Volume; + bool MainComment; + bool Locked; + bool Signed; + bool NotFirstVolume; + bool Protected; + bool Encrypted; + size_t SFXSize; + bool BrokenFileHeader; + + bool Splitting; + + ushort HeaderCRC; + + int64 VolWrite; + int64 AddingFilesSize; + size_t AddingHeadersSize; + + bool NewArchive; + + char FirstVolumeName[NM]; + wchar FirstVolumeNameW[NM]; +}; + +#endif diff --git a/libunrar/arcread.cpp b/libunrar/arcread.cpp new file mode 100644 index 0000000..256287d --- /dev/null +++ b/libunrar/arcread.cpp @@ -0,0 +1,712 @@ +#include "rar.hpp" + +size_t Archive::SearchBlock(int BlockType) +{ + size_t Size,Count=0; + while ((Size=ReadHeader())!=0 && + (BlockType==ENDARC_HEAD || GetHeaderType()!=ENDARC_HEAD)) + { + if ((++Count & 127)==0) + Wait(); + if (GetHeaderType()==BlockType) + return(Size); + SeekToNext(); + } + return(0); +} + + +size_t Archive::SearchSubBlock(const char *Type) +{ + size_t Size; + while ((Size=ReadHeader())!=0 && GetHeaderType()!=ENDARC_HEAD) + { + if (GetHeaderType()==NEWSUB_HEAD && SubHead.CmpName(Type)) + return(Size); + SeekToNext(); + } + return(0); +} + + +void Archive::UnexpEndArcMsg() +{ + int64 ArcSize=FileLength(); + if (CurBlockPos>ArcSize || NextBlockPos>ArcSize) + { +#ifndef SHELL_EXT + Log(FileName,St(MLogUnexpEOF)); +#endif + ErrHandler.SetErrorCode(WARNING); + } +} + + +size_t Archive::ReadHeader() +{ + CurBlockPos=Tell(); + +#ifndef SFX_MODULE + if (OldFormat) + return(ReadOldHeader()); +#endif + + RawRead Raw(this); + + bool Decrypt=Encrypted && CurBlockPos>=(int64)SFXSize+SIZEOF_MARKHEAD+SIZEOF_NEWMHD; + + if (Decrypt) + { +#if defined(SHELL_EXT) || defined(NOCRYPT) + return(0); +#else + if (Read(HeadersSalt,SALT_SIZE)!=SALT_SIZE) + { + UnexpEndArcMsg(); + return(0); + } + if (*Cmd->Password==0) +#ifdef RARDLL + if (Cmd->Callback==NULL || + Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1) + { + Close(); + ErrHandler.Exit(USER_BREAK); + } + +#else + if (!GetPassword(PASSWORD_ARCHIVE,FileName,Cmd->Password,sizeof(Cmd->Password))) + { + Close(); + ErrHandler.Exit(USER_BREAK); + } +#endif + HeadersCrypt.SetCryptKeys(Cmd->Password,HeadersSalt,false,false,NewMhd.EncryptVer>=36); + Raw.SetCrypt(&HeadersCrypt); +#endif + } + + Raw.Read(SIZEOF_SHORTBLOCKHEAD); + if (Raw.Size()==0) + { + UnexpEndArcMsg(); + return(0); + } + + Raw.Get(ShortBlock.HeadCRC); + byte HeadType; + Raw.Get(HeadType); + ShortBlock.HeadType=(HEADER_TYPE)HeadType; + Raw.Get(ShortBlock.Flags); + Raw.Get(ShortBlock.HeadSize); + if (ShortBlock.HeadSizePackSize); + Raw.Get(hd->UnpSize); + Raw.Get(hd->HostOS); + Raw.Get(hd->FileCRC); + Raw.Get(hd->FileTime); + Raw.Get(hd->UnpVer); + Raw.Get(hd->Method); + Raw.Get(hd->NameSize); + Raw.Get(hd->FileAttr); + if (hd->Flags & LHD_LARGE) + { + Raw.Get(hd->HighPackSize); + Raw.Get(hd->HighUnpSize); + } + else + { + hd->HighPackSize=hd->HighUnpSize=0; + if (hd->UnpSize==0xffffffff) + { + // UnpSize equal to 0xffffffff without LHD_LARGE flag indicates + // that we do not know the unpacked file size and must unpack it + // until we find the end of file marker in compressed data. + hd->UnpSize=(uint)(INT64NDF); + hd->HighUnpSize=(uint)(INT64NDF>>32); + } + } + hd->FullPackSize=INT32TO64(hd->HighPackSize,hd->PackSize); + hd->FullUnpSize=INT32TO64(hd->HighUnpSize,hd->UnpSize); + + char FileName[NM*4]; + int NameSize=Min(hd->NameSize,sizeof(FileName)-1); + Raw.Get((byte *)FileName,NameSize); + FileName[NameSize]=0; + + strncpyz(hd->FileName,FileName,ASIZE(hd->FileName)); + + if (hd->HeadType==NEWSUB_HEAD) + { + int DataSize=hd->HeadSize-hd->NameSize-SIZEOF_NEWLHD; + if (hd->Flags & LHD_SALT) + DataSize-=SALT_SIZE; + if (DataSize>0) + { + hd->SubData.Alloc(DataSize); + Raw.Get(&hd->SubData[0],DataSize); + if (hd->CmpName(SUBHEAD_TYPE_RR)) + { + byte *D=&hd->SubData[8]; + RecoverySectors=D[0]+((uint)D[1]<<8)+((uint)D[2]<<16)+((uint)D[3]<<24); + } + } + } + else + if (hd->HeadType==FILE_HEAD) + { + if (hd->Flags & LHD_UNICODE) + { + EncodeFileName NameCoder; + size_t Length=strlen(FileName); + if (Length==hd->NameSize) + { + UtfToWide(FileName,hd->FileNameW,sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])-1); + WideToChar(hd->FileNameW,hd->FileName,sizeof(hd->FileName)/sizeof(hd->FileName[0])-1); + ExtToInt(hd->FileName,hd->FileName); + } + else + { + Length++; + NameCoder.Decode(FileName,(byte *)FileName+Length, + hd->NameSize-Length,hd->FileNameW, + sizeof(hd->FileNameW)/sizeof(hd->FileNameW[0])); + } + if (*hd->FileNameW==0) + hd->Flags &= ~LHD_UNICODE; + } + else + *hd->FileNameW=0; +#ifndef SFX_MODULE + ConvertNameCase(hd->FileName); + ConvertNameCase(hd->FileNameW); +#endif + ConvertUnknownHeader(); + } + if (hd->Flags & LHD_SALT) + Raw.Get(hd->Salt,SALT_SIZE); + hd->mtime.SetDos(hd->FileTime); + hd->ctime.Reset(); + hd->atime.Reset(); + hd->arctime.Reset(); + if (hd->Flags & LHD_EXTTIME) + { + ushort Flags; + Raw.Get(Flags); + RarTime *tbl[4]; + tbl[0]=&NewLhd.mtime; + tbl[1]=&NewLhd.ctime; + tbl[2]=&NewLhd.atime; + tbl[3]=&NewLhd.arctime; + for (int I=0;I<4;I++) + { + RarTime *CurTime=tbl[I]; + uint rmode=Flags>>(3-I)*4; + if ((rmode & 8)==0) + continue; + if (I!=0) + { + uint DosTime; + Raw.Get(DosTime); + CurTime->SetDos(DosTime); + } + RarLocalTime rlt; + CurTime->GetLocal(&rlt); + if (rmode & 4) + rlt.Second++; + rlt.Reminder=0; + int count=rmode&3; + for (int J=0;JSetLocal(&rlt); + } + } + NextBlockPos+=hd->FullPackSize; + bool CRCProcessedOnly=(hd->Flags & LHD_COMMENT)!=0; + HeaderCRC=~Raw.GetCRC(CRCProcessedOnly)&0xffff; + if (hd->HeadCRC!=HeaderCRC) + { + if (hd->HeadType==NEWSUB_HEAD) + strcat(hd->FileName,"- ???"); + BrokenFileHeader=true; + ErrHandler.SetErrorCode(WARNING); +#ifndef SHELL_EXT + Log(Archive::FileName,St(MLogFileHead),IntNameToExt(hd->FileName)); + Alarm(); +#endif + } + } + break; +#ifndef SFX_MODULE + case COMM_HEAD: + *(BaseBlock *)&CommHead=ShortBlock; + Raw.Get(CommHead.UnpSize); + Raw.Get(CommHead.UnpVer); + Raw.Get(CommHead.Method); + Raw.Get(CommHead.CommCRC); + break; + case SIGN_HEAD: + *(BaseBlock *)&SignHead=ShortBlock; + Raw.Get(SignHead.CreationTime); + Raw.Get(SignHead.ArcNameSize); + Raw.Get(SignHead.UserNameSize); + break; + case AV_HEAD: + *(BaseBlock *)&AVHead=ShortBlock; + Raw.Get(AVHead.UnpVer); + Raw.Get(AVHead.Method); + Raw.Get(AVHead.AVVer); + Raw.Get(AVHead.AVInfoCRC); + break; + case PROTECT_HEAD: + *(BaseBlock *)&ProtectHead=ShortBlock; + Raw.Get(ProtectHead.DataSize); + Raw.Get(ProtectHead.Version); + Raw.Get(ProtectHead.RecSectors); + Raw.Get(ProtectHead.TotalBlocks); + Raw.Get(ProtectHead.Mark,8); + NextBlockPos+=ProtectHead.DataSize; + RecoverySectors=ProtectHead.RecSectors; + break; + case SUB_HEAD: + *(BaseBlock *)&SubBlockHead=ShortBlock; + Raw.Get(SubBlockHead.DataSize); + NextBlockPos+=SubBlockHead.DataSize; + Raw.Get(SubBlockHead.SubType); + Raw.Get(SubBlockHead.Level); + switch(SubBlockHead.SubType) + { + case UO_HEAD: + *(SubBlockHeader *)&UOHead=SubBlockHead; + Raw.Get(UOHead.OwnerNameSize); + Raw.Get(UOHead.GroupNameSize); + if (UOHead.OwnerNameSize>NM-1) + UOHead.OwnerNameSize=NM-1; + if (UOHead.GroupNameSize>NM-1) + UOHead.GroupNameSize=NM-1; + Raw.Get((byte *)UOHead.OwnerName,UOHead.OwnerNameSize); + Raw.Get((byte *)UOHead.GroupName,UOHead.GroupNameSize); + UOHead.OwnerName[UOHead.OwnerNameSize]=0; + UOHead.GroupName[UOHead.GroupNameSize]=0; + break; + case MAC_HEAD: + *(SubBlockHeader *)&MACHead=SubBlockHead; + Raw.Get(MACHead.fileType); + Raw.Get(MACHead.fileCreator); + break; + case EA_HEAD: + case BEEA_HEAD: + case NTACL_HEAD: + *(SubBlockHeader *)&EAHead=SubBlockHead; + Raw.Get(EAHead.UnpSize); + Raw.Get(EAHead.UnpVer); + Raw.Get(EAHead.Method); + Raw.Get(EAHead.EACRC); + break; + case STREAM_HEAD: + *(SubBlockHeader *)&StreamHead=SubBlockHead; + Raw.Get(StreamHead.UnpSize); + Raw.Get(StreamHead.UnpVer); + Raw.Get(StreamHead.Method); + Raw.Get(StreamHead.StreamCRC); + Raw.Get(StreamHead.StreamNameSize); + if (StreamHead.StreamNameSize>NM-1) + StreamHead.StreamNameSize=NM-1; + Raw.Get((byte *)StreamHead.StreamName,StreamHead.StreamNameSize); + StreamHead.StreamName[StreamHead.StreamNameSize]=0; + break; + } + break; +#endif + default: + if (ShortBlock.Flags & LONG_BLOCK) + { + uint DataSize; + Raw.Get(DataSize); + NextBlockPos+=DataSize; + } + break; + } + HeaderCRC=~Raw.GetCRC(false)&0xffff; + CurHeaderType=ShortBlock.HeadType; + if (Decrypt) + { + NextBlockPos+=Raw.PaddedSize()+SALT_SIZE; + + if (ShortBlock.HeadCRC!=HeaderCRC) + { + bool Recovered=false; + if (ShortBlock.HeadType==ENDARC_HEAD && (EndArcHead.Flags & EARC_REVSPACE)!=0) + { + // Last 7 bytes of recovered volume can contain zeroes, because + // REV files store its own information (volume number, etc.) here. + SaveFilePos SavePos(*this); + int64 Length=Tell(); + Seek(Length-7,SEEK_SET); + Recovered=true; + for (int J=0;J<7;J++) + if (GetByte()!=0) + Recovered=false; + } + if (!Recovered) + { +#ifndef SILENT + Log(FileName,St(MEncrBadCRC),FileName); +#endif + Close(); + + BrokenFileHeader=true; + ErrHandler.SetErrorCode(CRC_ERROR); + return(0); +// ErrHandler.Exit(CRC_ERROR); + } + } + } + + if (NextBlockPos<=CurBlockPos) + { +#ifndef SHELL_EXT + Log(FileName,St(MLogFileHead),"???"); +#endif + BrokenFileHeader=true; + ErrHandler.SetErrorCode(CRC_ERROR); + return(0); + } + return(Raw.Size()); +} + + +#ifndef SFX_MODULE +size_t Archive::ReadOldHeader() +{ + RawRead Raw(this); + if (CurBlockPos<=(int64)SFXSize) + { + Raw.Read(SIZEOF_OLDMHD); + Raw.Get(OldMhd.Mark,4); + Raw.Get(OldMhd.HeadSize); + Raw.Get(OldMhd.Flags); + NextBlockPos=CurBlockPos+OldMhd.HeadSize; + CurHeaderType=MAIN_HEAD; + } + else + { + OldFileHeader OldLhd; + Raw.Read(SIZEOF_OLDLHD); + NewLhd.HeadType=FILE_HEAD; + Raw.Get(NewLhd.PackSize); + Raw.Get(NewLhd.UnpSize); + Raw.Get(OldLhd.FileCRC); + Raw.Get(NewLhd.HeadSize); + Raw.Get(NewLhd.FileTime); + Raw.Get(OldLhd.FileAttr); + Raw.Get(OldLhd.Flags); + Raw.Get(OldLhd.UnpVer); + Raw.Get(OldLhd.NameSize); + Raw.Get(OldLhd.Method); + + NewLhd.Flags=OldLhd.Flags|LONG_BLOCK; + NewLhd.UnpVer=(OldLhd.UnpVer==2) ? 13 : 10; + NewLhd.Method=OldLhd.Method+0x30; + NewLhd.NameSize=OldLhd.NameSize; + NewLhd.FileAttr=OldLhd.FileAttr; + NewLhd.FileCRC=OldLhd.FileCRC; + NewLhd.FullPackSize=NewLhd.PackSize; + NewLhd.FullUnpSize=NewLhd.UnpSize; + + NewLhd.mtime.SetDos(NewLhd.FileTime); + NewLhd.ctime.Reset(); + NewLhd.atime.Reset(); + NewLhd.arctime.Reset(); + + Raw.Read(OldLhd.NameSize); + Raw.Get((byte *)NewLhd.FileName,OldLhd.NameSize); + NewLhd.FileName[OldLhd.NameSize]=0; + ConvertNameCase(NewLhd.FileName); + *NewLhd.FileNameW=0; + + if (Raw.Size()!=0) + NextBlockPos=CurBlockPos+NewLhd.HeadSize+NewLhd.PackSize; + CurHeaderType=FILE_HEAD; + } + return(NextBlockPos>CurBlockPos ? Raw.Size():0); +} +#endif + + +void Archive::ConvertNameCase(char *Name) +{ + if (Cmd->ConvertNames==NAMES_UPPERCASE) + { + IntToExt(Name,Name); + strupper(Name); + ExtToInt(Name,Name); + } + if (Cmd->ConvertNames==NAMES_LOWERCASE) + { + IntToExt(Name,Name); + strlower(Name); + ExtToInt(Name,Name); + } +} + + +#ifndef SFX_MODULE +void Archive::ConvertNameCase(wchar *Name) +{ + if (Cmd->ConvertNames==NAMES_UPPERCASE) + strupperw(Name); + if (Cmd->ConvertNames==NAMES_LOWERCASE) + strlowerw(Name); +} +#endif + + +bool Archive::IsArcDir() +{ + return((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY); +} + + +bool Archive::IsArcLabel() +{ + return(NewLhd.HostOS<=HOST_WIN32 && (NewLhd.FileAttr & 8)); +} + + +void Archive::ConvertAttributes() +{ +#if defined(_WIN_32) || defined(_EMX) + switch(NewLhd.HostOS) + { + case HOST_MSDOS: + case HOST_OS2: + case HOST_WIN32: + break; + case HOST_UNIX: + case HOST_BEOS: + if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) + NewLhd.FileAttr=0x10; + else + NewLhd.FileAttr=0x20; + break; + default: + if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) + NewLhd.FileAttr=0x10; + else + NewLhd.FileAttr=0x20; + break; + } +#endif +#ifdef _UNIX + // umask defines which permission bits must not be set by default + // when creating a file or directory. + static mode_t mask = (mode_t) -1; + + if (mask == (mode_t) -1) + { + // umask call returns the current umask value. Argument (022) is not + // important here. + mask = umask(022); + + // Restore the original umask value, which was changed to 022 above. + umask(mask); + } + + switch(NewLhd.HostOS) + { + case HOST_MSDOS: + case HOST_OS2: + case HOST_WIN32: + { + // Mapping MSDOS, OS/2 and Windows file attributes to Unix. + + if (NewLhd.FileAttr & 0x10) // FILE_ATTRIBUTE_DIRECTORY + { + // For directories we use 0777 mask. + NewLhd.FileAttr=0777 & ~mask; + } + else + if (NewLhd.FileAttr & 1) // FILE_ATTRIBUTE_READONLY + { + // For read only files we use 0444 mask with 'w' bits turned off. + NewLhd.FileAttr=0444 & ~mask; + } + else + { + // umask does not set +x for regular files, so we use 0666 + // instead of 0777 as for directories. + NewLhd.FileAttr=0666 & ~mask; + } + } + break; + case HOST_UNIX: + case HOST_BEOS: + break; + default: + if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) + NewLhd.FileAttr=0x41ff & ~mask; + else + NewLhd.FileAttr=0x81b6 & ~mask; + break; + } +#endif +} + + +void Archive::ConvertUnknownHeader() +{ + if (NewLhd.UnpVer<20 && (NewLhd.FileAttr & 0x10)) + NewLhd.Flags|=LHD_DIRECTORY; + if (NewLhd.HostOS>=HOST_MAX) + { + if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY) + NewLhd.FileAttr=0x10; + else + NewLhd.FileAttr=0x20; + } + for (char *s=NewLhd.FileName;*s!=0;s=charnext(s)) + { + if (*s=='/' || *s=='\\') + *s=CPATHDIVIDER; +#if defined(_APPLE) && !defined(UNICODE_SUPPORTED) + if ((byte)*s<32 || (byte)*s>127) + *s='_'; +#endif + +#if defined(_WIN_32) || defined(_EMX) + // ':' in file names is allowed in Unix, but not in Windows. + // Even worse, file data will be written to NTFS stream on NTFS, + // so automatic name correction on file create error in extraction + // routine does not work. In Windows and DOS versions we better + // replace ':' now. + if (*s==':') + *s='_'; +#endif + + } + + for (wchar *s=NewLhd.FileNameW;*s!=0;s++) + { + if (*s=='/' || *s=='\\') + *s=CPATHDIVIDER; + +#if defined(_WIN_32) || defined(_EMX) + // ':' in file names is allowed in Unix, but not in Windows. + // Even worse, file data will be written to NTFS stream on NTFS, + // so automatic name correction on file create error in extraction + // routine does not work. In Windows and DOS versions we better + // replace ':' now. + if (*s==':') + *s='_'; +#endif + } +} + + +#ifndef SHELL_EXT +bool Archive::ReadSubData(Array *UnpData,File *DestFile) +{ + if (HeaderCRC!=SubHead.HeadCRC) + { +#ifndef SHELL_EXT + Log(FileName,St(MSubHeadCorrupt)); +#endif + ErrHandler.SetErrorCode(CRC_ERROR); + return(false); + } + if (SubHead.Method<0x30 || SubHead.Method>0x35 || SubHead.UnpVer>/*PACK_VER*/36) + { +#ifndef SHELL_EXT + Log(FileName,St(MSubHeadUnknown)); +#endif + return(false); + } + + if (SubHead.PackSize==0 && (SubHead.Flags & LHD_SPLIT_AFTER)==0) + return(true); + + SubDataIO.Init(); + Unpack Unpack(&SubDataIO); + Unpack.Init(); + + if (DestFile==NULL) + { + UnpData->Alloc(SubHead.UnpSize); + SubDataIO.SetUnpackToMemory(&(*UnpData)[0],SubHead.UnpSize); + } + if (SubHead.Flags & LHD_PASSWORD) + if (*Cmd->Password) + SubDataIO.SetEncryption(SubHead.UnpVer,Cmd->Password, + (SubHead.Flags & LHD_SALT) ? SubHead.Salt:NULL,false, + SubHead.UnpVer>=36); + else + return(false); + SubDataIO.SetPackedSizeToRead(SubHead.PackSize); + SubDataIO.EnableShowProgress(false); + SubDataIO.SetFiles(this,DestFile); + SubDataIO.UnpVolume=(SubHead.Flags & LHD_SPLIT_AFTER)!=0; + SubDataIO.SetSubHeader(&SubHead,NULL); + Unpack.SetDestSize(SubHead.UnpSize); + if (SubHead.Method==0x30) + CmdExtract::UnstoreFile(SubDataIO,SubHead.UnpSize); + else + Unpack.DoUnpack(SubHead.UnpVer,false); + + if (SubHead.FileCRC!=~SubDataIO.UnpFileCRC) + { +#ifndef SHELL_EXT + Log(FileName,St(MSubHeadDataCRC),SubHead.FileName); +#endif + ErrHandler.SetErrorCode(CRC_ERROR); + if (UnpData!=NULL) + UnpData->Reset(); + return(false); + } + return(true); +} +#endif diff --git a/libunrar/array.hpp b/libunrar/array.hpp new file mode 100644 index 0000000..c67817a --- /dev/null +++ b/libunrar/array.hpp @@ -0,0 +1,122 @@ +#ifndef _RAR_ARRAY_ +#define _RAR_ARRAY_ + +extern ErrorHandler ErrHandler; + +template class Array +{ + private: + T *Buffer; + size_t BufSize; + size_t AllocSize; + public: + Array(); + Array(size_t Size); + ~Array(); + inline void CleanData(); + inline T& operator [](size_t Item); + inline size_t Size(); + void Add(size_t Items); + void Alloc(size_t Items); + void Reset(); + void operator = (Array &Src); + void Push(T Item); + T* Addr() {return(Buffer);} +}; + +template void Array::CleanData() +{ + Buffer=NULL; + BufSize=0; + AllocSize=0; +} + + +template Array::Array() +{ + CleanData(); +} + + +template Array::Array(size_t Size) +{ + Buffer=(T *)rarmalloc(sizeof(T)*Size); + if (Buffer==NULL && Size!=0) + ErrHandler.MemoryError(); + + AllocSize=BufSize=Size; +} + + +template Array::~Array() +{ + if (Buffer!=NULL) + rarfree(Buffer); +} + + +template inline T& Array::operator [](size_t Item) +{ + return(Buffer[Item]); +} + + +template inline size_t Array::Size() +{ + return(BufSize); +} + + +template void Array::Add(size_t Items) +{ + BufSize+=Items; + if (BufSize>AllocSize) + { + size_t Suggested=AllocSize+AllocSize/4+32; + size_t NewSize=Max(BufSize,Suggested); + + Buffer=(T *)rarrealloc(Buffer,NewSize*sizeof(T)); + if (Buffer==NULL) + ErrHandler.MemoryError(); + AllocSize=NewSize; + } +} + + +template void Array::Alloc(size_t Items) +{ + if (Items>AllocSize) + Add(Items-BufSize); + else + BufSize=Items; +} + + +template void Array::Reset() +{ + if (Buffer!=NULL) + { + rarfree(Buffer); + Buffer=NULL; + } + BufSize=0; + AllocSize=0; +} + + +template void Array::operator =(Array &Src) +{ + Reset(); + Alloc(Src.BufSize); + if (Src.BufSize!=0) + memcpy((void *)Buffer,(void *)Src.Buffer,Src.BufSize*sizeof(T)); +} + + +template void Array::Push(T Item) +{ + Add(1); + (*this)[Size()-1]=Item; +} + +#endif diff --git a/libunrar/beosea.cpp b/libunrar/beosea.cpp new file mode 100644 index 0000000..86eb7d4 --- /dev/null +++ b/libunrar/beosea.cpp @@ -0,0 +1,113 @@ + + +void ExtractBeEA(Archive &Arc,char *FileName) +{ + if (Arc.HeaderCRC!=Arc.EAHead.HeadCRC) + { + Log(Arc.FileName,St(MEABroken),FileName); + ErrHandler.SetErrorCode(CRC_ERROR); + return; + } + if (Arc.EAHead.Method<0x31 || Arc.EAHead.Method>0x35 || Arc.EAHead.UnpVer>PACK_VER) + { + Log(Arc.FileName,St(MEAUnknHeader),FileName); + return; + } + + ComprDataIO DataIO; + Unpack Unpack(&DataIO); + Unpack.Init(); + + Array UnpData(Arc.EAHead.UnpSize); + DataIO.SetUnpackToMemory(&UnpData[0],Arc.EAHead.UnpSize); + DataIO.SetPackedSizeToRead(Arc.EAHead.DataSize); + DataIO.EnableShowProgress(false); + DataIO.SetFiles(&Arc,NULL); + Unpack.SetDestSize(Arc.EAHead.UnpSize); + Unpack.DoUnpack(Arc.EAHead.UnpVer,false); + + if (Arc.EAHead.EACRC!=~DataIO.UnpFileCRC) + { + Log(Arc.FileName,St(MEABroken),FileName); + ErrHandler.SetErrorCode(CRC_ERROR); + return; + } + int fd = open(FileName,O_WRONLY); + if (fd==-1) + { + Log(Arc.FileName,St(MCannotSetEA),FileName); + ErrHandler.SetErrorCode(WARNING); + return; + } + + int AttrPos=0; + while (AttrPos=sizeof(Name)) + { + Log(Arc.FileName,St(MCannotSetEA),FileName); + ErrHandler.SetErrorCode(WARNING); + break; + } + memcpy(Name,CurItem+10,NameSize); + Name[NameSize]=0; + if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1) + { + Log(Arc.FileName,St(MCannotSetEA),FileName); + ErrHandler.SetErrorCode(WARNING); + break; + } + AttrPos+=10+NameSize+Size; + } + close(fd); + mprintf(St(MShowEA)); +} + + +void ExtractBeEANew(Archive &Arc,char *FileName) +{ + Array SubData; + if (!Arc.ReadSubData(&SubData,NULL)) + return; + + int fd = open(FileName,O_WRONLY); + if (fd==-1) + { + Log(Arc.FileName,St(MCannotSetEA),FileName); + ErrHandler.SetErrorCode(WARNING); + return; + } + + int AttrPos=0; + while (AttrPos=sizeof(Name)) + { + Log(Arc.FileName,St(MCannotSetEA),FileName); + ErrHandler.SetErrorCode(WARNING); + break; + } + memcpy(Name,CurItem+10,NameSize); + Name[NameSize]=0; + if (fs_write_attr(fd,Name,Type,0,CurItem+10+NameSize,Size)==-1) + { + Log(Arc.FileName,St(MCannotSetEA),FileName); + ErrHandler.SetErrorCode(WARNING); + break; + } + AttrPos+=10+NameSize+Size; + } + close(fd); + mprintf(St(MShowEA)); +} + diff --git a/libunrar/cmddata.cpp b/libunrar/cmddata.cpp new file mode 100644 index 0000000..4f53f44 --- /dev/null +++ b/libunrar/cmddata.cpp @@ -0,0 +1,1298 @@ +#include "rar.hpp" + +CommandData::CommandData() +{ + FileArgs=ExclArgs=InclArgs=StoreArgs=ArcNames=NULL; + Init(); +} + + +CommandData::~CommandData() +{ + Close(); +} + + +void CommandData::Init() +{ + Close(); + + *Command=0; + *ArcName=0; + *ArcNameW=0; + FileLists=false; + NoMoreSwitches=false; + + FileArgs=new StringList; + ExclArgs=new StringList; + InclArgs=new StringList; + StoreArgs=new StringList; + ArcNames=new StringList; +} + + +void CommandData::Close() +{ + delete FileArgs; + delete ExclArgs; + delete InclArgs; + delete StoreArgs; + delete ArcNames; + FileArgs=ExclArgs=InclArgs=StoreArgs=ArcNames=NULL; + NextVolSizes.Reset(); +} + + +#if !defined(SFX_MODULE) +void CommandData::ParseArg(char *Arg,wchar *ArgW) +{ + if (IsSwitch(*Arg) && !NoMoreSwitches) + if (Arg[1]=='-') + NoMoreSwitches=true; + else + ProcessSwitch(&Arg[1],(ArgW!=NULL && *ArgW!=0 ? &ArgW[1]:NULL)); + else + if (*Command==0) + { + strncpyz(Command,Arg,ASIZE(Command)); + if (ArgW!=NULL) + strncpyw(CommandW,ArgW,sizeof(CommandW)/sizeof(CommandW[0])); + if (etoupper(*Command)=='S') + { + const char *SFXName=Command[1] ? Command+1:DefSFXName; + if (PointToName(SFXName)!=SFXName || FileExist(SFXName)) + strcpy(SFXModule,SFXName); + else + GetConfigName(SFXName,SFXModule,true); + } +#ifndef GUI + *Command=etoupper(*Command); + if (*Command!='I' && *Command!='S') + strupper(Command); +#endif + } + else + if (*ArcName==0) + { + strncpyz(ArcName,Arg,ASIZE(ArcName)); + if (ArgW!=NULL) + strncpyzw(ArcNameW,ArgW,ASIZE(ArcNameW)); + } + else + { + size_t Length=strlen(Arg); + char EndChar=Length==0 ? 0:Arg[Length-1]; + char CmdChar=etoupper(*Command); + bool Add=strchr("AFUM",CmdChar)!=NULL; + bool Extract=CmdChar=='X' || CmdChar=='E'; + if ((IsDriveDiv(EndChar) || IsPathDiv(EndChar)) && !Add) + { + strncpyz(ExtrPath,Arg,ASIZE(ExtrPath)); + if (ArgW!=NULL) + strncpyzw(ExtrPathW,ArgW,ASIZE(ExtrPathW)); + } + else + if ((Add || CmdChar=='T') && *Arg!='@') + FileArgs->AddString(Arg); + else + { + struct FindData FileData; + bool Found=FindFile::FastFind(Arg,NULL,&FileData); + if (!Found && *Arg=='@' && !IsWildcard(Arg)) + { + FileLists=true; + + RAR_CHARSET Charset=FilelistCharset; + +#if defined(_WIN_32) && !defined(GUI) + // for compatibility reasons we use OEM encoding + // in Win32 console version by default + + if (Charset==RCH_DEFAULT) + Charset=RCH_OEM; +#endif + + ReadTextFile(Arg+1,FileArgs,false,true,Charset,true,true,true); + } + else + if (Found && FileData.IsDir && Extract && *ExtrPath==0) + { + strcpy(ExtrPath,Arg); + AddEndSlash(ExtrPath); + } + else + FileArgs->AddString(Arg); + } + } +} +#endif + + +void CommandData::ParseDone() +{ + if (FileArgs->ItemsCount()==0 && !FileLists) + FileArgs->AddString(MASKALL); + char CmdChar=etoupper(*Command); + bool Extract=CmdChar=='X' || CmdChar=='E' || CmdChar=='P'; + if (Test && Extract) + Test=false; // Switch '-t' is senseless for 'X', 'E', 'P' commands. + BareOutput=(CmdChar=='L' || CmdChar=='V') && Command[1]=='B'; +} + + +#if !defined(SFX_MODULE) && !defined(_WIN_CE) +void CommandData::ParseEnvVar() +{ + char *EnvStr=getenv("RAR"); + if (EnvStr!=NULL) + ProcessSwitchesString(EnvStr); +} +#endif + + + +// return 'false' if -cfg- is present and preprocess switches +// which must be processed before the rest of command line + +#ifndef SFX_MODULE +bool CommandData::IsConfigEnabled(int argc,char *argv[]) +{ + bool ConfigEnabled=true; + for (int I=1;I='0' && Switch[2]<='4'; + if (CommonMode) + Mode=(EXTTIME_MODE)(Switch[2]-'0'); + if (Switch[2]=='-') + Mode=EXTTIME_NONE; + if (CommonMode || Switch[2]=='-' || Switch[2]=='+' || Switch[2]==0) + xmtime=xctime=xatime=Mode; + else + { + if (Switch[3]>='0' && Switch[3]<='4') + Mode=(EXTTIME_MODE)(Switch[3]-'0'); + if (Switch[3]=='-') + Mode=EXTTIME_NONE; + switch(etoupper(Switch[2])) + { + case 'M': + xmtime=Mode; + break; + case 'C': + xctime=Mode; + break; + case 'A': + xatime=Mode; + break; + case 'R': + xarctime=Mode; + break; + } + } + } + break; + case '-': + Test=false; + break; + case 0: + Test=true; + break; + default: + BadSwitch(Switch); + break; + } + break; + case 'A': + switch(etoupper(Switch[1])) + { + case 'C': + ClearArc=true; + break; + case 'D': + AppendArcNameToPath=true; + break; + case 'G': + if (Switch[2]=='-' && Switch[3]==0) + GenerateArcName=0; + else + { + GenerateArcName=true; + strncpyz(GenerateMask,Switch+2,ASIZE(GenerateMask)); + } + break; + case 'I': + IgnoreGeneralAttr=true; + break; + case 'N': //reserved for archive name + break; + case 'O': + AddArcOnly=true; + break; + case 'P': + strcpy(ArcPath,Switch+2); + if (SwitchW!=NULL && *SwitchW!=0) + strcpyw(ArcPathW,SwitchW+2); + break; + case 'S': + SyncFiles=true; + break; + default: + BadSwitch(Switch); + break; + } + break; + case 'D': + if (Switch[2]==0) + switch(etoupper(Switch[1])) + { + case 'S': + DisableSortSolid=true; + break; + case 'H': + OpenShared=true; + break; + case 'F': + DeleteFiles=true; + break; + } + break; + case 'O': + switch(etoupper(Switch[1])) + { + case '+': + Overwrite=OVERWRITE_ALL; + break; + case '-': + Overwrite=OVERWRITE_NONE; + break; + case 0: + Overwrite=OVERWRITE_FORCE_ASK; + break; + case 'R': + Overwrite=OVERWRITE_AUTORENAME; + break; + case 'W': + ProcessOwners=true; + break; +#ifdef SAVE_LINKS + case 'L': + SaveLinks=true; + break; +#endif +#ifdef _WIN_32 + case 'S': + SaveStreams=true; + break; + case 'C': + SetCompressedAttr=true; + break; +#endif + default : + BadSwitch(Switch); + break; + } + break; + case 'R': + switch(etoupper(Switch[1])) + { + case 0: + Recurse=RECURSE_ALWAYS; + break; + case '-': + Recurse=RECURSE_DISABLE; + break; + case '0': + Recurse=RECURSE_WILDCARDS; + break; +#ifndef _WIN_CE + case 'I': + { + Priority=atoi(Switch+2); + char *ChPtr=strchr(Switch+2,':'); + if (ChPtr!=NULL) + { + SleepTime=atoi(ChPtr+1); + InitSystemOptions(SleepTime); + } + SetPriority(Priority); + } + break; +#endif + } + break; + case 'Y': + AllYes=true; + break; + case 'N': + case 'X': + if (Switch[1]!=0) + { + StringList *Args=etoupper(Switch[0])=='N' ? InclArgs:ExclArgs; + if (Switch[1]=='@' && !IsWildcard(Switch)) + { + RAR_CHARSET Charset=FilelistCharset; + +#if defined(_WIN_32) && !defined(GUI) + // for compatibility reasons we use OEM encoding + // in Win32 console version by default + + if (Charset==RCH_DEFAULT) + Charset=RCH_OEM; +#endif + + ReadTextFile(Switch+2,Args,false,true,Charset,true,true,true); + } + else + Args->AddString(Switch+1); + } + break; + case 'E': + switch(etoupper(Switch[1])) + { + case 'P': + switch(Switch[2]) + { + case 0: + ExclPath=EXCL_SKIPWHOLEPATH; + break; + case '1': + ExclPath=EXCL_BASEPATH; + break; + case '2': + ExclPath=EXCL_SAVEFULLPATH; + break; + case '3': + ExclPath=EXCL_ABSPATH; + break; + } + break; + case 'E': + ProcessEA=false; + break; + case 'N': + NoEndBlock=true; + break; + default: + if (Switch[1]=='+') + { + InclFileAttr=GetExclAttr(&Switch[2]); + InclAttrSet=true; + } + else + ExclFileAttr=GetExclAttr(&Switch[1]); + break; + } + break; + case 'P': + if (Switch[1]==0) + { + GetPassword(PASSWORD_GLOBAL,NULL,Password,sizeof(Password)); + eprintf("\n"); + } + else + strncpyz(Password,Switch+1,ASIZE(Password)); + break; + case 'H': + if (etoupper(Switch[1])=='P') + { + EncryptHeaders=true; + if (Switch[2]!=0) + strncpyz(Password,Switch+2,ASIZE(Password)); + else + if (*Password==0) + { + GetPassword(PASSWORD_GLOBAL,NULL,Password,sizeof(Password)); + eprintf("\n"); + } + } + break; + case 'Z': + strncpyz(CommentFile,Switch[1]!=0 ? Switch+1:"stdin",ASIZE(CommentFile)); + break; + case 'M': + switch(etoupper(Switch[1])) + { + case 'C': + { + char *Str=Switch+2; + if (*Str=='-') + for (int I=0;IAddString(Mask); + if (End==NULL) + break; + Names=End+1; + } + } + break; +#ifdef PACK_SMP + case 'T': + Threads=atoi(Switch+2); + if (Threads>16) + BadSwitch(Switch); + else + { + } + break; +#endif + default: + Method=Switch[1]-'0'; + if (Method>5 || Method<0) + BadSwitch(Switch); + break; + } + break; + case 'V': + switch(etoupper(Switch[1])) + { +#ifdef _WIN_32 + case 'D': + EraseDisk=true; + break; +#endif + case 'N': + OldNumbering=true; + break; + case 'P': + VolumePause=true; + break; + case 'E': + if (etoupper(Switch[2])=='R') + VersionControl=atoi(Switch+3)+1; + break; + case '-': + VolSize=0; + break; + default: + { + int64 NewVolSize=atoil(&Switch[1]); + + if (NewVolSize==0) + NewVolSize=INT64NDF; // Autodetecting volume size. + else + switch (Switch[strlen(Switch)-1]) + { + case 'f': + case 'F': + switch(NewVolSize) + { + case 360: + NewVolSize=362496; + break; + case 720: + NewVolSize=730112; + break; + case 1200: + NewVolSize=1213952; + break; + case 1440: + NewVolSize=1457664; + break; + case 2880: + NewVolSize=2915328; + break; + } + break; + case 'k': + NewVolSize*=1024; + break; + case 'm': + NewVolSize*=1024*1024; + break; + case 'M': + NewVolSize*=1000*1000; + break; + case 'g': + NewVolSize*=1024*1024; + NewVolSize*=1024; + break; + case 'G': + NewVolSize*=1000*1000; + NewVolSize*=1000; + break; + case 'b': + case 'B': + break; + default: + NewVolSize*=1000; + break; + } + if (VolSize==0) + VolSize=NewVolSize; + else + NextVolSizes.Push(NewVolSize); + } + break; + } + break; + case 'F': + if (Switch[1]==0) + FreshFiles=true; + else + BadSwitch(Switch); + break; + case 'U': + if (Switch[1]==0) + UpdateFiles=true; + else + BadSwitch(Switch); + break; + case 'W': + strncpyz(TempPath,&Switch[1],ASIZE(TempPath)); + AddEndSlash(TempPath); + break; + case 'S': + if (strnicomp(Switch,"SFX",3)==0) + { + const char *SFXName=Switch[3] ? Switch+3:DefSFXName; + if (PointToName(SFXName)!=SFXName || FileExist(SFXName)) + strcpy(SFXModule,SFXName); + else + GetConfigName(SFXName,SFXModule,true); + } + if (IsDigit(Switch[1])) + { + Solid|=SOLID_COUNT; + SolidCount=atoi(&Switch[1]); + } + else + switch(etoupper(Switch[1])) + { + case 0: + Solid|=SOLID_NORMAL; + break; + case '-': + Solid=SOLID_NONE; + break; + case 'E': + Solid|=SOLID_FILEEXT; + break; + case 'V': + Solid|=Switch[2]=='-' ? SOLID_VOLUME_DEPENDENT:SOLID_VOLUME_INDEPENDENT; + break; + case 'D': + Solid|=SOLID_VOLUME_DEPENDENT; + break; + case 'L': + if (IsDigit(Switch[2])) + FileSizeLess=atoil(Switch+2); + break; + case 'M': + if (IsDigit(Switch[2])) + FileSizeMore=atoil(Switch+2); + break; + case 'C': + { + // Switch is already found bad, avoid reporting it several times. + bool AlreadyBad=false; + + RAR_CHARSET rch=RCH_DEFAULT; + switch(etoupper(Switch[2])) + { + case 'A': + rch=RCH_ANSI; + break; + case 'O': + rch=RCH_OEM; + break; + case 'U': + rch=RCH_UNICODE; + break; + default : + BadSwitch(Switch); + AlreadyBad=true; + break; + }; + if (!AlreadyBad) + if (Switch[3]==0) + CommentCharset=FilelistCharset=rch; + else + for (int I=3;Switch[I]!=0 && !AlreadyBad;I++) + switch(etoupper(Switch[I])) + { + case 'C': + CommentCharset=rch; + break; + case 'L': + FilelistCharset=rch; + break; + default: + BadSwitch(Switch); + AlreadyBad=true; + break; + } + } + break; + + } + break; + case 'C': + if (Switch[2]==0) + switch(etoupper(Switch[1])) + { + case '-': + DisableComment=true; + break; + case 'U': + ConvertNames=NAMES_UPPERCASE; + break; + case 'L': + ConvertNames=NAMES_LOWERCASE; + break; + } + break; + case 'K': + switch(etoupper(Switch[1])) + { + case 'B': + KeepBroken=true; + break; + case 0: + Lock=true; + break; + } + break; +#ifndef GUI + case '?' : + OutHelp(); + break; +#endif + default : + BadSwitch(Switch); + break; + } +} +#endif + + +#ifndef SFX_MODULE +void CommandData::BadSwitch(char *Switch) +{ + mprintf(St(MUnknownOption),Switch); + ErrHandler.Exit(USER_ERROR); +} +#endif + + +#ifndef GUI +void CommandData::OutTitle() +{ + if (BareOutput || DisableCopyright) + return; +#if defined(__GNUC__) && defined(SFX_MODULE) + mprintf(St(MCopyrightS)); +#else +#ifndef SILENT + static bool TitleShown=false; + if (TitleShown) + return; + TitleShown=true; + char Version[50]; + int Beta=RARVER_BETA; + if (Beta!=0) + sprintf(Version,"%d.%02d %s %d",RARVER_MAJOR,RARVER_MINOR,St(MBeta),RARVER_BETA); + else + sprintf(Version,"%d.%02d",RARVER_MAJOR,RARVER_MINOR); +#ifdef UNRAR + mprintf(St(MUCopyright),Version,RARVER_YEAR); +#else +#endif +#endif +#endif +} +#endif + + +inline bool CmpMSGID(MSGID i1,MSGID i2) +{ +#ifdef MSGID_INT + return(i1==i2); +#else + // If MSGID is const char*, we cannot compare pointers only. + // Pointers to different instances of same strings can differ, + // so we need to compare complete strings. + return(strcmp(i1,i2)==0); +#endif +} + +void CommandData::OutHelp() +{ +#if !defined(GUI) && !defined(SILENT) + OutTitle(); + static MSGID Help[]={ +#ifdef SFX_MODULE + // Console SFX switches definition. + MCHelpCmd,MSHelpCmdE,MSHelpCmdT,MSHelpCmdV +#elif defined(UNRAR) + // UnRAR switches definition. + MUNRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdE,MCHelpCmdL, + MCHelpCmdP,MCHelpCmdT,MCHelpCmdV,MCHelpCmdX,MCHelpSw, + MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAI,MCHelpSwAP, + MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU, + MCHelpSwDH,MCHelpSwEP,MCHelpSwEP3,MCHelpSwF,MCHelpSwIDP,MCHelpSwIERR, + MCHelpSwINUL,MCHelpSwIOFF,MCHelpSwKB,MCHelpSwN,MCHelpSwNa,MCHelpSwNal, + MCHelpSwO,MCHelpSwOC,MCHelpSwOR,MCHelpSwOW,MCHelpSwP, + MCHelpSwPm,MCHelpSwR,MCHelpSwRI,MCHelpSwSL,MCHelpSwSM,MCHelpSwTA, + MCHelpSwTB,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU,MCHelpSwVUnr, + MCHelpSwVER,MCHelpSwVP,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY +#else + // RAR switches definition. + MRARTitle1,MRARTitle2,MCHelpCmd,MCHelpCmdA,MCHelpCmdC,MCHelpCmdCF, + MCHelpCmdCH,MCHelpCmdCW,MCHelpCmdD,MCHelpCmdE,MCHelpCmdF,MCHelpCmdI, + MCHelpCmdK,MCHelpCmdL,MCHelpCmdM,MCHelpCmdP,MCHelpCmdR,MCHelpCmdRC, + MCHelpCmdRN,MCHelpCmdRR,MCHelpCmdRV,MCHelpCmdS,MCHelpCmdT,MCHelpCmdU, + MCHelpCmdV,MCHelpCmdX,MCHelpSw,MCHelpSwm,MCHelpSwAC,MCHelpSwAD,MCHelpSwAG, + MCHelpSwAI,MCHelpSwAO,MCHelpSwAP,MCHelpSwAS,MCHelpSwAV,MCHelpSwAVm, + MCHelpSwCm,MCHelpSwCFGm,MCHelpSwCL,MCHelpSwCU,MCHelpSwDF,MCHelpSwDH, + MCHelpSwDR,MCHelpSwDS,MCHelpSwDW,MCHelpSwEa,MCHelpSwED,MCHelpSwEE, + MCHelpSwEN,MCHelpSwEP,MCHelpSwEP1,MCHelpSwEP2,MCHelpSwEP3,MCHelpSwF, + MCHelpSwHP,MCHelpSwIDP,MCHelpSwIEML,MCHelpSwIERR,MCHelpSwILOG,MCHelpSwINUL, + MCHelpSwIOFF,MCHelpSwISND,MCHelpSwK,MCHelpSwKB,MCHelpSwMn,MCHelpSwMC, + MCHelpSwMD,MCHelpSwMS,MCHelpSwMT,MCHelpSwN,MCHelpSwNa,MCHelpSwNal, + MCHelpSwO,MCHelpSwOC,MCHelpSwOL,MCHelpSwOR,MCHelpSwOS,MCHelpSwOW, + MCHelpSwP,MCHelpSwPm,MCHelpSwR,MCHelpSwRm,MCHelpSwR0,MCHelpSwRI, + MCHelpSwRR,MCHelpSwRV,MCHelpSwS,MCHelpSwSm,MCHelpSwSC,MCHelpSwSFX, + MCHelpSwSI,MCHelpSwSL,MCHelpSwSM,MCHelpSwT,MCHelpSwTA,MCHelpSwTB, + MCHelpSwTK,MCHelpSwTL,MCHelpSwTN,MCHelpSwTO,MCHelpSwTS,MCHelpSwU, + MCHelpSwV,MCHelpSwVn,MCHelpSwVD,MCHelpSwVER,MCHelpSwVN,MCHelpSwVP, + MCHelpSwW,MCHelpSwX,MCHelpSwXa,MCHelpSwXal,MCHelpSwY,MCHelpSwZ +#endif + }; + + for (int I=0;IRewind(); + while ((CurName=Args->GetString())!=NULL) +#ifndef SFX_MODULE + if (CheckFullPath && IsFullPath(CurName)) + { + if (*FullName==0) + ConvertNameToFull(CheckName,FullName); + if (CmpName(CurName,FullName,MatchMode)) + return(true); + } + else +#endif + if (CmpName(ConvertPath(CurName,NULL),Name,MatchMode)) + return(true); + return(false); +} + + +// Return 'true' if we need to exclude the file from processing as result +// of -x switch. If CheckInclList is true, we also check the file against +// the include list created with -n switch. +bool CommandData::ExclCheck(char *CheckName,bool CheckFullPath,bool CheckInclList) +{ + if (ExclCheckArgs(ExclArgs,CheckName,CheckFullPath,MATCH_WILDSUBPATH)) + return(true); + if (!CheckInclList || InclArgs->ItemsCount()==0) + return(false); + if (ExclCheckArgs(InclArgs,CheckName,false,MATCH_WILDSUBPATH)) + return(false); + return(true); +} + + + + +#ifndef SFX_MODULE +bool CommandData::TimeCheck(RarTime &ft) +{ + if (FileTimeBefore.IsSet() && ft>=FileTimeBefore) + return(true); + if (FileTimeAfter.IsSet() && ft<=FileTimeAfter) + return(true); + return(false); +} +#endif + + +#ifndef SFX_MODULE +bool CommandData::SizeCheck(int64 Size) +{ + if (FileSizeLess!=INT64NDF && Size>=FileSizeLess) + return(true); + if (FileSizeMore!=INT64NDF && Size<=FileSizeMore) + return(true); + return(false); +} +#endif + + + + +int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType) +{ + if (strlen(NewLhd.FileName)>=NM || strlenw(NewLhd.FileNameW)>=NM) + return(0); + if (ExclCheck(NewLhd.FileName,false,true)) + return(0); +#ifndef SFX_MODULE + if (TimeCheck(NewLhd.mtime)) + return(0); + if ((NewLhd.FileAttr & ExclFileAttr)!=0 || InclAttrSet && (NewLhd.FileAttr & InclFileAttr)==0) + return(0); + if ((NewLhd.Flags & LHD_WINDOWMASK)!=LHD_DIRECTORY && SizeCheck(NewLhd.FullUnpSize)) + return(0); +#endif + char *ArgName; + wchar *ArgNameW; + FileArgs->Rewind(); + for (int StringCount=1;FileArgs->GetString(&ArgName,&ArgNameW);StringCount++) + { +#ifndef SFX_MODULE + bool Unicode=(NewLhd.Flags & LHD_UNICODE) || ArgNameW!=NULL; + if (Unicode) + { + wchar NameW[NM],ArgW[NM],*NamePtr=NewLhd.FileNameW; + bool CorrectUnicode=true; + if (ArgNameW==NULL) + { + if (!CharToWide(ArgName,ArgW) || *ArgW==0) + CorrectUnicode=false; + ArgNameW=ArgW; + } + if ((NewLhd.Flags & LHD_UNICODE)==0) + { + if (!CharToWide(NewLhd.FileName,NameW) || *NameW==0) + CorrectUnicode=false; + NamePtr=NameW; + } + if (CmpName(ArgNameW,NamePtr,MatchType)) + { + if (ExactMatch!=NULL) + *ExactMatch=stricompcw(ArgNameW,NamePtr)==0; + return(StringCount); + } + if (CorrectUnicode) + continue; + } +#endif + if (CmpName(ArgName,NewLhd.FileName,MatchType)) + { + if (ExactMatch!=NULL) + *ExactMatch=stricompc(ArgName,NewLhd.FileName)==0; + return(StringCount); + } + } + return(0); +} + + +#ifndef GUI +void CommandData::ProcessCommand() +{ +#ifndef SFX_MODULE + + const char *SingleCharCommands="FUADPXETK"; + if (Command[1] && strchr(SingleCharCommands,*Command)!=NULL || *ArcName==0) + OutHelp(); + +#ifdef _UNIX + if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName)))) + strcat(ArcName,".rar"); +#else + if (GetExt(ArcName)==NULL) + strcat(ArcName,".rar"); +#endif + + if (strchr("AFUMD",*Command)==NULL) + { + StringList ArcMasks; + ArcMasks.AddString(ArcName); + ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS); + FindData FindData; + while (Scan.GetNext(&FindData)==SCAN_SUCCESS) + AddArcName(FindData.Name,FindData.NameW); + } + else + AddArcName(ArcName,NULL); +#endif + + switch(Command[0]) + { + case 'P': + case 'X': + case 'E': + case 'T': + case 'I': + { + CmdExtract Extract; + Extract.DoExtract(this); + } + break; +#ifndef SILENT + case 'V': + case 'L': + ListArchive(this); + break; + default: + OutHelp(); +#endif + } + if (!BareOutput) + mprintf("\n"); +} +#endif + + +void CommandData::AddArcName(char *Name,wchar *NameW) +{ + ArcNames->AddString(Name,NameW); +} + + +bool CommandData::GetArcName(char *Name,wchar *NameW,int MaxSize) +{ + if (!ArcNames->GetString(Name,NameW,NM)) + return(false); + return(true); +} + + +bool CommandData::IsSwitch(int Ch) +{ +#if defined(_WIN_32) || defined(_EMX) + return(Ch=='-' || Ch=='/'); +#else + return(Ch=='-'); +#endif +} + + +#ifndef SFX_MODULE +uint CommandData::GetExclAttr(char *Str) +{ + if (IsDigit(*Str)) + return(strtol(Str,NULL,0)); + else + { + uint Attr; + for (Attr=0;*Str;Str++) + switch(etoupper(*Str)) + { +#ifdef _UNIX + case 'D': + Attr|=S_IFDIR; + break; + case 'V': + Attr|=S_IFCHR; + break; +#elif defined(_WIN_32) || defined(_EMX) + case 'R': + Attr|=0x1; + break; + case 'H': + Attr|=0x2; + break; + case 'S': + Attr|=0x4; + break; + case 'D': + Attr|=0x10; + break; + case 'A': + Attr|=0x20; + break; +#endif + } + return(Attr); + } +} +#endif + + + + +#ifndef SFX_MODULE +bool CommandData::CheckWinSize() +{ + static int ValidSize[]={ + 0x10000,0x20000,0x40000,0x80000,0x100000,0x200000,0x400000 + }; + for (int I=0;IGetChar()); +} + + +void RangeCoder::InitDecoder(Unpack *UnpackRead) +{ + RangeCoder::UnpackRead=UnpackRead; + + low=code=0; + range=uint(-1); + for (int i=0;i < 4;i++) + code=(code << 8) | GetChar(); +} + + +// (int) cast before "low" added only to suppress compiler warnings. +#define ARI_DEC_NORMALIZE(code,low,range,read) \ +{ \ + while ((low^(low+range))GetChar(); \ + range <<= 8; \ + low <<= 8; \ + } \ +} + + +inline int RangeCoder::GetCurrentCount() +{ + return (code-low)/(range /= SubRange.scale); +} + + +inline uint RangeCoder::GetCurrentShiftCount(uint SHIFT) +{ + return (code-low)/(range >>= SHIFT); +} + + +inline void RangeCoder::Decode() +{ + low += range*SubRange.LowCount; + range *= SubRange.HighCount-SubRange.LowCount; +} diff --git a/libunrar/coder.hpp b/libunrar/coder.hpp new file mode 100644 index 0000000..f09f911 --- /dev/null +++ b/libunrar/coder.hpp @@ -0,0 +1,24 @@ +/**************************************************************************** + * Contents: 'Carryless rangecoder' by Dmitry Subbotin * + ****************************************************************************/ + +const uint TOP=1 << 24, BOT=1 << 15; + +class RangeCoder +{ + public: + void InitDecoder(Unpack *UnpackRead); + inline int GetCurrentCount(); + inline uint GetCurrentShiftCount(uint SHIFT); + inline void Decode(); + inline void PutChar(unsigned int c); + inline unsigned int GetChar(); + + uint low, code, range; + struct SUBRANGE + { + uint LowCount, HighCount, scale; + } SubRange; + + Unpack *UnpackRead; +}; diff --git a/libunrar/compress.hpp b/libunrar/compress.hpp new file mode 100644 index 0000000..3181e45 --- /dev/null +++ b/libunrar/compress.hpp @@ -0,0 +1,36 @@ +#ifndef _RAR_COMPRESS_ +#define _RAR_COMPRESS_ + +class ComprDataIO; +class PackingFileTable; + +#define CODEBUFSIZE 0x4000 +#define MAXWINSIZE 0x400000 +#define MAXWINMASK (MAXWINSIZE-1) + +#define LOW_DIST_REP_COUNT 16 + +#define NC 299 /* alphabet = {0, 1, 2, ..., NC - 1} */ +#define DC 60 +#define LDC 17 +#define RC 28 +#define HUFF_TABLE_SIZE (NC+DC+RC+LDC) +#define BC 20 + +#define NC20 298 /* alphabet = {0, 1, 2, ..., NC - 1} */ +#define DC20 48 +#define RC20 28 +#define BC20 19 +#define MC20 257 + +enum {CODE_HUFFMAN,CODE_LZ,CODE_LZ2,CODE_REPEATLZ,CODE_CACHELZ, + CODE_STARTFILE,CODE_ENDFILE,CODE_VM,CODE_VMDATA}; + + +enum FilterType { + FILTER_NONE, FILTER_PPM /*dummy*/, FILTER_E8, FILTER_E8E9, + FILTER_UPCASETOLOW, FILTER_AUDIO, FILTER_RGB, FILTER_DELTA, + FILTER_ITANIUM, FILTER_E8E9V2 +}; + +#endif diff --git a/libunrar/consio.cpp b/libunrar/consio.cpp new file mode 100644 index 0000000..b21eda6 --- /dev/null +++ b/libunrar/consio.cpp @@ -0,0 +1,294 @@ +#include "rar.hpp" + +#ifndef GUI +#include "log.cpp" +#endif + +static int KbdAnsi(char *Addr,int Size); + +#if !defined(GUI) && !defined(SILENT) +static void RawPrint(char *Msg,MESSAGE_TYPE MessageType); +static uint GetKey(); +#endif + +static MESSAGE_TYPE MsgStream=MSG_STDOUT; +static bool Sound=false; +const int MaxMsgSize=2*NM+2048; + +void InitConsoleOptions(MESSAGE_TYPE MsgStream,bool Sound) +{ + ::MsgStream=MsgStream; + ::Sound=Sound; +} + +#if !defined(GUI) && !defined(SILENT) +void mprintf(const char *fmt,...) +{ + if (MsgStream==MSG_NULL || MsgStream==MSG_ERRONLY) + return; + safebuf char Msg[MaxMsgSize]; + va_list argptr; + va_start(argptr,fmt); + vsprintf(Msg,fmt,argptr); + RawPrint(Msg,MsgStream); + va_end(argptr); +} +#endif + + +#if !defined(GUI) && !defined(SILENT) +void eprintf(const char *fmt,...) +{ + if (MsgStream==MSG_NULL) + return; + safebuf char Msg[MaxMsgSize]; + va_list argptr; + va_start(argptr,fmt); + vsprintf(Msg,fmt,argptr); + RawPrint(Msg,MSG_STDERR); + va_end(argptr); +} +#endif + + +#if !defined(GUI) && !defined(SILENT) +void RawPrint(char *Msg,MESSAGE_TYPE MessageType) +{ + File OutFile; + switch(MessageType) + { + case MSG_STDOUT: + OutFile.SetHandleType(FILE_HANDLESTD); + break; + case MSG_STDERR: + case MSG_ERRONLY: + OutFile.SetHandleType(FILE_HANDLEERR); + break; + default: + return; + } +#ifdef _WIN_32 + CharToOem(Msg,Msg); + + char OutMsg[MaxMsgSize],*OutPos=OutMsg; + for (int I=0;Msg[I]!=0;I++) + { + if (Msg[I]=='\n' && (I==0 || Msg[I-1]!='\r')) + *(OutPos++)='\r'; + *(OutPos++)=Msg[I]; + } + *OutPos=0; + strcpy(Msg,OutMsg); +#endif +#if defined(_UNIX) || defined(_EMX) + char OutMsg[MaxMsgSize],*OutPos=OutMsg; + for (int I=0;Msg[I]!=0;I++) + if (Msg[I]!='\r') + *(OutPos++)=Msg[I]; + *OutPos=0; + strcpy(Msg,OutMsg); +#endif + + OutFile.Write(Msg,strlen(Msg)); +// OutFile.Flush(); +} +#endif + + +#ifndef SILENT +void Alarm() +{ +#ifndef SFX_MODULE + if (Sound) + putchar('\007'); +#endif +} +#endif + + +#ifndef SILENT +#ifndef GUI +void GetPasswordText(char *Str,int MaxLength) +{ +#ifdef _WIN_32 + HANDLE hConIn=GetStdHandle(STD_INPUT_HANDLE); + HANDLE hConOut=GetStdHandle(STD_OUTPUT_HANDLE); + DWORD ConInMode,ConOutMode; + DWORD Read=0; + GetConsoleMode(hConIn,&ConInMode); + GetConsoleMode(hConOut,&ConOutMode); + SetConsoleMode(hConIn,ENABLE_LINE_INPUT); + SetConsoleMode(hConOut,ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT); + ReadConsole(hConIn,Str,MaxLength-1,&Read,NULL); + Str[Read]=0; + OemToChar(Str,Str); + SetConsoleMode(hConIn,ConInMode); + SetConsoleMode(hConOut,ConOutMode); +#elif defined(_EMX) || defined(_BEOS) || defined(__sparc) || defined(sparc) || defined (__VMS) + fgets(Str,MaxLength-1,stdin); +#else + strncpyz(Str,getpass(""),MaxLength); +#endif + Str[MaxLength-1]=0; + RemoveLF(Str); +} +#endif +#endif + + +#ifndef SILENT +bool GetPassword(PASSWORD_TYPE Type,const char *FileName,char *Password,int MaxLength) +{ + Alarm(); + while (true) + { + char PromptStr[NM+256]; +#if defined(_EMX) || defined(_BEOS) + strcpy(PromptStr,St(MAskPswEcho)); +#else + strcpy(PromptStr,St(MAskPsw)); +#endif + if (Type!=PASSWORD_GLOBAL) + { + strcat(PromptStr,St(MFor)); + char *NameOnly=PointToName(FileName); + if (strlen(PromptStr)+strlen(NameOnly)4 ? "\n":" "):", "); + int KeyPos=ItemKeyPos[I]; + for (int J=0;J>1)^0xEDB88320L : (C>>1); + CRCTab[I]=C; + } +} + + +uint CRC(uint StartCRC,const void *Addr,size_t Size) +{ + if (CRCTab[1]==0) + InitCRC(); + byte *Data=(byte *)Addr; + +#if defined(LITTLE_ENDIAN) && defined(PRESENT_INT32) && defined(ALLOW_NOT_ALIGNED_INT) + while (Size>0 && ((long)Data & 7)) + { + StartCRC=CRCTab[(byte)(StartCRC^Data[0])]^(StartCRC>>8); + Size--; + Data++; + } + while (Size>=8) + { + StartCRC^=*(uint32 *)Data; + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC^=*(uint32 *)(Data+4); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + StartCRC=CRCTab[(byte)StartCRC]^(StartCRC>>8); + Data+=8; + Size-=8; + } +#endif + + for (size_t I=0;I>8); + return(StartCRC); +} + +#ifndef SFX_MODULE +ushort OldCRC(ushort StartCRC,const void *Addr,size_t Size) +{ + byte *Data=(byte *)Addr; + for (size_t I=0;I>15))&0xffff; + } + return(StartCRC); +} +#endif diff --git a/libunrar/crc.hpp b/libunrar/crc.hpp new file mode 100644 index 0000000..a632a54 --- /dev/null +++ b/libunrar/crc.hpp @@ -0,0 +1,10 @@ +#ifndef _RAR_CRC_ +#define _RAR_CRC_ + +extern uint CRCTab[256]; + +void InitCRC(); +uint CRC(uint StartCRC,const void *Addr,size_t Size); +ushort OldCRC(ushort StartCRC,const void *Addr,size_t Size); + +#endif diff --git a/libunrar/crypt.cpp b/libunrar/crypt.cpp new file mode 100644 index 0000000..b6a56db --- /dev/null +++ b/libunrar/crypt.cpp @@ -0,0 +1,381 @@ +#include "rar.hpp" + +#ifndef SFX_MODULE +extern uint CRCTab[256]; +#endif + +#define NROUNDS 32 + +#define rol(x,n,xsize) (((x)<<(n)) | ((x)>>(xsize-(n)))) +#define ror(x,n,xsize) (((x)>>(n)) | ((x)<<(xsize-(n)))) + +#define substLong(t) ( (uint)SubstTable[(uint)t&255] | \ + ((uint)SubstTable[(int)(t>> 8)&255]<< 8) | \ + ((uint)SubstTable[(int)(t>>16)&255]<<16) | \ + ((uint)SubstTable[(int)(t>>24)&255]<<24) ) + +CryptKeyCacheItem CryptData::Cache[4]; +int CryptData::CachePos=0; + + +#ifndef SFX_MODULE +static byte InitSubstTable[256]={ + 215, 19,149, 35, 73,197,192,205,249, 28, 16,119, 48,221, 2, 42, + 232, 1,177,233, 14, 88,219, 25,223,195,244, 90, 87,239,153,137, + 255,199,147, 70, 92, 66,246, 13,216, 40, 62, 29,217,230, 86, 6, + 71, 24,171,196,101,113,218,123, 93, 91,163,178,202, 67, 44,235, + 107,250, 75,234, 49,167,125,211, 83,114,157,144, 32,193,143, 36, + 158,124,247,187, 89,214,141, 47,121,228, 61,130,213,194,174,251, + 97,110, 54,229,115, 57,152, 94,105,243,212, 55,209,245, 63, 11, + 164,200, 31,156, 81,176,227, 21, 76, 99,139,188,127, 17,248, 51, + 207,120,189,210, 8,226, 41, 72,183,203,135,165,166, 60, 98, 7, + 122, 38,155,170, 69,172,252,238, 39,134, 59,128,236, 27,240, 80, + 131, 3, 85,206,145, 79,154,142,159,220,201,133, 74, 64, 20,129, + 224,185,138,103,173,182, 43, 34,254, 82,198,151,231,180, 58, 10, + 118, 26,102, 12, 50,132, 22,191,136,111,162,179, 45, 4,148,108, + 161, 56, 78,126,242,222, 15,175,146, 23, 33,241,181,190, 77,225, + 0, 46,169,186, 68, 95,237, 65, 53,208,253,168, 9, 18,100, 52, + 116,184,160, 96,109, 37, 30,106,140,104,150, 5,204,117,112, 84 +}; +#endif + + + +void CryptData::DecryptBlock(byte *Buf,size_t Size) +{ + rin.blockDecrypt(Buf,Size,Buf); +} + + +#ifndef SFX_MODULE +void CryptData::EncryptBlock20(byte *Buf) +{ + uint A,B,C,D,T,TA,TB; +#if defined(BIG_ENDIAN) || !defined(PRESENT_INT32) || !defined(ALLOW_NOT_ALIGNED_INT) + A=((uint)Buf[0]|((uint)Buf[1]<<8)|((uint)Buf[2]<<16)|((uint)Buf[3]<<24))^Key[0]; + B=((uint)Buf[4]|((uint)Buf[5]<<8)|((uint)Buf[6]<<16)|((uint)Buf[7]<<24))^Key[1]; + C=((uint)Buf[8]|((uint)Buf[9]<<8)|((uint)Buf[10]<<16)|((uint)Buf[11]<<24))^Key[2]; + D=((uint)Buf[12]|((uint)Buf[13]<<8)|((uint)Buf[14]<<16)|((uint)Buf[15]<<24))^Key[3]; +#else + uint32 *BufPtr=(uint32 *)Buf; + A=BufPtr[0]^Key[0]; + B=BufPtr[1]^Key[1]; + C=BufPtr[2]^Key[2]; + D=BufPtr[3]^Key[3]; +#endif + for(int I=0;I>8); + Buf[2]=(byte)(C>>16); + Buf[3]=(byte)(C>>24); + D^=Key[1]; + Buf[4]=(byte)D; + Buf[5]=(byte)(D>>8); + Buf[6]=(byte)(D>>16); + Buf[7]=(byte)(D>>24); + A^=Key[2]; + Buf[8]=(byte)A; + Buf[9]=(byte)(A>>8); + Buf[10]=(byte)(A>>16); + Buf[11]=(byte)(A>>24); + B^=Key[3]; + Buf[12]=(byte)B; + Buf[13]=(byte)(B>>8); + Buf[14]=(byte)(B>>16); + Buf[15]=(byte)(B>>24); +#else + BufPtr[0]=C^Key[0]; + BufPtr[1]=D^Key[1]; + BufPtr[2]=A^Key[2]; + BufPtr[3]=B^Key[3]; +#endif + UpdKeys(Buf); +} + + +void CryptData::DecryptBlock20(byte *Buf) +{ + byte InBuf[16]; + uint A,B,C,D,T,TA,TB; +#if defined(BIG_ENDIAN) || !defined(PRESENT_INT32) || !defined(ALLOW_NOT_ALIGNED_INT) + A=((uint)Buf[0]|((uint)Buf[1]<<8)|((uint)Buf[2]<<16)|((uint)Buf[3]<<24))^Key[0]; + B=((uint)Buf[4]|((uint)Buf[5]<<8)|((uint)Buf[6]<<16)|((uint)Buf[7]<<24))^Key[1]; + C=((uint)Buf[8]|((uint)Buf[9]<<8)|((uint)Buf[10]<<16)|((uint)Buf[11]<<24))^Key[2]; + D=((uint)Buf[12]|((uint)Buf[13]<<8)|((uint)Buf[14]<<16)|((uint)Buf[15]<<24))^Key[3]; +#else + uint32 *BufPtr=(uint32 *)Buf; + A=BufPtr[0]^Key[0]; + B=BufPtr[1]^Key[1]; + C=BufPtr[2]^Key[2]; + D=BufPtr[3]^Key[3]; +#endif + memcpy(InBuf,Buf,sizeof(InBuf)); + for(int I=NROUNDS-1;I>=0;I--) + { + T=((C+rol(D,11,32))^Key[I&3]); + TA=A^substLong(T); + T=((D^rol(C,17,32))+Key[I&3]); + TB=B^substLong(T); + A=C; + B=D; + C=TA; + D=TB; + } +#if defined(BIG_ENDIAN) || !defined(PRESENT_INT32) || !defined(ALLOW_NOT_ALIGNED_INT) + C^=Key[0]; + Buf[0]=(byte)C; + Buf[1]=(byte)(C>>8); + Buf[2]=(byte)(C>>16); + Buf[3]=(byte)(C>>24); + D^=Key[1]; + Buf[4]=(byte)D; + Buf[5]=(byte)(D>>8); + Buf[6]=(byte)(D>>16); + Buf[7]=(byte)(D>>24); + A^=Key[2]; + Buf[8]=(byte)A; + Buf[9]=(byte)(A>>8); + Buf[10]=(byte)(A>>16); + Buf[11]=(byte)(A>>24); + B^=Key[3]; + Buf[12]=(byte)B; + Buf[13]=(byte)(B>>8); + Buf[14]=(byte)(B>>16); + Buf[15]=(byte)(B>>24); +#else + BufPtr[0]=C^Key[0]; + BufPtr[1]=D^Key[1]; + BufPtr[2]=A^Key[2]; + BufPtr[3]=B^Key[3]; +#endif + UpdKeys(InBuf); +} + + +void CryptData::UpdKeys(byte *Buf) +{ + for (int I=0;I<16;I+=4) + { + Key[0]^=CRCTab[Buf[I]]; + Key[1]^=CRCTab[Buf[I+1]]; + Key[2]^=CRCTab[Buf[I+2]]; + Key[3]^=CRCTab[Buf[I+3]]; + } +} + + +void CryptData::Swap(byte *Ch1,byte *Ch2) +{ + byte Ch=*Ch1; + *Ch1=*Ch2; + *Ch2=Ch; +} +#endif + + +void CryptData::SetCryptKeys(const char *Password,const byte *Salt,bool Encrypt,bool OldOnly,bool HandsOffHash) +{ + if (*Password==0) + return; + if (OldOnly) + { +#ifndef SFX_MODULE + if (CRCTab[1]==0) + InitCRC(); + byte Psw[MAXPASSWORD]; + SetOldKeys(Password); + Key[0]=0xD3A3B879L; + Key[1]=0x3F6D12F7L; + Key[2]=0x7515A235L; + Key[3]=0xA4E7F123L; + memset(Psw,0,sizeof(Psw)); +#if defined(_WIN_32) && !defined(GUI) + CharToOemBuff(Password,(char*)Psw,(DWORD)strlen(Password)); +#else + strncpyz((char *)Psw,Password,ASIZE(Psw)); +#endif + size_t PswLength=strlen(Password); + memcpy(SubstTable,InitSubstTable,sizeof(SubstTable)); + for (int J=0;J<256;J++) + for (size_t I=0;I>8); + PswNum[2]=(byte)(I>>16); + hash_process( &c, PswNum, 3, HandsOffHash); + if (I%(HashRounds/16)==0) + { + hash_context tempc=c; + uint32 digest[5]; + hash_final( &tempc, digest, HandsOffHash); + AESInit[I/(HashRounds/16)]=(byte)digest[4]; + } + } + uint32 digest[5]; + hash_final( &c, digest, HandsOffHash); + for (int I=0;I<4;I++) + for (int J=0;J<4;J++) + AESKey[I*4+J]=(byte)(digest[I]>>(J*8)); + + strcpy(Cache[CachePos].Password,Password); + if ((Cache[CachePos].SaltPresent=(Salt!=NULL))==true) + memcpy(Cache[CachePos].Salt,Salt,SALT_SIZE); + Cache[CachePos].HandsOffHash=HandsOffHash; + memcpy(Cache[CachePos].AESKey,AESKey,sizeof(AESKey)); + memcpy(Cache[CachePos].AESInit,AESInit,sizeof(AESInit)); + CachePos=(CachePos+1)%(sizeof(Cache)/sizeof(Cache[0])); + } + rin.init(Encrypt ? Rijndael::Encrypt : Rijndael::Decrypt,AESKey,AESInit); +} + + +#ifndef SFX_MODULE +void CryptData::SetOldKeys(const char *Password) +{ + uint PswCRC=CRC(0xffffffff,Password,strlen(Password)); + OldKey[0]=PswCRC&0xffff; + OldKey[1]=(PswCRC>>16)&0xffff; + OldKey[2]=OldKey[3]=0; + PN1=PN2=PN3=0; + byte Ch; + while ((Ch=*Password)!=0) + { + PN1+=Ch; + PN2^=Ch; + PN3+=Ch; + PN3=(byte)rol(PN3,1,8); + OldKey[2]^=Ch^CRCTab[Ch]; + OldKey[3]+=Ch+(CRCTab[Ch]>>16); + Password++; + } +} + + +void CryptData::SetAV15Encryption() +{ + OldKey[0]=0x4765; + OldKey[1]=0x9021; + OldKey[2]=0x7382; + OldKey[3]=0x5215; +} + + +void CryptData::SetCmt13Encryption() +{ + PN1=0; + PN2=7; + PN3=77; +} + + +void CryptData::Crypt(byte *Data,uint Count,int Method) +{ + if (Method==OLD_DECODE) + Decode13(Data,Count); + else + if (Method==OLD_ENCODE) + Encode13(Data,Count); + else + Crypt15(Data,Count); +} + + +void CryptData::Encode13(byte *Data,uint Count) +{ + while (Count--) + { + PN2+=PN3; + PN1+=PN2; + *Data+=PN1; + Data++; + } +} + + +void CryptData::Decode13(byte *Data,uint Count) +{ + while (Count--) + { + PN2+=PN3; + PN1+=PN2; + *Data-=PN1; + Data++; + } +} + + +void CryptData::Crypt15(byte *Data,uint Count) +{ + while (Count--) + { + OldKey[0]+=0x1234; + OldKey[1]^=CRCTab[(OldKey[0] & 0x1fe)>>1]; + OldKey[2]-=CRCTab[(OldKey[0] & 0x1fe)>>1]>>16; + OldKey[0]^=OldKey[2]; + OldKey[3]=ror(OldKey[3]&0xffff,1,16)^OldKey[1]; + OldKey[3]=ror(OldKey[3]&0xffff,1,16); + OldKey[0]^=OldKey[3]; + *Data^=(byte)(OldKey[0]>>8); + Data++; + } +} +#endif + + diff --git a/libunrar/crypt.hpp b/libunrar/crypt.hpp new file mode 100644 index 0000000..b16e650 --- /dev/null +++ b/libunrar/crypt.hpp @@ -0,0 +1,62 @@ +#ifndef _RAR_CRYPT_ +#define _RAR_CRYPT_ + +enum { OLD_DECODE=0,OLD_ENCODE=1,NEW_CRYPT=2 }; + + +struct CryptKeyCacheItem +{ +#ifndef _SFX_RTL_ + CryptKeyCacheItem() + { + *Password=0; + } + + ~CryptKeyCacheItem() + { + memset(AESKey,0,sizeof(AESKey)); + memset(AESInit,0,sizeof(AESInit)); + memset(Password,0,sizeof(Password)); + } +#endif + byte AESKey[16],AESInit[16]; + char Password[MAXPASSWORD]; + bool SaltPresent; + byte Salt[SALT_SIZE]; + bool HandsOffHash; +}; + +class CryptData +{ + private: + void Encode13(byte *Data,uint Count); + void Decode13(byte *Data,uint Count); + void Crypt15(byte *Data,uint Count); + void UpdKeys(byte *Buf); + void Swap(byte *Ch1,byte *Ch2); + void SetOldKeys(const char *Password); + + Rijndael rin; + + byte SubstTable[256]; + uint Key[4]; + ushort OldKey[4]; + byte PN1,PN2,PN3; + + byte AESKey[16],AESInit[16]; + + static CryptKeyCacheItem Cache[4]; + static int CachePos; + public: + void SetCryptKeys(const char *Password,const byte *Salt,bool Encrypt,bool OldOnly,bool HandsOffHash); + void SetAV15Encryption(); + void SetCmt13Encryption(); + void EncryptBlock20(byte *Buf); + void DecryptBlock20(byte *Buf); + void EncryptBlock(byte *Buf,size_t Size); + void DecryptBlock(byte *Buf,size_t Size); + void Crypt(byte *Data,uint Count,int Method); + static void SetSalt(byte *Salt,int SaltSize); +}; + +#endif diff --git a/libunrar/dll.cpp b/libunrar/dll.cpp new file mode 100644 index 0000000..be5120d --- /dev/null +++ b/libunrar/dll.cpp @@ -0,0 +1,369 @@ +#include "rar.hpp" +#include "dll.hpp" + +static int RarErrorToDll(int ErrCode); + +struct DataSet +{ + CommandData Cmd; + CmdExtract Extract; + Archive Arc; + int OpenMode; + int HeaderSize; + + DataSet():Arc(&Cmd) {}; +}; + + +HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *r) +{ + RAROpenArchiveDataEx rx; + memset(&rx,0,sizeof(rx)); + rx.ArcName=r->ArcName; + rx.OpenMode=r->OpenMode; + rx.CmtBuf=r->CmtBuf; + rx.CmtBufSize=r->CmtBufSize; + HANDLE hArc=RAROpenArchiveEx(&rx); + r->OpenResult=rx.OpenResult; + r->CmtSize=rx.CmtSize; + r->CmtState=rx.CmtState; + return(hArc); +} + + +HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *r) +{ + try + { + r->OpenResult=0; + DataSet *Data=new DataSet; + Data->Cmd.DllError=0; + Data->OpenMode=r->OpenMode; + Data->Cmd.FileArgs->AddString("*"); + + char an[NM]; + if (r->ArcName==NULL && r->ArcNameW!=NULL) + { + WideToChar(r->ArcNameW,an,NM); + r->ArcName=an; + } + + Data->Cmd.AddArcName(r->ArcName,r->ArcNameW); + Data->Cmd.Overwrite=OVERWRITE_ALL; + Data->Cmd.VersionControl=1; + if (!Data->Arc.Open(r->ArcName,r->ArcNameW)) + { + r->OpenResult=ERAR_EOPEN; + delete Data; + return(NULL); + } + if (!Data->Arc.IsArchive(false)) + { + r->OpenResult=Data->Cmd.DllError!=0 ? Data->Cmd.DllError:ERAR_BAD_ARCHIVE; + delete Data; + return(NULL); + } + r->Flags=Data->Arc.NewMhd.Flags; + Array CmtData; + if (r->CmtBufSize!=0 && Data->Arc.GetComment(&CmtData,NULL)) + { + r->Flags|=2; + size_t Size=CmtData.Size()+1; + r->CmtState=Size>r->CmtBufSize ? ERAR_SMALL_BUF:1; + r->CmtSize=(uint)Min(Size,r->CmtBufSize); + memcpy(r->CmtBuf,&CmtData[0],r->CmtSize-1); + if (Size<=r->CmtBufSize) + r->CmtBuf[r->CmtSize-1]=0; + } + else + r->CmtState=r->CmtSize=0; + if (Data->Arc.Signed) + r->Flags|=0x20; + Data->Extract.ExtractArchiveInit(&Data->Cmd,Data->Arc); + return((HANDLE)Data); + } + catch (int ErrCode) + { + r->OpenResult=RarErrorToDll(ErrCode); + return(NULL); + } +} + + +int PASCAL RARCloseArchive(HANDLE hArcData) +{ + DataSet *Data=(DataSet *)hArcData; + bool Success=Data==NULL ? false:Data->Arc.Close(); + delete Data; + return(Success ? 0:ERAR_ECLOSE); +} + + +int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *D) +{ + DataSet *Data=(DataSet *)hArcData; + try + { + if ((Data->HeaderSize=(int)Data->Arc.SearchBlock(FILE_HEAD))<=0) + { + if (Data->Arc.Volume && Data->Arc.GetHeaderType()==ENDARC_HEAD && + (Data->Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)) + if (MergeArchive(Data->Arc,NULL,false,'L')) + { + Data->Extract.SignatureFound=false; + Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); + return(RARReadHeader(hArcData,D)); + } + else + return(ERAR_EOPEN); + return(Data->Arc.BrokenFileHeader ? ERAR_BAD_DATA:ERAR_END_ARCHIVE); + } + if (Data->OpenMode==RAR_OM_LIST && (Data->Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)) + { + int Code=RARProcessFile(hArcData,RAR_SKIP,NULL,NULL); + if (Code==0) + return(RARReadHeader(hArcData,D)); + else + return(Code); + } + strncpyz(D->ArcName,Data->Arc.FileName,ASIZE(D->ArcName)); + strncpyz(D->FileName,Data->Arc.NewLhd.FileName,ASIZE(D->FileName)); + D->Flags=Data->Arc.NewLhd.Flags; + D->PackSize=Data->Arc.NewLhd.PackSize; + D->UnpSize=Data->Arc.NewLhd.UnpSize; + D->HostOS=Data->Arc.NewLhd.HostOS; + D->FileCRC=Data->Arc.NewLhd.FileCRC; + D->FileTime=Data->Arc.NewLhd.FileTime; + D->UnpVer=Data->Arc.NewLhd.UnpVer; + D->Method=Data->Arc.NewLhd.Method; + D->FileAttr=Data->Arc.NewLhd.FileAttr; + D->CmtSize=0; + D->CmtState=0; + } + catch (int ErrCode) + { + return(RarErrorToDll(ErrCode)); + } + return(0); +} + + +int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *D) +{ + DataSet *Data=(DataSet *)hArcData; + try + { + if ((Data->HeaderSize=(int)Data->Arc.SearchBlock(FILE_HEAD))<=0) + { + if (Data->Arc.Volume && Data->Arc.GetHeaderType()==ENDARC_HEAD && + (Data->Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)) + if (MergeArchive(Data->Arc,NULL,false,'L')) + { + Data->Extract.SignatureFound=false; + Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); + return(RARReadHeaderEx(hArcData,D)); + } + else + return(ERAR_EOPEN); + return(Data->Arc.BrokenFileHeader ? ERAR_BAD_DATA:ERAR_END_ARCHIVE); + } + if (Data->OpenMode==RAR_OM_LIST && (Data->Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)) + { + int Code=RARProcessFile(hArcData,RAR_SKIP,NULL,NULL); + if (Code==0) + return(RARReadHeaderEx(hArcData,D)); + else + return(Code); + } + strncpyz(D->ArcName,Data->Arc.FileName,ASIZE(D->ArcName)); + if (*Data->Arc.FileNameW) + strncpyw(D->ArcNameW,Data->Arc.FileNameW,sizeof(D->ArcNameW)); + else + CharToWide(Data->Arc.FileName,D->ArcNameW); + strncpyz(D->FileName,Data->Arc.NewLhd.FileName,ASIZE(D->FileName)); + if (*Data->Arc.NewLhd.FileNameW) + strncpyw(D->FileNameW,Data->Arc.NewLhd.FileNameW,sizeof(D->FileNameW)); + else + { +#ifdef _WIN_32 + char AnsiName[NM]; + OemToChar(Data->Arc.NewLhd.FileName,AnsiName); + CharToWide(AnsiName,D->FileNameW); +#else + CharToWide(Data->Arc.NewLhd.FileName,D->FileNameW); +#endif + } + D->Flags=Data->Arc.NewLhd.Flags; + D->PackSize=Data->Arc.NewLhd.PackSize; + D->PackSizeHigh=Data->Arc.NewLhd.HighPackSize; + D->UnpSize=Data->Arc.NewLhd.UnpSize; + D->UnpSizeHigh=Data->Arc.NewLhd.HighUnpSize; + D->HostOS=Data->Arc.NewLhd.HostOS; + D->FileCRC=Data->Arc.NewLhd.FileCRC; + D->FileTime=Data->Arc.NewLhd.FileTime; + D->UnpVer=Data->Arc.NewLhd.UnpVer; + D->Method=Data->Arc.NewLhd.Method; + D->FileAttr=Data->Arc.NewLhd.FileAttr; + D->CmtSize=0; + D->CmtState=0; + } + catch (int ErrCode) + { + return(RarErrorToDll(ErrCode)); + } + return(0); +} + + +int PASCAL ProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName,wchar *DestPathW,wchar *DestNameW) +{ + DataSet *Data=(DataSet *)hArcData; + try + { + Data->Cmd.DllError=0; + if (Data->OpenMode==RAR_OM_LIST || Data->OpenMode==RAR_OM_LIST_INCSPLIT || + Operation==RAR_SKIP && !Data->Arc.Solid) + { + if (Data->Arc.Volume && + Data->Arc.GetHeaderType()==FILE_HEAD && + (Data->Arc.NewLhd.Flags & LHD_SPLIT_AFTER)!=0) + if (MergeArchive(Data->Arc,NULL,false,'L')) + { + Data->Extract.SignatureFound=false; + Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); + return(0); + } + else + return(ERAR_EOPEN); + Data->Arc.SeekToNext(); + } + else + { + Data->Cmd.DllOpMode=Operation; + + if (DestPath!=NULL || DestName!=NULL) + { +#ifdef _WIN_32 + OemToChar(NullToEmpty(DestPath),Data->Cmd.ExtrPath); +#else + strcpy(Data->Cmd.ExtrPath,NullToEmpty(DestPath)); +#endif + AddEndSlash(Data->Cmd.ExtrPath); +#ifdef _WIN_32 + OemToChar(NullToEmpty(DestName),Data->Cmd.DllDestName); +#else + strcpy(Data->Cmd.DllDestName,NullToEmpty(DestName)); +#endif + } + else + { + *Data->Cmd.ExtrPath=0; + *Data->Cmd.DllDestName=0; + } + + if (DestPathW!=NULL || DestNameW!=NULL) + { + strncpyw(Data->Cmd.ExtrPathW,NullToEmpty(DestPathW),NM-2); + AddEndSlash(Data->Cmd.ExtrPathW); + strncpyw(Data->Cmd.DllDestNameW,NullToEmpty(DestNameW),NM-1); + + if (*Data->Cmd.DllDestNameW!=0 && *Data->Cmd.DllDestName==0) + WideToChar(Data->Cmd.DllDestNameW,Data->Cmd.DllDestName); + } + else + { + *Data->Cmd.ExtrPathW=0; + *Data->Cmd.DllDestNameW=0; + } + + strcpy(Data->Cmd.Command,Operation==RAR_EXTRACT ? "X":"T"); + Data->Cmd.Test=Operation!=RAR_EXTRACT; + bool Repeat=false; + Data->Extract.ExtractCurrentFile(&Data->Cmd,Data->Arc,Data->HeaderSize,Repeat); + + while (Data->Arc.ReadHeader()!=0 && Data->Arc.GetHeaderType()==NEWSUB_HEAD) + { + Data->Extract.ExtractCurrentFile(&Data->Cmd,Data->Arc,Data->HeaderSize,Repeat); + Data->Arc.SeekToNext(); + } + Data->Arc.Seek(Data->Arc.CurBlockPos,SEEK_SET); + } + } + catch (int ErrCode) + { + return(RarErrorToDll(ErrCode)); + } + return(Data->Cmd.DllError); +} + + +int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName) +{ + return(ProcessFile(hArcData,Operation,DestPath,DestName,NULL,NULL)); +} + + +int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar *DestPath,wchar *DestName) +{ + return(ProcessFile(hArcData,Operation,NULL,NULL,DestPath,DestName)); +} + + +void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc) +{ + DataSet *Data=(DataSet *)hArcData; + Data->Cmd.ChangeVolProc=ChangeVolProc; +} + + +void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData) +{ + DataSet *Data=(DataSet *)hArcData; + Data->Cmd.Callback=Callback; + Data->Cmd.UserData=UserData; +} + + +void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc) +{ + DataSet *Data=(DataSet *)hArcData; + Data->Cmd.ProcessDataProc=ProcessDataProc; +} + +#ifndef NOCRYPT +void PASCAL RARSetPassword(HANDLE hArcData,char *Password) +{ + DataSet *Data=(DataSet *)hArcData; + strncpyz(Data->Cmd.Password,Password,ASIZE(Data->Cmd.Password)); +} +#endif + + +int PASCAL RARGetDllVersion() +{ + return(RAR_DLL_VERSION); +} + + +static int RarErrorToDll(int ErrCode) +{ + switch(ErrCode) + { + case FATAL_ERROR: + return(ERAR_EREAD); + case CRC_ERROR: + return(ERAR_BAD_DATA); + case WRITE_ERROR: + return(ERAR_EWRITE); + case OPEN_ERROR: + return(ERAR_EOPEN); + case CREATE_ERROR: + return(ERAR_ECREATE); + case MEMORY_ERROR: + return(ERAR_NO_MEMORY); + case SUCCESS: + return(0); + default: + return(ERAR_UNKNOWN); + } +} diff --git a/libunrar/dll.def b/libunrar/dll.def new file mode 100644 index 0000000..660f69b --- /dev/null +++ b/libunrar/dll.def @@ -0,0 +1,12 @@ +EXPORTS + RAROpenArchive + RAROpenArchiveEx + RARCloseArchive + RARReadHeader + RARReadHeaderEx + RARProcessFile + RARSetCallback + RARSetChangeVolProc + RARSetProcessDataProc + RARSetPassword + RARGetDllVersion diff --git a/libunrar/dll.hpp b/libunrar/dll.hpp new file mode 100644 index 0000000..4582f2c --- /dev/null +++ b/libunrar/dll.hpp @@ -0,0 +1,140 @@ +#ifndef _UNRAR_DLL_ +#define _UNRAR_DLL_ + +#define ERAR_END_ARCHIVE 10 +#define ERAR_NO_MEMORY 11 +#define ERAR_BAD_DATA 12 +#define ERAR_BAD_ARCHIVE 13 +#define ERAR_UNKNOWN_FORMAT 14 +#define ERAR_EOPEN 15 +#define ERAR_ECREATE 16 +#define ERAR_ECLOSE 17 +#define ERAR_EREAD 18 +#define ERAR_EWRITE 19 +#define ERAR_SMALL_BUF 20 +#define ERAR_UNKNOWN 21 +#define ERAR_MISSING_PASSWORD 22 + +#define RAR_OM_LIST 0 +#define RAR_OM_EXTRACT 1 +#define RAR_OM_LIST_INCSPLIT 2 + +#define RAR_SKIP 0 +#define RAR_TEST 1 +#define RAR_EXTRACT 2 + +#define RAR_VOL_ASK 0 +#define RAR_VOL_NOTIFY 1 + +#define RAR_DLL_VERSION 4 + +#ifdef _UNIX +#define CALLBACK +#define PASCAL +#define LONG long +#define HANDLE void * +#define LPARAM long +#define UINT unsigned int +#endif + +struct RARHeaderData +{ + char ArcName[260]; + char FileName[260]; + unsigned int Flags; + unsigned int PackSize; + unsigned int UnpSize; + unsigned int HostOS; + unsigned int FileCRC; + unsigned int FileTime; + unsigned int UnpVer; + unsigned int Method; + unsigned int FileAttr; + char *CmtBuf; + unsigned int CmtBufSize; + unsigned int CmtSize; + unsigned int CmtState; +}; + + +struct RARHeaderDataEx +{ + char ArcName[1024]; + wchar_t ArcNameW[1024]; + char FileName[1024]; + wchar_t FileNameW[1024]; + unsigned int Flags; + unsigned int PackSize; + unsigned int PackSizeHigh; + unsigned int UnpSize; + unsigned int UnpSizeHigh; + unsigned int HostOS; + unsigned int FileCRC; + unsigned int FileTime; + unsigned int UnpVer; + unsigned int Method; + unsigned int FileAttr; + char *CmtBuf; + unsigned int CmtBufSize; + unsigned int CmtSize; + unsigned int CmtState; + unsigned int Reserved[1024]; +}; + + +struct RAROpenArchiveData +{ + char *ArcName; + unsigned int OpenMode; + unsigned int OpenResult; + char *CmtBuf; + unsigned int CmtBufSize; + unsigned int CmtSize; + unsigned int CmtState; +}; + +struct RAROpenArchiveDataEx +{ + char *ArcName; + wchar_t *ArcNameW; + unsigned int OpenMode; + unsigned int OpenResult; + char *CmtBuf; + unsigned int CmtBufSize; + unsigned int CmtSize; + unsigned int CmtState; + unsigned int Flags; + unsigned int Reserved[32]; +}; + +enum UNRARCALLBACK_MESSAGES { + UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD +}; + +typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2); + +typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode); +typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size); + +#ifdef __cplusplus +extern "C" { +#endif + +HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData); +HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData); +int PASCAL RARCloseArchive(HANDLE hArcData); +int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData); +int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData); +int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName); +int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName); +void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData); +void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc); +void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc); +void PASCAL RARSetPassword(HANDLE hArcData,char *Password); +int PASCAL RARGetDllVersion(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libunrar/encname.cpp b/libunrar/encname.cpp new file mode 100644 index 0000000..4e42a75 --- /dev/null +++ b/libunrar/encname.cpp @@ -0,0 +1,57 @@ +#include "rar.hpp" + +EncodeFileName::EncodeFileName() +{ + Flags=0; + FlagBits=0; + FlagsPos=0; + DestSize=0; +} + + + + +void EncodeFileName::Decode(char *Name,byte *EncName,size_t EncSize,wchar *NameW, + size_t MaxDecSize) +{ + size_t EncPos=0,DecPos=0; + byte HighByte=EncName[EncPos++]; + while (EncPos>6) + { + case 0: + NameW[DecPos++]=EncName[EncPos++]; + break; + case 1: + NameW[DecPos++]=EncName[EncPos++]+(HighByte<<8); + break; + case 2: + NameW[DecPos++]=EncName[EncPos]+(EncName[EncPos+1]<<8); + EncPos+=2; + break; + case 3: + { + int Length=EncName[EncPos++]; + if (Length & 0x80) + { + byte Correction=EncName[EncPos++]; + for (Length=(Length&0x7f)+2;Length>0 && DecPos0 && DecPosMAX_PATH) + { + Log(ArcName && *ArcName ? ArcName:NULL,St(MMaxPathLimit),MAX_PATH); + } + } +#endif + SysErrMsg(); +#endif +} + + +void ErrorHandler::ReadErrorMsg(const char *ArcName,const char *FileName) +{ +#ifndef SILENT + ErrMsg(ArcName,St(MErrRead),FileName); + SysErrMsg(); +#endif +} + + +void ErrorHandler::WriteErrorMsg(const char *ArcName,const char *FileName) +{ +#ifndef SILENT + ErrMsg(ArcName,St(MErrWrite),FileName); + SysErrMsg(); +#endif +} + + +void ErrorHandler::Exit(int ExitCode) +{ +#ifndef SFX_MODULE + Alarm(); +#endif + Throw(ExitCode); +} + + +#ifndef GUI +void ErrorHandler::ErrMsg(const char *ArcName,const char *fmt,...) +{ + safebuf char Msg[NM+1024]; + va_list argptr; + va_start(argptr,fmt); + vsprintf(Msg,fmt,argptr); + va_end(argptr); +#ifdef _WIN_32 + if (UserBreak) + Sleep(5000); +#endif + Alarm(); + if (*Msg) + { + Log(ArcName,"\n%s",Msg); + mprintf("\n%s\n",St(MProgAborted)); + } +} +#endif + + +void ErrorHandler::SetErrorCode(int Code) +{ + switch(Code) + { + case WARNING: + case USER_BREAK: + if (ExitCode==SUCCESS) + ExitCode=Code; + break; + case FATAL_ERROR: + if (ExitCode==SUCCESS || ExitCode==WARNING) + ExitCode=FATAL_ERROR; + break; + default: + ExitCode=Code; + break; + } + ErrCount++; +} + + +#if !defined(GUI) && !defined(_SFX_RTL_) +#ifdef _WIN_32 +BOOL __stdcall ProcessSignal(DWORD SigType) +#else +#if defined(__sun) +extern "C" +#endif +void _stdfunction ProcessSignal(int SigType) +#endif +{ +#ifdef _WIN_32 + if (SigType==CTRL_LOGOFF_EVENT) + return(TRUE); +#endif + UserBreak=true; + mprintf(St(MBreak)); + for (int I=0;!File::RemoveCreated() && I<3;I++) + { +#ifdef _WIN_32 + Sleep(100); +#endif + } +#if defined(USE_RC) && !defined(SFX_MODULE) && !defined(_WIN_CE) + ExtRes.UnloadDLL(); +#endif + exit(USER_BREAK); +#if defined(_WIN_32) && !defined(_MSC_VER) + // never reached, just to avoid a compiler warning + return(TRUE); +#endif +} +#endif + + +void ErrorHandler::SetSignalHandlers(bool Enable) +{ + EnableBreak=Enable; +#if !defined(GUI) && !defined(_SFX_RTL_) +#ifdef _WIN_32 + SetConsoleCtrlHandler(Enable ? ProcessSignal:NULL,TRUE); +// signal(SIGBREAK,Enable ? ProcessSignal:SIG_IGN); +#else + signal(SIGINT,Enable ? ProcessSignal:SIG_IGN); + signal(SIGTERM,Enable ? ProcessSignal:SIG_IGN); +#endif +#endif +} + + +void ErrorHandler::Throw(int Code) +{ + if (Code==USER_BREAK && !EnableBreak) + return; + ErrHandler.SetErrorCode(Code); +#ifdef ALLOW_EXCEPTIONS + throw Code; +#else + File::RemoveCreated(); + exit(Code); +#endif +} + + +void ErrorHandler::SysErrMsg() +{ +#if !defined(SFX_MODULE) && !defined(SILENT) +#ifdef _WIN_32 + #define STRCHR strchr + #define ERRCHAR char + ERRCHAR *lpMsgBuf=NULL; + int ErrType=GetLastError(); + if (ErrType!=0 && FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM, + NULL,ErrType,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR)&lpMsgBuf,0,NULL)) + { + ERRCHAR *CurMsg=lpMsgBuf; + while (CurMsg!=NULL) + { + while (*CurMsg=='\r' || *CurMsg=='\n') + CurMsg++; + if (*CurMsg==0) + break; + ERRCHAR *EndMsg=STRCHR(CurMsg,'\r'); + if (EndMsg==NULL) + EndMsg=STRCHR(CurMsg,'\n'); + if (EndMsg!=NULL) + { + *EndMsg=0; + EndMsg++; + } + Log(NULL,"\n%s",CurMsg); + CurMsg=EndMsg; + } + } + LocalFree( lpMsgBuf ); +#endif + +#if defined(_UNIX) || defined(_EMX) + char *err=strerror(errno); + if (err!=NULL) + Log(NULL,"\n%s",err); +#endif + +#endif +} + + + + diff --git a/libunrar/errhnd.hpp b/libunrar/errhnd.hpp new file mode 100644 index 0000000..28e9843 --- /dev/null +++ b/libunrar/errhnd.hpp @@ -0,0 +1,63 @@ +#ifndef _RAR_ERRHANDLER_ +#define _RAR_ERRHANDLER_ + +#if (defined(GUI) || !defined(_WIN_32)) && !defined(SFX_MODULE) && !defined(_WIN_CE) || defined(RARDLL) +#define ALLOW_EXCEPTIONS +#endif + + + +#define rarmalloc malloc +#define rarcalloc calloc +#define rarrealloc realloc +#define rarfree free +#define rarstrdup strdup +#define rarstrdupw strdupw + + + +enum { SUCCESS,WARNING,FATAL_ERROR,CRC_ERROR,LOCK_ERROR,WRITE_ERROR, + OPEN_ERROR,USER_ERROR,MEMORY_ERROR,CREATE_ERROR,USER_BREAK=255}; + +class ErrorHandler +{ + private: + void ErrMsg(const char *ArcName,const char *fmt,...); + + int ExitCode; + int ErrCount; + bool EnableBreak; + bool Silent; + bool DoShutdown; + public: + ErrorHandler(); + void Clean(); + void MemoryError(); + void OpenError(const char *FileName); + void CloseError(const char *FileName); + void ReadError(const char *FileName); + bool AskRepeatRead(const char *FileName); + void WriteError(const char *ArcName,const char *FileName); + void WriteErrorFAT(const char *FileName); + bool AskRepeatWrite(const char *FileName,bool DiskFull); + void SeekError(const char *FileName); + void GeneralErrMsg(const char *Msg); + void MemoryErrorMsg(); + void OpenErrorMsg(const char *FileName); + void OpenErrorMsg(const char *ArcName,const char *FileName); + void CreateErrorMsg(const char *FileName); + void CreateErrorMsg(const char *ArcName,const char *FileName); + void ReadErrorMsg(const char *ArcName,const char *FileName); + void WriteErrorMsg(const char *ArcName,const char *FileName); + void Exit(int ExitCode); + void SetErrorCode(int Code); + int GetErrorCode() {return(ExitCode);} + int GetErrorCount() {return(ErrCount);} + void SetSignalHandlers(bool Enable); + void Throw(int Code); + void SetSilent(bool Mode) {Silent=Mode;}; + void SetShutdown(bool Mode) {DoShutdown=Mode;}; + void SysErrMsg(); +}; + +#endif diff --git a/libunrar/extinfo.cpp b/libunrar/extinfo.cpp new file mode 100644 index 0000000..13239fe --- /dev/null +++ b/libunrar/extinfo.cpp @@ -0,0 +1,76 @@ +#include "rar.hpp" + +#ifdef _WIN_32 +#include "win32acl.cpp" +#include "win32stm.cpp" +#endif +#ifdef _BEOS +#include "beosea.cpp" +#endif +#if defined(_EMX) && !defined(_DJGPP) +#include "os2ea.cpp" +#endif +#ifdef _UNIX +#include "uowners.cpp" +#endif + + + +#ifndef SFX_MODULE +void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW) +{ + switch(Arc.SubBlockHead.SubType) + { +#if defined(_EMX) && !defined(_DJGPP) + case EA_HEAD: + if (Cmd->ProcessEA) + ExtractOS2EA(Arc,Name); + break; +#endif +#ifdef _UNIX + case UO_HEAD: + if (Cmd->ProcessOwners) + ExtractUnixOwner(Arc,Name); + break; +#endif +#ifdef _BEOS + case BEEA_HEAD: + if (Cmd->ProcessEA) + ExtractBeEA(Arc,Name); + break; +#endif +#ifdef _WIN_32 + case NTACL_HEAD: + if (Cmd->ProcessOwners) + ExtractACL(Arc,Name,NameW); + break; + case STREAM_HEAD: + ExtractStreams(Arc,Name,NameW); + break; +#endif + } +} +#endif + + +void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW) +{ +#if defined(_EMX) && !defined(_DJGPP) + if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_OS2EA)) + ExtractOS2EANew(Arc,Name); +#endif +#ifdef _UNIX + if (Cmd->ProcessOwners && Arc.SubHead.CmpName(SUBHEAD_TYPE_UOWNER)) + ExtractUnixOwnerNew(Arc,Name); +#endif +#ifdef _BEOS + if (Cmd->ProcessEA && Arc.SubHead.CmpName(SUBHEAD_TYPE_UOWNER)) + ExtractUnixOwnerNew(Arc,Name); +#endif +#ifdef _WIN_32 + if (Cmd->ProcessOwners && Arc.SubHead.CmpName(SUBHEAD_TYPE_ACL)) + ExtractACLNew(Arc,Name,NameW); + if (Arc.SubHead.CmpName(SUBHEAD_TYPE_STREAM)) + ExtractStreamsNew(Arc,Name,NameW); +#endif +} diff --git a/libunrar/extinfo.hpp b/libunrar/extinfo.hpp new file mode 100644 index 0000000..db7cea5 --- /dev/null +++ b/libunrar/extinfo.hpp @@ -0,0 +1,8 @@ +#ifndef _RAR_EXTINFO_ +#define _RAR_EXTINFO_ + + +void SetExtraInfo(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW); +void SetExtraInfoNew(CommandData *Cmd,Archive &Arc,char *Name,wchar *NameW); + +#endif diff --git a/libunrar/extract.cpp b/libunrar/extract.cpp new file mode 100644 index 0000000..992c87d --- /dev/null +++ b/libunrar/extract.cpp @@ -0,0 +1,928 @@ +#include "rar.hpp" + +CmdExtract::CmdExtract() +{ + TotalFileCount=0; + *Password=0; + Unp=new Unpack(&DataIO); + Unp->Init(NULL); +} + + +CmdExtract::~CmdExtract() +{ + delete Unp; + memset(Password,0,sizeof(Password)); +} + + +void CmdExtract::DoExtract(CommandData *Cmd) +{ + PasswordCancelled=false; + DataIO.SetCurrentCommand(*Cmd->Command); + + struct FindData FD; + while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName))) + if (FindFile::FastFind(ArcName,ArcNameW,&FD)) + DataIO.TotalArcSize+=FD.Size; + + Cmd->ArcNames->Rewind(); + while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName))) + { + while (true) + { + char PrevCmdPassword[MAXPASSWORD]; + strcpy(PrevCmdPassword,Cmd->Password); + + EXTRACT_ARC_CODE Code=ExtractArchive(Cmd); + + // Restore Cmd->Password, which could be changed in IsArchive() call + // for next header encrypted archive. + strcpy(Cmd->Password,PrevCmdPassword); + + if (Code!=EXTRACT_ARC_REPEAT) + break; + } + if (FindFile::FastFind(ArcName,ArcNameW,&FD)) + DataIO.ProcessedArcSize+=FD.Size; + } + + if (TotalFileCount==0 && *Cmd->Command!='I') + { + if (!PasswordCancelled) + { + mprintf(St(MExtrNoFiles)); + } + ErrHandler.SetErrorCode(WARNING); + } +#ifndef GUI + else + if (!Cmd->DisableDone) + if (*Cmd->Command=='I') + mprintf(St(MDone)); + else + if (ErrHandler.GetErrorCount()==0) + mprintf(St(MExtrAllOk)); + else + mprintf(St(MExtrTotalErr),ErrHandler.GetErrorCount()); +#endif +} + + +void CmdExtract::ExtractArchiveInit(CommandData *Cmd,Archive &Arc) +{ + DataIO.UnpArcSize=Arc.FileLength(); + + FileCount=0; + MatchedArgs=0; +#ifndef SFX_MODULE + FirstFile=true; +#endif + + if (*Cmd->Password!=0) + strcpy(Password,Cmd->Password); + PasswordAll=(*Cmd->Password!=0); + + DataIO.UnpVolume=false; + + PrevExtracted=false; + SignatureFound=false; + AllMatchesExact=true; + ReconstructDone=false; + + StartTime.SetCurrentTime(); +} + + +EXTRACT_ARC_CODE CmdExtract::ExtractArchive(CommandData *Cmd) +{ + Archive Arc(Cmd); + if (!Arc.WOpen(ArcName,ArcNameW)) + { + ErrHandler.SetErrorCode(OPEN_ERROR); + return(EXTRACT_ARC_NEXT); + } + + if (!Arc.IsArchive(true)) + { +#ifndef GUI + mprintf(St(MNotRAR),ArcName); +#endif + if (CmpExt(ArcName,"rar")) + ErrHandler.SetErrorCode(WARNING); + return(EXTRACT_ARC_NEXT); + } + + // archive with corrupt encrypted header can be closed in IsArchive() call + if (!Arc.IsOpened()) + return(EXTRACT_ARC_NEXT); + +#ifndef SFX_MODULE + if (Arc.Volume && Arc.NotFirstVolume) + { + char FirstVolName[NM]; + VolNameToFirstName(ArcName,FirstVolName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)!=0); + + // If several volume names from same volume set are specified + // and current volume is not first in set and first volume is present + // and specified too, let's skip the current volume. + if (stricomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) && + Cmd->ArcNames->Search(FirstVolName,NULL,false)) + return(EXTRACT_ARC_NEXT); + } +#endif + + int64 VolumeSetSize=0; // Total size of volumes after the current volume. + + if (Arc.Volume) + { + // Calculate the total size of all accessible volumes. + // This size is necessary to display the correct total progress indicator. + + char NextName[NM]; + wchar NextNameW[NM]; + + strcpy(NextName,Arc.FileName); + strcpyw(NextNameW,Arc.FileNameW); + + while (true) + { + // First volume is already added to DataIO.TotalArcSize + // in initial TotalArcSize calculation in DoExtract. + // So we skip it and start from second volume. + NextVolumeName(NextName,NextNameW,ASIZE(NextName),(Arc.NewMhd.Flags & MHD_NEWNUMBERING)==0 || Arc.OldFormat); + struct FindData FD; + if (FindFile::FastFind(NextName,NextNameW,&FD)) + VolumeSetSize+=FD.Size; + else + break; + } + DataIO.TotalArcSize+=VolumeSetSize; + } + + ExtractArchiveInit(Cmd,Arc); + + if (*Cmd->Command=='T' || *Cmd->Command=='I') + Cmd->Test=true; + +#ifndef GUI + if (*Cmd->Command=='I') + Cmd->DisablePercentage=true; + else + if (Cmd->Test) + mprintf(St(MExtrTest),ArcName); + else + mprintf(St(MExtracting),ArcName); +#endif + + Arc.ViewComment(); + + // RAR can close a corrupt encrypted archive + if (!Arc.IsOpened()) + return(EXTRACT_ARC_NEXT); + + + while (1) + { + size_t Size=Arc.ReadHeader(); + bool Repeat=false; + if (!ExtractCurrentFile(Cmd,Arc,Size,Repeat)) + if (Repeat) + { + // If we started extraction from not first volume and need to + // restart it from first, we must correct DataIO.TotalArcSize + // for correct total progress display. We subtract the size + // of current volume and all volumes after it and add the size + // of new (first) volume. + struct FindData OldArc,NewArc; + if (FindFile::FastFind(Arc.FileName,Arc.FileNameW,&OldArc) && + FindFile::FastFind(ArcName,ArcNameW,&NewArc)) + DataIO.TotalArcSize-=VolumeSetSize+OldArc.Size-NewArc.Size; + return(EXTRACT_ARC_REPEAT); + } + else + break; + } + + return(EXTRACT_ARC_NEXT); +} + + +bool CmdExtract::ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderSize,bool &Repeat) +{ + char Command=*Cmd->Command; + if (HeaderSize==0) + if (DataIO.UnpVolume) + { +#ifdef NOVOLUME + return(false); +#else + if (!MergeArchive(Arc,&DataIO,false,Command)) + { + ErrHandler.SetErrorCode(WARNING); + return(false); + } + SignatureFound=false; +#endif + } + else + return(false); + int HeadType=Arc.GetHeaderType(); + if (HeadType!=FILE_HEAD) + { + if (HeadType==AV_HEAD || HeadType==SIGN_HEAD) + SignatureFound=true; +#if !defined(SFX_MODULE) && !defined(_WIN_CE) + if (HeadType==SUB_HEAD && PrevExtracted) + SetExtraInfo(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL); +#endif + if (HeadType==NEWSUB_HEAD) + { + if (Arc.SubHead.CmpName(SUBHEAD_TYPE_AV)) + SignatureFound=true; +#if !defined(NOSUBBLOCKS) && !defined(_WIN_CE) + if (PrevExtracted) + SetExtraInfoNew(Cmd,Arc,DestFileName,*DestFileNameW ? DestFileNameW:NULL); +#endif + } + if (HeadType==ENDARC_HEAD) + if (Arc.EndArcHead.Flags & EARC_NEXT_VOLUME) + { +#ifndef NOVOLUME + if (!MergeArchive(Arc,&DataIO,false,Command)) + { + ErrHandler.SetErrorCode(WARNING); + return(false); + } + SignatureFound=false; +#endif + Arc.Seek(Arc.CurBlockPos,SEEK_SET); + return(true); + } + else + return(false); + Arc.SeekToNext(); + return(true); + } + PrevExtracted=false; + + if (SignatureFound || + !Cmd->Recurse && MatchedArgs>=Cmd->FileArgs->ItemsCount() && + AllMatchesExact) + return(false); + + char ArcFileName[NM]; + IntToExt(Arc.NewLhd.FileName,Arc.NewLhd.FileName); + strcpy(ArcFileName,Arc.NewLhd.FileName); + + wchar ArcFileNameW[NM]; + *ArcFileNameW=0; + + int MatchType=MATCH_WILDSUBPATH; + + bool EqualNames=false; + int MatchNumber=Cmd->IsProcessFile(Arc.NewLhd,&EqualNames,MatchType); + bool ExactMatch=MatchNumber!=0; +#if !defined(SFX_MODULE) && !defined(_WIN_CE) + if (Cmd->ExclPath==EXCL_BASEPATH) + { + *Cmd->ArcPath=0; + if (ExactMatch) + { + Cmd->FileArgs->Rewind(); + if (Cmd->FileArgs->GetString(Cmd->ArcPath,NULL,sizeof(Cmd->ArcPath),MatchNumber-1)) + *PointToName(Cmd->ArcPath)=0; + } + } +#endif + if (ExactMatch && !EqualNames) + AllMatchesExact=false; + +#ifdef UNICODE_SUPPORTED + bool WideName=(Arc.NewLhd.Flags & LHD_UNICODE) && UnicodeEnabled(); +#else + bool WideName=false; +#endif + +#ifdef _APPLE + if (WideName) + { + WideToUtf(Arc.NewLhd.FileNameW,ArcFileName,sizeof(ArcFileName)); + WideName=false; + } +#endif + + wchar *DestNameW=WideName ? DestFileNameW:NULL; + +#ifdef UNICODE_SUPPORTED + if (WideName) + { + ConvertPath(Arc.NewLhd.FileNameW,ArcFileNameW); + char Name[NM]; + if (WideToChar(ArcFileNameW,Name) && IsNameUsable(Name)) + strcpy(ArcFileName,Name); + } +#endif + + ConvertPath(ArcFileName,ArcFileName); + + if (Arc.IsArcLabel()) + return(true); + + if (Arc.NewLhd.Flags & LHD_VERSION) + { + if (Cmd->VersionControl!=1 && !EqualNames) + { + if (Cmd->VersionControl==0) + ExactMatch=false; + int Version=ParseVersionFileName(ArcFileName,ArcFileNameW,false); + if (Cmd->VersionControl-1==Version) + ParseVersionFileName(ArcFileName,ArcFileNameW,true); + else + ExactMatch=false; + } + } + else + if (!Arc.IsArcDir() && Cmd->VersionControl>1) + ExactMatch=false; + + Arc.ConvertAttributes(); + +#ifndef SFX_MODULE + if ((Arc.NewLhd.Flags & (LHD_SPLIT_BEFORE/*|LHD_SOLID*/)) && FirstFile) + { + char CurVolName[NM]; + strcpy(CurVolName,ArcName); + + VolNameToFirstName(ArcName,ArcName,(Arc.NewMhd.Flags & MHD_NEWNUMBERING)!=0); + if (stricomp(ArcName,CurVolName)!=0 && FileExist(ArcName)) + { + *ArcNameW=0; + Repeat=true; + return(false); + } +#if !defined(RARDLL) && !defined(_WIN_CE) + if (!ReconstructDone) + { + ReconstructDone=true; + + RecVolumes RecVol; + if (RecVol.Restore(Cmd,Arc.FileName,Arc.FileNameW,true)) + { + Repeat=true; + return(false); + } + } +#endif + strcpy(ArcName,CurVolName); + } +#endif + DataIO.UnpVolume=(Arc.NewLhd.Flags & LHD_SPLIT_AFTER)!=0; + DataIO.NextVolumeMissing=false; + + Arc.Seek(Arc.NextBlockPos-Arc.NewLhd.FullPackSize,SEEK_SET); + + bool TestMode=false; + bool ExtrFile=false; + bool SkipSolid=false; + +#ifndef SFX_MODULE + if (FirstFile && (ExactMatch || Arc.Solid) && (Arc.NewLhd.Flags & (LHD_SPLIT_BEFORE/*|LHD_SOLID*/))!=0) + { + if (ExactMatch) + { + Log(Arc.FileName,St(MUnpCannotMerge),ArcFileName); +#ifdef RARDLL + Cmd->DllError=ERAR_BAD_DATA; +#endif + ErrHandler.SetErrorCode(OPEN_ERROR); + } + ExactMatch=false; + } + + FirstFile=false; +#endif + + if (ExactMatch || (SkipSolid=Arc.Solid)!=0) + { + if ((Arc.NewLhd.Flags & LHD_PASSWORD)!=0) +#ifndef RARDLL + if (*Password==0) +#endif + { +#ifdef RARDLL + if (*Cmd->Password==0) + if (Cmd->Callback==NULL || + Cmd->Callback(UCM_NEEDPASSWORD,Cmd->UserData,(LPARAM)Cmd->Password,sizeof(Cmd->Password))==-1) + return(false); + strcpy(Password,Cmd->Password); + +#else + if (!GetPassword(PASSWORD_FILE,ArcFileName,Password,sizeof(Password))) + { + PasswordCancelled=true; + return(false); + } +#endif + } +#if !defined(GUI) && !defined(SILENT) + else + if (!PasswordAll && (!Arc.Solid || Arc.NewLhd.UnpVer>=20 && (Arc.NewLhd.Flags & LHD_SOLID)==0)) + { + eprintf(St(MUseCurPsw),ArcFileName); + switch(Cmd->AllYes ? 1:Ask(St(MYesNoAll))) + { + case -1: + ErrHandler.Exit(USER_BREAK); + case 2: + if (!GetPassword(PASSWORD_FILE,ArcFileName,Password,sizeof(Password))) + { + return(false); + } + break; + case 3: + PasswordAll=true; + break; + } + } +#endif + +#ifndef SFX_MODULE + if (*Cmd->ExtrPath==0 && *Cmd->ExtrPathW!=0) + WideToChar(Cmd->ExtrPathW,DestFileName); + else +#endif + strcpy(DestFileName,Cmd->ExtrPath); + + +#ifndef SFX_MODULE + if (Cmd->AppendArcNameToPath) + { + strcat(DestFileName,PointToName(Arc.FirstVolumeName)); + SetExt(DestFileName,NULL); + AddEndSlash(DestFileName); + } +#endif + + char *ExtrName=ArcFileName; + + bool EmptyName=false; +#ifndef SFX_MODULE + size_t Length=strlen(Cmd->ArcPath); + if (Length>1 && IsPathDiv(Cmd->ArcPath[Length-1]) && + strlen(ArcFileName)==Length-1) + Length--; + if (Length>0 && strnicomp(Cmd->ArcPath,ArcFileName,Length)==0) + { + ExtrName+=Length; + while (*ExtrName==CPATHDIVIDER) + ExtrName++; + if (*ExtrName==0) + EmptyName=true; + } +#endif + + bool AbsPaths=Cmd->ExclPath==EXCL_ABSPATH && Command=='X' && IsDriveDiv(':'); + if (AbsPaths) + *DestFileName=0; + + if (Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH) + strcat(DestFileName,PointToName(ExtrName)); + else + strcat(DestFileName,ExtrName); + + char DiskLetter=etoupper(DestFileName[0]); + + if (AbsPaths && DestFileName[1]=='_' && IsPathDiv(DestFileName[2]) && + DiskLetter>='A' && DiskLetter<='Z') + DestFileName[1]=':'; + +#ifndef SFX_MODULE + if (!WideName && *Cmd->ExtrPathW!=0) + { + DestNameW=DestFileNameW; + WideName=true; + CharToWide(ArcFileName,ArcFileNameW); + } +#endif + + if (WideName) + { + if (*Cmd->ExtrPathW!=0) + strcpyw(DestFileNameW,Cmd->ExtrPathW); + else + CharToWide(Cmd->ExtrPath,DestFileNameW); + +#ifndef SFX_MODULE + if (Cmd->AppendArcNameToPath) + { + wchar FileNameW[NM]; + if (*Arc.FirstVolumeNameW!=0) + strcpyw(FileNameW,Arc.FirstVolumeNameW); + else + CharToWide(Arc.FirstVolumeName,FileNameW); + strcatw(DestFileNameW,PointToName(FileNameW)); + SetExt(DestFileNameW,NULL); + AddEndSlash(DestFileNameW); + } +#endif + wchar *ExtrNameW=ArcFileNameW; +#ifndef SFX_MODULE + if (Length>0) + { + wchar ArcPathW[NM]; + GetWideName(Cmd->ArcPath,Cmd->ArcPathW,ArcPathW); + Length=strlenw(ArcPathW); + } + ExtrNameW+=Length; + while (*ExtrNameW==CPATHDIVIDER) + ExtrNameW++; +#endif + + if (AbsPaths) + *DestFileNameW=0; + + if (Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH) + strcatw(DestFileNameW,PointToName(ExtrNameW)); + else + strcatw(DestFileNameW,ExtrNameW); + + if (AbsPaths && DestFileNameW[1]=='_' && IsPathDiv(DestFileNameW[2])) + DestFileNameW[1]=':'; + } + else + *DestFileNameW=0; + + ExtrFile=!SkipSolid && !EmptyName && (Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0; + + if ((Cmd->FreshFiles || Cmd->UpdateFiles) && (Command=='E' || Command=='X')) + { + struct FindData FD; + if (FindFile::FastFind(DestFileName,DestNameW,&FD)) + { + if (FD.mtime >= Arc.NewLhd.mtime) + { + // If directory already exists and its modification time is newer + // than start of extraction, it is likely it was created + // when creating a path to one of already extracted items. + // In such case we'll better update its time even if archived + // directory is older. + + if (!FD.IsDir || FD.mtimeFreshFiles) + ExtrFile=false; + } + + // Skip encrypted file if no password is specified. + if ((Arc.NewLhd.Flags & LHD_PASSWORD)!=0 && *Password==0) + { + ErrHandler.SetErrorCode(WARNING); +#ifdef RARDLL + Cmd->DllError=ERAR_MISSING_PASSWORD; +#endif + ExtrFile=false; + } + +#ifdef RARDLL + if (*Cmd->DllDestName) + { + strncpyz(DestFileName,Cmd->DllDestName,ASIZE(DestFileName)); + *DestFileNameW=0; + if (Cmd->DllOpMode!=RAR_EXTRACT) + ExtrFile=false; + } + if (*Cmd->DllDestNameW) + { + strncpyzw(DestFileNameW,Cmd->DllDestNameW,ASIZE(DestFileNameW)); + DestNameW=DestFileNameW; + if (Cmd->DllOpMode!=RAR_EXTRACT) + ExtrFile=false; + } +#endif + +#ifdef SFX_MODULE + if ((Arc.NewLhd.UnpVer!=UNP_VER && Arc.NewLhd.UnpVer!=29) && + Arc.NewLhd.Method!=0x30) +#else + if (Arc.NewLhd.UnpVer<13 || Arc.NewLhd.UnpVer>UNP_VER) +#endif + { +#ifndef SILENT + Log(Arc.FileName,St(MUnknownMeth),ArcFileName); +#ifndef SFX_MODULE + Log(Arc.FileName,St(MVerRequired),Arc.NewLhd.UnpVer/10,Arc.NewLhd.UnpVer%10); +#endif +#endif + ExtrFile=false; + ErrHandler.SetErrorCode(WARNING); +#ifdef RARDLL + Cmd->DllError=ERAR_UNKNOWN_FORMAT; +#endif + } + + File CurFile; + + if (!IsLink(Arc.NewLhd.FileAttr)) + if (Arc.IsArcDir()) + { + if (!ExtrFile || Command=='P' || Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH) + return(true); + if (SkipSolid) + { +#ifndef GUI + mprintf(St(MExtrSkipFile),ArcFileName); +#endif + return(true); + } + TotalFileCount++; + if (Cmd->Test) + { +#ifndef GUI + mprintf(St(MExtrTestFile),ArcFileName); + mprintf(" %s",St(MOk)); +#endif + return(true); + } + MKDIR_CODE MDCode=MakeDir(DestFileName,DestNameW,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr); + bool DirExist=false; + if (MDCode!=MKDIR_SUCCESS) + { + DirExist=FileExist(DestFileName,DestNameW); + if (DirExist && !IsDir(GetFileAttr(DestFileName,DestNameW))) + { + bool UserReject; + FileCreate(Cmd,NULL,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime); + DirExist=false; + } + CreatePath(DestFileName,DestNameW,true); + MDCode=MakeDir(DestFileName,DestNameW,!Cmd->IgnoreGeneralAttr,Arc.NewLhd.FileAttr); + } + if (MDCode==MKDIR_SUCCESS) + { +#ifndef GUI + mprintf(St(MCreatDir),DestFileName); + mprintf(" %s",St(MOk)); +#endif + PrevExtracted=true; + } + else + if (DirExist) + { + if (!Cmd->IgnoreGeneralAttr) + SetFileAttr(DestFileName,DestNameW,Arc.NewLhd.FileAttr); + PrevExtracted=true; + } + else + { + Log(Arc.FileName,St(MExtrErrMkDir),DestFileName); + ErrHandler.SysErrMsg(); +#ifdef RARDLL + Cmd->DllError=ERAR_ECREATE; +#endif + ErrHandler.SetErrorCode(CREATE_ERROR); + } + if (PrevExtracted) + { +#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE) + if (Cmd->SetCompressedAttr && + (Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT()) + SetFileCompression(DestFileName,DestNameW,true); +#endif + SetDirTime(DestFileName,DestNameW, + Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime, + Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime, + Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime); + } + return(true); + } + else + { + if (Cmd->Test && ExtrFile) + TestMode=true; +#if !defined(GUI) && !defined(SFX_MODULE) + if (Command=='P' && ExtrFile) + CurFile.SetHandleType(FILE_HANDLESTD); +#endif + if ((Command=='E' || Command=='X') && ExtrFile && !Cmd->Test) + { + bool UserReject; + if (!FileCreate(Cmd,&CurFile,DestFileName,DestNameW,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime)) + { + ExtrFile=false; + if (!UserReject) + { + ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName); + ErrHandler.SetErrorCode(CREATE_ERROR); +#ifdef RARDLL + Cmd->DllError=ERAR_ECREATE; +#endif + if (!IsNameUsable(DestFileName)) + { + Log(Arc.FileName,St(MCorrectingName)); + char OrigName[sizeof(DestFileName)]; + strncpyz(OrigName,DestFileName,ASIZE(OrigName)); + + MakeNameUsable(DestFileName,true); + CreatePath(DestFileName,NULL,true); + if (FileCreate(Cmd,&CurFile,DestFileName,NULL,Cmd->Overwrite,&UserReject,Arc.NewLhd.FullUnpSize,Arc.NewLhd.FileTime)) + { +#ifndef SFX_MODULE + Log(Arc.FileName,St(MRenaming),OrigName,DestFileName); +#endif + ExtrFile=true; + } + else + ErrHandler.CreateErrorMsg(Arc.FileName,DestFileName); + } + } + } + } + } + + if (!ExtrFile && Arc.Solid) + { + SkipSolid=true; + TestMode=true; + ExtrFile=true; + + } + if (ExtrFile) + { + if (!SkipSolid) + { + if (!TestMode && Command!='P' && CurFile.IsDevice()) + { + Log(Arc.FileName,St(MInvalidName),DestFileName); + ErrHandler.WriteError(Arc.FileName,DestFileName); + } + TotalFileCount++; + } + FileCount++; +#ifndef GUI + if (Command!='I') + if (SkipSolid) + mprintf(St(MExtrSkipFile),ArcFileName); + else + switch(Cmd->Test ? 'T':Command) + { + case 'T': + mprintf(St(MExtrTestFile),ArcFileName); + break; +#ifndef SFX_MODULE + case 'P': + mprintf(St(MExtrPrinting),ArcFileName); + break; +#endif + case 'X': + case 'E': + mprintf(St(MExtrFile),DestFileName); + break; + } + if (!Cmd->DisablePercentage) + mprintf(" "); +#endif + DataIO.CurUnpRead=0; + DataIO.CurUnpWrite=0; + DataIO.UnpFileCRC=Arc.OldFormat ? 0 : 0xffffffff; + DataIO.PackedCRC=0xffffffff; + DataIO.SetEncryption( + (Arc.NewLhd.Flags & LHD_PASSWORD) ? Arc.NewLhd.UnpVer:0,Password, + (Arc.NewLhd.Flags & LHD_SALT) ? Arc.NewLhd.Salt:NULL,false, + Arc.NewLhd.UnpVer>=36); + DataIO.SetPackedSizeToRead(Arc.NewLhd.FullPackSize); + DataIO.SetFiles(&Arc,&CurFile); + DataIO.SetTestMode(TestMode); + DataIO.SetSkipUnpCRC(SkipSolid); +#ifndef _WIN_CE + if (!TestMode && !Arc.BrokenFileHeader && + (Arc.NewLhd.FullPackSize<<11)>Arc.NewLhd.FullUnpSize && + (Arc.NewLhd.FullUnpSize<100000000 || Arc.FileLength()>Arc.NewLhd.FullPackSize)) + CurFile.Prealloc(Arc.NewLhd.FullUnpSize); +#endif + + CurFile.SetAllowDelete(!Cmd->KeepBroken); + + bool LinkCreateMode=!Cmd->Test && !SkipSolid; + if (ExtractLink(DataIO,Arc,DestFileName,DataIO.UnpFileCRC,LinkCreateMode)) + PrevExtracted=LinkCreateMode; + else + if ((Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)==0) + if (Arc.NewLhd.Method==0x30) + UnstoreFile(DataIO,Arc.NewLhd.FullUnpSize); + else + { + Unp->SetDestSize(Arc.NewLhd.FullUnpSize); +#ifndef SFX_MODULE + if (Arc.NewLhd.UnpVer<=15) + Unp->DoUnpack(15,FileCount>1 && Arc.Solid); + else +#endif + Unp->DoUnpack(Arc.NewLhd.UnpVer,(Arc.NewLhd.Flags & LHD_SOLID)!=0); + } + + if (Arc.IsOpened()) + Arc.SeekToNext(); + + bool BrokenFile=false; + if (!SkipSolid) + { + if (Arc.OldFormat && UINT32(DataIO.UnpFileCRC)==UINT32(Arc.NewLhd.FileCRC) || + !Arc.OldFormat && UINT32(DataIO.UnpFileCRC)==UINT32(Arc.NewLhd.FileCRC^0xffffffff)) + { +#ifndef GUI + if (Command!='P' && Command!='I') + mprintf("%s%s ",Cmd->DisablePercentage ? " ":"\b\b\b\b\b ",St(MOk)); +#endif + } + else + { + char *BadArcName=/*(Arc.NewLhd.Flags & LHD_SPLIT_BEFORE) ? NULL:*/Arc.FileName; + if (Arc.NewLhd.Flags & LHD_PASSWORD) + { + Log(BadArcName,St(MEncrBadCRC),ArcFileName); + } + else + { + Log(BadArcName,St(MCRCFailed),ArcFileName); + } + BrokenFile=true; + ErrHandler.SetErrorCode(CRC_ERROR); +#ifdef RARDLL + Cmd->DllError=ERAR_BAD_DATA; +#endif + Alarm(); + } + } +#ifndef GUI + else + mprintf("\b\b\b\b\b "); +#endif + + if (!TestMode && (Command=='X' || Command=='E') && + !IsLink(Arc.NewLhd.FileAttr)) + { +#if defined(_WIN_32) || defined(_EMX) + if (Cmd->ClearArc) + Arc.NewLhd.FileAttr&=~FA_ARCH; +/* + else + Arc.NewLhd.FileAttr|=FA_ARCH; //set archive bit for unpacked files (file is not backed up) +*/ +#endif + if (!BrokenFile || Cmd->KeepBroken) + { + if (BrokenFile) + CurFile.Truncate(); + CurFile.SetOpenFileTime( + Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime, + Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.NewLhd.ctime, + Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime); + CurFile.Close(); +#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE) + if (Cmd->SetCompressedAttr && + (Arc.NewLhd.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0 && WinNT()) + SetFileCompression(CurFile.FileName,CurFile.FileNameW,true); +#endif + CurFile.SetCloseFileTime( + Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.NewLhd.mtime, + Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.NewLhd.atime); + if (!Cmd->IgnoreGeneralAttr) + SetFileAttr(CurFile.FileName,CurFile.FileNameW,Arc.NewLhd.FileAttr); + PrevExtracted=true; + } + } + } + } + if (ExactMatch) + MatchedArgs++; + if (DataIO.NextVolumeMissing || !Arc.IsOpened()) + return(false); + if (!ExtrFile) + if (!Arc.Solid) + Arc.SeekToNext(); + else + if (!SkipSolid) + return(false); + return(true); +} + + +void CmdExtract::UnstoreFile(ComprDataIO &DataIO,int64 DestUnpSize) +{ + Array Buffer(0x10000); + while (1) + { + uint Code=DataIO.UnpRead(&Buffer[0],Buffer.Size()); + if (Code==0 || (int)Code==-1) + break; + Code=Code=0) + DestUnpSize-=Code; + } +} + diff --git a/libunrar/extract.hpp b/libunrar/extract.hpp new file mode 100644 index 0000000..40f9cc0 --- /dev/null +++ b/libunrar/extract.hpp @@ -0,0 +1,43 @@ +#ifndef _RAR_EXTRACT_ +#define _RAR_EXTRACT_ + +enum EXTRACT_ARC_CODE {EXTRACT_ARC_NEXT,EXTRACT_ARC_REPEAT}; + +class CmdExtract +{ + private: + EXTRACT_ARC_CODE ExtractArchive(CommandData *Cmd); + RarTime StartTime; // time when extraction started + + ComprDataIO DataIO; + Unpack *Unp; + unsigned long TotalFileCount; + + unsigned long FileCount; + unsigned long MatchedArgs; + bool FirstFile; + bool AllMatchesExact; + bool ReconstructDone; + + char ArcName[NM]; + wchar ArcNameW[NM]; + + char Password[MAXPASSWORD]; + bool PasswordAll; + bool PrevExtracted; + char DestFileName[NM]; + wchar DestFileNameW[NM]; + bool PasswordCancelled; + public: + CmdExtract(); + ~CmdExtract(); + void DoExtract(CommandData *Cmd); + void ExtractArchiveInit(CommandData *Cmd,Archive &Arc); + bool ExtractCurrentFile(CommandData *Cmd,Archive &Arc,size_t HeaderSize, + bool &Repeat); + static void UnstoreFile(ComprDataIO &DataIO,int64 DestUnpSize); + + bool SignatureFound; +}; + +#endif diff --git a/libunrar/filcreat.cpp b/libunrar/filcreat.cpp new file mode 100644 index 0000000..c570cd3 --- /dev/null +++ b/libunrar/filcreat.cpp @@ -0,0 +1,245 @@ +#include "rar.hpp" + +bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW, + OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize, + uint FileTime) +{ + if (UserReject!=NULL) + *UserReject=false; +#if defined(_WIN_32) && !defined(_WIN_CE) + bool ShortNameChanged=false; +#endif + while (FileExist(Name,NameW)) + { +#if defined(_WIN_32) && !defined(_WIN_CE) + if (!ShortNameChanged) + { + ShortNameChanged=true; + if (UpdateExistingShortName(Name,NameW)) + continue; + } +#endif + if (Mode==OVERWRITE_NONE) + { + if (UserReject!=NULL) + *UserReject=true; + return(false); + } +#ifdef SILENT + Mode=OVERWRITE_ALL; +#endif + if (Cmd->AllYes || Mode==OVERWRITE_ALL) + break; + if (Mode==OVERWRITE_DEFAULT || Mode==OVERWRITE_FORCE_ASK) + { + eprintf(St(MFileExists),Name); + int Choice=Ask(St(MYesNoAllRenQ)); + if (Choice==1) + break; + if (Choice==2) + { + if (UserReject!=NULL) + *UserReject=true; + return(false); + } + if (Choice==3) + { + Cmd->Overwrite=OVERWRITE_ALL; + break; + } + if (Choice==4) + { + if (UserReject!=NULL) + *UserReject=true; + Cmd->Overwrite=OVERWRITE_NONE; + return(false); + } + if (Choice==5) + { + mprintf(St(MAskNewName)); + + char NewName[NM]; +#ifdef _WIN_32 + File SrcFile; + SrcFile.SetHandleType(FILE_HANDLESTD); + int Size=SrcFile.Read(NewName,sizeof(NewName)-1); + NewName[Size]=0; + OemToChar(NewName,NewName); +#else + if (fgets(NewName,sizeof(NewName),stdin)==NULL) + { + // Process fgets failure as if user answered 'No'. + if (UserReject!=NULL) + *UserReject=true; + return(false); + } +#endif + RemoveLF(NewName); + if (PointToName(NewName)==NewName) + strcpy(PointToName(Name),NewName); + else + strcpy(Name,NewName); + if (NameW!=NULL) + *NameW=0; + continue; + } + if (Choice==6) + ErrHandler.Exit(USER_BREAK); + } + if (Mode==OVERWRITE_AUTORENAME) + { + if (GetAutoRenamedName(Name)) + { + if (NameW!=NULL) + *NameW=0; + } + else + Mode=OVERWRITE_DEFAULT; + continue; + } + } + if (NewFile!=NULL && NewFile->Create(Name,NameW)) + return(true); + PrepareToDelete(Name,NameW); + CreatePath(Name,NameW,true); + return(NewFile!=NULL ? NewFile->Create(Name,NameW):DelFile(Name,NameW)); +} + + +bool GetAutoRenamedName(char *Name) +{ + char NewName[NM]; + + if (strlen(Name)>sizeof(NewName)-10) + return(false); + char *Ext=GetExt(Name); + if (Ext==NULL) + Ext=Name+strlen(Name); + for (int FileVer=1;;FileVer++) + { + sprintf(NewName,"%.*s(%d)%s",int(Ext-Name),Name,FileVer,Ext); + if (!FileExist(NewName)) + { + strcpy(Name,NewName); + break; + } + if (FileVer>=1000000) + return(false); + } + return(true); +} + + +#if defined(_WIN_32) && !defined(_WIN_CE) +bool UpdateExistingShortName(char *Name,wchar *NameW) +{ + FindData fd; + if (!FindFile::FastFind(Name,NameW,&fd)) + return(false); + if (*fd.Name==0 || *fd.ShortName==0) + return(false); + if (stricomp(PointToName(fd.Name),fd.ShortName)==0 || + stricomp(PointToName(Name),fd.ShortName)!=0) + return(false); + + char NewName[NM]; + for (int I=0;I<10000;I+=123) + { + strncpyz(NewName,Name,ASIZE(NewName)); + sprintf(PointToName(NewName),"rtmp%d",I); + if (!FileExist(NewName)) + break; + } + if (FileExist(NewName)) + return(false); + char FullName[NM]; + strncpyz(FullName,Name,ASIZE(FullName)); + strcpy(PointToName(FullName),PointToName(fd.Name)); + if (!MoveFile(FullName,NewName)) + return(false); + File KeepShortFile; + bool Created=false; + if (!FileExist(Name)) + Created=KeepShortFile.Create(Name); + MoveFile(NewName,FullName); + if (Created) + { + KeepShortFile.Close(); + KeepShortFile.Delete(); + } + return(true); +} + +/* +bool UpdateExistingShortName(char *Name,wchar *NameW) +{ + if (WinNT()<5) + return(false); + FindData fd; + if (!FindFile::FastFind(Name,NameW,&fd)) + return(false); + if (*fd.Name==0 || *fd.ShortName==0) + return(false); + if (stricomp(PointToName(fd.Name),fd.ShortName)==0 || + stricomp(PointToName(Name),fd.ShortName)!=0) + return(false); + + typedef BOOL (WINAPI *SETFILESHORTNAME)(HANDLE,LPCSTR); + static SETFILESHORTNAME pSetFileShortName=NULL; + if (pSetFileShortName==NULL) + { + HMODULE hKernel=GetModuleHandle("kernel32.dll"); + if (hKernel!=NULL) + pSetFileShortName=(SETFILESHORTNAME)GetProcAddress(hKernel,"SetFileShortNameA"); + if (pSetFileShortName==NULL) + return(false); + } + static bool RestoreEnabled=false; + if (!RestoreEnabled) + { + HANDLE hToken; + if (!OpenProcessToken(GetCurrentProcess(), TOKEN_ADJUST_PRIVILEGES, &hToken)) + return(false); + + TOKEN_PRIVILEGES tp; + tp.PrivilegeCount = 1; + tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED; + + if (LookupPrivilegeValue(NULL,SE_RESTORE_NAME,&tp.Privileges[0].Luid)) + AdjustTokenPrivileges(hToken, FALSE, &tp, 0, NULL, NULL); + + CloseHandle(hToken); + RestoreEnabled=true; + } + + wchar FileNameW[NM]; + GetWideName(Name,NameW,FileNameW); + HANDLE hFile=CreateFileW(FileNameW,GENERIC_WRITE|DELETE,FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL); + if (hFile==INVALID_HANDLE_VALUE) + return(false); + + bool RetCode=false; + + char FullName[NM]; + wchar FullNameW[NM]; + strcpy(FullName,Name); + strcpyw(FullNameW,NullToEmpty(NameW)); + for (int I=1;I<1000000;I++) + { + char NewName[NM]; + sprintf(NewName,"NAME~%d.%d",I%1000,I/1000+1); + strcpy(PointToName(FullName),NewName); + if (*FullNameW) + CharToWide(NewName,PointToName(FullNameW)); + if (!FileExist(FullName,FullNameW)) + { + RetCode=pSetFileShortName(hFile,NewName); + break; + } + } + CloseHandle(hFile); + return(RetCode); +} +*/ +#endif diff --git a/libunrar/filcreat.hpp b/libunrar/filcreat.hpp new file mode 100644 index 0000000..5c8e8f5 --- /dev/null +++ b/libunrar/filcreat.hpp @@ -0,0 +1,13 @@ +#ifndef _RAR_FILECREATE_ +#define _RAR_FILECREATE_ + +bool FileCreate(RAROptions *Cmd,File *NewFile,char *Name,wchar *NameW, + OVERWRITE_MODE Mode,bool *UserReject,int64 FileSize=INT64NDF, + uint FileTime=0); +bool GetAutoRenamedName(char *Name); + +#if defined(_WIN_32) && !defined(_WIN_CE) +bool UpdateExistingShortName(char *Name,wchar *NameW); +#endif + +#endif diff --git a/libunrar/file.cpp b/libunrar/file.cpp new file mode 100644 index 0000000..bd54c06 --- /dev/null +++ b/libunrar/file.cpp @@ -0,0 +1,678 @@ +#include "rar.hpp" + +static File *CreatedFiles[256]; +static int RemoveCreatedActive=0; + +File::File() +{ + hFile=BAD_HANDLE; + *FileName=0; + *FileNameW=0; + NewFile=false; + LastWrite=false; + HandleType=FILE_HANDLENORMAL; + SkipClose=false; + IgnoreReadErrors=false; + ErrorType=FILE_SUCCESS; + OpenShared=false; + AllowDelete=true; + CloseCount=0; + AllowExceptions=true; +#ifdef _WIN_32 + NoSequentialRead=false; +#endif +} + + +File::~File() +{ + if (hFile!=BAD_HANDLE && !SkipClose) + if (NewFile) + Delete(); + else + Close(); +} + + +void File::operator = (File &SrcFile) +{ + hFile=SrcFile.hFile; + strcpy(FileName,SrcFile.FileName); + NewFile=SrcFile.NewFile; + LastWrite=SrcFile.LastWrite; + HandleType=SrcFile.HandleType; + SrcFile.SkipClose=true; +} + + +bool File::Open(const char *Name,const wchar *NameW,bool OpenShared,bool Update) +{ + ErrorType=FILE_SUCCESS; + FileHandle hNewFile; + if (File::OpenShared) + OpenShared=true; +#ifdef _WIN_32 + uint Access=GENERIC_READ; + if (Update) + Access|=GENERIC_WRITE; + uint ShareMode=FILE_SHARE_READ; + if (OpenShared) + ShareMode|=FILE_SHARE_WRITE; + uint Flags=NoSequentialRead ? 0:FILE_FLAG_SEQUENTIAL_SCAN; + if (WinNT() && NameW!=NULL && *NameW!=0) + hNewFile=CreateFileW(NameW,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); + else + hNewFile=CreateFile(Name,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL); + + if (hNewFile==BAD_HANDLE && GetLastError()==ERROR_FILE_NOT_FOUND) + ErrorType=FILE_NOTFOUND; +#else + int flags=Update ? O_RDWR:O_RDONLY; +#ifdef O_BINARY + flags|=O_BINARY; +#if defined(_AIX) && defined(_LARGE_FILE_API) + flags|=O_LARGEFILE; +#endif +#endif +#if defined(_EMX) && !defined(_DJGPP) + int sflags=OpenShared ? SH_DENYNO:SH_DENYWR; + int handle=sopen(Name,flags,sflags); +#else + int handle=open(Name,flags); +#ifdef LOCK_EX + +#ifdef _OSF_SOURCE + extern "C" int flock(int, int); +#endif + + if (!OpenShared && Update && handle>=0 && flock(handle,LOCK_EX|LOCK_NB)==-1) + { + close(handle); + return(false); + } +#endif +#endif + hNewFile=handle==-1 ? BAD_HANDLE:fdopen(handle,Update ? UPDATEBINARY:READBINARY); + if (hNewFile==BAD_HANDLE && errno==ENOENT) + ErrorType=FILE_NOTFOUND; +#endif + NewFile=false; + HandleType=FILE_HANDLENORMAL; + SkipClose=false; + bool Success=hNewFile!=BAD_HANDLE; + if (Success) + { + hFile=hNewFile; + if (NameW!=NULL) + strcpyw(FileNameW,NameW); + else + *FileNameW=0; + if (Name!=NULL) + strcpy(FileName,Name); + else + WideToChar(NameW,FileName); + AddFileToList(hFile); + } + return(Success); +} + + +#if !defined(SHELL_EXT) && !defined(SFX_MODULE) +void File::TOpen(const char *Name,const wchar *NameW) +{ + if (!WOpen(Name,NameW)) + ErrHandler.Exit(OPEN_ERROR); +} +#endif + + +bool File::WOpen(const char *Name,const wchar *NameW) +{ + if (Open(Name,NameW)) + return(true); + ErrHandler.OpenErrorMsg(Name); + return(false); +} + + +bool File::Create(const char *Name,const wchar *NameW,bool ShareRead) +{ +#ifdef _WIN_32 + DWORD ShareMode=(ShareRead || File::OpenShared) ? FILE_SHARE_READ:0; + if (WinNT() && NameW!=NULL && *NameW!=0) + hFile=CreateFileW(NameW,GENERIC_READ|GENERIC_WRITE,ShareMode,NULL, + CREATE_ALWAYS,0,NULL); + else + hFile=CreateFile(Name,GENERIC_READ|GENERIC_WRITE,ShareMode,NULL, + CREATE_ALWAYS,0,NULL); +#else + hFile=fopen(Name,CREATEBINARY); +#endif + NewFile=true; + HandleType=FILE_HANDLENORMAL; + SkipClose=false; + if (NameW!=NULL) + strcpyw(FileNameW,NameW); + else + *FileNameW=0; + if (Name!=NULL) + strcpy(FileName,Name); + else + WideToChar(NameW,FileName); + AddFileToList(hFile); + return(hFile!=BAD_HANDLE); +} + + +void File::AddFileToList(FileHandle hFile) +{ + if (hFile!=BAD_HANDLE) + for (int I=0;ISize && FilePos-Size<=0xffffffff && FilePos+Size>0xffffffff) + ErrHandler.WriteErrorFAT(FileName); +#endif + if (ErrHandler.AskRepeatWrite(FileName,false)) + { +#ifndef _WIN_32 + clearerr(hFile); +#endif + if (Written0) + Seek(Tell()-Written,SEEK_SET); + continue; + } + ErrHandler.WriteError(NULL,FileName); + } + break; + } + LastWrite=true; +} + + +int File::Read(void *Data,size_t Size) +{ + int64 FilePos=0; //initialized only to suppress some compilers warning + + if (IgnoreReadErrors) + FilePos=Tell(); + int ReadSize; + while (true) + { + ReadSize=DirectRead(Data,Size); + if (ReadSize==-1) + { + ErrorType=FILE_READERROR; + if (AllowExceptions) + if (IgnoreReadErrors) + { + ReadSize=0; + for (size_t I=0;IMaxDeviceRead) + Size=MaxDeviceRead; + hFile=GetStdHandle(STD_INPUT_HANDLE); +#else + hFile=stdin; +#endif + } +#endif +#ifdef _WIN_32 + DWORD Read; + if (!ReadFile(hFile,Data,(DWORD)Size,&Read,NULL)) + { + if (IsDevice() && Size>MaxDeviceRead) + return(DirectRead(Data,MaxDeviceRead)); + if (HandleType==FILE_HANDLESTD && GetLastError()==ERROR_BROKEN_PIPE) + return(0); + return(-1); + } + return(Read); +#else + if (LastWrite) + { + fflush(hFile); + LastWrite=false; + } + clearerr(hFile); + size_t ReadSize=fread(Data,1,Size,hFile); + if (ferror(hFile)) + return(-1); + return((int)ReadSize); +#endif +} + + +void File::Seek(int64 Offset,int Method) +{ + if (!RawSeek(Offset,Method) && AllowExceptions) + ErrHandler.SeekError(FileName); +} + + +bool File::RawSeek(int64 Offset,int Method) +{ + if (hFile==BAD_HANDLE) + return(true); + if (Offset<0 && Method!=SEEK_SET) + { + Offset=(Method==SEEK_CUR ? Tell():FileLength())+Offset; + Method=SEEK_SET; + } +#ifdef _WIN_32 + LONG HighDist=(LONG)(Offset>>32); + if (SetFilePointer(hFile,(LONG)Offset,&HighDist,Method)==0xffffffff && + GetLastError()!=NO_ERROR) + return(false); +#else + LastWrite=false; +#if defined(_LARGEFILE_SOURCE) && !defined(_OSF_SOURCE) && !defined(__VMS) + if (fseeko(hFile,Offset,Method)!=0) +#else + if (fseek(hFile,(long)Offset,Method)!=0) +#endif + return(false); +#endif + return(true); +} + + +int64 File::Tell() +{ +#ifdef _WIN_32 + LONG HighDist=0; + uint LowDist=SetFilePointer(hFile,0,&HighDist,FILE_CURRENT); + if (LowDist==0xffffffff && GetLastError()!=NO_ERROR) + if (AllowExceptions) + ErrHandler.SeekError(FileName); + else + return(-1); + return(INT32TO64(HighDist,LowDist)); +#else +#if defined(_LARGEFILE_SOURCE) && !defined(_OSF_SOURCE) + return(ftello(hFile)); +#else + return(ftell(hFile)); +#endif +#endif +} + + +void File::Prealloc(int64 Size) +{ +#ifdef _WIN_32 + if (RawSeek(Size,SEEK_SET)) + { + Truncate(); + Seek(0,SEEK_SET); + } +#endif +} + + +byte File::GetByte() +{ + byte Byte=0; + Read(&Byte,1); + return(Byte); +} + + +void File::PutByte(byte Byte) +{ + Write(&Byte,1); +} + + +bool File::Truncate() +{ +#ifdef _WIN_32 + return(SetEndOfFile(hFile)==TRUE); +#else + return(false); +#endif +} + + +void File::SetOpenFileTime(RarTime *ftm,RarTime *ftc,RarTime *fta) +{ +#ifdef _WIN_32 + bool sm=ftm!=NULL && ftm->IsSet(); + bool sc=ftc!=NULL && ftc->IsSet(); + bool sa=fta!=NULL && fta->IsSet(); + FILETIME fm,fc,fa; + if (sm) + ftm->GetWin32(&fm); + if (sc) + ftc->GetWin32(&fc); + if (sa) + fta->GetWin32(&fa); + SetFileTime(hFile,sc ? &fc:NULL,sa ? &fa:NULL,sm ? &fm:NULL); +#endif +} + + +void File::SetCloseFileTime(RarTime *ftm,RarTime *fta) +{ +#if defined(_UNIX) || defined(_EMX) + SetCloseFileTimeByName(FileName,ftm,fta); +#endif +} + + +void File::SetCloseFileTimeByName(const char *Name,RarTime *ftm,RarTime *fta) +{ +#if defined(_UNIX) || defined(_EMX) + bool setm=ftm!=NULL && ftm->IsSet(); + bool seta=fta!=NULL && fta->IsSet(); + if (setm || seta) + { + struct utimbuf ut; + if (setm) + ut.modtime=ftm->GetUnix(); + else + ut.modtime=fta->GetUnix(); + if (seta) + ut.actime=fta->GetUnix(); + else + ut.actime=ut.modtime; + utime(Name,&ut); + } +#endif +} + + +void File::GetOpenFileTime(RarTime *ft) +{ +#ifdef _WIN_32 + FILETIME FileTime; + GetFileTime(hFile,NULL,NULL,&FileTime); + *ft=FileTime; +#endif +#if defined(_UNIX) || defined(_EMX) + struct stat st; + fstat(fileno(hFile),&st); + *ft=st.st_mtime; +#endif +} + + +int64 File::FileLength() +{ + SaveFilePos SavePos(*this); + Seek(0,SEEK_END); + return(Tell()); +} + + +void File::SetHandleType(FILE_HANDLETYPE Type) +{ + HandleType=Type; +} + + +bool File::IsDevice() +{ + if (hFile==BAD_HANDLE) + return(false); +#ifdef _WIN_32 + uint Type=GetFileType(hFile); + return(Type==FILE_TYPE_CHAR || Type==FILE_TYPE_PIPE); +#else + return(isatty(fileno(hFile))); +#endif +} + + +#ifndef SFX_MODULE +void File::fprintf(const char *fmt,...) +{ + va_list argptr; + va_start(argptr,fmt); + safebuf char Msg[2*NM+1024],OutMsg[2*NM+1024]; + vsprintf(Msg,fmt,argptr); +#ifdef _WIN_32 + for (int Src=0,Dest=0;;Src++) + { + char CurChar=Msg[Src]; + if (CurChar=='\n') + OutMsg[Dest++]='\r'; + OutMsg[Dest++]=CurChar; + if (CurChar==0) + break; + } +#else + strcpy(OutMsg,Msg); +#endif + Write(OutMsg,strlen(OutMsg)); + va_end(argptr); +} +#endif + + +bool File::RemoveCreated() +{ + RemoveCreatedActive++; + bool RetCode=true; + for (int I=0;ISetExceptions(false); + bool Success; + if (CreatedFiles[I]->NewFile) + Success=CreatedFiles[I]->Delete(); + else + Success=CreatedFiles[I]->Close(); + if (Success) + CreatedFiles[I]=NULL; + else + RetCode=false; + } + RemoveCreatedActive--; + return(RetCode); +} + + +#ifndef SFX_MODULE +int64 File::Copy(File &Dest,int64 Length) +{ + Array Buffer(0x10000); + int64 CopySize=0; + bool CopyAll=(Length==INT64NDF); + + while (CopyAll || Length>0) + { + Wait(); + size_t SizeToRead=(!CopyAll && Length<(int64)Buffer.Size()) ? (size_t)Length:Buffer.Size(); + int ReadSize=Read(&Buffer[0],SizeToRead); + if (ReadSize==0) + break; + Dest.Write(&Buffer[0],ReadSize); + CopySize+=ReadSize; + if (!CopyAll) + Length-=ReadSize; + } + return(CopySize); +} +#endif diff --git a/libunrar/file.hpp b/libunrar/file.hpp new file mode 100644 index 0000000..3e17ae9 --- /dev/null +++ b/libunrar/file.hpp @@ -0,0 +1,98 @@ +#ifndef _RAR_FILE_ +#define _RAR_FILE_ + +#ifdef _WIN_32 +typedef HANDLE FileHandle; +#define BAD_HANDLE INVALID_HANDLE_VALUE +#else +typedef FILE* FileHandle; +#define BAD_HANDLE NULL +#endif + +class RAROptions; + +enum FILE_HANDLETYPE {FILE_HANDLENORMAL,FILE_HANDLESTD,FILE_HANDLEERR}; + +enum FILE_ERRORTYPE {FILE_SUCCESS,FILE_NOTFOUND,FILE_READERROR}; + +struct FileStat +{ + uint FileAttr; + uint FileTime; + int64 FileSize; + bool IsDir; +}; + + +class File +{ + private: + void AddFileToList(FileHandle hFile); + + FileHandle hFile; + bool LastWrite; + FILE_HANDLETYPE HandleType; + bool SkipClose; + bool IgnoreReadErrors; + bool NewFile; + bool AllowDelete; + bool AllowExceptions; +#ifdef _WIN_32 + bool NoSequentialRead; +#endif + protected: + bool OpenShared; + public: + char FileName[NM]; + wchar FileNameW[NM]; + + FILE_ERRORTYPE ErrorType; + + uint CloseCount; + public: + File(); + virtual ~File(); + void operator = (File &SrcFile); + bool Open(const char *Name,const wchar *NameW=NULL,bool OpenShared=false,bool Update=false); + void TOpen(const char *Name,const wchar *NameW=NULL); + bool WOpen(const char *Name,const wchar *NameW=NULL); + bool Create(const char *Name,const wchar *NameW=NULL,bool ShareRead=true); + void TCreate(const char *Name,const wchar *NameW=NULL,bool ShareRead=true); + bool WCreate(const char *Name,const wchar *NameW=NULL,bool ShareRead=true); + bool Close(); + void Flush(); + bool Delete(); + bool Rename(const char *NewName,const wchar *NewNameW=NULL); + void Write(const void *Data,size_t Size); + int Read(void *Data,size_t Size); + int DirectRead(void *Data,size_t Size); + void Seek(int64 Offset,int Method); + bool RawSeek(int64 Offset,int Method); + int64 Tell(); + void Prealloc(int64 Size); + byte GetByte(); + void PutByte(byte Byte); + bool Truncate(); + void SetOpenFileTime(RarTime *ftm,RarTime *ftc=NULL,RarTime *fta=NULL); + void SetCloseFileTime(RarTime *ftm,RarTime *fta=NULL); + static void SetCloseFileTimeByName(const char *Name,RarTime *ftm,RarTime *fta); + void GetOpenFileTime(RarTime *ft); + bool IsOpened() {return(hFile!=BAD_HANDLE);}; + int64 FileLength(); + void SetHandleType(FILE_HANDLETYPE Type); + FILE_HANDLETYPE GetHandleType() {return(HandleType);}; + bool IsDevice(); + void fprintf(const char *fmt,...); + static bool RemoveCreated(); + FileHandle GetHandle() {return(hFile);}; + void SetIgnoreReadErrors(bool Mode) {IgnoreReadErrors=Mode;}; + char *GetName() {return(FileName);} + int64 Copy(File &Dest,int64 Length=INT64NDF); + void SetAllowDelete(bool Allow) {AllowDelete=Allow;} + void SetExceptions(bool Allow) {AllowExceptions=Allow;} +#ifdef _WIN_32 + void RemoveSequentialFlag() {NoSequentialRead=true;} +#endif +}; + +#endif diff --git a/libunrar/filefn.cpp b/libunrar/filefn.cpp new file mode 100644 index 0000000..215f797 --- /dev/null +++ b/libunrar/filefn.cpp @@ -0,0 +1,585 @@ +#include "rar.hpp" + +MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr) +{ +#ifdef _WIN_32 + int Success; + if (WinNT() && NameW!=NULL && *NameW!=0) + Success=CreateDirectoryW(NameW,NULL); + else + Success=CreateDirectory(Name,NULL); + if (Success) + { + if (SetAttr) + SetFileAttr(Name,NameW,Attr); + return(MKDIR_SUCCESS); + } + int ErrCode=GetLastError(); + if (ErrCode==ERROR_FILE_NOT_FOUND || ErrCode==ERROR_PATH_NOT_FOUND) + return(MKDIR_BADPATH); + return(MKDIR_ERROR); +#endif +#ifdef _EMX +#ifdef _DJGPP + if (mkdir(Name,(Attr & FA_RDONLY) ? 0:S_IWUSR)==0) +#else + if (__mkdir(Name)==0) +#endif + { + if (SetAttr) + SetFileAttr(Name,NameW,Attr); + return(MKDIR_SUCCESS); + } + return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR); +#endif +#ifdef _UNIX + mode_t uattr=SetAttr ? (mode_t)Attr:0777; + int ErrCode=Name==NULL ? -1:mkdir(Name,uattr); + if (ErrCode==-1) + return(errno==ENOENT ? MKDIR_BADPATH:MKDIR_ERROR); + return(MKDIR_SUCCESS); +#endif +} + + +bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName) +{ +#if defined(_WIN_32) || defined(_EMX) + uint DirAttr=0; +#else + uint DirAttr=0777; +#endif +#ifdef UNICODE_SUPPORTED + bool Wide=PathW!=NULL && *PathW!=0 && UnicodeEnabled(); +#else + bool Wide=false; +#endif + bool IgnoreAscii=false; + bool Success=true; + + const char *s=Path; + for (int PosW=0;;PosW++) + { + if (s==NULL || s-Path>=NM || *s==0) + IgnoreAscii=true; + if (Wide && (PosW>=NM || PathW[PosW]==0) || !Wide && IgnoreAscii) + break; + if (Wide && PathW[PosW]==CPATHDIVIDER || !Wide && *s==CPATHDIVIDER) + { + wchar *DirPtrW=NULL,DirNameW[NM]; + if (Wide) + { + strncpyw(DirNameW,PathW,PosW); + DirNameW[PosW]=0; + DirPtrW=DirNameW; + } + char DirName[NM]; + if (IgnoreAscii) + WideToChar(DirPtrW,DirName); + else + { +#ifndef DBCS_SUPPORTED + if (*s!=CPATHDIVIDER) + for (const char *n=s;*n!=0 && n-PathIsSet(); + bool sc=ftc!=NULL && ftc->IsSet(); + bool sa=fta!=NULL && fta->IsSet(); + + unsigned int DirAttr=GetFileAttr(Name,NameW); + bool ResetAttr=(DirAttr!=0xffffffff && (DirAttr & FA_RDONLY)!=0); + if (ResetAttr) + SetFileAttr(Name,NameW,0); + + wchar DirNameW[NM]; + GetWideName(Name,NameW,DirNameW); + HANDLE hFile=CreateFileW(DirNameW,GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE, + NULL,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,NULL); + if (hFile==INVALID_HANDLE_VALUE) + return; + FILETIME fm,fc,fa; + if (sm) + ftm->GetWin32(&fm); + if (sc) + ftc->GetWin32(&fc); + if (sa) + fta->GetWin32(&fa); + SetFileTime(hFile,sc ? &fc:NULL,sa ? &fa:NULL,sm ? &fm:NULL); + CloseHandle(hFile); + if (ResetAttr) + SetFileAttr(Name,NameW,DirAttr); +#endif +#if defined(_UNIX) || defined(_EMX) + File::SetCloseFileTimeByName(Name,ftm,fta); +#endif +} + + +bool IsRemovable(const char *Name) +{ +#ifdef _WIN_32 + char Root[NM]; + GetPathRoot(Name,Root); + int Type=GetDriveType(*Root ? Root:NULL); + return(Type==DRIVE_REMOVABLE || Type==DRIVE_CDROM); +#elif defined(_EMX) + char Drive=etoupper(Name[0]); + return((Drive=='A' || Drive=='B') && Name[1]==':'); +#else + return(false); +#endif +} + + +#ifndef SFX_MODULE +int64 GetFreeDisk(const char *Name) +{ +#ifdef _WIN_32 + char Root[NM]; + GetPathRoot(Name,Root); + + typedef BOOL (WINAPI *GETDISKFREESPACEEX)( + LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER + ); + static GETDISKFREESPACEEX pGetDiskFreeSpaceEx=NULL; + + if (pGetDiskFreeSpaceEx==NULL) + { + HMODULE hKernel=GetModuleHandle("kernel32.dll"); + if (hKernel!=NULL) + pGetDiskFreeSpaceEx=(GETDISKFREESPACEEX)GetProcAddress(hKernel,"GetDiskFreeSpaceExA"); + } + if (pGetDiskFreeSpaceEx!=NULL) + { + GetFilePath(Name,Root,ASIZE(Root)); + ULARGE_INTEGER uiTotalSize,uiTotalFree,uiUserFree; + uiUserFree.u.LowPart=uiUserFree.u.HighPart=0; + if (pGetDiskFreeSpaceEx(*Root ? Root:NULL,&uiUserFree,&uiTotalSize,&uiTotalFree) && + uiUserFree.u.HighPart<=uiTotalFree.u.HighPart) + return(INT32TO64(uiUserFree.u.HighPart,uiUserFree.u.LowPart)); + } + + // We are here if we failed to load GetDiskFreeSpaceExA. + DWORD SectorsPerCluster,BytesPerSector,FreeClusters,TotalClusters; + if (!GetDiskFreeSpace(*Root ? Root:NULL,&SectorsPerCluster,&BytesPerSector,&FreeClusters,&TotalClusters)) + return(1457664); + int64 FreeSize=SectorsPerCluster*BytesPerSector; + FreeSize=FreeSize*FreeClusters; + return(FreeSize); +#elif defined(_BEOS) + char Root[NM]; + GetFilePath(Name,Root,ASIZE(Root)); + dev_t Dev=dev_for_path(*Root ? Root:"."); + if (Dev<0) + return(1457664); + fs_info Info; + if (fs_stat_dev(Dev,&Info)!=0) + return(1457664); + int64 FreeSize=Info.block_size; + FreeSize=FreeSize*Info.free_blocks; + return(FreeSize); +#elif defined(_UNIX) + return(1457664); +#elif defined(_EMX) + int Drive=IsDiskLetter(Name) ? etoupper(Name[0])-'A'+1:0; +#ifndef _DJGPP + if (_osmode == OS2_MODE) + { + FSALLOCATE fsa; + if (DosQueryFSInfo(Drive,1,&fsa,sizeof(fsa))!=0) + return(1457664); + int64 FreeSize=fsa.cSectorUnit*fsa.cbSector; + FreeSize=FreeSize*fsa.cUnitAvail; + return(FreeSize); + } + else +#endif + { + union REGS regs,outregs; + memset(®s,0,sizeof(regs)); + regs.h.ah=0x36; + regs.h.dl=Drive; +#ifdef _DJGPP + int86 (0x21,®s,&outregs); +#else + _int86 (0x21,®s,&outregs); +#endif + if (outregs.x.ax==0xffff) + return(1457664); + int64 FreeSize=outregs.x.ax*outregs.x.cx; + FreeSize=FreeSize*outregs.x.bx; + return(FreeSize); + } +#else + #define DISABLEAUTODETECT + return(1457664); +#endif +} +#endif + + +bool FileExist(const char *Name,const wchar *NameW) +{ +#ifdef _WIN_32 + if (WinNT() && NameW!=NULL && *NameW!=0) + return(GetFileAttributesW(NameW)!=0xffffffff); + else + return(GetFileAttributes(Name)!=0xffffffff); +#elif defined(ENABLE_ACCESS) + return(access(Name,0)==0); +#else + struct FindData FD; + return(FindFile::FastFind(Name,NameW,&FD)); +#endif +} + + +bool WildFileExist(const char *Name,const wchar *NameW) +{ + if (IsWildcard(Name,NameW)) + { + FindFile Find; + Find.SetMask(Name); + Find.SetMaskW(NameW); + struct FindData fd; + return(Find.Next(&fd)); + } + return(FileExist(Name,NameW)); +} + + +bool IsDir(uint Attr) +{ +#if defined (_WIN_32) || defined(_EMX) + return(Attr!=0xffffffff && (Attr & 0x10)!=0); +#endif +#if defined(_UNIX) + return((Attr & 0xF000)==0x4000); +#endif +} + + +bool IsUnreadable(uint Attr) +{ +#if defined(_UNIX) && defined(S_ISFIFO) && defined(S_ISSOCK) && defined(S_ISCHR) + return(S_ISFIFO(Attr) || S_ISSOCK(Attr) || S_ISCHR(Attr)); +#endif + return(false); +} + + +bool IsLabel(uint Attr) +{ +#if defined (_WIN_32) || defined(_EMX) + return((Attr & 8)!=0); +#else + return(false); +#endif +} + + +bool IsLink(uint Attr) +{ +#ifdef _UNIX + return((Attr & 0xF000)==0xA000); +#else + return(false); +#endif +} + + + + + + +bool IsDeleteAllowed(uint FileAttr) +{ +#if defined(_WIN_32) || defined(_EMX) + return((FileAttr & (FA_RDONLY|FA_SYSTEM|FA_HIDDEN))==0); +#else + return((FileAttr & (S_IRUSR|S_IWUSR))==(S_IRUSR|S_IWUSR)); +#endif +} + + +void PrepareToDelete(const char *Name,const wchar *NameW) +{ +#if defined(_WIN_32) || defined(_EMX) + SetFileAttr(Name,NameW,0); +#endif +#ifdef _UNIX + chmod(Name,S_IRUSR|S_IWUSR|S_IXUSR); +#endif +} + + +uint GetFileAttr(const char *Name,const wchar *NameW) +{ +#ifdef _WIN_32 + if (WinNT() && NameW!=NULL && *NameW!=0) + return(GetFileAttributesW(NameW)); + else + return(GetFileAttributes(Name)); +#elif defined(_DJGPP) + return(_chmod(Name,0)); +#else + struct stat st; + if (stat(Name,&st)!=0) + return(0); +#ifdef _EMX + return(st.st_attr); +#else + return(st.st_mode); +#endif +#endif +} + + +bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr) +{ + bool Success; +#ifdef _WIN_32 + if (WinNT() && NameW!=NULL && *NameW!=0) + Success=SetFileAttributesW(NameW,Attr)!=0; + else + Success=SetFileAttributes(Name,Attr)!=0; +#elif defined(_DJGPP) + Success=_chmod(Name,1,Attr)!=-1; +#elif defined(_EMX) + Success=__chmod(Name,1,Attr)!=-1; +#elif defined(_UNIX) + Success=chmod(Name,(mode_t)Attr)==0; +#else + Success=false; +#endif + return(Success); +} + + +void ConvertNameToFull(const char *Src,char *Dest) +{ +#ifdef _WIN_32 +#ifndef _WIN_CE + char FullName[NM],*NamePtr; + if (GetFullPathName(Src,sizeof(FullName),FullName,&NamePtr)) + strcpy(Dest,FullName); + else +#endif + if (Src!=Dest) + strcpy(Dest,Src); +#else + char FullName[NM]; + if (IsPathDiv(*Src) || IsDiskLetter(Src)) + strcpy(FullName,Src); + else + { + if (getcwd(FullName,sizeof(FullName))==NULL) + *FullName=0; + else + AddEndSlash(FullName); + strcat(FullName,Src); + } + strcpy(Dest,FullName); +#endif +} + + +#ifndef SFX_MODULE +void ConvertNameToFull(const wchar *Src,wchar *Dest) +{ + if (Src==NULL || *Src==0) + { + *Dest=0; + return; + } +#ifdef _WIN_32 +#ifndef _WIN_CE + if (WinNT()) +#endif + { +#ifndef _WIN_CE + wchar FullName[NM],*NamePtr; + if (GetFullPathNameW(Src,sizeof(FullName)/sizeof(FullName[0]),FullName,&NamePtr)) + strcpyw(Dest,FullName); + else +#endif + if (Src!=Dest) + strcpyw(Dest,Src); + } +#ifndef _WIN_CE + else + { + char AnsiName[NM]; + WideToChar(Src,AnsiName); + ConvertNameToFull(AnsiName,AnsiName); + CharToWide(AnsiName,Dest); + } +#endif +#else + char AnsiName[NM]; + WideToChar(Src,AnsiName); + ConvertNameToFull(AnsiName,AnsiName); + CharToWide(AnsiName,Dest); +#endif +} +#endif + + +#ifndef SFX_MODULE +char *MkTemp(char *Name) +{ + size_t Length=strlen(Name); + if (Length<=6) + return(NULL); + int Random=clock(); + for (int Attempt=0;;Attempt++) + { + sprintf(Name+Length-6,"%06u",Random+Attempt); + Name[Length-4]='.'; + if (!FileExist(Name)) + break; + if (Attempt==1000) + return(NULL); + } + return(Name); +} +#endif + + + + +#ifndef SFX_MODULE +uint CalcFileCRC(File *SrcFile,int64 Size,CALCCRC_SHOWMODE ShowMode) +{ + SaveFilePos SavePos(*SrcFile); + const size_t BufSize=0x10000; + Array Data(BufSize); + int64 BlockCount=0; + uint DataCRC=0xffffffff; + +#if !defined(SILENT) && !defined(_WIN_CE) + int64 FileLength=SrcFile->FileLength(); + if (ShowMode!=CALCCRC_SHOWNONE) + { + mprintf(St(MCalcCRC)); + mprintf(" "); + } + +#endif + + SrcFile->Seek(0,SEEK_SET); + while (true) + { + size_t SizeToRead; + if (Size==INT64NDF) // If we process the entire file. + SizeToRead=BufSize; // Then always attempt to read the entire buffer. + else + SizeToRead=(size_t)Min((int64)BufSize,Size); + int ReadSize=SrcFile->Read(&Data[0],SizeToRead); + if (ReadSize==0) + break; + + ++BlockCount; + if ((BlockCount & 15)==0) + { +#if !defined(SILENT) && !defined(_WIN_CE) + if (ShowMode==CALCCRC_SHOWALL) + mprintf("\b\b\b\b%3d%%",ToPercent(BlockCount*int64(BufSize),FileLength)); +#endif + Wait(); + } + DataCRC=CRC(DataCRC,&Data[0],ReadSize); + if (Size!=INT64NDF) + Size-=ReadSize; + } +#if !defined(SILENT) && !defined(_WIN_CE) + if (ShowMode==CALCCRC_SHOWALL) + mprintf("\b\b\b\b "); +#endif + return(DataCRC^0xffffffff); +} +#endif + + +bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW) +{ + return(rename(SrcName,DestName)==0); +} + + +bool DelFile(const char *Name) +{ + return(DelFile(Name,NULL)); +} + + +bool DelFile(const char *Name,const wchar *NameW) +{ + return(remove(Name)==0); +} + + + + + + +#if defined(_WIN_32) && !defined(_WIN_CE) && !defined(SFX_MODULE) +bool SetFileCompression(char *Name,wchar *NameW,bool State) +{ + wchar FileNameW[NM]; + GetWideName(Name,NameW,FileNameW); + HANDLE hFile=CreateFileW(FileNameW,FILE_READ_DATA|FILE_WRITE_DATA, + FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS|FILE_FLAG_SEQUENTIAL_SCAN,NULL); + if (hFile==INVALID_HANDLE_VALUE) + return(false); + SHORT NewState=State ? COMPRESSION_FORMAT_DEFAULT:COMPRESSION_FORMAT_NONE; + DWORD Result; + int RetCode=DeviceIoControl(hFile,FSCTL_SET_COMPRESSION,&NewState, + sizeof(NewState),NULL,0,&Result,NULL); + CloseHandle(hFile); + return(RetCode!=0); +} +#endif + + + + + + + + diff --git a/libunrar/filefn.hpp b/libunrar/filefn.hpp new file mode 100644 index 0000000..77df847 --- /dev/null +++ b/libunrar/filefn.hpp @@ -0,0 +1,44 @@ +#ifndef _RAR_FILEFN_ +#define _RAR_FILEFN_ + +enum MKDIR_CODE {MKDIR_SUCCESS,MKDIR_ERROR,MKDIR_BADPATH}; + +MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,bool SetAttr,uint Attr); +bool CreatePath(const char *Path,const wchar *PathW,bool SkipLastName); +void SetDirTime(const char *Name,const wchar *NameW,RarTime *ftm,RarTime *ftc,RarTime *fta); +bool IsRemovable(const char *Name); +int64 GetFreeDisk(const char *Name); +bool FileExist(const char *Name,const wchar *NameW=NULL); +bool WildFileExist(const char *Name,const wchar *NameW=NULL); +bool IsDir(uint Attr); +bool IsUnreadable(uint Attr); +bool IsLabel(uint Attr); +bool IsLink(uint Attr); +void SetSFXMode(const char *FileName); +void EraseDiskContents(const char *FileName); +bool IsDeleteAllowed(uint FileAttr); +void PrepareToDelete(const char *Name,const wchar *NameW=NULL); +uint GetFileAttr(const char *Name,const wchar *NameW=NULL); +bool SetFileAttr(const char *Name,const wchar *NameW,uint Attr); +void ConvertNameToFull(const char *Src,char *Dest); +void ConvertNameToFull(const wchar *Src,wchar *Dest); +char* MkTemp(char *Name); + + +enum CALCCRC_SHOWMODE {CALCCRC_SHOWNONE,CALCCRC_SHOWTEXT,CALCCRC_SHOWALL}; +uint CalcFileCRC(File *SrcFile,int64 Size=INT64NDF,CALCCRC_SHOWMODE ShowMode=CALCCRC_SHOWNONE); + +bool RenameFile(const char *SrcName,const wchar *SrcNameW,const char *DestName,const wchar *DestNameW); +bool DelFile(const char *Name); +bool DelFile(const char *Name,const wchar *NameW); +bool DelDir(const char *Name); +bool DelDir(const char *Name,const wchar *NameW); + +#if defined(_WIN_32) && !defined(_WIN_CE) +bool SetFileCompression(char *Name,wchar *NameW,bool State); +#endif + + + + +#endif diff --git a/libunrar/filestr.cpp b/libunrar/filestr.cpp new file mode 100644 index 0000000..c5fba51 --- /dev/null +++ b/libunrar/filestr.cpp @@ -0,0 +1,189 @@ +#include "rar.hpp" + +static bool IsUnicode(byte *Data,int Size); + +bool ReadTextFile(const char *Name,StringList *List,bool Config, + bool AbortOnError,RAR_CHARSET SrcCharset,bool Unquote, + bool SkipComments,bool ExpandEnvStr) +{ + char FileName[NM]; + if (Config) + GetConfigName(Name,FileName,true); + else + strcpy(FileName,Name); + + File SrcFile; + if (*FileName) + { + bool OpenCode=AbortOnError ? SrcFile.WOpen(FileName):SrcFile.Open(FileName); + + if (!OpenCode) + { + if (AbortOnError) + ErrHandler.Exit(OPEN_ERROR); + return(false); + } + } + else + SrcFile.SetHandleType(FILE_HANDLESTD); + + unsigned int DataSize=0,ReadSize; + const int ReadBlock=1024; + Array Data(ReadBlock+5); + while ((ReadSize=SrcFile.Read(&Data[DataSize],ReadBlock))!=0) + { + DataSize+=ReadSize; + Data.Add(ReadSize); + } + + memset(&Data[DataSize],0,5); + + if (SrcCharset==RCH_UNICODE || + SrcCharset==RCH_DEFAULT && IsUnicode((byte *)&Data[0],DataSize)) + { + // Unicode in native system format, can be more than 2 bytes per character. + Array DataW(Data.Size()/2+1); + for (size_t I=2;I AnsiName; + + while (*CurStr!=0) + { + wchar *NextStr=CurStr,*CmtPtr=NULL; + while (*NextStr!='\r' && *NextStr!='\n' && *NextStr!=0) + { + if (SkipComments && NextStr[0]=='/' && NextStr[1]=='/') + { + *NextStr=0; + CmtPtr=NextStr; + } + NextStr++; + } + *NextStr=0; + for (wchar *SpacePtr=(CmtPtr ? CmtPtr:NextStr)-1;SpacePtr>=CurStr;SpacePtr--) + { + if (*SpacePtr!=' ' && *SpacePtr!='\t') + break; + *SpacePtr=0; + } + if (*CurStr) + { + // Length and AddSize must be defined as signed, because AddSize + // can be negative. + int Length=(int)strlenw(CurStr); + int AddSize=4*(Length-(int)AnsiName.Size()+1); + + if (AddSize>0) + AnsiName.Add(AddSize); + if (Unquote && *CurStr=='\"' && CurStr[Length-1]=='\"') + { + CurStr[Length-1]=0; + CurStr++; + } + WideToChar(CurStr,&AnsiName[0],AnsiName.Size()); + + bool Expanded=false; +#if defined(_WIN_32) && !defined(_WIN_CE) + if (ExpandEnvStr && *CurStr=='%') + { + // expanding environment variables in Windows version + + char ExpName[NM]; + wchar ExpNameW[NM]; + *ExpNameW=0; + int ret,retw=1; + ret=ExpandEnvironmentStrings(&AnsiName[0],ExpName,ASIZE(ExpName)); + if (ret!=0 && WinNT()) + retw=ExpandEnvironmentStringsW(CurStr,ExpNameW,ASIZE(ExpNameW)); + Expanded=ret!=0 && retAddString(ExpName,ExpNameW); + } +#endif + if (!Expanded) + List->AddString(&AnsiName[0],CurStr); + } + CurStr=NextStr+1; + while (*CurStr=='\r' || *CurStr=='\n') + CurStr++; + } + } + else + { + char *CurStr=&Data[0]; + while (*CurStr!=0) + { + char *NextStr=CurStr,*CmtPtr=NULL; + while (*NextStr!='\r' && *NextStr!='\n' && *NextStr!=0) + { + if (SkipComments && NextStr[0]=='/' && NextStr[1]=='/') + { + *NextStr=0; + CmtPtr=NextStr; + } + NextStr++; + } + *NextStr=0; + for (char *SpacePtr=(CmtPtr ? CmtPtr:NextStr)-1;SpacePtr>=CurStr;SpacePtr--) + { + if (*SpacePtr!=' ' && *SpacePtr!='\t') + break; + *SpacePtr=0; + } + if (*CurStr) + { + if (Unquote && *CurStr=='\"') + { + size_t Length=strlen(CurStr); + if (CurStr[Length-1]=='\"') + { + CurStr[Length-1]=0; + CurStr++; + } + } +#if defined(_WIN_32) + if (SrcCharset==RCH_OEM) + OemToChar(CurStr,CurStr); +#endif + + bool Expanded=false; +#if defined(_WIN_32) && !defined(_WIN_CE) + if (ExpandEnvStr && *CurStr=='%') + { + // expanding environment variables in Windows version + + char ExpName[NM]; + int ret=ExpandEnvironmentStrings(CurStr,ExpName,ASIZE(ExpName)); + Expanded=ret!=0 && retAddString(ExpName); + } +#endif + if (!Expanded) + List->AddString(CurStr); + } + CurStr=NextStr+1; + while (*CurStr=='\r' || *CurStr=='\n') + CurStr++; + } + } + return(true); +} + + +bool IsUnicode(byte *Data,int Size) +{ + if (Size<4 || Data[0]!=0xff || Data[1]!=0xfe) + return(false); + for (int I=2;IError=false; + if (*FindMask==0) + return(false); +#ifdef _WIN_32 + if (FirstCall) + { + if ((hFind=Win32Find(INVALID_HANDLE_VALUE,FindMask,FindMaskW,fd))==INVALID_HANDLE_VALUE) + return(false); + } + else + if (Win32Find(hFind,FindMask,FindMaskW,fd)==INVALID_HANDLE_VALUE) + return(false); +#else + if (FirstCall) + { + char DirName[NM]; + strcpy(DirName,FindMask); + RemoveNameFromPath(DirName); + if (*DirName==0) + strcpy(DirName,"."); +/* + else + { + int Length=strlen(DirName); + if (Length>1 && DirName[Length-1]==CPATHDIVIDER && (Length!=3 || !IsDriveDiv(DirName[1]))) + DirName[Length-1]=0; + } +*/ + if ((dirp=opendir(DirName))==NULL) + { + fd->Error=(errno!=ENOENT); + return(false); + } + } + while (1) + { + struct dirent *ent=readdir(dirp); + if (ent==NULL) + return(false); + if (strcmp(ent->d_name,".")==0 || strcmp(ent->d_name,"..")==0) + continue; + if (CmpName(FindMask,ent->d_name,MATCH_NAMES)) + { + char FullName[NM]; + strcpy(FullName,FindMask); + *PointToName(FullName)=0; + if (strlen(FullName)+strlen(ent->d_name)>=ASIZE(FullName)-1) + { +#ifndef SILENT + Log(NULL,"\n%s%s",FullName,ent->d_name); + Log(NULL,St(MPathTooLong)); +#endif + return(false); + } + strcat(FullName,ent->d_name); + if (!FastFind(FullName,NULL,fd,GetSymLink)) + { + ErrHandler.OpenErrorMsg(FullName); + continue; + } + strcpy(fd->Name,FullName); + break; + } + } + *fd->NameW=0; +#ifdef _APPLE + if (!LowAscii(fd->Name)) + UtfToWide(fd->Name,fd->NameW,sizeof(fd->NameW)); +#elif defined(UNICODE_SUPPORTED) + if (!LowAscii(fd->Name) && UnicodeEnabled()) + CharToWide(fd->Name,fd->NameW); +#endif +#endif + fd->Flags=0; + fd->IsDir=IsDir(fd->FileAttr); + FirstCall=false; + char *Name=PointToName(fd->Name); + if (strcmp(Name,".")==0 || strcmp(Name,"..")==0) + return(Next(fd)); + return(true); +} + + +bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,struct FindData *fd,bool GetSymLink) +{ + fd->Error=false; +#ifndef _UNIX + if (IsWildcard(FindMask,FindMaskW)) + return(false); +#endif +#ifdef _WIN_32 + HANDLE hFind=Win32Find(INVALID_HANDLE_VALUE,FindMask,FindMaskW,fd); + if (hFind==INVALID_HANDLE_VALUE) + return(false); + FindClose(hFind); +#else + struct stat st; + if (GetSymLink) + { +#ifdef SAVE_LINKS + if (lstat(FindMask,&st)!=0) +#else + if (stat(FindMask,&st)!=0) +#endif + { + fd->Error=(errno!=ENOENT); + return(false); + } + } + else + if (stat(FindMask,&st)!=0) + { + fd->Error=(errno!=ENOENT); + return(false); + } +#ifdef _DJGPP + fd->FileAttr=_chmod(FindMask,0); +#elif defined(_EMX) + fd->FileAttr=st.st_attr; +#else + fd->FileAttr=st.st_mode; +#endif + fd->IsDir=IsDir(st.st_mode); + fd->Size=st.st_size; + fd->mtime=st.st_mtime; + fd->atime=st.st_atime; + fd->ctime=st.st_ctime; + fd->FileTime=fd->mtime.GetDos(); + strcpy(fd->Name,FindMask); + + *fd->NameW=0; +#ifdef _APPLE + if (!LowAscii(fd->Name)) + UtfToWide(fd->Name,fd->NameW,sizeof(fd->NameW)); +#elif defined(UNICODE_SUPPORTED) + if (!LowAscii(fd->Name) && UnicodeEnabled()) + CharToWide(fd->Name,fd->NameW); +#endif +#endif + fd->Flags=0; + fd->IsDir=IsDir(fd->FileAttr); + return(true); +} + + +#ifdef _WIN_32 +HANDLE FindFile::Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd) +{ +#ifndef _WIN_CE + if (WinNT()) +#endif + { + wchar WideMask[NM]; + if (MaskW!=NULL && *MaskW!=0) + strcpyw(WideMask,MaskW); + else + CharToWide(Mask,WideMask); + + WIN32_FIND_DATAW FindData; + if (hFind==INVALID_HANDLE_VALUE) + { + hFind=FindFirstFileW(WideMask,&FindData); + if (hFind==INVALID_HANDLE_VALUE) + { + int SysErr=GetLastError(); + fd->Error=(SysErr!=ERROR_FILE_NOT_FOUND && + SysErr!=ERROR_PATH_NOT_FOUND && + SysErr!=ERROR_NO_MORE_FILES); + } + } + else + if (!FindNextFileW(hFind,&FindData)) + { + hFind=INVALID_HANDLE_VALUE; + fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; + } + + if (hFind!=INVALID_HANDLE_VALUE) + { + strcpyw(fd->NameW,WideMask); + strcpyw(PointToName(fd->NameW),FindData.cFileName); + WideToChar(fd->NameW,fd->Name); + fd->Size=INT32TO64(FindData.nFileSizeHigh,FindData.nFileSizeLow); + fd->FileAttr=FindData.dwFileAttributes; + WideToChar(FindData.cAlternateFileName,fd->ShortName); + fd->ftCreationTime=FindData.ftCreationTime; + fd->ftLastAccessTime=FindData.ftLastAccessTime; + fd->ftLastWriteTime=FindData.ftLastWriteTime; + fd->mtime=FindData.ftLastWriteTime; + fd->ctime=FindData.ftCreationTime; + fd->atime=FindData.ftLastAccessTime; + fd->FileTime=fd->mtime.GetDos(); + +#ifndef _WIN_CE + if (LowAscii(fd->NameW)) + *fd->NameW=0; +#endif + } + } +#ifndef _WIN_CE + else + { + char CharMask[NM]; + if (Mask!=NULL && *Mask!=0) + strcpy(CharMask,Mask); + else + WideToChar(MaskW,CharMask); + + WIN32_FIND_DATA FindData; + if (hFind==INVALID_HANDLE_VALUE) + { + hFind=FindFirstFile(CharMask,&FindData); + if (hFind==INVALID_HANDLE_VALUE) + { + int SysErr=GetLastError(); + fd->Error=SysErr!=ERROR_FILE_NOT_FOUND && SysErr!=ERROR_PATH_NOT_FOUND; + } + } + else + if (!FindNextFile(hFind,&FindData)) + { + hFind=INVALID_HANDLE_VALUE; + fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; + } + + if (hFind!=INVALID_HANDLE_VALUE) + { + strcpy(fd->Name,CharMask); + strcpy(PointToName(fd->Name),FindData.cFileName); + CharToWide(fd->Name,fd->NameW); + fd->Size=INT32TO64(FindData.nFileSizeHigh,FindData.nFileSizeLow); + fd->FileAttr=FindData.dwFileAttributes; + strcpy(fd->ShortName,FindData.cAlternateFileName); + fd->ftCreationTime=FindData.ftCreationTime; + fd->ftLastAccessTime=FindData.ftLastAccessTime; + fd->ftLastWriteTime=FindData.ftLastWriteTime; + fd->mtime=FindData.ftLastWriteTime; + fd->ctime=FindData.ftCreationTime; + fd->atime=FindData.ftLastAccessTime; + fd->FileTime=fd->mtime.GetDos(); + if (LowAscii(fd->Name)) + *fd->NameW=0; + } + } +#endif + fd->Flags=0; + return(hFind); +} +#endif + diff --git a/libunrar/find.hpp b/libunrar/find.hpp new file mode 100644 index 0000000..99e804a --- /dev/null +++ b/libunrar/find.hpp @@ -0,0 +1,53 @@ +#ifndef _RAR_FINDDATA_ +#define _RAR_FINDDATA_ + +enum FINDDATA_FLAGS { + FDDF_SECONDDIR=1 // Second encounter of same directory in SCAN_GETDIRSTWICE ScanTree mode +}; + +struct FindData +{ + char Name[NM]; + wchar NameW[NM]; + int64 Size; + uint FileAttr; + uint FileTime; + bool IsDir; + RarTime mtime; + RarTime ctime; + RarTime atime; +#ifdef _WIN_32 + char ShortName[NM]; + FILETIME ftCreationTime; + FILETIME ftLastAccessTime; + FILETIME ftLastWriteTime; +#endif + uint Flags; + bool Error; +}; + +class FindFile +{ + private: +#ifdef _WIN_32 + static HANDLE Win32Find(HANDLE hFind,const char *Mask,const wchar *MaskW,struct FindData *fd); +#endif + + char FindMask[NM]; + wchar FindMaskW[NM]; + bool FirstCall; +#ifdef _WIN_32 + HANDLE hFind; +#else + DIR *dirp; +#endif + public: + FindFile(); + ~FindFile(); + void SetMask(const char *FindMask); + void SetMaskW(const wchar *FindMaskW); + bool Next(struct FindData *fd,bool GetSymLink=false); + static bool FastFind(const char *FindMask,const wchar *FindMaskW,struct FindData *fd,bool GetSymLink=false); +}; + +#endif diff --git a/libunrar/getbits.cpp b/libunrar/getbits.cpp new file mode 100644 index 0000000..e5d590a --- /dev/null +++ b/libunrar/getbits.cpp @@ -0,0 +1,30 @@ +#include "rar.hpp" + +BitInput::BitInput() +{ + // getbits attempts to read data from InAddr, InAddr+1, InAddr+2 positions. + // So let's allocate two additional bytes for situation, when we need to + // read only 1 byte from the last position of buffer and avoid a crash + // from access to next 2 bytes, which contents we do not need. + InBuf=new byte[MAX_SIZE+2]; +} + + +BitInput::~BitInput() +{ + delete[] InBuf; +} + + +void BitInput::faddbits(uint Bits) +{ + // Function wrapped version of inline addbits to save code size. + addbits(Bits); +} + + +uint BitInput::fgetbits() +{ + // Function wrapped version of inline getbits to save code size. + return(getbits()); +} diff --git a/libunrar/getbits.hpp b/libunrar/getbits.hpp new file mode 100644 index 0000000..d44fb9f --- /dev/null +++ b/libunrar/getbits.hpp @@ -0,0 +1,51 @@ +#ifndef _RAR_GETBITS_ +#define _RAR_GETBITS_ + +class BitInput +{ + public: + enum BufferSize {MAX_SIZE=0x8000}; // Size of input buffer. + protected: + int InAddr; // Curent byte position in the buffer. + int InBit; // Current bit position in the current byte. + public: + BitInput(); + ~BitInput(); + + byte *InBuf; // Dynamically allocated input buffer. + + void InitBitInput() + { + InAddr=InBit=0; + } + + // Move forward by 'Bits' bits. + void addbits(uint Bits) + { + Bits+=InBit; + InAddr+=Bits>>3; + InBit=Bits&7; + } + + // Return 16 bits from current position in the buffer. + // Bit at (InAddr,InBit) has the highest position in returning data. + uint getbits() + { + uint BitField=(uint)InBuf[InAddr] << 16; + BitField|=(uint)InBuf[InAddr+1] << 8; + BitField|=(uint)InBuf[InAddr+2]; + BitField >>= (8-InBit); + return(BitField & 0xffff); + } + + void faddbits(uint Bits); + uint fgetbits(); + + // Check if buffer has enough space for IncPtr bytes. Returns 'true' + // if buffer will be overflown. + bool Overflow(uint IncPtr) + { + return(InAddr+IncPtr>=MAX_SIZE); + } +}; +#endif diff --git a/libunrar/global.cpp b/libunrar/global.cpp new file mode 100644 index 0000000..593a057 --- /dev/null +++ b/libunrar/global.cpp @@ -0,0 +1,4 @@ +#define INCLUDEGLOBAL + + +#include "rar.hpp" diff --git a/libunrar/global.hpp b/libunrar/global.hpp new file mode 100644 index 0000000..35c6cf9 --- /dev/null +++ b/libunrar/global.hpp @@ -0,0 +1,14 @@ +#ifndef _RAR_GLOBAL_ +#define _RAR_GLOBAL_ + +#ifdef INCLUDEGLOBAL + #define EXTVAR +#else + #define EXTVAR extern +#endif + +EXTVAR ErrorHandler ErrHandler; + + + +#endif diff --git a/libunrar/headers.hpp b/libunrar/headers.hpp new file mode 100644 index 0000000..9e632f4 --- /dev/null +++ b/libunrar/headers.hpp @@ -0,0 +1,308 @@ +#ifndef _RAR_HEADERS_ +#define _RAR_HEADERS_ + +#define SIZEOF_MARKHEAD 7 +#define SIZEOF_OLDMHD 7 +#define SIZEOF_NEWMHD 13 +#define SIZEOF_OLDLHD 21 +#define SIZEOF_NEWLHD 32 +#define SIZEOF_SHORTBLOCKHEAD 7 +#define SIZEOF_LONGBLOCKHEAD 11 +#define SIZEOF_SUBBLOCKHEAD 14 +#define SIZEOF_COMMHEAD 13 +#define SIZEOF_PROTECTHEAD 26 +#define SIZEOF_AVHEAD 14 +#define SIZEOF_SIGNHEAD 15 +#define SIZEOF_UOHEAD 18 +#define SIZEOF_MACHEAD 22 +#define SIZEOF_EAHEAD 24 +#define SIZEOF_BEEAHEAD 24 +#define SIZEOF_STREAMHEAD 26 + +#define PACK_VER 29 +#define PACK_CRYPT_VER 29 +#define UNP_VER 36 +#define CRYPT_VER 29 +#define AV_VER 20 +#define PROTECT_VER 20 + +#define MHD_VOLUME 0x0001U +#define MHD_COMMENT 0x0002U +#define MHD_LOCK 0x0004U +#define MHD_SOLID 0x0008U +#define MHD_PACK_COMMENT 0x0010U +#define MHD_NEWNUMBERING 0x0010U +#define MHD_AV 0x0020U +#define MHD_PROTECT 0x0040U +#define MHD_PASSWORD 0x0080U +#define MHD_FIRSTVOLUME 0x0100U +#define MHD_ENCRYPTVER 0x0200U + +#define LHD_SPLIT_BEFORE 0x0001U +#define LHD_SPLIT_AFTER 0x0002U +#define LHD_PASSWORD 0x0004U +#define LHD_COMMENT 0x0008U +#define LHD_SOLID 0x0010U + +#define LHD_WINDOWMASK 0x00e0U +#define LHD_WINDOW64 0x0000U +#define LHD_WINDOW128 0x0020U +#define LHD_WINDOW256 0x0040U +#define LHD_WINDOW512 0x0060U +#define LHD_WINDOW1024 0x0080U +#define LHD_WINDOW2048 0x00a0U +#define LHD_WINDOW4096 0x00c0U +#define LHD_DIRECTORY 0x00e0U + +#define LHD_LARGE 0x0100U +#define LHD_UNICODE 0x0200U +#define LHD_SALT 0x0400U +#define LHD_VERSION 0x0800U +#define LHD_EXTTIME 0x1000U +#define LHD_EXTFLAGS 0x2000U + +#define SKIP_IF_UNKNOWN 0x4000U +#define LONG_BLOCK 0x8000U + +#define EARC_NEXT_VOLUME 0x0001U // not last volume +#define EARC_DATACRC 0x0002U // store CRC32 of RAR archive (now used only in volumes) +#define EARC_REVSPACE 0x0004U // reserve space for end of REV file 7 byte record +#define EARC_VOLNUMBER 0x0008U // store a number of current volume + +enum HEADER_TYPE { + MARK_HEAD=0x72,MAIN_HEAD=0x73,FILE_HEAD=0x74,COMM_HEAD=0x75,AV_HEAD=0x76, + SUB_HEAD=0x77,PROTECT_HEAD=0x78,SIGN_HEAD=0x79,NEWSUB_HEAD=0x7a, + ENDARC_HEAD=0x7b +}; + +enum { EA_HEAD=0x100,UO_HEAD=0x101,MAC_HEAD=0x102,BEEA_HEAD=0x103, + NTACL_HEAD=0x104,STREAM_HEAD=0x105 }; + +enum HOST_SYSTEM { + HOST_MSDOS=0,HOST_OS2=1,HOST_WIN32=2,HOST_UNIX=3,HOST_MACOS=4, + HOST_BEOS=5,HOST_MAX +}; + +#define SUBHEAD_TYPE_CMT "CMT" +#define SUBHEAD_TYPE_ACL "ACL" +#define SUBHEAD_TYPE_STREAM "STM" +#define SUBHEAD_TYPE_UOWNER "UOW" +#define SUBHEAD_TYPE_AV "AV" +#define SUBHEAD_TYPE_RR "RR" +#define SUBHEAD_TYPE_OS2EA "EA2" +#define SUBHEAD_TYPE_BEOSEA "EABE" + +/* new file inherits a subblock when updating a host file */ +#define SUBHEAD_FLAGS_INHERITED 0x80000000 + +#define SUBHEAD_FLAGS_CMT_UNICODE 0x00000001 + +struct OldMainHeader +{ + byte Mark[4]; + ushort HeadSize; + byte Flags; +}; + + +struct OldFileHeader +{ + uint PackSize; + uint UnpSize; + ushort FileCRC; + ushort HeadSize; + uint FileTime; + byte FileAttr; + byte Flags; + byte UnpVer; + byte NameSize; + byte Method; +}; + + +struct MarkHeader +{ + byte Mark[7]; +}; + + +struct BaseBlock +{ + ushort HeadCRC; + HEADER_TYPE HeadType;//byte + ushort Flags; + ushort HeadSize; + + bool IsSubBlock() + { + if (HeadType==SUB_HEAD) + return(true); + if (HeadType==NEWSUB_HEAD && (Flags & LHD_SOLID)!=0) + return(true); + return(false); + } +}; + +struct BlockHeader:BaseBlock +{ + union { + uint DataSize; + uint PackSize; + }; +}; + + +struct MainHeader:BaseBlock +{ + ushort HighPosAV; + uint PosAV; + byte EncryptVer; +}; + + +#define SALT_SIZE 8 + +struct FileHeader:BlockHeader +{ + uint UnpSize; + byte HostOS; + uint FileCRC; + uint FileTime; + byte UnpVer; + byte Method; + ushort NameSize; + union { + uint FileAttr; + uint SubFlags; + }; +/* optional */ + uint HighPackSize; + uint HighUnpSize; +/* names */ + char FileName[NM]; + wchar FileNameW[NM]; +/* optional */ + Array SubData; + byte Salt[SALT_SIZE]; + + RarTime mtime; + RarTime ctime; + RarTime atime; + RarTime arctime; +/* dummy */ + int64 FullPackSize; + int64 FullUnpSize; + + void Clear(size_t SubDataSize) + { + SubData.Alloc(SubDataSize); + Flags=LONG_BLOCK; + SubFlags=0; + } + + bool CmpName(const char *Name) + { + return(strcmp(FileName,Name)==0); + } + + FileHeader& operator = (FileHeader &hd) + { + SubData.Reset(); + memcpy(this,&hd,sizeof(*this)); + SubData.CleanData(); + SubData=hd.SubData; + return(*this); + } +}; + + +struct EndArcHeader:BaseBlock +{ + uint ArcDataCRC; // optional archive CRC32 + ushort VolNumber; // optional current volume number +}; + + +// SubBlockHeader and its successors were used in RAR 2.x format. +// RAR 3.x uses FileHeader with NEWSUB_HEAD HeadType for subblocks. +struct SubBlockHeader:BlockHeader +{ + ushort SubType; + byte Level; +}; + + +struct CommentHeader:BaseBlock +{ + ushort UnpSize; + byte UnpVer; + byte Method; + ushort CommCRC; +}; + + +struct ProtectHeader:BlockHeader +{ + byte Version; + ushort RecSectors; + uint TotalBlocks; + byte Mark[8]; +}; + + +struct AVHeader:BaseBlock +{ + byte UnpVer; + byte Method; + byte AVVer; + uint AVInfoCRC; +}; + + +struct SignHeader:BaseBlock +{ + uint CreationTime; + ushort ArcNameSize; + ushort UserNameSize; +}; + + +struct UnixOwnersHeader:SubBlockHeader +{ + ushort OwnerNameSize; + ushort GroupNameSize; +/* dummy */ + char OwnerName[NM]; + char GroupName[NM]; +}; + + +struct EAHeader:SubBlockHeader +{ + uint UnpSize; + byte UnpVer; + byte Method; + uint EACRC; +}; + + +struct StreamHeader:SubBlockHeader +{ + uint UnpSize; + byte UnpVer; + byte Method; + uint StreamCRC; + ushort StreamNameSize; +/* dummy */ + byte StreamName[NM]; +}; + + +struct MacFInfoHeader:SubBlockHeader +{ + uint fileType; + uint fileCreator; +}; + + +#endif diff --git a/libunrar/isnt.cpp b/libunrar/isnt.cpp new file mode 100644 index 0000000..493a9eb --- /dev/null +++ b/libunrar/isnt.cpp @@ -0,0 +1,17 @@ +#include "rar.hpp" + +#ifdef _WIN_32 +int WinNT() +{ + static int dwPlatformId=-1,dwMajorVersion; + if (dwPlatformId==-1) + { + OSVERSIONINFO WinVer; + WinVer.dwOSVersionInfoSize=sizeof(WinVer); + GetVersionEx(&WinVer); + dwPlatformId=WinVer.dwPlatformId; + dwMajorVersion=WinVer.dwMajorVersion; + } + return(dwPlatformId==VER_PLATFORM_WIN32_NT ? dwMajorVersion:0); +} +#endif diff --git a/libunrar/isnt.hpp b/libunrar/isnt.hpp new file mode 100644 index 0000000..0265236 --- /dev/null +++ b/libunrar/isnt.hpp @@ -0,0 +1,6 @@ +#ifndef _RAR_ISNT_ +#define _RAR_ISNT_ + +int WinNT(); + +#endif diff --git a/libunrar/license.txt b/libunrar/license.txt new file mode 100644 index 0000000..ec35e09 --- /dev/null +++ b/libunrar/license.txt @@ -0,0 +1,40 @@ + ****** ***** ****** UnRAR - free utility for RAR archives + ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ****** ******* ****** License for use and distribution of + ** ** ** ** ** ** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ** ** ** ** ** ** FREE portable version + ~~~~~~~~~~~~~~~~~~~~~ + + The source code of UnRAR utility is freeware. This means: + + 1. All copyrights to RAR and the utility UnRAR are exclusively + owned by the author - Alexander Roshal. + + 2. The UnRAR sources may be used in any software to handle RAR + archives without limitations free of charge, but cannot be used + to re-create the RAR compression algorithm, which is proprietary. + Distribution of modified UnRAR sources in separate form or as a + part of other software is permitted, provided that it is clearly + stated in the documentation and source comments that the code may + not be used to develop a RAR (WinRAR) compatible archiver. + + 3. The UnRAR utility may be freely distributed. It is allowed + to distribute UnRAR inside of other software packages. + + 4. THE RAR ARCHIVER AND THE UnRAR UTILITY ARE DISTRIBUTED "AS IS". + NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT + YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS, + DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING + OR MISUSING THIS SOFTWARE. + + 5. Installing and using the UnRAR utility signifies acceptance of + these terms and conditions of the license. + + 6. If you don't agree with terms of the license you must remove + UnRAR files from your storage devices and cease to use the + utility. + + Thank you for your interest in RAR and UnRAR. + + + Alexander L. Roshal \ No newline at end of file diff --git a/libunrar/list.cpp b/libunrar/list.cpp new file mode 100644 index 0000000..ba02674 --- /dev/null +++ b/libunrar/list.cpp @@ -0,0 +1,396 @@ +#include "rar.hpp" + +static void ListFileHeader(FileHeader &hd,bool Verbose,bool Technical,bool &TitleShown,bool Bare); +static void ListSymLink(Archive &Arc); +static void ListFileAttr(uint A,int HostOS); +static void ListOldSubHeader(Archive &Arc); +static void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical); + +void ListArchive(CommandData *Cmd) +{ + int64 SumPackSize=0,SumUnpSize=0; + uint ArcCount=0,SumFileCount=0; + bool Technical=(Cmd->Command[1]=='T'); + bool Bare=(Cmd->Command[1]=='B'); + bool Verbose=(*Cmd->Command=='V'); + + char ArcName[NM]; + wchar ArcNameW[NM]; + + while (Cmd->GetArcName(ArcName,ArcNameW,sizeof(ArcName))) + { + Archive Arc(Cmd); +#ifdef _WIN_32 + Arc.RemoveSequentialFlag(); +#endif + if (!Arc.WOpen(ArcName,ArcNameW)) + continue; + bool FileMatched=true; + while (1) + { + int64 TotalPackSize=0,TotalUnpSize=0; + uint FileCount=0; + if (Arc.IsArchive(true)) + { + if (!Arc.IsOpened()) + break; + bool TitleShown=false; + if (!Bare) + { + Arc.ViewComment(); + + // RAR can close a corrupt encrypted archive + if (!Arc.IsOpened()) + break; + + mprintf("\n"); + if (Arc.Solid) + mprintf(St(MListSolid)); + if (Arc.SFXSize>0) + mprintf(St(MListSFX)); + if (Arc.Volume) + if (Arc.Solid) + mprintf(St(MListVol1)); + else + mprintf(St(MListVol2)); + else + if (Arc.Solid) + mprintf(St(MListArc1)); + else + mprintf(St(MListArc2)); + mprintf(" %s\n",Arc.FileName); + if (Technical) + { + if (Arc.Protected) + mprintf(St(MListRecRec)); + if (Arc.Locked) + mprintf(St(MListLock)); + } + } + while(Arc.ReadHeader()>0) + { + int HeaderType=Arc.GetHeaderType(); + if (HeaderType==ENDARC_HEAD) + break; + switch(HeaderType) + { + case FILE_HEAD: + IntToExt(Arc.NewLhd.FileName,Arc.NewLhd.FileName); + FileMatched=Cmd->IsProcessFile(Arc.NewLhd)!=0; + if (FileMatched) + { + ListFileHeader(Arc.NewLhd,Verbose,Technical,TitleShown,Bare); + if (!(Arc.NewLhd.Flags & LHD_SPLIT_BEFORE)) + { + TotalUnpSize+=Arc.NewLhd.FullUnpSize; + FileCount++; + } + TotalPackSize+=Arc.NewLhd.FullPackSize; + if (Technical) + ListSymLink(Arc); +#ifndef SFX_MODULE + if (Verbose) + Arc.ViewFileComment(); +#endif + } + break; +#ifndef SFX_MODULE + case SUB_HEAD: + if (Technical && FileMatched && !Bare) + ListOldSubHeader(Arc); + break; +#endif + case NEWSUB_HEAD: + if (FileMatched && !Bare) + { + if (Technical) + ListFileHeader(Arc.SubHead,Verbose,true,TitleShown,false); + ListNewSubHeader(Cmd,Arc,Technical); + } + break; + } + Arc.SeekToNext(); + } + if (!Bare) + if (TitleShown) + { + mprintf("\n"); + for (int I=0;I<79;I++) + mprintf("-"); + char UnpSizeText[20]; + itoa(TotalUnpSize,UnpSizeText); + + char PackSizeText[20]; + itoa(TotalPackSize,PackSizeText); + + mprintf("\n%5lu %16s %8s %3d%%",FileCount,UnpSizeText, + PackSizeText,ToPercentUnlim(TotalPackSize,TotalUnpSize)); + SumFileCount+=FileCount; + SumUnpSize+=TotalUnpSize; + SumPackSize+=TotalPackSize; +#ifndef SFX_MODULE + if (Arc.EndArcHead.Flags & EARC_VOLNUMBER) + { + mprintf(" "); + mprintf(St(MVolumeNumber),Arc.EndArcHead.VolNumber+1); + } +#endif + mprintf("\n"); + } + else + mprintf(St(MListNoFiles)); + + ArcCount++; + +#ifndef NOVOLUME + if (Cmd->VolSize!=0 && ((Arc.NewLhd.Flags & LHD_SPLIT_AFTER) || + Arc.GetHeaderType()==ENDARC_HEAD && + (Arc.EndArcHead.Flags & EARC_NEXT_VOLUME)!=0) && + MergeArchive(Arc,NULL,false,*Cmd->Command)) + { + Arc.Seek(0,SEEK_SET); + } + else +#endif + break; + } + else + { + if (Cmd->ArcNames->ItemsCount()<2 && !Bare) + mprintf(St(MNotRAR),Arc.FileName); + break; + } + } + } + if (ArcCount>1 && !Bare) + { + char UnpSizeText[20],PackSizeText[20]; + itoa(SumUnpSize,UnpSizeText); + itoa(SumPackSize,PackSizeText); + mprintf("\n%5lu %16s %8s %3d%%\n",SumFileCount,UnpSizeText, + PackSizeText,ToPercentUnlim(SumPackSize,SumUnpSize)); + } +} + + +void ListFileHeader(FileHeader &hd,bool Verbose,bool Technical,bool &TitleShown,bool Bare) +{ + if (!Bare) + { + if (!TitleShown) + { + if (Verbose) + mprintf(St(MListPathComm)); + else + mprintf(St(MListName)); + mprintf(St(MListTitle)); + if (Technical) + mprintf(St(MListTechTitle)); + for (int I=0;I<79;I++) + mprintf("-"); + TitleShown=true; + } + + if (hd.HeadType==NEWSUB_HEAD) + mprintf(St(MSubHeadType),hd.FileName); + + mprintf("\n%c",(hd.Flags & LHD_PASSWORD) ? '*' : ' '); + } + + char *Name=hd.FileName; + +#ifdef UNICODE_SUPPORTED + char ConvertedName[NM]; + if ((hd.Flags & LHD_UNICODE)!=0 && *hd.FileNameW!=0 && UnicodeEnabled()) + { + if (WideToChar(hd.FileNameW,ConvertedName) && *ConvertedName!=0) + Name=ConvertedName; + } +#endif + + if (Bare) + { + mprintf("%s\n",Verbose ? Name:PointToName(Name)); + return; + } + + if (Verbose) + mprintf("%s\n%12s ",Name,""); + else + mprintf("%-12s",PointToName(Name)); + + char UnpSizeText[20],PackSizeText[20]; + if (hd.FullUnpSize==INT64NDF) + strcpy(UnpSizeText,"?"); + else + itoa(hd.FullUnpSize,UnpSizeText); + itoa(hd.FullPackSize,PackSizeText); + + mprintf(" %8s %8s ",UnpSizeText,PackSizeText); + + if ((hd.Flags & LHD_SPLIT_BEFORE) && (hd.Flags & LHD_SPLIT_AFTER)) + mprintf(" <->"); + else + if (hd.Flags & LHD_SPLIT_BEFORE) + mprintf(" <--"); + else + if (hd.Flags & LHD_SPLIT_AFTER) + mprintf(" -->"); + else + mprintf("%3d%%",ToPercentUnlim(hd.FullPackSize,hd.FullUnpSize)); + + char DateStr[50]; + hd.mtime.GetText(DateStr,false); + mprintf(" %s ",DateStr); + + if (hd.HeadType==NEWSUB_HEAD) + mprintf(" %c....B ",(hd.SubFlags & SUBHEAD_FLAGS_INHERITED) ? 'I' : '.'); + else + ListFileAttr(hd.FileAttr,hd.HostOS); + + mprintf(" %8.8X",hd.FileCRC); + mprintf(" m%d",hd.Method-0x30); + if ((hd.Flags & LHD_WINDOWMASK)<=6*32) + mprintf("%c",((hd.Flags&LHD_WINDOWMASK)>>5)+'a'); + else + mprintf(" "); + mprintf(" %d.%d",hd.UnpVer/10,hd.UnpVer%10); + + static const char *RarOS[]={ + "DOS","OS/2","Win95/NT","Unix","MacOS","BeOS","WinCE","","","" + }; + + if (Technical) + mprintf("\n%22s %8s %4s", + (hd.HostOS",FileName); + } + else + { + // Link data are encrypted. We would need to ask for password + // and initialize decryption routine to display the link target. + mprintf("\n%22s %s","-->","*<-?->"); + } +} + + +void ListFileAttr(uint A,int HostOS) +{ + switch(HostOS) + { + case HOST_MSDOS: + case HOST_OS2: + case HOST_WIN32: + case HOST_MACOS: + mprintf(" %c%c%c%c%c%c%c ", + (A & 0x08) ? 'V' : '.', + (A & 0x10) ? 'D' : '.', + (A & 0x01) ? 'R' : '.', + (A & 0x02) ? 'H' : '.', + (A & 0x04) ? 'S' : '.', + (A & 0x20) ? 'A' : '.', + (A & 0x800) ? 'C' : '.'); + break; + case HOST_UNIX: + case HOST_BEOS: + switch (A & 0xF000) + { + case 0x4000: + mprintf("d"); + break; + case 0xA000: + mprintf("l"); + break; + default: + mprintf("-"); + break; + } + mprintf("%c%c%c%c%c%c%c%c%c", + (A & 0x0100) ? 'r' : '-', + (A & 0x0080) ? 'w' : '-', + (A & 0x0040) ? ((A & 0x0800) ? 's':'x'):((A & 0x0800) ? 'S':'-'), + (A & 0x0020) ? 'r' : '-', + (A & 0x0010) ? 'w' : '-', + (A & 0x0008) ? ((A & 0x0400) ? 's':'x'):((A & 0x0400) ? 'S':'-'), + (A & 0x0004) ? 'r' : '-', + (A & 0x0002) ? 'w' : '-', + (A & 0x0001) ? 'x' : '-'); + break; + } +} + + +#ifndef SFX_MODULE +void ListOldSubHeader(Archive &Arc) +{ + switch(Arc.SubBlockHead.SubType) + { + case EA_HEAD: + mprintf(St(MListEAHead)); + break; + case UO_HEAD: + mprintf(St(MListUOHead),Arc.UOHead.OwnerName,Arc.UOHead.GroupName); + break; + case MAC_HEAD: + mprintf(St(MListMACHead1),Arc.MACHead.fileType>>24,Arc.MACHead.fileType>>16,Arc.MACHead.fileType>>8,Arc.MACHead.fileType); + mprintf(St(MListMACHead2),Arc.MACHead.fileCreator>>24,Arc.MACHead.fileCreator>>16,Arc.MACHead.fileCreator>>8,Arc.MACHead.fileCreator); + break; + case BEEA_HEAD: + mprintf(St(MListBeEAHead)); + break; + case NTACL_HEAD: + mprintf(St(MListNTACLHead)); + break; + case STREAM_HEAD: + mprintf(St(MListStrmHead),Arc.StreamHead.StreamName); + break; + default: + mprintf(St(MListUnkHead),Arc.SubBlockHead.SubType); + break; + } +} +#endif + + +void ListNewSubHeader(CommandData *Cmd,Archive &Arc,bool Technical) +{ + if (Arc.SubHead.CmpName(SUBHEAD_TYPE_CMT) && + (Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0 && !Cmd->DisableComment) + { + Array CmtData; + size_t ReadSize=Arc.ReadCommentData(&CmtData,NULL); + if (ReadSize!=0) + { + mprintf(St(MFileComment)); + OutComment((char *)&CmtData[0],ReadSize); + } + } + if (Arc.SubHead.CmpName(SUBHEAD_TYPE_STREAM) && + (Arc.SubHead.Flags & LHD_SPLIT_BEFORE)==0) + { + size_t DestSize=Arc.SubHead.SubData.Size()/2; + wchar DestNameW[NM]; + char DestName[NM]; + if (DestSize - - " +#define MUNRARTitle1 "\nUsage: unrar - - " +#define MRARTitle2 "\n <@listfiles...> " +#define MCHelpCmd "\n\n" +#define MCHelpCmdA "\n a Add files to archive" +#define MCHelpCmdC "\n c Add archive comment" +#define MCHelpCmdCF "\n cf Add files comment" +#define MCHelpCmdCH "\n ch Change archive parameters" +#define MCHelpCmdCW "\n cw Write archive comment to file" +#define MCHelpCmdD "\n d Delete files from archive" +#define MCHelpCmdE "\n e Extract files to current directory" +#define MCHelpCmdF "\n f Freshen files in archive" +#define MCHelpCmdI "\n i[par]= Find string in archives" +#define MCHelpCmdK "\n k Lock archive" +#define MCHelpCmdL "\n l[t,b] List archive [technical, bare]" +#define MCHelpCmdM "\n m[f] Move to archive [files only]" +#define MCHelpCmdP "\n p Print file to stdout" +#define MCHelpCmdR "\n r Repair archive" +#define MCHelpCmdRC "\n rc Reconstruct missing volumes" +#define MCHelpCmdRN "\n rn Rename archived files" +#define MCHelpCmdRR "\n rr[N] Add data recovery record" +#define MCHelpCmdRV "\n rv[N] Create recovery volumes" +#define MCHelpCmdS "\n s[name|-] Convert archive to or from SFX" +#define MCHelpCmdT "\n t Test archive files" +#define MCHelpCmdU "\n u Update files in archive" +#define MCHelpCmdV "\n v[t,b] Verbosely list archive [technical,bare]" +#define MCHelpCmdX "\n x Extract files with full path" +#define MCHelpSw "\n\n" +#define MCHelpSwm "\n - Stop switches scanning" +#define MCHelpSwAC "\n ac Clear Archive attribute after compression or extraction" +#define MCHelpSwAD "\n ad Append archive name to destination path" +#define MCHelpSwAG "\n ag[format] Generate archive name using the current date" +#define MCHelpSwAI "\n ai Ignore file attributes" +#define MCHelpSwAO "\n ao Add files with Archive attribute set" +#define MCHelpSwAP "\n ap Set path inside archive" +#define MCHelpSwAS "\n as Synchronize archive contents" +#define MCHelpSwAV "\n av Put authenticity verification (registered versions only)" +#define MCHelpSwAVm "\n av- Disable authenticity verification check" +#define MCHelpSwCm "\n c- Disable comments show" +#define MCHelpSwCFGm "\n cfg- Disable read configuration" +#define MCHelpSwCL "\n cl Convert names to lower case" +#define MCHelpSwCU "\n cu Convert names to upper case" +#define MCHelpSwDF "\n df Delete files after archiving" +#define MCHelpSwDH "\n dh Open shared files" +#define MCHelpSwDR "\n dr Delete files to Recycle Bin" +#define MCHelpSwDS "\n ds Disable name sort for solid archive" +#define MCHelpSwDW "\n dw Wipe files after archiving" +#define MCHelpSwEa "\n e[+] Set file exclude and include attributes" +#define MCHelpSwED "\n ed Do not add empty directories" +#define MCHelpSwEE "\n ee Do not save and extract extended attributes" +#define MCHelpSwEN "\n en Do not put 'end of archive' block" +#define MCHelpSwEP "\n ep Exclude paths from names" +#define MCHelpSwEP1 "\n ep1 Exclude base directory from names" +#define MCHelpSwEP2 "\n ep2 Expand paths to full" +#define MCHelpSwEP3 "\n ep3 Expand paths to full including the drive letter" +#define MCHelpSwF "\n f Freshen files" +#define MCHelpSwHP "\n hp[password] Encrypt both file data and headers" +#define MCHelpSwIDP "\n id[c,d,p,q] Disable messages" +#define MCHelpSwIEML "\n ieml[addr] Send archive by email" +#define MCHelpSwIERR "\n ierr Send all messages to stderr" +#define MCHelpSwILOG "\n ilog[name] Log errors to file (registered versions only)" +#define MCHelpSwINUL "\n inul Disable all messages" +#define MCHelpSwIOFF "\n ioff Turn PC off after completing an operation" +#define MCHelpSwISND "\n isnd Enable sound" +#define MCHelpSwK "\n k Lock archive" +#define MCHelpSwKB "\n kb Keep broken extracted files" +#define MCHelpSwMn "\n m<0..5> Set compression level (0-store...3-default...5-maximal)" +#define MCHelpSwMC "\n mc Set advanced compression parameters" +#define MCHelpSwMD "\n md Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)" +#define MCHelpSwMS "\n ms[ext;ext] Specify file types to store" +#define MCHelpSwMT "\n mt Set the number of threads" +#define MCHelpSwN "\n n Include only specified file" +#define MCHelpSwNa "\n n@ Read file names to include from stdin" +#define MCHelpSwNal "\n n@ Include files listed in specified list file" +#define MCHelpSwO "\n o[+|-] Set the overwrite mode" +#define MCHelpSwOC "\n oc Set NTFS Compressed attribute" +#define MCHelpSwOL "\n ol Save symbolic links as the link instead of the file" +#define MCHelpSwOR "\n or Rename files automatically" +#define MCHelpSwOS "\n os Save NTFS streams" +#define MCHelpSwOW "\n ow Save or restore file owner and group" +#define MCHelpSwP "\n p[password] Set password" +#define MCHelpSwPm "\n p- Do not query password" +#define MCHelpSwR "\n r Recurse subdirectories" +#define MCHelpSwRm "\n r- Disable recursion" +#define MCHelpSwR0 "\n r0 Recurse subdirectories for wildcard names only" +#define MCHelpSwRI "\n ri

[:] Set priority (0-default,1-min..15-max) and sleep time in ms" +#define MCHelpSwRR "\n rr[N] Add data recovery record" +#define MCHelpSwRV "\n rv[N] Create recovery volumes" +#define MCHelpSwS "\n s[,v[-],e] Create solid archive" +#define MCHelpSwSm "\n s- Disable solid archiving" +#define MCHelpSwSC "\n sc[obj] Specify the character set" +#define MCHelpSwSFX "\n sfx[name] Create SFX archive" +#define MCHelpSwSI "\n si[name] Read data from standard input (stdin)" +#define MCHelpSwSL "\n sl Process files with size less than specified" +#define MCHelpSwSM "\n sm Process files with size more than specified" +#define MCHelpSwT "\n t Test files after archiving" +#define MCHelpSwTK "\n tk Keep original archive time" +#define MCHelpSwTL "\n tl Set archive time to latest file" +#define MCHelpSwTN "\n tn