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 58 bool _removeSfxBlock; 59 60 // bool _volumeMode; 61 InitSolidFiles()62 void InitSolidFiles() { _numSolidFiles = (UInt64)(Int64)(-1); } InitSolidSize()63 void InitSolidSize() { _numSolidBytes = (UInt64)(Int64)(-1); } InitSolid()64 void InitSolid() 65 { 66 InitSolidFiles(); 67 InitSolidSize(); 68 _solidExtension = false; 69 _numSolidBytesDefined = false; 70 } 71 72 void InitProps7z(); 73 void InitProps(); 74 COutHandler()75 COutHandler() { InitProps7z(); } 76 77 HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value); 78 }; 79 80 #endif 81 82 class CHandler Z7_final: 83 public IInArchive, 84 public IArchiveGetRawProps, 85 86 #ifdef Z7_7Z_SET_PROPERTIES 87 public ISetProperties, 88 #endif 89 90 #ifndef Z7_EXTRACT_ONLY 91 public IOutArchive, 92 #endif 93 94 Z7_PUBLIC_ISetCompressCodecsInfo_IFEC 95 96 public CMyUnknownImp, 97 98 #ifndef Z7_EXTRACT_ONLY 99 public COutHandler 100 #else 101 public CCommonMethodProps 102 #endif 103 { 104 Z7_COM_QI_BEGIN2(IInArchive) 105 Z7_COM_QI_ENTRY(IArchiveGetRawProps) 106 #ifdef Z7_7Z_SET_PROPERTIES 107 Z7_COM_QI_ENTRY(ISetProperties) 108 #endif 109 #ifndef Z7_EXTRACT_ONLY 110 Z7_COM_QI_ENTRY(IOutArchive) 111 #endif 112 Z7_COM_QI_ENTRY_ISetCompressCodecsInfo_IFEC 113 Z7_COM_QI_END 114 Z7_COM_ADDREF_RELEASE 115 116 Z7_IFACE_COM7_IMP(IInArchive) 117 Z7_IFACE_COM7_IMP(IArchiveGetRawProps) 118 #ifdef Z7_7Z_SET_PROPERTIES 119 Z7_IFACE_COM7_IMP(ISetProperties) 120 #endif 121 #ifndef Z7_EXTRACT_ONLY 122 Z7_IFACE_COM7_IMP(IOutArchive) 123 #endif 124 DECL_ISetCompressCodecsInfo 125 126 private: 127 CMyComPtr<IInStream> _inStream; 128 NArchive::N7z::CDbEx _db; 129 130 #ifndef Z7_NO_CRYPTO 131 bool _isEncrypted; 132 bool _passwordIsDefined; 133 UString _password; // _Wipe 134 #endif 135 136 #ifdef Z7_EXTRACT_ONLY 137 138 #ifdef Z7_7Z_SET_PROPERTIES 139 bool _useMultiThreadMixer; 140 #endif 141 142 UInt32 _crcSize; 143 144 #else 145 146 CRecordVector<CBond2> _bonds; 147 148 HRESULT PropsMethod_To_FullMethod(CMethodFull &dest, const COneMethodInfo &m); 149 HRESULT SetHeaderMethod(CCompressionMethodMode &headerMethod); 150 HRESULT SetMainMethod(CCompressionMethodMode &method); 151 152 #endif 153 154 bool IsFolderEncrypted(CNum folderIndex) const; 155 #ifndef Z7_SFX 156 157 CRecordVector<UInt64> _fileInfoPopIDs; 158 void FillPopIDs(); 159 void AddMethodName(AString &s, UInt64 id); 160 HRESULT SetMethodToProp(CNum folderIndex, PROPVARIANT *prop) const; 161 162 #endif 163 164 DECL_EXTERNAL_CODECS_VARS 165 166 public: 167 CHandler(); ~CHandler()168 ~CHandler() 169 { 170 Close(); 171 } 172 }; 173 174 }} 175 176 #endif 177