blob: 82a9ea0d94dd4a462beb00e2f6ce3a5e9a262ff6 (
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
|
// Archive/CabIn.h
#ifndef __ARCHIVE_CAB_IN_H
#define __ARCHIVE_CAB_IN_H
#include "../../IStream.h"
#include "CabHeader.h"
#include "CabItem.h"
namespace NArchive {
namespace NCab {
class CInArchiveException
{
public:
enum CCauseType
{
kUnexpectedEndOfArchive = 0,
kIncorrectArchive,
kUnsupported,
} Cause;
CInArchiveException(CCauseType cause) : Cause(cause) {}
};
class CInArchiveInfo
{
public:
UInt32 Size; /* size of this cabinet file in bytes */
Byte VersionMinor; /* cabinet file format version, minor */
Byte VersionMajor; /* cabinet file format version, major */
UInt16 NumFolders; /* number of CFFOLDER entries in this cabinet */
UInt16 NumFiles; /* number of CFFILE entries in this cabinet */
UInt16 Flags; /* cabinet file option indicators */
UInt16 SetID; /* must be the same for all cabinets in a set */
UInt16 CabinetNumber; /* number of this cabinet file in a set */
bool ReserveBlockPresent() const { return (Flags & NHeader::NArchive::NFlags::kReservePresent) != 0; }
NHeader::NArchive::CPerDataSizes PerDataSizes;
AString PreviousCabinetName;
AString PreviousDiskName;
AString NextCabinetName;
AString NextDiskName;
};
class CProgressVirt
{
public:
STDMETHOD(SetTotal)(const UInt64 *numFiles) PURE;
STDMETHOD(SetCompleted)(const UInt64 *numFiles) PURE;
};
const UInt32 kMaxBlockSize = NHeader::NArchive::kArchiveHeaderSize;
class CInArchive
{
UInt16 _blockSize;
Byte _block[kMaxBlockSize];
UInt32 _blockPos;
Byte ReadByte();
UInt16 ReadUInt16();
UInt32 ReadUInt32();
public:
HRESULT Open(IInStream *inStream,
const UInt64 *searchHeaderSizeLimit,
CInArchiveInfo &inArchiveInfo,
CObjectVector<NHeader::CFolder> &folders,
CObjectVector<CItem> &files,
CProgressVirt *progressVirt);
};
}}
#endif
|