Click here to Skip to main content
15,868,016 members
Articles / Desktop Programming / MFC

Exile 1.8 - The Password Manager

Rate me:
Please Sign up or sign in to vote.
4.57/5 (51 votes)
6 Mar 20058 min read 254K   7.4K   111  
Yet another password manager.
/********************************************************************
	Created:	27/3/2004, 14:36
	File name: 	D:\Projects\Exile\Exile\ExileDlg.h
	File path:	D:\Projects\Exile\Exile
	File base:	ExileDlg
	File ext:	h
	Author:		Gogolev Anton
*********************************************************************/

// ExileDlg.h : header file
//

#if !defined(AFX_EXILEDLG_H__4CCF6630_637C_419F_9F46_7AE19F62C70B__INCLUDED_)
#define AFX_EXILEDLG_H__4CCF6630_637C_419F_9F46_7AE19F62C70B__INCLUDED_

#include "typedefs.h"	// Added by ClassView
#include "GroupedControls.h"	// Added by ClassView
#include "../RC5/RC5.h"
#include "StaticEx.h"	// Added by ClassView
#include "StaticHyperlinkEx.h"	// Added by ClassView
#include "ReadonlyEdit.h"
#include "TreeCtrlEx.h"
#include "predefined.h"	// Added by ClassView
#include "hyperlink.h"
#import <msxml3.dll>

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/////////////////////////////////////////////////////////////////////////////
// CExileDlg dialog

class CExileDlg : public CDialog
{
// Construction
public:	
	CExileDlg(CWnd* pParent = NULL);	// standard constructor	

