diff options
Diffstat (limited to 'NSCmpts/EncryptActions.h')
-rw-r--r-- | NSCmpts/EncryptActions.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/NSCmpts/EncryptActions.h b/NSCmpts/EncryptActions.h new file mode 100644 index 0000000..70f9dd6 --- /dev/null +++ b/NSCmpts/EncryptActions.h @@ -0,0 +1,93 @@ +// EncryptActions.h: interface for the CBackupActions class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) +#define AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "ActionEngine.h" +#include <mystring.h> +#include <path.h> + +#include "../common/cmptdata.h" +#include <xpyex.h> + +class CEncryptActions +{ +public: + + class Encrypt : public CAction + { + public: + Encrypt(const file_path& file) + { + m_file = file; + AddXpyRef(); + } + virtual ~Encrypt() + { + ReleaseXpyRef(); + } + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr); + virtual bool IsFixable(HRESULT hr) const; + virtual bool IsRetryable() const + { return true; } + + static bool m_bEncryptReadOnly; + + protected: + file_path m_file; + + /////////////////////////////////////////////////// + // Xpy Related stuff + + // Starts XpyEx + static HRESULT InitXpy(); + + // These are used in reference counting and when to release the + // XpyEx pointer + + // XXXXXXXXXXXXXXX + // We don't use the built in reference counting, because the then + // we have no way of telling whether it's released or not + static void AddXpyRef() + { m_nXpyRefs++; } + static void ReleaseXpyRef() + { + if(!--m_nXpyRefs && m_pXpy != NULL) + m_pXpy = NULL; + } + static IXpyExPtr m_pXpy; + static UINT m_nXpyRefs; + }; + + class EncryptPrepare : public CAction + { + public: + EncryptPrepare() {}; + + virtual bool Do(CActionEngine* pEngine, HWND hwndUpdates); + virtual void Fix(HRESULT hr) { } + virtual bool IsFixable(HRESULT hr) const + { return false; } + virtual bool IsRetryable() const + { return false; } + + HRESULT Initialize(const CPropertyBag& data); + + protected: + string_array m_aFiles; + string_set m_asIgnore; + + friend class Encrypt; + }; + +}; + +#endif // !defined(AFX_ENCRYPTACTIONS_H__75916453_A62F_11D3_82DF_0020182B97FC__INCLUDED_) |