blob: 9e6fb5cb1ac4cc1d9e2871a80cf1732f767806c2 (
plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
// RarHandler.h
#ifndef __RAR_HANDLER_H
#define __RAR_HANDLER_H
#include "../IArchive.h"
#include "../../Common/CreateCoder.h"
#include "RarItem.h"
namespace NArchive {
namespace NRar {
struct CInArcInfo
{
UInt32 Flags;
Byte EncryptVersion;
UInt64 StartPos;
UInt64 EndPos;
UInt64 FileSize;
UInt32 EndFlags;
UInt32 VolNumber;
UInt32 DataCRC;
bool EndOfArchive_was_Read;
CInArcInfo(): EndFlags(0), EndOfArchive_was_Read(false) {}
UInt64 GetPhySize() const { return EndPos - StartPos; }
bool ExtraZeroTail_is_Possible() const { return IsVolume() && IsRecovery() && EndOfArchive_was_Read; }
bool IsVolume() const { return (Flags & NHeader::NArchive::kVolume) != 0; }
bool IsCommented() const { return (Flags & NHeader::NArchive::kComment) != 0; }
// kLock
bool IsSolid() const { return (Flags & NHeader::NArchive::kSolid) != 0; }
bool HaveNewVolumeName() const { return (Flags & NHeader::NArchive::kNewVolName) != 0; }
// kAuthenticity
bool IsRecovery() const { return (Flags & NHeader::NArchive::kRecovery) != 0; }
bool IsEncrypted() const { return (Flags & NHeader::NArchive::kBlockEncryption) != 0; }
bool IsFirstVolume() const { return (Flags & NHeader::NArchive::kFirstVolume) != 0; }
bool IsThereEncryptVer() const { return (Flags & NHeader::NArchive::kEncryptVer) != 0; }
bool IsEncryptOld() const { return (!IsThereEncryptVer() || EncryptVersion < 36); }
bool Is_VolNumber_Defined() const { return (EndFlags & NHeader::NArchive::kEndOfArc_Flags_VolNumber) != 0; }
bool Is_DataCRC_Defined() const { return (EndFlags & NHeader::NArchive::kEndOfArc_Flags_DataCRC) != 0; }
};
struct CArc
{
CMyComPtr<IInStream> Stream;
UInt64 PhySize;
// CByteBuffer Comment;
CArc(): PhySize(0) {}
ISequentialInStream *CreateLimitedStream(UInt64 offset, UInt64 size) const;
};
struct CRefItem
{
unsigned VolumeIndex;
unsigned ItemIndex;
unsigned NumItems;
};
class CHandler:
public IInArchive,
PUBLIC_ISetCompressCodecsInfo
public CMyUnknownImp
{
CRecordVector<CRefItem> _refItems;
CObjectVector<CItem> _items;
CObjectVector<CArc> _arcs;
NArchive::NRar::CInArcInfo _arcInfo;
// AString _errorMessage;
UInt32 _errorFlags;
UInt32 _warningFlags;
bool _isArc;
UString _missingVolName;
DECL_EXTERNAL_CODECS_VARS
UInt64 GetPackSize(unsigned refIndex) const;
bool IsSolid(unsigned refIndex) const;
/*
void AddErrorMessage(const AString &s)
{
if (!_errorMessage.IsEmpty())
_errorMessage += '\n';
_errorMessage += s;
}
*/
HRESULT Open2(IInStream *stream,
const UInt64 *maxCheckStartPosition,
IArchiveOpenCallback *openCallback);
public:
MY_QUERYINTERFACE_BEGIN2(IInArchive)
QUERY_ENTRY_ISetCompressCodecsInfo
MY_QUERYINTERFACE_END
MY_ADDREF_RELEASE
INTERFACE_IInArchive(;)
DECL_ISetCompressCodecsInfo
};
}}
#endif
|