1 // UpdateCallback.h
2 
3 #ifndef __UPDATECALLBACK_H
4 #define __UPDATECALLBACK_H
5 
6 #include "Common/MyCom.h"
7 #include "Common/MyString.h"
8 
9 #include "../../IPassword.h"
10 #include "../../ICoder.h"
11 
12 #include "../Common/UpdatePair.h"
13 #include "../Common/UpdateProduce.h"
14 
15 #define INTERFACE_IUpdateCallbackUI(x) \
16   virtual HRESULT SetTotal(UInt64 size) x; \
17   virtual HRESULT SetCompleted(const UInt64 *completeValue) x; \
18   virtual HRESULT SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize) x; \
19   virtual HRESULT CheckBreak() x; \
20   virtual HRESULT Finilize() x; \
21   virtual HRESULT SetNumFiles(UInt64 numFiles) x; \
22   virtual HRESULT GetStream(const wchar_t *name, bool isAnti) x; \
23   virtual HRESULT OpenFileError(const wchar_t *name, DWORD systemError) x; \
24   virtual HRESULT SetOperationResult(Int32 operationResult) x; \
25   virtual HRESULT CryptoGetTextPassword2(Int32 *passwordIsDefined, BSTR *password) x; \
26   virtual HRESULT CryptoGetTextPassword(BSTR *password) x; \
27   /* virtual HRESULT ShowDeleteFile(const wchar_t *name) x; */ \
28   /* virtual HRESULT CloseProgress() { return S_OK; }; */
29 
30 struct IUpdateCallbackUI
31 {
32   INTERFACE_IUpdateCallbackUI(=0)
33 };
34 
35 class CArchiveUpdateCallback:
36   public IArchiveUpdateCallback2,
37   public ICryptoGetTextPassword2,
38   public ICryptoGetTextPassword,
39   public ICompressProgressInfo,
40   public CMyUnknownImp
41 {
42 public:
43   MY_UNKNOWN_IMP4(
44       IArchiveUpdateCallback2,
45       ICryptoGetTextPassword2,
46       ICryptoGetTextPassword,
47       ICompressProgressInfo)
48 
49   STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
50 
51   INTERFACE_IArchiveUpdateCallback2(;)
52 
53   STDMETHOD(CryptoGetTextPassword2)(Int32 *passwordIsDefined, BSTR *password);
54   STDMETHOD(CryptoGetTextPassword)(BSTR *password);
55 
56 public:
57   CRecordVector<UInt64> VolumesSizes;
58   UString VolName;
59   UString VolExt;
60 
61   IUpdateCallbackUI *Callback;
62 
63   bool ShareForWrite;
64   bool StdInMode;
65   const CDirItems *DirItems;
66   const CObjectVector<CArcItem> *ArcItems;
67   const CRecordVector<CUpdatePair2> *UpdatePairs;
68   const UStringVector *NewNames;
69   CMyComPtr<IInArchive> Archive;
70 
71   CArchiveUpdateCallback();
72 };
73 
74 #endif
75