rdwrfn.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef _RAR_DATAIO_
  2. #define _RAR_DATAIO_
  3. class CmdAdd;
  4. class Unpack;
  5. class ComprDataIO
  6. {
  7. private:
  8. void ShowUnpRead(int64 ArcPos,int64 ArcSize);
  9. void ShowUnpWrite();
  10. bool UnpackFromMemory;
  11. size_t UnpackFromMemorySize;
  12. byte *UnpackFromMemoryAddr;
  13. bool UnpackToMemory;
  14. size_t UnpackToMemorySize;
  15. byte *UnpackToMemoryAddr;
  16. size_t UnpWrSize;
  17. byte *UnpWrAddr;
  18. int64 UnpPackedSize;
  19. bool ShowProgress;
  20. bool TestMode;
  21. bool SkipUnpCRC;
  22. File *SrcFile;
  23. File *DestFile;
  24. CmdAdd *Command;
  25. FileHeader *SubHead;
  26. int64 *SubHeadPos;
  27. #ifndef RAR_NOCRYPT
  28. CryptData Crypt;
  29. CryptData Decrypt;
  30. #endif
  31. int LastPercent;
  32. char CurrentCommand;
  33. public:
  34. ComprDataIO();
  35. void Init();
  36. int UnpRead(byte *Addr,size_t Count);
  37. void UnpWrite(byte *Addr,size_t Count);
  38. void EnableShowProgress(bool Show) {ShowProgress=Show;}
  39. void GetUnpackedData(byte **Data,size_t *Size);
  40. void SetPackedSizeToRead(int64 Size) {UnpPackedSize=Size;}
  41. void SetTestMode(bool Mode) {TestMode=Mode;}
  42. void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
  43. void SetFiles(File *SrcFile,File *DestFile);
  44. void SetCommand(CmdAdd *Cmd) {Command=Cmd;}
  45. void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
  46. void SetEncryption(int Method,const wchar *Password,const byte *Salt,bool Encrypt,bool HandsOffHash);
  47. void SetAV15Encryption();
  48. void SetCmt13Encryption();
  49. void SetUnpackToMemory(byte *Addr,uint Size);
  50. void SetCurrentCommand(char Cmd) {CurrentCommand=Cmd;}
  51. bool PackVolume;
  52. bool UnpVolume;
  53. bool NextVolumeMissing;
  54. int64 TotalPackRead;
  55. int64 UnpArcSize;
  56. int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
  57. // Size of already processed archives.
  58. // Used to calculate the total operation progress.
  59. int64 ProcessedArcSize;
  60. int64 TotalArcSize;
  61. uint PackFileCRC,UnpFileCRC,PackedCRC;
  62. int Encryption;
  63. int Decryption;
  64. };
  65. #endif