rdwrfn.hpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #ifndef _RAR_DATAIO_
  2. #define _RAR_DATAIO_
  3. class Archive;
  4. class CmdAdd;
  5. class Unpack;
  6. class ArcFileSearch;
  7. #if 0
  8. // We use external i/o calls for Benchmark command.
  9. #define COMPRDATAIO_EXTIO
  10. #endif
  11. class ComprDataIO
  12. {
  13. private:
  14. void ShowUnpRead(int64 ArcPos,int64 ArcSize);
  15. void ShowUnpWrite();
  16. bool UnpackFromMemory;
  17. size_t UnpackFromMemorySize;
  18. byte *UnpackFromMemoryAddr;
  19. bool UnpackToMemory;
  20. size_t UnpackToMemorySize;
  21. byte *UnpackToMemoryAddr;
  22. size_t UnpWrSize;
  23. byte *UnpWrAddr;
  24. int64 UnpPackedSize;
  25. int64 UnpPackedLeft;
  26. bool ShowProgress;
  27. bool TestMode;
  28. bool SkipUnpCRC;
  29. bool NoFileHeader;
  30. File *SrcFile;
  31. File *DestFile;
  32. CmdAdd *Command;
  33. FileHeader *SubHead;
  34. int64 *SubHeadPos;
  35. #ifndef RAR_NOCRYPT
  36. CryptData *Crypt;
  37. CryptData *Decrypt;
  38. #endif
  39. int LastPercent;
  40. wchar CurrentCommand;
  41. public:
  42. ComprDataIO();
  43. ~ComprDataIO();
  44. void Init();
  45. int UnpRead(byte *Addr,size_t Count);
  46. void UnpWrite(byte *Addr,size_t Count);
  47. void EnableShowProgress(bool Show) {ShowProgress=Show;}
  48. void GetUnpackedData(byte **Data,size_t *Size);
  49. void SetPackedSizeToRead(int64 Size) {UnpPackedSize=UnpPackedLeft=Size;}
  50. void SetTestMode(bool Mode) {TestMode=Mode;}
  51. void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
  52. void SetNoFileHeader(bool Mode) {NoFileHeader=Mode;}
  53. void SetFiles(File *SrcFile,File *DestFile);
  54. void SetCommand(CmdAdd *Cmd) {Command=Cmd;}
  55. void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
  56. void SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password,
  57. const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck);
  58. void SetAV15Encryption();
  59. void SetCmt13Encryption();
  60. void SetUnpackToMemory(byte *Addr,uint Size);
  61. void SetCurrentCommand(wchar Cmd) {CurrentCommand=Cmd;}
  62. void AdjustTotalArcSize(Archive *Arc);
  63. bool PackVolume;
  64. bool UnpVolume;
  65. bool NextVolumeMissing;
  66. int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
  67. // Size of already processed archives.
  68. // Used to calculate the total operation progress.
  69. int64 ProcessedArcSize;
  70. // Last extracted archive size up to QO or RR block.
  71. int64 LastArcSize;
  72. int64 TotalArcSize;
  73. DataHash PackedDataHash; // Packed write and unpack read hash.
  74. DataHash PackHash; // Pack read hash.
  75. DataHash UnpHash; // Unpack write hash.
  76. bool Encryption;
  77. bool Decryption;
  78. };
  79. #endif