2009-11-10 16:48:42 +01:00
|
|
|
#ifndef _RAR_DATAIO_
|
|
|
|
#define _RAR_DATAIO_
|
|
|
|
|
|
|
|
class CmdAdd;
|
|
|
|
class Unpack;
|
2020-07-15 00:40:26 +02:00
|
|
|
class ArcFileSearch;
|
2009-11-10 16:48:42 +01:00
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
#if 0
|
|
|
|
// We use external i/o calls for Benchmark command.
|
|
|
|
#define COMPRDATAIO_EXTIO
|
|
|
|
#endif
|
2009-11-10 16:48:42 +01:00
|
|
|
|
|
|
|
class ComprDataIO
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
void ShowUnpRead(int64 ArcPos,int64 ArcSize);
|
|
|
|
void ShowUnpWrite();
|
|
|
|
|
|
|
|
|
|
|
|
bool UnpackFromMemory;
|
|
|
|
size_t UnpackFromMemorySize;
|
|
|
|
byte *UnpackFromMemoryAddr;
|
|
|
|
|
|
|
|
bool UnpackToMemory;
|
|
|
|
size_t UnpackToMemorySize;
|
|
|
|
byte *UnpackToMemoryAddr;
|
|
|
|
|
|
|
|
size_t UnpWrSize;
|
|
|
|
byte *UnpWrAddr;
|
|
|
|
|
|
|
|
int64 UnpPackedSize;
|
|
|
|
|
|
|
|
bool ShowProgress;
|
|
|
|
bool TestMode;
|
|
|
|
bool SkipUnpCRC;
|
2020-07-15 00:40:26 +02:00
|
|
|
bool NoFileHeader;
|
2009-11-10 16:48:42 +01:00
|
|
|
|
|
|
|
File *SrcFile;
|
|
|
|
File *DestFile;
|
|
|
|
|
|
|
|
CmdAdd *Command;
|
|
|
|
|
|
|
|
FileHeader *SubHead;
|
|
|
|
int64 *SubHeadPos;
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
#ifndef RAR_NOCRYPT
|
|
|
|
CryptData *Crypt;
|
|
|
|
CryptData *Decrypt;
|
2009-11-10 16:48:42 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
int LastPercent;
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
wchar CurrentCommand;
|
2009-11-10 16:48:42 +01:00
|
|
|
|
|
|
|
public:
|
|
|
|
ComprDataIO();
|
2020-07-15 00:40:26 +02:00
|
|
|
~ComprDataIO();
|
2009-11-10 16:48:42 +01:00
|
|
|
void Init();
|
|
|
|
int UnpRead(byte *Addr,size_t Count);
|
|
|
|
void UnpWrite(byte *Addr,size_t Count);
|
|
|
|
void EnableShowProgress(bool Show) {ShowProgress=Show;}
|
|
|
|
void GetUnpackedData(byte **Data,size_t *Size);
|
|
|
|
void SetPackedSizeToRead(int64 Size) {UnpPackedSize=Size;}
|
|
|
|
void SetTestMode(bool Mode) {TestMode=Mode;}
|
|
|
|
void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
|
2020-07-15 00:40:26 +02:00
|
|
|
void SetNoFileHeader(bool Mode) {NoFileHeader=Mode;}
|
2009-11-10 16:48:42 +01:00
|
|
|
void SetFiles(File *SrcFile,File *DestFile);
|
|
|
|
void SetCommand(CmdAdd *Cmd) {Command=Cmd;}
|
|
|
|
void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
|
2020-07-15 00:40:26 +02:00
|
|
|
void SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password,
|
|
|
|
const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck);
|
2009-11-10 16:48:42 +01:00
|
|
|
void SetAV15Encryption();
|
|
|
|
void SetCmt13Encryption();
|
|
|
|
void SetUnpackToMemory(byte *Addr,uint Size);
|
2020-07-15 00:40:26 +02:00
|
|
|
void SetCurrentCommand(wchar Cmd) {CurrentCommand=Cmd;}
|
|
|
|
|
2009-11-10 16:48:42 +01:00
|
|
|
|
|
|
|
bool PackVolume;
|
|
|
|
bool UnpVolume;
|
|
|
|
bool NextVolumeMissing;
|
|
|
|
int64 UnpArcSize;
|
|
|
|
int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
|
2009-11-10 16:48:42 +01:00
|
|
|
// Size of already processed archives.
|
|
|
|
// Used to calculate the total operation progress.
|
|
|
|
int64 ProcessedArcSize;
|
|
|
|
|
|
|
|
int64 TotalArcSize;
|
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
DataHash PackedDataHash; // Packed write and unpack read hash.
|
|
|
|
DataHash PackHash; // Pack read hash.
|
|
|
|
DataHash UnpHash; // Unpack write hash.
|
2009-11-10 16:48:42 +01:00
|
|
|
|
2020-07-15 00:40:26 +02:00
|
|
|
bool Encryption;
|
|
|
|
bool Decryption;
|
2009-11-10 16:48:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|