cpgpexch.h

来自「PGP8.0源码 请认真阅读您的文件包然后写出其具体功能」· C头文件 代码 · 共 260 行

H
260
字号
/*____________________________________________________________________________
	Copyright (C) 2002 PGP Corporation
	All rights reserved.

	$Id: CPGPexch.h,v 1.20 2002/11/19 02:19:38 sdas Exp $
____________________________________________________________________________*/
#ifndef Included_CPGPexch_h	/* [ */
#define Included_CPGPexch_h

#include <windows.h>
#include <commctrl.h>
#include <mapix.h>
#include <mapiform.h>
#include <exchext.h>
#include "CPGPExtModeless.h"

#ifndef PR_BODY_HTML
#define PR_BODY_HTML				0x1013001E
#endif

#ifndef PR_ATTACH_CONTENT_ID
#define PR_ATTACH_CONTENT_ID		0x3712001E
#endif

#ifndef PR_INTERNET_CPID
#define PR_INTERNET_CPID			0x3FDE0003
#endif

#define PR_PGPEXCH_HTML				PROP_TAG(PT_BOOLEAN, 0x6260)
#define PR_PGPEXCH_DECRYPTED		PROP_TAG(PT_BOOLEAN, 0x6261)

#include "CPGPMsgBackup.h"
#include "pgpClientLib.h"

const DWORD SFPA_FOUND_HTML_DATA = 0x00000001;
const DWORD SFPA_FOUND_RTF_DATA  = 0x00000002;

