-
Notifications
You must be signed in to change notification settings - Fork 43
/
rdwrfn.hpp
100 lines (74 loc) · 2.36 KB
/
rdwrfn.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef _RAR_DATAIO_
#define _RAR_DATAIO_
class Archive;
class CmdAdd;
class Unpack;
class ArcFileSearch;
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;
int64 UnpPackedLeft;
bool ShowProgress;
bool TestMode;
bool SkipUnpCRC;
bool NoFileHeader;
File *SrcFile;
File *DestFile;
CmdAdd *Command;
FileHeader *SubHead;
int64 *SubHeadPos;
#ifndef RAR_NOCRYPT
CryptData *Crypt;
CryptData *Decrypt;
#endif
int LastPercent;
wchar CurrentCommand;
public:
ComprDataIO();
~ComprDataIO();
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=UnpPackedLeft=Size;}
void SetTestMode(bool Mode) {TestMode=Mode;}
void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
void SetNoFileHeader(bool Mode) {NoFileHeader=Mode;}
void SetFiles(File *SrcFile,File *DestFile);
void SetCommand(CmdAdd *Cmd) {Command=Cmd;}
void SetSubHeader(FileHeader *hd,int64 *Pos) {SubHead=hd;SubHeadPos=Pos;}
bool SetEncryption(bool Encrypt,CRYPT_METHOD Method,SecPassword *Password,
const byte *Salt,const byte *InitV,uint Lg2Cnt,byte *HashKey,byte *PswCheck);
void SetCmt13Encryption();
void SetUnpackToMemory(byte *Addr,uint Size);
void SetCurrentCommand(wchar Cmd) {CurrentCommand=Cmd;}
void AdjustTotalArcSize(Archive *Arc);
bool PackVolume;
bool UnpVolume;
bool NextVolumeMissing;
int64 CurPackRead,CurPackWrite,CurUnpRead,CurUnpWrite;
// Size of already processed archives.
// Used to calculate the total operation progress.
int64 ProcessedArcSize;
// Last extracted archive size up to QO or RR block.
int64 LastArcSize;
int64 TotalArcSize;
DataHash PackedDataHash; // Packed write and unpack read hash.
DataHash PackHash; // Pack read hash.
DataHash UnpHash; // Unpack write hash.
bool Encryption;
bool Decryption;
};
#endif