Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // ArchiveOpenCallback.h |
michael@0 | 2 | |
michael@0 | 3 | #ifndef __ARCHIVE_OPEN_CALLBACK_H |
michael@0 | 4 | #define __ARCHIVE_OPEN_CALLBACK_H |
michael@0 | 5 | |
michael@0 | 6 | #include "Common/String.h" |
michael@0 | 7 | #include "Common/MyCom.h" |
michael@0 | 8 | #include "Windows/FileFind.h" |
michael@0 | 9 | |
michael@0 | 10 | #ifndef _NO_CRYPTO |
michael@0 | 11 | #include "../../IPassword.h" |
michael@0 | 12 | #endif |
michael@0 | 13 | #include "../../Archive/IArchive.h" |
michael@0 | 14 | |
michael@0 | 15 | struct IOpenCallbackUI |
michael@0 | 16 | { |
michael@0 | 17 | virtual HRESULT CheckBreak() = 0; |
michael@0 | 18 | virtual HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes) = 0; |
michael@0 | 19 | virtual HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes) = 0; |
michael@0 | 20 | #ifndef _NO_CRYPTO |
michael@0 | 21 | virtual HRESULT CryptoGetTextPassword(BSTR *password) = 0; |
michael@0 | 22 | virtual HRESULT GetPasswordIfAny(UString &password) = 0; |
michael@0 | 23 | #endif |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | class COpenCallbackImp: |
michael@0 | 27 | public IArchiveOpenCallback, |
michael@0 | 28 | public IArchiveOpenVolumeCallback, |
michael@0 | 29 | public IArchiveOpenSetSubArchiveName, |
michael@0 | 30 | #ifndef _NO_CRYPTO |
michael@0 | 31 | public ICryptoGetTextPassword, |
michael@0 | 32 | #endif |
michael@0 | 33 | public CMyUnknownImp |
michael@0 | 34 | { |
michael@0 | 35 | public: |
michael@0 | 36 | #ifndef _NO_CRYPTO |
michael@0 | 37 | MY_UNKNOWN_IMP3( |
michael@0 | 38 | IArchiveOpenVolumeCallback, |
michael@0 | 39 | ICryptoGetTextPassword, |
michael@0 | 40 | IArchiveOpenSetSubArchiveName |
michael@0 | 41 | ) |
michael@0 | 42 | #else |
michael@0 | 43 | MY_UNKNOWN_IMP2( |
michael@0 | 44 | IArchiveOpenVolumeCallback, |
michael@0 | 45 | IArchiveOpenSetSubArchiveName |
michael@0 | 46 | ) |
michael@0 | 47 | #endif |
michael@0 | 48 | |
michael@0 | 49 | STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes); |
michael@0 | 50 | STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes); |
michael@0 | 51 | |
michael@0 | 52 | // IArchiveOpenVolumeCallback |
michael@0 | 53 | STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value); |
michael@0 | 54 | STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream); |
michael@0 | 55 | |
michael@0 | 56 | #ifndef _NO_CRYPTO |
michael@0 | 57 | // ICryptoGetTextPassword |
michael@0 | 58 | STDMETHOD(CryptoGetTextPassword)(BSTR *password); |
michael@0 | 59 | #endif |
michael@0 | 60 | |
michael@0 | 61 | STDMETHOD(SetSubArchiveName(const wchar_t *name)) |
michael@0 | 62 | { |
michael@0 | 63 | _subArchiveMode = true; |
michael@0 | 64 | _subArchiveName = name; |
michael@0 | 65 | return S_OK; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | private: |
michael@0 | 69 | UString _folderPrefix; |
michael@0 | 70 | NWindows::NFile::NFind::CFileInfoW _fileInfo; |
michael@0 | 71 | bool _subArchiveMode; |
michael@0 | 72 | UString _subArchiveName; |
michael@0 | 73 | public: |
michael@0 | 74 | UStringVector FileNames; |
michael@0 | 75 | IOpenCallbackUI *Callback; |
michael@0 | 76 | void Init(const UString &folderPrefix, const UString &fileName) |
michael@0 | 77 | { |
michael@0 | 78 | _folderPrefix = folderPrefix; |
michael@0 | 79 | if (!NWindows::NFile::NFind::FindFile(_folderPrefix + fileName, _fileInfo)) |
michael@0 | 80 | throw 1; |
michael@0 | 81 | FileNames.Clear(); |
michael@0 | 82 | _subArchiveMode = false; |
michael@0 | 83 | } |
michael@0 | 84 | int FindName(const UString &name); |
michael@0 | 85 | }; |
michael@0 | 86 | |
michael@0 | 87 | #endif |