1 // 7z/Handler.h 2 3 #ifndef __7Z_HANDLER_H 4 #define __7Z_HANDLER_H 5 6 #include "../../ICoder.h" 7 #include "../IArchive.h" 8 9 #include "../../Common/CreateCoder.h" 10 11 #ifndef EXTRACT_ONLY 12 #include "../Common/HandlerOut.h" 13 #endif 14 15 #include "7zCompressionMode.h" 16 #include "7zIn.h" 17 18 namespace NArchive { 19 namespace N7z { 20 21 #ifndef __7Z_SET_PROPERTIES 22 23 #ifdef EXTRACT_ONLY 24 #if !defined(_7ZIP_ST) && !defined(_SFX) 25 #define __7Z_SET_PROPERTIES 26 #endif 27 #else 28 #define __7Z_SET_PROPERTIES 29 #endif 30 31 #endif 32 33 34 #ifndef EXTRACT_ONLY 35 36 class COutHandler: public CMultiMethodProps 37 { 38 HRESULT SetSolidFromString(const UString &s); 39 HRESULT SetSolidFromPROPVARIANT(const PROPVARIANT &value); 40 public: 41 bool _removeSfxBlock; 42 43 UInt64 _numSolidFiles; 44 UInt64 _numSolidBytes; 45 bool _numSolidBytesDefined; 46 bool _solidExtension; 47 bool _useTypeSorting; 48 49 bool _compressHeaders; 50 bool _encryptHeadersSpecified; 51 bool _encryptHeaders; 52 // bool _useParents; 9.26 53 54 CBoolPair Write_CTime; 55 CBoolPair Write_ATime; 56 CBoolPair Write_MTime; 57 58 bool _useMultiThreadMixer; 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 InitProps(); 73 COutHandler()74 COutHandler() { InitProps(); } 75 76 HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value); 77 }; 78 79 #endif 80 81 class CHandler: 82 public IInArchive, 83 public IArchiveGetRawProps, 84 #ifdef __7Z_SET_PROPERTIES 85 public ISetProperties, 86 #endif 87 #ifndef EXTRACT_ONLY 88 public IOutArchive, 89 #endif 90 PUBLIC_ISetCompressCodecsInfo 91 public CMyUnknownImp 92 #ifndef EXTRACT_ONLY 93 , public COutHandler 94 #endif 95 { 96 public: 97 MY_QUERYINTERFACE_BEGIN2(IInArchive) 98 MY_QUERYINTERFACE_ENTRY(IArchiveGetRawProps) 99 #ifdef __7Z_SET_PROPERTIES 100 MY_QUERYINTERFACE_ENTRY(ISetProperties) 101 #endif 102 #ifndef EXTRACT_ONLY 103 MY_QUERYINTERFACE_ENTRY(IOutArchive) 104 #endif 105 QUERY_ENTRY_ISetCompressCodecsInfo 106 MY_QUERYINTERFACE_END 107 MY_ADDREF_RELEASE 108 109 INTERFACE_IInArchive(;) 110 INTERFACE_IArchiveGetRawProps(;) 111 112 #ifdef __7Z_SET_PROPERTIES 113 STDMETHOD(SetProperties)(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps); 114 #endif 115 116 #ifndef EXTRACT_ONLY 117 INTERFACE_IOutArchive(;) 118 #endif 119 120 DECL_ISetCompressCodecsInfo 121 122 CHandler(); 123 124 private: 125 CMyComPtr<IInStream> _inStream; 126 NArchive::N7z::CDbEx _db; 127 128 #ifndef _NO_CRYPTO 129 bool _isEncrypted; 130 bool _passwordIsDefined; 131 UString _password; 132 #endif 133 134 #ifdef EXTRACT_ONLY 135 136 #ifdef __7Z_SET_PROPERTIES 137 UInt32 _numThreads; 138 bool _useMultiThreadMixer; 139 #endif 140 141 UInt32 _crcSize; 142 143 #else 144 145 CRecordVector<CBond2> _bonds; 146 147 HRESULT PropsMethod_To_FullMethod(CMethodFull &dest, const COneMethodInfo &m); 148 HRESULT SetHeaderMethod(CCompressionMethodMode &headerMethod); 149 HRESULT SetMainMethod(CCompressionMethodMode &method 150 #ifndef _7ZIP_ST 151 , UInt32 numThreads 152 #endif 153 ); 154 155 156 #endif 157 158 bool IsFolderEncrypted(CNum folderIndex) const; 159 #ifndef _SFX 160 161 CRecordVector<UInt64> _fileInfoPopIDs; 162 void FillPopIDs(); 163 void AddMethodName(AString &s, UInt64 id); 164 HRESULT SetMethodToProp(CNum folderIndex, PROPVARIANT *prop) const; 165 166 #endif 167 168 DECL_EXTERNAL_CODECS_VARS 169 }; 170 171 }} 172 173 #endif 174