class CPGPexch : public IExchExt, 
						IExchExtMessageEvents, 
						IExchExtCommands, 
						IExchExtAttachedFileEvents
{
public:
    CPGPexch();
	~CPGPexch();

	// The methods of IUnknown 

    STDMETHODIMP QueryInterface(REFIID riid, void** ppvObj);
    inline STDMETHODIMP_(ULONG) AddRef()
    	{ ++_cRef; return _cRef; }
    inline STDMETHODIMP_(ULONG) Release()
        { ULONG ulCount = --_cRef;
          if (!ulCount) { delete this; }
          return ulCount;
        } 

	// The methods of IExchExt 

    STDMETHODIMP Install(IExchExtCallback* pmecb, 
                          ULONG mecontext, ULONG ulFlags);

	// The methods of IExchExtPropertySheets 

    STDMETHODIMP_(ULONG) GetMaxPageCount(ULONG ulFlags);          
    STDMETHODIMP GetPages(IExchExtCallback* peecb,
                          ULONG ulFlags, LPPROPSHEETPAGE ppsp, 
						  ULONG * pcpsp);          
    STDMETHODIMP_(VOID) FreePages(LPPROPSHEETPAGE ppsp, ULONG ulFlags, 
                                         ULONG cpsp);          

	// The methods of IExchExtMessageEvents 

    STDMETHODIMP OnRead(IExchExtCallback* lpeecb);
    STDMETHODIMP OnReadComplete(IExchExtCallback* lpeecb, ULONG ulFlags);
    STDMETHODIMP OnWrite(IExchExtCallback* lpeecb);
    STDMETHODIMP OnWriteComplete(IExchExtCallback* lpeecb, ULONG ulFlags);
    STDMETHODIMP OnCheckNames(IExchExtCallback* lpeecb);
    STDMETHODIMP OnCheckNamesComplete(IExchExtCallback* lpeecb, 
										ULONG ulFlags);
    STDMETHODIMP OnSubmit(IExchExtCallback* lpeecb);
    STDMETHODIMP_(VOID) OnSubmitComplete(IExchExtCallback* lpeecb, 
											ULONG ulFlags);

	// The methods of IExchExtCommands 

    STDMETHODIMP InstallCommands(IExchExtCallback* pmecb, 
                                HWND hwnd, HMENU hmenu,
                                UINT * cmdidBase, LPTBENTRY lptbeArray,
                                UINT ctbe, ULONG ulFlags);
    STDMETHODIMP DoCommand(IExchExtCallback* pmecb, UINT mni);
    STDMETHODIMP_(VOID) InitMenu(IExchExtCallback* pmecb);
    STDMETHODIMP Help(IExchExtCallback* pmecb, UINT mni);
    STDMETHODIMP QueryHelpText(UINT mni, ULONG ulFlags, LPTSTR sz, UINT cch);
    STDMETHODIMP QueryButtonInfo(ULONG tbid, UINT itbb, LPTBBUTTON ptbb,
                                LPTSTR lpsz, UINT cch, ULONG ulFlags);
    STDMETHODIMP ResetToolbar(ULONG tbid, ULONG ulFlags);

	// The methods of IExchExtAttachedFileEvents

	STDMETHODIMP OnReadPattFromSzFile(IAttach* lpAtt, LPTSTR lpszFile, 
										ULONG ulFlags); 
	STDMETHODIMP OnWritePattToSzFile(IAttach* lpAtt, LPTSTR lpszFile, 
										ULONG ulFlags);
	STDMETHODIMP QueryDisallowOpenPatt(IAttach* lpAtt); 
    STDMETHODIMP OnOpenPatt(IAttach* lpAtt); 
	STDMETHODIMP OnOpenSzFile(LPTSTR lpszFile, ULONG ulFlags);

	// Needed to both decrypt and restore attachments

	int DecryptVerifyRestoreAttachment(	HWND hwnd, IMessage *psmg,
										SRowSet *prAttach, BOOL bRestore);


private:
    ULONG	_cRef;

	// Set in Install.

    UINT	_context;			// The context of the current instance

	BOOL	_fOutlook;			// Set if Outlook is being used
	BOOL	_fOutlook98;		// Set if Outlook 98 is being used
	BOOL	_fOutlook2000;		// Set if Outlook 2000 is being used
	BOOL	_fOutlookXP;		// Set if Outlook XP is being used
	BOOL	_fCorporate;		// Set if Corporate version is installed
	BOOL	_fLoaded;			// Set if the plug-in DLL was already loaded
	HWND	_hwndMessage;		// Window containing message
	BOOL	_bDecryptAttach;	// Set if attachment needs decrypting
	HANDLE	_hExistance;		// Handle to existance semaphore
	void *	_pWipeList;			// List of attachments to wipe
	
	// Set in OnSubmit and OnSubmitComplete. 

    BOOL    _fInSubmitState;	// Set if in a submission.

	// Set on the first pass through InitMenu. 

	BOOL	_fInitMenuOnce;		// Flag as to whether the above is 
								// initialized yet.

	// Set in InstallCommands. 

	// PGP menu on menu bar

	HMENU _hmenuPGP;

	// Menu and/or button command ID's

	UINT	_cmdidSign;
	UINT	_cmdidSignNow;
	UINT	_cmdidEncrypt;
	UINT	_cmdidEncryptNow;
	UINT	_cmdidEncryptSign;
	UINT	_cmdidConvert;
	UINT	_cmdidDecrypt;
	UINT	_cmdidPgpKeys;
	UINT	_cmdidPrefs;
	UINT	_cmdidHelp;
	UINT	_cmdidAbout;

	// Button bitmap ID's

	UINT	_itbmSign;
	UINT	_itbmSignNow;
	UINT	_itbmEncrypt;
	UINT	_itbmEncryptNow;
	UINT	_itbmEncryptSign;
	UINT	_itbmDecrypt;
	UINT	_itbmPgpKeys;

	// Button ID's

	UINT	_itbbSign;
	UINT	_itbbSignNow;
	UINT	_itbbEncrypt;
	UINT	_itbbEncryptNow;
	UINT	_itbbEncryptSign;
	UINT	_itbbDecrypt;
	UINT	_itbbPgpKeys;

	// Toolbar handles

	HWND	_hwndSendToolbar;
	HWND	_hwndReadToolbar;

	// Message flags

	BOOL	_bSign;
	BOOL	_bEncrypt;
	BOOL	_bHaveAttachments;
	BOOL	_bConvert;

	// Backup of original message

	CPGPMsgBackup *m_pBackupMsg;

	LPEXCHEXTMODELESSCALLBACK m_pExtMdlessCallBack;
	CPGPExtModeless *m_pemOurMdlessCallBack;

	int EncryptSignMessage(	HWND hwnd, 
							IMessage *pmsg,
							PGPclRecipientDialogStruct *prds,
							PGPOptionListRef *pSignOptions);

	int DecryptVerifyMessage(HWND hwnd, IMessage *pmsg, IMsgStore *pMsgStore);

	HRESULT OpenSavePGPAttachment(LPTSTR lpszFile, char **pszOutFile);

	int EncryptSignAttachment(	HWND hwnd, 
								IMessage *pmsg, UINT nOutSize,
								SRowSet *prAttach,
								PGPclRecipientDialogStruct *prds,
								PGPOptionListRef *pSignOptions);

	BOOL EncryptSignMessageWindow(	HWND hwndMain, IExchExtCallback *pecb,
									BOOL bEncrypt, BOOL bSign,
									PGPclRecipientDialogStruct *prds);

	void WipeMessageAttachment(char *szFile);
	void AddToWipeList(char *szFile);
	void WipeAttachmentList(void);
	void LoseExtension(char *pszFileName);

	HRESULT BackupFormatInfoIfAny(IMessage *pCurMsg, void * &pvBuf, 
					DWORD &dwSize, DWORD &dwBufType, ULONG &ulAttIndex);


	HRESULT SearchForPluginAttachment(IMessage *pCurMsg, SRowSet *prAttach, 
									  ULONG &ulNum, DWORD &dwResult, 
									  char *szFileName, DWORD dwBufSize1, 
									  char *szLongFileName, DWORD dwBufSize2, 
									  char *szDisplayName, DWORD dwBufSize3);

	HRESULT GetAttachBuf(IMessage *pCurMsg, ULONG ulNum, 
						 char * &pAttachText, DWORD &dwAttSize);

	HRESULT ReadMsgBodyToBuf(IMessage *pCurMsg, void * &pvBuf, DWORD &dwSize);

	BOOL DoesBufHavePGPHeaders(char *pInput);

	HRESULT AreAnyOleAttachmentsPresent(  IMessage *pmsg, 
										  SRowSet *prsAttachTabRowSet, 
										  BOOL &bPresent);

	HRESULT NullifyStream(IStream *pStream);
};

#endif /* ] Included_CPGPexch_h */


/*__Editor_settings____

	Local Variables:
	tab-width: 4
	End:
	vi: ts=4 sw=4
	vim: si
_____________________*/

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?