1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
// OpenCallback.h
#ifndef __OPENCALLBACK_H
#define __OPENCALLBACK_H
#include "Common/MyCom.h"
#include "Common/MyString.h"
#include "Windows/FileFind.h"
#include "../../IPassword.h"
#include "../../Archive/IArchive.h"
#ifdef _SFX
#include "ProgressDialog.h"
#else
#include "ProgressDialog2.h"
#endif
class COpenArchiveCallback:
public IArchiveOpenCallback,
public IArchiveOpenVolumeCallback,
public IArchiveOpenSetSubArchiveName,
public IProgress,
public ICryptoGetTextPassword,
public CMyUnknownImp
{
FString _folderPrefix;
NWindows::NFile::NFind::CFileInfo _fileInfo;
NWindows::NSynchronization::CCriticalSection _criticalSection;
bool _subArchiveMode;
UString _subArchiveName;
public:
bool PasswordIsDefined;
bool PasswordWasAsked;
UString Password;
HWND ParentWindow;
CProgressDialog ProgressDialog;
MY_UNKNOWN_IMP5(
IArchiveOpenCallback,
IArchiveOpenVolumeCallback,
IArchiveOpenSetSubArchiveName,
IProgress,
ICryptoGetTextPassword)
INTERFACE_IProgress(;)
INTERFACE_IArchiveOpenCallback(;)
INTERFACE_IArchiveOpenVolumeCallback(;)
// ICryptoGetTextPassword
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
STDMETHOD(SetSubArchiveName(const wchar_t *name))
{
_subArchiveMode = true;
_subArchiveName = name;
return S_OK;
}
COpenArchiveCallback():
ParentWindow(0)
{
_subArchiveMode = false;
PasswordIsDefined = false;
PasswordWasAsked = false;
}
/*
void Init()
{
PasswordIsDefined = false;
_subArchiveMode = false;
}
*/
void LoadFileInfo(const FString &folderPrefix, const FString &fileName)
{
_folderPrefix = folderPrefix;
if (!_fileInfo.Find(_folderPrefix + fileName))
throw 1;
}
void ShowMessage(const UInt64 *completed);
INT_PTR StartProgressDialog(const UString &title, NWindows::CThread &thread)
{
return ProgressDialog.Create(title, thread, ParentWindow);
}
};
#endif
|