Mercurial > vba-linux
diff src/win32/7zip/7z/CPP/7zip/Archive/Zip/ZipHeader.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Archive/Zip/ZipHeader.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,265 @@ 1.4 +// Archive/Zip/Header.h 1.5 + 1.6 +#ifndef __ARCHIVE_ZIP_HEADER_H 1.7 +#define __ARCHIVE_ZIP_HEADER_H 1.8 + 1.9 +#include "../../../Common/Types.h" 1.10 + 1.11 +namespace NArchive { 1.12 +namespace NZip { 1.13 + 1.14 +namespace NSignature 1.15 +{ 1.16 + extern UInt32 kLocalFileHeader; 1.17 + extern UInt32 kDataDescriptor; 1.18 + extern UInt32 kCentralFileHeader; 1.19 + extern UInt32 kEndOfCentralDir; 1.20 + extern UInt32 kZip64EndOfCentralDir; 1.21 + extern UInt32 kZip64EndOfCentralDirLocator; 1.22 + 1.23 + static const UInt32 kMarkerSize = 4; 1.24 +} 1.25 + 1.26 +const UInt32 kEcdSize = 22; 1.27 +const UInt32 kZip64EcdSize = 44; 1.28 +const UInt32 kZip64EcdLocatorSize = 20; 1.29 +/* 1.30 +struct CEndOfCentralDirectoryRecord 1.31 +{ 1.32 + UInt16 ThisDiskNumber; 1.33 + UInt16 StartCentralDirectoryDiskNumber; 1.34 + UInt16 NumEntriesInCentaralDirectoryOnThisDisk; 1.35 + UInt16 NumEntriesInCentaralDirectory; 1.36 + UInt32 CentralDirectorySize; 1.37 + UInt32 CentralDirectoryStartOffset; 1.38 + UInt16 CommentSize; 1.39 +}; 1.40 + 1.41 +struct CEndOfCentralDirectoryRecordFull 1.42 +{ 1.43 + UInt32 Signature; 1.44 + CEndOfCentralDirectoryRecord Header; 1.45 +}; 1.46 +*/ 1.47 + 1.48 +namespace NFileHeader 1.49 +{ 1.50 + /* 1.51 + struct CVersion 1.52 + { 1.53 + Byte Version; 1.54 + Byte HostOS; 1.55 + }; 1.56 + */ 1.57 + 1.58 + namespace NCompressionMethod 1.59 + { 1.60 + enum EType 1.61 + { 1.62 + kStored = 0, 1.63 + kShrunk = 1, 1.64 + kReduced1 = 2, 1.65 + kReduced2 = 3, 1.66 + kReduced3 = 4, 1.67 + kReduced4 = 5, 1.68 + kImploded = 6, 1.69 + kReservedTokenizing = 7, // reserved for tokenizing 1.70 + kDeflated = 8, 1.71 + kDeflated64 = 9, 1.72 + kPKImploding = 10, 1.73 + 1.74 + kBZip2 = 12, 1.75 + kLZMA = 14, 1.76 + kTerse = 18, 1.77 + kLz77 = 19, 1.78 + kJpeg = 0x60, 1.79 + kWavPack = 0x61, 1.80 + kPPMd = 0x62, 1.81 + kWzAES = 0x63 1.82 + }; 1.83 + const int kNumCompressionMethods = 11; 1.84 + const Byte kMadeByProgramVersion = 20; 1.85 + 1.86 + const Byte kDeflateExtractVersion = 20; 1.87 + const Byte kStoreExtractVersion = 10; 1.88 + 1.89 + const Byte kSupportedVersion = 20; 1.90 + } 1.91 + 1.92 + namespace NExtraID 1.93 + { 1.94 + enum 1.95 + { 1.96 + kZip64 = 0x01, 1.97 + kNTFS = 0x0A, 1.98 + kStrongEncrypt = 0x17, 1.99 + kWzAES = 0x9901 1.100 + }; 1.101 + } 1.102 + 1.103 + namespace NNtfsExtra 1.104 + { 1.105 + const UInt16 kTagTime = 1; 1.106 + enum 1.107 + { 1.108 + kMTime = 0, 1.109 + kATime = 1, 1.110 + kCTime = 2 1.111 + }; 1.112 + } 1.113 + 1.114 + const UInt32 kLocalBlockSize = 26; 1.115 + /* 1.116 + struct CLocalBlock 1.117 + { 1.118 + CVersion ExtractVersion; 1.119 + 1.120 + UInt16 Flags; 1.121 + UInt16 CompressionMethod; 1.122 + UInt32 Time; 1.123 + UInt32 FileCRC; 1.124 + UInt32 PackSize; 1.125 + UInt32 UnPackSize; 1.126 + UInt16 NameSize; 1.127 + UInt16 ExtraSize; 1.128 + }; 1.129 + */ 1.130 + 1.131 + const UInt32 kDataDescriptorSize = 16; 1.132 + // const UInt32 kDataDescriptor64Size = 16 + 8; 1.133 + /* 1.134 + struct CDataDescriptor 1.135 + { 1.136 + UInt32 Signature; 1.137 + UInt32 FileCRC; 1.138 + UInt32 PackSize; 1.139 + UInt32 UnPackSize; 1.140 + }; 1.141 + 1.142 + struct CLocalBlockFull 1.143 + { 1.144 + UInt32 Signature; 1.145 + CLocalBlock Header; 1.146 + }; 1.147 + */ 1.148 + 1.149 + const UInt32 kCentralBlockSize = 42; 1.150 + /* 1.151 + struct CBlock 1.152 + { 1.153 + CVersion MadeByVersion; 1.154 + CVersion ExtractVersion; 1.155 + UInt16 Flags; 1.156 + UInt16 CompressionMethod; 1.157 + UInt32 Time; 1.158 + UInt32 FileCRC; 1.159 + UInt32 PackSize; 1.160 + UInt32 UnPackSize; 1.161 + UInt16 NameSize; 1.162 + UInt16 ExtraSize; 1.163 + UInt16 CommentSize; 1.164 + UInt16 DiskNumberStart; 1.165 + UInt16 InternalAttributes; 1.166 + UInt32 ExternalAttributes; 1.167 + UInt32 LocalHeaderOffset; 1.168 + }; 1.169 + 1.170 + struct CBlockFull 1.171 + { 1.172 + UInt32 Signature; 1.173 + CBlock Header; 1.174 + }; 1.175 + */ 1.176 + 1.177 + namespace NFlags 1.178 + { 1.179 + const int kEncrypted = 1 << 0; 1.180 + const int kLzmaEOS = 1 << 1; 1.181 + const int kDescriptorUsedMask = 1 << 3; 1.182 + const int kStrongEncrypted = 1 << 6; 1.183 + const int kUtf8 = 1 << 11; 1.184 + 1.185 + const int kImplodeDictionarySizeMask = 1 << 1; 1.186 + const int kImplodeLiteralsOnMask = 1 << 2; 1.187 + 1.188 + const int kDeflateTypeBitStart = 1; 1.189 + const int kNumDeflateTypeBits = 2; 1.190 + const int kNumDeflateTypes = (1 << kNumDeflateTypeBits); 1.191 + const int kDeflateTypeMask = (1 << kNumDeflateTypeBits) - 1; 1.192 + } 1.193 + 1.194 + namespace NHostOS 1.195 + { 1.196 + enum EEnum 1.197 + { 1.198 + kFAT = 0, 1.199 + kAMIGA = 1, 1.200 + kVMS = 2, // VAX/VMS 1.201 + kUnix = 3, 1.202 + kVM_CMS = 4, 1.203 + kAtari = 5, // what if it's a minix filesystem? [cjh] 1.204 + kHPFS = 6, // filesystem used by OS/2 (and NT 3.x) 1.205 + kMac = 7, 1.206 + kZ_System = 8, 1.207 + kCPM = 9, 1.208 + kTOPS20 = 10, // pkzip 2.50 NTFS 1.209 + kNTFS = 11, // filesystem used by Windows NT 1.210 + kQDOS = 12, // SMS/QDOS 1.211 + kAcorn = 13, // Archimedes Acorn RISC OS 1.212 + kVFAT = 14, // filesystem used by Windows 95, NT 1.213 + kMVS = 15, 1.214 + kBeOS = 16, // hybrid POSIX/database filesystem 1.215 + kTandem = 17, 1.216 + kOS400 = 18, 1.217 + kOSX = 19 1.218 + }; 1.219 + } 1.220 + namespace NUnixAttribute 1.221 + { 1.222 + const UInt32 kIFMT = 0170000; /* Unix file type mask */ 1.223 + 1.224 + const UInt32 kIFDIR = 0040000; /* Unix directory */ 1.225 + const UInt32 kIFREG = 0100000; /* Unix regular file */ 1.226 + const UInt32 kIFSOCK = 0140000; /* Unix socket (BSD, not SysV or Amiga) */ 1.227 + const UInt32 kIFLNK = 0120000; /* Unix symbolic link (not SysV, Amiga) */ 1.228 + const UInt32 kIFBLK = 0060000; /* Unix block special (not Amiga) */ 1.229 + const UInt32 kIFCHR = 0020000; /* Unix character special (not Amiga) */ 1.230 + const UInt32 kIFIFO = 0010000; /* Unix fifo (BCC, not MSC or Amiga) */ 1.231 + 1.232 + const UInt32 kISUID = 04000; /* Unix set user id on execution */ 1.233 + const UInt32 kISGID = 02000; /* Unix set group id on execution */ 1.234 + const UInt32 kISVTX = 01000; /* Unix directory permissions control */ 1.235 + const UInt32 kENFMT = kISGID; /* Unix record locking enforcement flag */ 1.236 + const UInt32 kIRWXU = 00700; /* Unix read, write, execute: owner */ 1.237 + const UInt32 kIRUSR = 00400; /* Unix read permission: owner */ 1.238 + const UInt32 kIWUSR = 00200; /* Unix write permission: owner */ 1.239 + const UInt32 kIXUSR = 00100; /* Unix execute permission: owner */ 1.240 + const UInt32 kIRWXG = 00070; /* Unix read, write, execute: group */ 1.241 + const UInt32 kIRGRP = 00040; /* Unix read permission: group */ 1.242 + const UInt32 kIWGRP = 00020; /* Unix write permission: group */ 1.243 + const UInt32 kIXGRP = 00010; /* Unix execute permission: group */ 1.244 + const UInt32 kIRWXO = 00007; /* Unix read, write, execute: other */ 1.245 + const UInt32 kIROTH = 00004; /* Unix read permission: other */ 1.246 + const UInt32 kIWOTH = 00002; /* Unix write permission: other */ 1.247 + const UInt32 kIXOTH = 00001; /* Unix execute permission: other */ 1.248 + } 1.249 + 1.250 + namespace NAmigaAttribute 1.251 + { 1.252 + const UInt32 kIFMT = 06000; /* Amiga file type mask */ 1.253 + const UInt32 kIFDIR = 04000; /* Amiga directory */ 1.254 + const UInt32 kIFREG = 02000; /* Amiga regular file */ 1.255 + const UInt32 kIHIDDEN = 00200; /* to be supported in AmigaDOS 3.x */ 1.256 + const UInt32 kISCRIPT = 00100; /* executable script (text command file) */ 1.257 + const UInt32 kIPURE = 00040; /* allow loading into resident memory */ 1.258 + const UInt32 kIARCHIVE = 00020; /* not modified since bit was last set */ 1.259 + const UInt32 kIREAD = 00010; /* can be opened for reading */ 1.260 + const UInt32 kIWRITE = 00004; /* can be opened for writing */ 1.261 + const UInt32 kIEXECUTE = 00002; /* executable image, a loadable runfile */ 1.262 + const UInt32 kIDELETE = 00001; /* can be deleted */ 1.263 + } 1.264 +} 1.265 + 1.266 +}} 1.267 + 1.268 +#endif