1 // 7z/Handler.h 2 3 #ifndef ZIP7_7Z_HANDLER_H 4 #define ZIP7_7Z_HANDLER_H 5 6 #include "../../ICoder.h" 7 #include "../IArchive.h" 8 9 #include "../../Common/CreateCoder.h" 10 11 #ifndef Z7_7Z_SET_PROPERTIES 12 13 #ifdef Z7_EXTRACT_ONLY 14 #if !defined(Z7_ST) && !defined(Z7_SFX) 15 #define Z7_7Z_SET_PROPERTIES 16 #endif 17 #else 18 #define Z7_7Z_SET_PROPERTIES 19 #endif 20 21 #endif 22 23 // #ifdef Z7_7Z_SET_PROPERTIES 24 #include "../Common/HandlerOut.h" 25 // #endif 26 27 #include "7zCompressionMode.h" 28 #include "7zIn.h" 29 30 namespace NArchive { 31 namespace N7z { 32 33 34 #ifndef Z7_EXTRACT_ONLY 35 36 class COutHandler: public CMultiMethodProps 37 { 38 HRESULT SetSolidFromString(const UString &s); 39 HRESULT SetSolidFromPROPVARIANT(const PROPVARIANT &value); 40 public: 41 UInt64 _numSolidFiles; 42 UInt64 _numSolidBytes; 43 bool _numSolidBytesDefined; 44 bool _solidExtension; 45 bool _useTypeSorting; 46 47 bool _compressHeaders; 48 bool _encryptHeadersSpecified; 49 bool _encryptHeaders; 50 // bool _useParents; 9.26 51 52 CHandlerTimeOptions TimeOptions; 53 54 CBoolPair Write_Attrib; 55 56 bool _useMultiThreadMixer; 57 bool _removeSfxBlock; 58 // bool _volumeMode; 59 60 UInt32 _decoderCompatibilityVersion; 61 CUIntVector _enabledFilters; 62 CUIntVector _disabledFilters; 63 InitSolidFiles()64 void InitSolidFiles() { _numSolidFiles = (UInt64)(Int64)(-1); } InitSolidSize()65 void InitSolidSize() { _numSolidBytes = (UInt64)(Int64)(-1); } InitSolid()66 void InitSolid() 67 { 68 InitSolidFiles(); 69 InitSolidSize(); 70 _solidExtension = false; 71 _numSolidBytesDefined = false; 72 } 73 74 void InitProps7z(); 75 void InitProps(); 76 COutHandler()77 COutHandler() { InitProps7z(); } 78 79 HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value); 80 }; 81 82 #endif 83 84 class CHandler Z7_final: 85 public IInArchive, 86 public IArchiveGetRawProps, 87 88 #ifdef Z7_7Z_SET_PROPERTIES 89 public ISetProperties, 90 #endif 91 92 #ifndef Z7_EXTRACT_ONLY 93 public IOutArchive, 94 #endif 95 96 Z7_PUBLIC_ISetCompressCodecsInfo_IFEC 97 98 public CMyUnknownImp, 99 100 #ifndef Z7_EXTRACT_ONLY 101 public COutHandler 102 #else 103 public CCommonMethodProps 104 #endif 105 { 106 Z7_COM_QI_BEGIN2(IInArchive) 107 Z7_COM_QI_ENTRY(IArchiveGetRawProps) 108 #ifdef Z7_7Z_SET_PROPERTIES 109 Z7_COM_QI_ENTRY(ISetProperties) 110 #endif 111 #ifndef Z7_EXTRACT_ONLY 112 Z7_COM_QI_ENTRY(IOutArchive) 113 #endif 114 Z7_COM_QI_ENTRY_ISetCompressCodecsInfo_IFEC 115 Z7_COM_QI_END 116 Z7_COM_ADDREF_RELEASE 117 118 Z7_IFACE_COM7_IMP(IInArchive) 119 Z7_IFACE_COM7_IMP(IArchiveGetRawProps) 120 #ifdef Z7_7Z_SET_PROPERTIES 121 Z7_IFACE_COM7_IMP(ISetProperties) 122 #endif 123 #ifndef Z7_EXTRACT_ONLY 124 Z7_IFACE_COM7_IMP(IOutArchive) 125 #endif 126 DECL_ISetCompressCodecsInfo 127 128 private: 129 CMyComPtr<IInStream> _inStream; 130 NArchive::N7z::CDbEx _db; 131 132 #ifndef Z7_NO_CRYPTO 133 bool _isEncrypted; 134 bool _passwordIsDefined; 135 UString _password; // _Wipe 136 #endif 137 138 #ifdef Z7_EXTRACT_ONLY 139 140 #ifdef Z7_7Z_SET_PROPERTIES 141 bool _useMultiThreadMixer; 142 #endif 143 144 UInt32 _crcSize; 145 146 #else 147 148 CRecordVector<CBond2> _bonds; 149 150 HRESULT PropsMethod_To_FullMethod(CMethodFull &dest, const COneMethodInfo &m); 151 HRESULT SetHeaderMethod(CCompressionMethodMode &headerMethod); 152 HRESULT SetMainMethod(CCompressionMethodMode &method); 153 154 #endif 155 156 bool IsFolderEncrypted(CNum folderIndex) const; 157 #ifndef Z7_SFX 158 159 CRecordVector<UInt64> _fileInfoPopIDs; 160 void FillPopIDs(); 161 void AddMethodName(AString &s, UInt64 id); 162 HRESULT SetMethodToProp(CNum folderIndex, PROPVARIANT *prop) const; 163 164 #endif 165 166 DECL_EXTERNAL_CODECS_VARS 167 168 public: 169 CHandler(); ~CHandler()170 ~CHandler() 171 { 172 Close(); 173 } 174 }; 175 176 }} 177 178 #endif 179