unrarsrc  6.1.7
About: unrar extracts, views and tests the contents of archives created with the RAR archiver.
  Fossies Dox: unrarsrc-6.1.7.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

archive.hpp
Go to the documentation of this file.
1#ifndef _RAR_ARCHIVE_
2#define _RAR_ARCHIVE_
3
4class PPack;
5class RawRead;
6class RawWrite;
7
9{
11};
12
14
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
26class Archive:public File
27{
28 private:
30 void ConvertNameCase(wchar *Name);
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)
45#endif
49
50
54
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();
77 bool IsArcDir();
78 void ConvertAttributes();
79 void VolSubtractHeaderSize(size_t SubSize);
80 uint FullHeaderSize(size_t Size);
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);
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
113
116
118 bool Solid;
119 bool Volume;
121 bool Locked;
122 bool Signed;
127 size_t SFXSize;
130
131#if !defined(RAR_NOCRYPT)
133#endif
134
136
141
143
145};
146
147
148#endif
RARFORMAT
Definition: archive.hpp:13
@ RARFMT_FUTURE
Definition: archive.hpp:13
@ RARFMT50
Definition: archive.hpp:13
@ RARFMT15
Definition: archive.hpp:13
@ RARFMT_NONE
Definition: archive.hpp:13
@ RARFMT14
Definition: archive.hpp:13
ADDSUBDATA_FLAGS
Definition: archive.hpp:16
@ ASDF_COMPRESS
Definition: archive.hpp:18
@ ASDF_CRYPTIFHEADERS
Definition: archive.hpp:20
@ ASDF_SPLIT
Definition: archive.hpp:17
@ ASDF_CRYPT
Definition: archive.hpp:19
NOMODIFY_FLAGS
Definition: archive.hpp:9
@ NMDF_ALLOWFIRSTVOLUME
Definition: archive.hpp:10
@ NMDF_ALLOWANYVOLUME
Definition: archive.hpp:10
@ NMDF_ALLOWLOCK
Definition: archive.hpp:10
ProtectHeader ProtectHead
Definition: archive.hpp:109
RAROptions * Cmd
Definition: archive.hpp:48
int64 GetStartPos()
Definition: arcread.cpp:1420
wchar FirstVolumeName[NM]
Definition: archive.hpp:144
size_t ReadHeader()
Definition: arcread.cpp:3
uint64 AddingFilesSize
Definition: archive.hpp:139
void CheckOpen(const wchar *Name)
Definition: archive.cpp:77
bool Signed
Definition: archive.hpp:122
bool DummyCmd
Definition: archive.hpp:47
bool Encrypted
Definition: archive.hpp:126
EAHeader EAHead
Definition: archive.hpp:111
bool BrokenHeader
Definition: archive.hpp:128
~Archive()
Definition: archive.cpp:56
bool FirstVolume
Definition: archive.hpp:123
bool FailedHeaderDecryption
Definition: archive.hpp:129
ComprDataIO SubDataIO
Definition: archive.hpp:46
HEADER_TYPE GetHeaderType()
Definition: archive.hpp:85
bool GetComment(Array< wchar > *CmtData)
Definition: arccmt.cpp:3
bool SilentOpen
Definition: archive.hpp:55
uint VolNumber
Definition: archive.hpp:137
bool Protected
Definition: archive.hpp:125
MarkHeader MarkHead
Definition: archive.hpp:101
int LastReadBlock
Definition: archive.hpp:52
void ConvertFileHeader(FileHeader *hd)
Definition: arcread.cpp:1370
bool IsArchive(bool EnableBroken)
Definition: archive.cpp:126
int64 VolWrite
Definition: archive.hpp:138
EndArcHeader EndArcHead
Definition: archive.hpp:105
bool Locked
Definition: archive.hpp:121
static RARFORMAT IsSignature(const byte *D, size_t Size)
Definition: archive.cpp:99
void ConvertNameCase(wchar *Name)
Definition: arcread.cpp:1289
void UnkEncVerMsg(const wchar *Name, const wchar *Info)
Definition: arcread.cpp:119
void SetSilentOpen(bool Mode)
Definition: archive.hpp:87
void SeekToNext()
Definition: archive.cpp:276
bool Solid
Definition: archive.hpp:118
HEADER_TYPE CurHeaderType
Definition: archive.hpp:53
bool ReadCommentData(Array< wchar > *CmtData)
Definition: arccmt.cpp:143
FileHeader FileHead
Definition: archive.hpp:104
void ViewComment()
Definition: arccmt.cpp:169
bool MainComment
Definition: archive.hpp:120
size_t SearchRR()
Definition: arcread.cpp:79
RARFORMAT Format
Definition: archive.hpp:117
uint FullHeaderSize(size_t Size)
Definition: archive.cpp:287
size_t SearchSubBlock(const wchar *Type)
Definition: arcread.cpp:64
RAROptions * GetRAROptions()
Definition: archive.hpp:86
byte ArcSalt[SIZE_SALT50]
Definition: archive.hpp:132
uint64 AddingHeadersSize
Definition: archive.hpp:140
bool IsArcDir()
Definition: arcread.cpp:1299
int64 NextBlockPos
Definition: archive.hpp:115
void ConvertAttributes()
Definition: arcread.cpp:1305
size_t ReadHeader15()
Definition: arcread.cpp:137
size_t SFXSize
Definition: archive.hpp:127
Archive(RAROptions *InitCmd=NULL)
Definition: archive.cpp:6
FileHeader SubHead
Definition: archive.hpp:107
bool Splitting
Definition: archive.hpp:135
size_t ReadHeader50()
Definition: arcread.cpp:549
void VolSubtractHeaderSize(size_t SubSize)
void UpdateLatestTime(FileHeader *CurBlock)
size_t SearchBlock(HEADER_TYPE HeaderType)
Definition: arcread.cpp:48
CryptData HeadersCrypt
Definition: archive.hpp:44
void AddSubData(byte *SrcData, uint64 DataSize, File *SrcFile, const wchar *Name, uint Flags)
BaseBlock ShortBlock
Definition: archive.hpp:100
bool DoGetComment(Array< wchar > *CmtData)
Definition: arccmt.cpp:14
MainHeader MainHead
Definition: archive.hpp:102
RarTime LatestTime
Definition: archive.hpp:51
SubBlockHeader SubBlockHead
Definition: archive.hpp:106
bool ReadSubData(Array< byte > *UnpData, File *DestFile, bool TestMode)
Definition: arcread.cpp:1431
StreamHeader StreamHead
Definition: archive.hpp:112
bool WCheckOpen(const wchar *Name)
Definition: archive.cpp:85
void UnexpEndArcMsg()
Definition: arcread.cpp:96
int64 CurBlockPos
Definition: archive.hpp:114
CommentHeader CommHead
Definition: archive.hpp:108
bool NewNumbering
Definition: archive.hpp:124
CryptHeader CryptHead
Definition: archive.hpp:103
bool CheckAccess()
void CheckArc(bool EnableBroken)
Definition: archive.cpp:63
void ProcessExtra50(RawRead *Raw, size_t ExtraSize, BaseBlock *bb)
Definition: arcread.cpp:962
size_t ReadHeader14()
Definition: arcread.cpp:1212
bool NewArchive
Definition: archive.hpp:142
void RequestArcPassword()
Definition: arcread.cpp:919
void BrokenHeaderMsg()
Definition: arcread.cpp:111
bool Volume
Definition: archive.hpp:119
void SetLatestTime(RarTime *NewTime)
UnixOwnersHeader UOHead
Definition: archive.hpp:110
Definition: file.hpp:57
virtual void Seek(int64 Offset, int Method)
Definition: file.cpp:514
virtual int Read(void *Data, size_t Size)
Definition: file.cpp:374
virtual bool Open(const wchar *Name, uint Mode=FMF_READ)
Definition: file.cpp:48
virtual int64 Tell()
Definition: file.cpp:576
void Unload()
Definition: qopen.hpp:55
#define SIZE_SALT50
Definition: crypt.hpp:9
@ FMF_READ
Definition: file.hpp:25
HEADER_TYPE
Definition: headers.hpp:74
wchar_t wchar
Definition: rartypes.hpp:13
int64_t int64
Definition: rartypes.hpp:12
unsigned int uint
Definition: rartypes.hpp:8
uint64_t uint64
Definition: rartypes.hpp:11