"Fossies" - the Fresh Open Source Software Archive 
Member "unrar/archive.hpp" (4 May 2022, 3891 Bytes) of package /linux/misc/unrarsrc-6.1.7.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "archive.hpp" see the
Fossies "Dox" file reference documentation.
1 #ifndef _RAR_ARCHIVE_
2 #define _RAR_ARCHIVE_
3
4 class PPack;
5 class RawRead;
6 class RawWrite;
7
8 enum NOMODIFY_FLAGS
9 {
10 NMDF_ALLOWLOCK=1,NMDF_ALLOWANYVOLUME=2,NMDF_ALLOWFIRSTVOLUME=4
11 };
12
13 enum RARFORMAT {RARFMT_NONE,RARFMT14,RARFMT15,RARFMT50,RARFMT_FUTURE};
14
15 enum ADDSUBDATA_FLAGS
16 {
17 ASDF_SPLIT = 1, // Allow to split archive just before header if necessary.
18 ASDF_COMPRESS = 2, // Allow to compress data following subheader.
19 ASDF_CRYPT = 4, // Encrypt data after subheader if password is set.
20 ASDF_CRYPTIFHEADERS = 8 // Encrypt data after subheader only in -hp mode.
21 };
22
23 // RAR5 headers must not exceed 2 MB.
24 #define MAX_HEADER_SIZE_RAR5 0x200000
25
26 class Archive:public File
27 {
28 private:
29 void UpdateLatestTime(FileHeader *CurBlock);
30 void ConvertNameCase(wchar *Name);
31 void ConvertFileHeader(FileHeader *hd);
32 size_t ReadHeader14();
33 size_t ReadHeader15();
34 size_t ReadHeader50();
35 void ProcessExtra50(RawRead *Raw,size_t ExtraSize,BaseBlock *bb);
36 void RequestArcPassword();
37 void UnexpEndArcMsg();
38 void BrokenHeaderMsg();
39 void UnkEncVerMsg(const wchar *Name,const wchar *Info);
40 bool DoGetComment(Array<wchar> *CmtData);
41 bool ReadCommentData(Array<wchar> *CmtData);
42
43 #if !defined(RAR_NOCRYPT)
44 CryptData HeadersCrypt;
45 #endif
46 ComprDataIO SubDataIO;
47 bool DummyCmd;
48 RAROptions *Cmd;
49
50
51 RarTime LatestTime;
52 int LastReadBlock;
53 HEADER_TYPE CurHeaderType;
54
55 bool SilentOpen;
56 #ifdef USE_QOPEN
57 QuickOpen QOpen;
58 bool ProhibitQOpen;
59 #endif
60 public:
61 Archive(RAROptions *InitCmd=NULL);
62 ~Archive();
63 static RARFORMAT IsSignature(const byte *D,size_t Size);
64 bool IsArchive(bool EnableBroken);
65 size_t SearchBlock(HEADER_TYPE HeaderType);
66 size_t SearchSubBlock(const wchar *Type);
67 size_t SearchRR();
68 size_t ReadHeader();
69 void CheckArc(bool EnableBroken);
70 void CheckOpen(const wchar *Name);
71 bool WCheckOpen(const wchar *Name);
72 bool GetComment(Array<wchar> *CmtData);
73 void ViewComment();
74 void SetLatestTime(RarTime *NewTime);
75 void SeekToNext();
76 bool CheckAccess();
77 bool IsArcDir();
78 void ConvertAttributes();
79 void VolSubtractHeaderSize(size_t SubSize);
80 uint FullHeaderSize(size_t Size);
81 int64 GetStartPos();
82 void AddSubData(byte *SrcData,uint64 DataSize,File *SrcFile,
83 const wchar *Name,uint Flags);
84 bool ReadSubData(Array<byte> *UnpData,File *DestFile,bool TestMode);
85 HEADER_TYPE GetHeaderType() {return CurHeaderType;}
86 RAROptions* GetRAROptions() {return Cmd;}
87 void SetSilentOpen(bool Mode) {SilentOpen=Mode;}
88 #if 0
89 void GetRecoveryInfo(bool Required,int64 *Size,int *Percent);
90 #endif
91 #ifdef USE_QOPEN
92 bool Open(const wchar *Name,uint Mode=FMF_READ);
93 int Read(void *Data,size_t Size);
94 void Seek(int64 Offset,int Method);
95 int64 Tell();
96 void QOpenUnload() {QOpen.Unload();}
97 void SetProhibitQOpen(bool Mode) {ProhibitQOpen=Mode;}
98 #endif
99
100 BaseBlock ShortBlock;
101 MarkHeader MarkHead;
102 MainHeader MainHead;
103 CryptHeader CryptHead;
104 FileHeader FileHead;
105 EndArcHeader EndArcHead;
106 SubBlockHeader SubBlockHead;
107 FileHeader SubHead;
108 CommentHeader CommHead;
109 ProtectHeader ProtectHead;
110 UnixOwnersHeader UOHead;
111 EAHeader EAHead;
112 StreamHeader StreamHead;
113
114 int64 CurBlockPos;
115 int64 NextBlockPos;
116
117 RARFORMAT Format;
118 bool Solid;
119 bool Volume;
120 bool MainComment;
121 bool Locked;
122 bool Signed;
123 bool FirstVolume;
124 bool NewNumbering;
125 bool Protected;
126 bool Encrypted;
127 size_t SFXSize;
128 bool BrokenHeader;
129 bool FailedHeaderDecryption;
130
131 #if !defined(RAR_NOCRYPT)
132 byte ArcSalt[SIZE_SALT50];
133 #endif
134
135 bool Splitting;
136
137 uint VolNumber;
138 int64 VolWrite;
139 uint64 AddingFilesSize;
140 uint64 AddingHeadersSize;
141
142 bool NewArchive;
143
144 wchar FirstVolumeName[NM];
145 };
146
147
148 #endif