⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chgpwddlg.cpp

📁 文件加密的过滤驱动程序源代码
💻 CPP
字号:
// ChgPwdDlg.cpp : implementation file
//

#include "stdafx.h"
#include "resource.h"
#include "FileGuard.h"
#include "ChgPwdDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CChgPwdDlg dialog


CChgPwdDlg::CChgPwdDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CChgPwdDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChgPwdDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CChgPwdDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChgPwdDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CChgPwdDlg, CDialog)
	//{{AFX_MSG_MAP(CChgPwdDlg)
	ON_BN_CLICKED(IDOK, OnOk)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChgPwdDlg message handlers

void CChgPwdDlg::OnOk() 
{
	char lpszOldPwd[CIPHER_LEN/2], 	lpszNewPwd1[CIPHER_LEN/2], lpszNewPwd2[CIPHER_LEN/2];
	char lpszCipher1[CIPHER_LEN], lpszCipher2[CIPHER_LEN];

	GetDlgItemText(IDC_NEW1_PWD, lpszNewPwd1, CIPHER_LEN/2);
	GetDlgItemText(IDC_NEW2_PWD, lpszNewPwd2, CIPHER_LEN/2);
	if(strcmp(lpszNewPwd1, lpszNewPwd2))
	{
		AfxMessageBox("两次输入的密码不符合。");
		return;
	}


	//compare old passwords
	GetDlgItemText(IDC_OLD_PWD, lpszOldPwd, CIPHER_LEN/2);
	GetCipher(lpszCipher1);
	Encrypt(lpszCipher2, lpszOldPwd);
	if(strcmp(lpszCipher1, lpszCipher2))
	{
		AfxMessageBox("旧密码错误!");
		return;
	}

	Encrypt(lpszCipher1, lpszNewPwd1);
	if(!WriteCipher(lpszCipher1))
		AfxMessageBox("发生错误,无法修改密码。");	//debug

	CDialog::OnOK();
}

⌨️ 快捷键说明

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