This commit is contained in:
Igor Pavlov
2005-05-30 00:00:00 +00:00
committed by Kornel Lesiński
parent 8c1b5c7b7e
commit 3c510ba80b
926 changed files with 40559 additions and 23519 deletions

View File

@@ -1,22 +1,17 @@
// Archive/Cab/Header.h
#pragma once
#ifndef __ARCHIVE_CAB_HEADER_H
#define __ARCHIVE_CAB_HEADER_H
#include "Common/Types.h"
#pragma pack(push, PragmaCabHeaders)
#pragma pack(push, 1)
namespace NArchive {
namespace NCab {
namespace NHeader{
namespace NArchive {
extern UINT32 kSignature;
extern UInt32 kSignature;
namespace NFlags
{
@@ -25,55 +20,61 @@ namespace NArchive {
const int kReservePresent = 0x0004;
}
const UInt32 kArchiveHeaderSize = 36;
/*
struct CBlock
{
UINT32 Signature; /* cabinet file signature */
UINT32 Reserved1; /* reserved */
UINT32 Size; /* size of this cabinet file in bytes */
UINT32 Reserved2; /* reserved */
UINT32 FileOffset; /* offset of the first CFFILE entry */
UINT32 Reserved3; /* reserved */
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 */
UInt32 Signature; // cabinet file signature
UInt32 Reserved1; // reserved
UInt32 Size; // size of this cabinet file in bytes
UInt32 Reserved2; // reserved
UInt32 FileOffset; // offset of the first CFFILE entry
UInt32 Reserved3; // reserved
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
};
*/
const UInt32 kPerDataSizesHeaderSize = 4;
struct CPerDataSizes
{
UINT16 PerCabinetAreaSize; /* (optional) size of per-cabinet reserved area */
BYTE PerFolderAreaSize; /* (optional) size of per-folder reserved area */
BYTE PerDatablockAreaSize; /* (optional) size of per-datablock reserved area */
UInt16 PerCabinetAreaSize; // (optional) size of per-cabinet reserved area
Byte PerFolderAreaSize; // (optional) size of per-folder reserved area
Byte PerDatablockAreaSize; // (optional) size of per-datablock reserved area
};
/*
BYTE abReserve[]; // (optional) per-cabinet reserved area
BYTE szCabinetPrev[]; // (optional) name of previous cabinet file
BYTE szDiskPrev[]; // (optional) name of previous disk
BYTE szCabinetNext[]; // (optional) name of next cabinet file
BYTE szDiskNext[]; // (optional) name of next disk
Byte abReserve[]; // (optional) per-cabinet reserved area
Byte szCabinetPrev[]; // (optional) name of previous cabinet file
Byte szDiskPrev[]; // (optional) name of previous disk
Byte szCabinetNext[]; // (optional) name of next cabinet file
Byte szDiskNext[]; // (optional) name of next disk
*/
}
namespace NCompressionMethodMajor
{
const BYTE kNone = 0;
const BYTE kMSZip = 1;
const BYTE kQuantum = 2;
const BYTE kLZX = 3;
const Byte kNone = 0;
const Byte kMSZip = 1;
const Byte kQuantum = 2;
const Byte kLZX = 3;
}
const UInt32 kFolderHeaderSize = 8;
struct CFolder
{
UINT32 DataStart; // offset of the first CFDATA block in this folder
UINT16 NumDataBlocks; // number of CFDATA blocks in this folder
BYTE CompressionTypeMajor;
BYTE CompressionTypeMinor;
// BYTE abReserve[]; // (optional) per-folder reserved area
BYTE GetCompressionMethod() const { return CompressionTypeMajor & 0xF; }
UInt32 DataStart; // offset of the first CFDATA block in this folder
UInt16 NumDataBlocks; // number of CFDATA blocks in this folder
Byte CompressionTypeMajor;
Byte CompressionTypeMinor;
// Byte abReserve[]; // (optional) per-folder reserved area
Byte GetCompressionMethod() const { return CompressionTypeMajor & 0xF; }
};
const int kFileNameIsUTFAttributeMask = 0x80;
@@ -83,7 +84,7 @@ namespace NFolderIndex
const int kContinuedFromPrev = 0xFFFD;
const int kContinuedToNext = 0xFFFE;
const int kContinuedPrevAndNext = 0xFFFF;
inline UINT16 GetRealFolderIndex(UINT16 aNumFolders, UINT16 aFolderIndex)
inline UInt16 GetRealFolderIndex(UInt16 aNumFolders, UInt16 aFolderIndex)
{
switch(aFolderIndex)
{
@@ -98,20 +99,19 @@ namespace NFolderIndex
}
}
const UInt32 kFileHeaderSize = 16;
/*
struct CFile
{
UINT32 UnPackSize; /* uncompressed size of this file in bytes */
UINT32 UnPackOffset; /* uncompressed offset of this file in the folder */
UINT16 FolderIndex; /* index into the CFFOLDER area */
UINT16 PureDate;
UINT16 PureTime; /* Time */
UINT16 Attributes; /* attribute flags for this file */
//BYTE szName[]; /* name of this file */
UInt32 UnPackSize; // uncompressed size of this file in bytes
UInt32 UnPackOffset; // uncompressed offset of this file in the folder
UInt16 FolderIndex; // index into the CFFOLDER area
UInt16 PureDate;
UInt16 PureTime; // Time
UInt16 Attributes; // attribute flags for this file
Byte szName[]; // name of this file
};
*/
}}}
#pragma pack(pop)
#pragma pack(pop, PragmaCabHeaders)
#endif