1 // WimHandler.h 2 3 #ifndef ZIP7_INC_ARCHIVE_WIM_HANDLER_H 4 #define ZIP7_INC_ARCHIVE_WIM_HANDLER_H 5 6 #include "../../../Common/MyCom.h" 7 8 #include "../Common/HandlerOut.h" 9 10 #include "WimIn.h" 11 12 namespace NArchive { 13 namespace NWim { 14 15 const Int32 kNumImagesMaxUpdate = 1 << 10; 16 17 Z7_CLASS_IMP_CHandler_IInArchive_5( 18 IArchiveGetRawProps 19 , IArchiveGetRootProps 20 , IArchiveKeepModeForNextOpen 21 , ISetProperties 22 , IOutArchive 23 ) 24 CDatabase _db; 25 UInt32 _version; 26 UInt32 _bootIndex; 27 28 CObjectVector<CVolume> _volumes; 29 CObjectVector<CWimXml> _xmls; 30 // unsigned _nameLenForStreams; 31 32 unsigned _numXmlItems; 33 unsigned _numIgnoreItems; 34 35 bool _isOldVersion; 36 bool _xmlInComments; 37 38 bool _xmlError; 39 bool _isArc; 40 bool _unsupported; 41 42 bool _set_use_ShowImageNumber; 43 bool _set_showImageNumber; 44 int _defaultImageNumber; 45 46 bool _showImageNumber; 47 bool _keepMode_ShowImageNumber; 48 bool _disable_Sha1Check; 49 50 UInt64 _phySize; 51 Int32 _firstVolumeIndex; 52 53 CHandlerTimeOptions _timeOptions; 54 InitDefaults()55 void InitDefaults() 56 { 57 _disable_Sha1Check = false; 58 _set_use_ShowImageNumber = false; 59 _set_showImageNumber = false; 60 _defaultImageNumber = -1; 61 _timeOptions.Init(); 62 } 63 IsUpdateSupported()64 bool IsUpdateSupported() const 65 { 66 if (ThereIsError()) return false; 67 if (_db.Images.Size() > kNumImagesMaxUpdate) return false; 68 69 // Solid format is complicated. So we disable updating now. 70 if (!_db.Solids.IsEmpty()) return false; 71 72 if (_volumes.Size() == 0) 73 return true; 74 75 if (_volumes.Size() != 2) return false; 76 if (_volumes[0].Stream) return false; 77 if (_version != k_Version_NonSolid 78 // && _version != k_Version_Solid 79 ) return false; 80 81 return true; 82 } 83 ThereIsError()84 bool ThereIsError() const { return _xmlError || _db.ThereIsError(); } 85 HRESULT GetSecurity(UInt32 realIndex, const void **data, UInt32 *dataSize, UInt32 *propType); 86 87 HRESULT GetOutProperty(IArchiveUpdateCallback *callback, UInt32 callbackIndex, Int32 arcIndex, PROPID propID, PROPVARIANT *value); 88 HRESULT GetTime(IArchiveUpdateCallback *callback, UInt32 callbackIndex, Int32 arcIndex, PROPID propID, FILETIME &ft); 89 public: 90 CHandler(); 91 }; 92 93 }} 94 95 #endif 96