	// Dialog Data
	//{{AFX_DATA(CExileDlg)
	enum { IDD = IDD_EXILE_DIALOG };
	CStatic	m_ctrlRatingIcon;
	CTreeCtrlEx	m_ctrlTree;
	CHyperlink		m_ctrlAddress;
	CReadonlyEdit	m_ctrlPassword;
	CReadonlyEdit	m_ctrlNotes;
	CReadonlyEdit	m_ctrlLogin;
	CStatic	m_ctrlModeSwitch;
	CStatic	m_ctrlItemIcon;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CExileDlg)
	public:
	virtual BOOL PreTranslateMessage(MSG* pMsg);
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	// Generated message map functions
	//{{AFX_MSG(CExileDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnFileNew();
	afx_msg void OnFileOpen();
	afx_msg void OnFileClose();
	afx_msg void OnFileSave();
	afx_msg void OnFileSaveas();
	afx_msg void OnDestroy();
	afx_msg void OnSelchangedTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnEditInsertcategory();
	afx_msg void OnEditInsertelement();
	afx_msg void OnAppAbout();
	afx_msg void OnClose();
	afx_msg void OnToolsMd5hashgenerator();
	afx_msg void OnToolsPasswordgenerator();
	afx_msg void OnPasswordTitle();
	afx_msg void OnEditDelete();
	afx_msg void OnEditEdit();
	afx_msg void OnEditStorageproperties();	
	afx_msg void OnRclickTree(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnTraymenuRestore();
	afx_msg void OnTraymenuEnablehotkeys();
	afx_msg void OnEditOptions();
	afx_msg void OnCategorycontextSortNameascending();
	afx_msg void OnCategorycontextSortNamedescending();
	afx_msg void OnCategorycontextSortUsernameascending();
	afx_msg void OnCategorycontextSortUsernamedescending();
	afx_msg void OnCategorycontextSortRatingascending();
	afx_msg void OnCategorycontextSortRatingdescending();
	afx_msg void OnFileExportExporttoxml();
	afx_msg void OnEditAdvanced();	
	//}}AFX_MSG
	afx_msg LRESULT OnActivateApp(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnTcexItemdragged(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnShleRButtondown(WPARAM wParam, LPARAM lParam);
	afx_msg void OnCopy();
	DECLARE_MESSAGE_MAP()
private:
	void PerformAutoCleanClipboard();
	void AutoCleanClipboard();
	BOOL m_bClipboardErasing; // Automatic Clipboard Erasing
	int m_nErasingTimeout; // Clipboard Erasing Timeout (seconds)
	CString m_strLastStorage;
	LONG XmlReadLong(MSXML2::IXMLDOMNodePtr pNode, LPCTSTR pszAttribute, LONG lDefault = 0);
	BOOL XmlReadBool(MSXML2::IXMLDOMNodePtr pNode, LPCTSTR pszAttribute, BOOL bDefault = TRUE);
	CString XmlReadString(MSXML2::IXMLDOMNodePtr pNode, LPCTSTR pszAttribute, CString strDefault = _T(""));
	void LoadSettings();
	BOOL m_bShellOpenReadonly; // Shell Open As Read Only
	BOOL m_bReloadReadonly; // Reload as Read Only
	void CopyToClipboard(CString& rString);
	void SaveSettings();
	BOOL m_bReadOnly;
	void MaintainFileAssociations();
	BOOL m_bMaintain;
	BOOL m_bBackup;
	// SmartType Hot Key Code
	WORD m_wKeyCode;
	// SmartType Hot Key Modifiers (MFC thing)
	WORD m_wModifiers;
	BOOL m_bSmartType;
	void EditElementAdvanced(HTREEITEM hItem);
	void LoadStorageXml();
	void LoadStorageSerial();
	void SaveStorageSerial();
	MSXML2::IXMLDOMElementPtr ExportTreeXml(MSXML2::IXMLDOMDocument2Ptr pXMLDoc, MSXML2::IXMLDOMElementPtr pXMLElement, HTREEITEM hRoot, 
		int nIndent, unsigned int nExportFlags);
	void ExportXml(CString strFileName, unsigned int nExportFlags); // flags from xmlexportflags.h
	int m_nSelection;
	CString Indent(int nIndent);
	MSXML2::IXMLDOMElementPtr SaveTreeXml(MSXML2::IXMLDOMDocument2Ptr pXMLDoc, MSXML2::IXMLDOMElementPtr pXMLElement, 
		HTREEITEM hRoot, int nIndent);
	void SaveStorageXml();
	static int CALLBACK CompareRatings(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	static int CALLBACK CompareUsernames(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	static int CALLBACK CompareNames(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
	MADVANCED m_mAdvanced;
	CImageList *m_pimgRating;
	void ProcessSortOrder();
	SORTORDER m_soSortOrder;
	void SortItems(HTREEITEM hRoot);
	int m_nSortOrder;
	BOOL m_bAutosort;
	void SetPassword(TCHAR *pszPassword);
	void SetInfo(TCHAR *pszInfo);
	CStaticEx m_ctrlInfo;
	static UINT m_suMessage;
	BOOL m_bAutosave;
	BOOL m_bReloadLastStorage;
	BOOL m_bHotKeys;
	void UnregisterHotKeys();
	void RegisterHotKeys();
	void ConvertStorage(long lVersion);
	void RemoveTrayIcon(UINT nIconID);
	void ShowTrayMenu();
	void AddTrayIcon(UINT nIconID);
	// Current window state
	BOOL m_bMaximized; 
	// TRUE - hide to tray
	void TrayWindow(BOOL bMode); 
	BOOL m_bMinimizeToTray; // Option
	void SetKeyInfo(int nKeySize); // In bits, Zero clears everything
	CStaticEx m_ctrlKeyInfo;
	HACCEL m_hAccel;
	void SetNotes(TCHAR *pszNotes);
	void SetAddress(TCHAR *pszAddress);
	void SetDirty(BOOL bDirty);
	void EditCategory(HTREEITEM hItem);
	void EditElement(HTREEITEM hItem);
	void SwitchMode();
	CImageList *m_pimgSwitch;
	void DeleteItems(HTREEITEM hRoot, BOOL bFirstCall);
	void DeleteItem(HTREEITEM hItem);
	BOOL m_bShowPassword;
	CStaticHyperlinkEx m_ctrlPasswordLink;
	CStaticEx m_ctrlDescription;
	void CompactString(CDC *pDC, TCHAR *pszString, int nWidth);
	void SetLogin(TCHAR *pszLogin);
	void LoadTree(VTREE &rvTree, HTREEITEM hRoot);
	void SaveTree(VTREE &rvTree, HTREEITEM hRoot);
	CImageList *m_pimgListSmall;
	CImageList *m_pimgList;
	void SetTitle(TCHAR *pszTitle);
	void SetTitle();
	void InsertElement();
	void InsertCategory();
	static void DecryptPrivateEntry(PRIVATEENTRY &rpePrivate, HRC5CONTEXT hRc5);
	static void EncryptPrivateEntry(PRIVATEENTRY &rpePrivate, HRC5CONTEXT hRc5);
	void SetDescription(TCHAR *pszDescription);
	void ShowEntry(HTREEITEM hItem);
	MENTRY m_mEntries;
	long m_lIndex;
	HRC5CONTEXT m_hRc5;
	void CleanPrivateData();
	KEYINFO m_kiKeyInfo;
	CString m_strStorageName;
	void LoadStorage(BOOL bShowDialog);
	void SaveStorage(BOOL bSaveAs);
	void CloseStorage();
	void ProcessDirtyStorage();
	BOOL m_bDirty;
	void CreateStorage();
	void SwitchMenu(long lItems, BOOL bSwitchOn);
	HFONT m_hFont;
	CGroupedControls m_gcControls;
	enum GROUPS { TITLE /* When no Storage is active */,
		CATEGORY /* When category is selected */ ,		
		ELEMENT_INDETAIL /* Element in detail */};

	//
	// Password Generator Settings
	//
	BOOL m_bDecimalDigits;
	BOOL m_bLowercase;
	BOOL m_bPunctuation;
	BOOL m_bSpecial;
	BOOL m_bUppercase;
	int m_nPasswordLength;
	
	//
	// Hash Generator Options
	//
	int m_nHashOptions;

	//
	// Export To Xml
	//
	unsigned int m_nExportFlags;
	CString m_strExportFileName;
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_EXILEDLG_H__4CCF6630_637C_419F_9F46_7AE19F62C70B__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Russian Federation Russian Federation
I'll think about it later on...

Comments and Discussions