diff options
Diffstat (limited to 'CPP/7zip/Archive/Wim/WimHandler.h')
-rw-r--r-- | CPP/7zip/Archive/Wim/WimHandler.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/CPP/7zip/Archive/Wim/WimHandler.h b/CPP/7zip/Archive/Wim/WimHandler.h new file mode 100644 index 0000000..3ba88d2 --- /dev/null +++ b/CPP/7zip/Archive/Wim/WimHandler.h | |||
@@ -0,0 +1,103 @@ | |||
1 | // WimHandler.h | ||
2 | |||
3 | #ifndef __ARCHIVE_WIM_HANDLER_H | ||
4 | #define __ARCHIVE_WIM_HANDLER_H | ||
5 | |||
6 | #include "../../../Common/MyCom.h" | ||
7 | |||
8 | #include "WimIn.h" | ||
9 | |||
10 | namespace NArchive { | ||
11 | namespace NWim { | ||
12 | |||
13 | static const Int32 kNumImagesMaxUpdate = (1 << 10); | ||
14 | |||
15 | class CHandler: | ||
16 | public IInArchive, | ||
17 | public IArchiveGetRawProps, | ||
18 | public IArchiveGetRootProps, | ||
19 | public IArchiveKeepModeForNextOpen, | ||
20 | public ISetProperties, | ||
21 | public IOutArchive, | ||
22 | public CMyUnknownImp | ||
23 | { | ||
24 | CDatabase _db; | ||
25 | UInt32 _version; | ||
26 | bool _isOldVersion; | ||
27 | UInt32 _bootIndex; | ||
28 | |||
29 | CObjectVector<CVolume> _volumes; | ||
30 | CObjectVector<CWimXml> _xmls; | ||
31 | // unsigned _nameLenForStreams; | ||
32 | bool _xmlInComments; | ||
33 | |||
34 | unsigned _numXmlItems; | ||
35 | unsigned _numIgnoreItems; | ||
36 | |||
37 | bool _xmlError; | ||
38 | bool _isArc; | ||
39 | bool _unsupported; | ||
40 | |||
41 | bool _set_use_ShowImageNumber; | ||
42 | bool _set_showImageNumber; | ||
43 | int _defaultImageNumber; | ||
44 | |||
45 | bool _showImageNumber; | ||
46 | |||
47 | bool _keepMode_ShowImageNumber; | ||
48 | |||
49 | UInt64 _phySize; | ||
50 | int _firstVolumeIndex; | ||
51 | |||
52 | void InitDefaults() | ||
53 | { | ||
54 | _set_use_ShowImageNumber = false; | ||
55 | _set_showImageNumber = false; | ||
56 | _defaultImageNumber = -1; | ||
57 | } | ||
58 | |||
59 | bool IsUpdateSupported() const | ||
60 | { | ||
61 | if (ThereIsError()) return false; | ||
62 | if (_db.Images.Size() > kNumImagesMaxUpdate) return false; | ||
63 | |||
64 | // Solid format is complicated. So we disable updating now. | ||
65 | if (!_db.Solids.IsEmpty()) return false; | ||
66 | |||
67 | if (_volumes.Size() == 0) | ||
68 | return true; | ||
69 | |||
70 | if (_volumes.Size() != 2) return false; | ||
71 | if (_volumes[0].Stream) return false; | ||
72 | if (_version != k_Version_NonSolid | ||
73 | // && _version != k_Version_Solid | ||
74 | ) return false; | ||
75 | |||
76 | return true; | ||
77 | } | ||
78 | |||
79 | bool ThereIsError() const { return _xmlError || _db.ThereIsError(); } | ||
80 | HRESULT GetSecurity(UInt32 realIndex, const void **data, UInt32 *dataSize, UInt32 *propType); | ||
81 | |||
82 | HRESULT GetOutProperty(IArchiveUpdateCallback *callback, UInt32 callbackIndex, Int32 arcIndex, PROPID propID, PROPVARIANT *value); | ||
83 | HRESULT GetTime(IArchiveUpdateCallback *callback, UInt32 callbackIndex, Int32 arcIndex, PROPID propID, FILETIME &ft); | ||
84 | public: | ||
85 | CHandler(); | ||
86 | MY_UNKNOWN_IMP6( | ||
87 | IInArchive, | ||
88 | IArchiveGetRawProps, | ||
89 | IArchiveGetRootProps, | ||
90 | IArchiveKeepModeForNextOpen, | ||
91 | ISetProperties, | ||
92 | IOutArchive) | ||
93 | INTERFACE_IInArchive(;) | ||
94 | INTERFACE_IArchiveGetRawProps(;) | ||
95 | INTERFACE_IArchiveGetRootProps(;) | ||
96 | STDMETHOD(SetProperties)(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps); | ||
97 | STDMETHOD(KeepModeForNextOpen)(); | ||
98 | INTERFACE_IOutArchive(;) | ||
99 | }; | ||
100 | |||
101 | }} | ||
102 | |||
103 | #endif | ||